Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update std-uritemplate to v2.0.0 #1489

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/abstractions/test/common/requestInformation.ts
Original file line number Diff line number Diff line change
@@ -25,8 +25,7 @@
endTime?: TimeOnly;
endDate?: DateOnly;
timeStamp?: Date;
time?: TimeOnly;
duration?: Duration;
duration?: Duration;
}

const getQueryParameterMapper: Record<string, string> = {
@@ -230,7 +229,7 @@
requestInformation.pathParameters["date"] = DateOnly.parse("2021-12-12");
requestInformation.urlTemplate = "http://localhost/users/{userId}/{date}{?objectId,startDate,startTime,endDate,endTime,timeStamp,duration}";
requestInformation.setQueryStringParametersFromRawObject<GetQueryParameters>({ objectId: parseGuidString("83afbf49-5583-152c-d7fb-176105d518bc"), startDate: new DateOnly({ year: 2021, month: 12, day: 12 }), startTime: new TimeOnly({ hours: 23, minutes: 12 }), timeStamp: new Date("2024-06-11T00:00:00.000Z"), duration: Duration.parse("P1D") }, getQueryParameterMapper);
assert.equal(requestInformation.URL, expected);

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Abstractions, ./packages/abstractions/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Http Fetch, ./packages/http/fetch/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Serialization JSON, ./packages/serialization/json/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Serialization Form, ./packages/serialization/form/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Serialization Text, ./packages/serialization/text/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Bundle, ./packages/bundle/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / code-coverage (Authentication Azure, ./packages/authentication/azure/coverage)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / build (18.x)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10

Check failure on line 232 in packages/abstractions/test/common/requestInformation.ts

GitHub Actions / build (20.x)

test/common/requestInformation.ts > RequestInformation > should correctly handle custom type in query/path parameter

AssertionError: expected 'http://localhost/users/33933a8d-32bb-…' to equal 'http://localhost/users/33933a8d-32bb-…' Expected: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z&duration=P1D" Received: "http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z" ❯ test/common/requestInformation.ts:232:10
});

it("Sets a scalar content", () => {

Unchanged files with check annotations Beta

* Registers the default serializer to the registry.
* @param type the class of the factory to be registered.
*/
export function registerDefaultSerializer(type: new () => SerializationWriterFactory): void {

Check warning on line 14 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 14 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 14 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!type) throw new Error("Type is required");
const serializer = new type();
SerializationWriterFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set(serializer.getValidContentType(), serializer);
* Registers the default deserializer to the registry.
* @param type the class of the factory to be registered.
*/
export function registerDefaultDeserializer(type: new () => ParseNodeFactory): void {

Check warning on line 23 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 23 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 23 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!type) throw new Error("Type is required");
const deserializer = new type();
ParseNodeFactoryRegistry.defaultInstance.contentTypeAssociatedFactories.set(deserializer.getValidContentType(), deserializer);
* @param original The serialization writer to enable the backing store on.
* @returns A new serialization writer with the backing store enabled.
*/
export function enableBackingStoreForSerializationWriterFactory(original: SerializationWriterFactory): SerializationWriterFactory {

Check warning on line 33 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 33 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 33 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!original) throw new Error("Original must be specified");
let result = original;
if (original instanceof SerializationWriterFactoryRegistry) {
* @param original The parse node factory to enable the backing store on.
* @returns A new parse node factory with the backing store enabled.
*/
export function enableBackingStoreForParseNodeFactory(original: ParseNodeFactory): ParseNodeFactory {

Check warning on line 50 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 50 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 50 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!original) throw new Error("Original must be specified");
let result = original;
if (original instanceof ParseNodeFactoryRegistry) {
* Enables the backing store on the given parse node factory registry.
* @param registry The parse node factory registry to enable the backing store on.
*/
function enableBackingStoreForParseNodeRegistry(registry: ParseNodeFactoryRegistry): void {

Check warning on line 65 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 65 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 65 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
for (const [k, v] of registry.contentTypeAssociatedFactories) {
if (!(v instanceof BackingStoreParseNodeFactory || v instanceof ParseNodeFactoryRegistry)) {
registry.contentTypeAssociatedFactories.set(k, new BackingStoreParseNodeFactory(v));
* Enables the backing store on the given serialization factory registry.
* @param registry The serialization factory registry to enable the backing store on.
*/
function enableBackingStoreForSerializationRegistry(registry: SerializationWriterFactoryRegistry): void {

Check warning on line 76 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 76 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 76 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
for (const [k, v] of registry.contentTypeAssociatedFactories) {
if (!(v instanceof BackingStoreSerializationWriterProxyFactory || v instanceof SerializationWriterFactoryRegistry)) {
registry.contentTypeAssociatedFactories.set(k, new BackingStoreSerializationWriterProxyFactory(v));
* Validates the protocol of the url.
* @param url - The url to validate.
*/
export function validateProtocol(url: string): void {

Check warning on line 14 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 14 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 14 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!isLocalhostUrl(url) && !url.toLocaleLowerCase().startsWith("https://") && !windowUrlStartsWithHttps()) {
throw new Error("Authentication scheme can only be used with https requests");
}
* Checks if the window url starts with https.
* @returns True if the window url starts with https, false otherwise.
*/
function windowUrlStartsWithHttps(): boolean {

Check warning on line 24 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 24 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 24 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!inNodeEnv()) {
return window.location.protocol.toLocaleLowerCase() === "https:";
}
* @param urlString - The url to check.
* @returns True if the url is a localhost url, false otherwise.
*/
export function isLocalhostUrl(urlString: string): boolean {

Check warning on line 36 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 36 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 36 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
try {
const url = new URL(urlString);
return localhostStrings.has(url.hostname);
* @param digits The number of digits to pad
* @returns The formatted segment
*/
export function formatSegment(segment: number, digits = 2): string {

Check warning on line 104 in packages/abstractions/src/dateOnly.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 104 in packages/abstractions/src/dateOnly.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 104 in packages/abstractions/src/dateOnly.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
return segment.toString().padStart(digits, "0");
}