Commit iniziale
This commit is contained in:
21
node_modules/@azure/core-client/LICENSE
generated
vendored
Normal file
21
node_modules/@azure/core-client/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
52
node_modules/@azure/core-client/README.md
generated
vendored
Normal file
52
node_modules/@azure/core-client/README.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# Azure Core Service client library for JavaScript
|
||||
|
||||
This library is primarily intended to be used in code generated by [AutoRest](https://github.com/Azure/Autorest) and [`autorest.typescript`](https://github.com/Azure/autorest.typescript).
|
||||
|
||||
## Getting started
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
||||
|
||||
### Installation
|
||||
|
||||
This package is primarily used in generated code and not meant to be consumed directly by end users.
|
||||
|
||||
## Key concepts
|
||||
|
||||
### ServiceClient
|
||||
|
||||
This is the common base class for generated clients. It provides the methods `sendOperationRequest` and `sendRequest`.
|
||||
|
||||
`sendRequest` simply makes an HTTP request using a `Pipeline` (see `@azure/core-rest-pipeline` for details.)
|
||||
|
||||
`sendOperationRequest` is used by generated code to make a request using an `OperationSpec` and `OperationArguments`. An `OperationSpec` is a translation of request requirements from the OpenAPI/Swagger file that describes the service.
|
||||
|
||||
### createClientPipeline
|
||||
|
||||
This method is used to create a `Pipeline` instance that is customized with extra policies that perform serialization and deserialization. The bulk of the work is in converting requests into the right HTTP message that a service expects and then converting the HTTP response payload into the response shape described by the service's OpenAPI specification file.
|
||||
|
||||
### Mappers / createSerializer
|
||||
|
||||
`Mapper`s are used to encode and decode data into HTTP headers and bodies. They describe all request and response fields. They are referenced by `OperationSpec`s.
|
||||
|
||||
The method `createSerializer` creates a `Serializer` that is used to do the bulk of the work transforming data when making a request or processing a response. Given a corpus of `Mapper`s and the appropriate `OperationSpec` it can manufacture an HTTP request object from a user provided input or convert an HTTP response object into a user-friendly form.
|
||||
|
||||
## Next steps
|
||||
|
||||
You can build and run the tests locally by executing `rushx test`. Explore the [test](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-client/test) folder to see advanced usage and behavior of the public classes.
|
||||
|
||||
Learn more about [AutoRest](https://github.com/Azure/autorest) and the [autorest.typescript extension](https://github.com/Azure/autorest.typescript) for generating a compatible client on top of this package.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you run into issues while using this library, please feel free to [file an issue](https://github.com/Azure/azure-sdk-for-js/issues/new).
|
||||
|
||||
## Contributing
|
||||
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
|
||||

|
||||
43
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.d.ts
generated
vendored
Normal file
43
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { AuthorizeRequestOnChallengeOptions } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* Converts: `Bearer a="b", c="d", Bearer d="e", f="g"`.
|
||||
* Into: `[ { a: 'b', c: 'd' }, { d: 'e', f: 'g' } ]`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare function parseCAEChallenge(challenges: string): any[];
|
||||
/**
|
||||
* CAE Challenge structure
|
||||
*/
|
||||
export interface CAEChallenge {
|
||||
scope: string;
|
||||
claims: string;
|
||||
}
|
||||
/**
|
||||
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
|
||||
* [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
|
||||
*
|
||||
* Call the `bearerTokenAuthenticationPolicy` with the following options:
|
||||
*
|
||||
* ```ts
|
||||
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
||||
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
|
||||
*
|
||||
* const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
|
||||
* authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Once provided, the `bearerTokenAuthenticationPolicy` policy will internally handle Continuous Access Evaluation (CAE) challenges.
|
||||
* When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
|
||||
*
|
||||
* Example challenge with claims:
|
||||
*
|
||||
* ```
|
||||
* Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
|
||||
* error_description="User session has been revoked",
|
||||
* claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
|
||||
* ```
|
||||
*/
|
||||
export declare function authorizeRequestOnClaimChallenge(onChallengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>;
|
||||
//# sourceMappingURL=authorizeRequestOnClaimChallenge.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"authorizeRequestOnClaimChallenge.d.ts","sourceRoot":"","sources":["../../src/authorizeRequestOnClaimChallenge.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAI/E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,EAAE,CAU3D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,gCAAgC,CACpD,kBAAkB,EAAE,kCAAkC,GACrD,OAAO,CAAC,OAAO,CAAC,CAkClB"}
|
||||
69
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.js
generated
vendored
Normal file
69
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { logger as coreClientLogger } from "./log.js";
|
||||
import { decodeStringToString } from "./base64.js";
|
||||
/**
|
||||
* Converts: `Bearer a="b", c="d", Bearer d="e", f="g"`.
|
||||
* Into: `[ { a: 'b', c: 'd' }, { d: 'e', f: 'g' } ]`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function parseCAEChallenge(challenges) {
|
||||
const bearerChallenges = `, ${challenges.trim()}`.split(", Bearer ").filter((x) => x);
|
||||
return bearerChallenges.map((challenge) => {
|
||||
const challengeParts = `${challenge.trim()}, `.split('", ').filter((x) => x);
|
||||
const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split('="')));
|
||||
// Key-value pairs to plain object:
|
||||
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
|
||||
* [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
|
||||
*
|
||||
* Call the `bearerTokenAuthenticationPolicy` with the following options:
|
||||
*
|
||||
* ```ts
|
||||
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
||||
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
|
||||
*
|
||||
* const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
|
||||
* authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Once provided, the `bearerTokenAuthenticationPolicy` policy will internally handle Continuous Access Evaluation (CAE) challenges.
|
||||
* When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
|
||||
*
|
||||
* Example challenge with claims:
|
||||
*
|
||||
* ```
|
||||
* Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
|
||||
* error_description="User session has been revoked",
|
||||
* claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
|
||||
* ```
|
||||
*/
|
||||
export async function authorizeRequestOnClaimChallenge(onChallengeOptions) {
|
||||
const { scopes, response } = onChallengeOptions;
|
||||
const logger = onChallengeOptions.logger || coreClientLogger;
|
||||
const challenge = response.headers.get("WWW-Authenticate");
|
||||
if (!challenge) {
|
||||
logger.info(`The WWW-Authenticate header was missing. Failed to perform the Continuous Access Evaluation authentication flow.`);
|
||||
return false;
|
||||
}
|
||||
const challenges = parseCAEChallenge(challenge) || [];
|
||||
const parsedChallenge = challenges.find((x) => x.claims);
|
||||
if (!parsedChallenge) {
|
||||
logger.info(`The WWW-Authenticate header was missing the necessary "claims" to perform the Continuous Access Evaluation authentication flow.`);
|
||||
return false;
|
||||
}
|
||||
const accessToken = await onChallengeOptions.getAccessToken(parsedChallenge.scope ? [parsedChallenge.scope] : scopes, {
|
||||
claims: decodeStringToString(parsedChallenge.claims),
|
||||
});
|
||||
if (!accessToken) {
|
||||
return false;
|
||||
}
|
||||
onChallengeOptions.request.headers.set("Authorization", `Bearer ${accessToken.token}`);
|
||||
return true;
|
||||
}
|
||||
//# sourceMappingURL=authorizeRequestOnClaimChallenge.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnClaimChallenge.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { AuthorizeRequestOnChallengeOptions } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* Defines a callback to handle auth challenge for Storage APIs.
|
||||
* This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge
|
||||
* Handling has specific features for storage that departs to the general AAD challenge docs.
|
||||
**/
|
||||
export declare const authorizeRequestOnTenantChallenge: (challengeOptions: AuthorizeRequestOnChallengeOptions) => Promise<boolean>;
|
||||
//# sourceMappingURL=authorizeRequestOnTenantChallenge.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"authorizeRequestOnTenantChallenge.d.ts","sourceRoot":"","sources":["../../src/authorizeRequestOnTenantChallenge.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kCAAkC,EAGnC,MAAM,2BAA2B,CAAC;AA0BnC;;;;IAII;AACJ,eAAO,MAAM,iCAAiC,EAAE,CAC9C,gBAAgB,EAAE,kCAAkC,KACjD,OAAO,CAAC,OAAO,CA0BnB,CAAC"}
|
||||
113
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.js
generated
vendored
Normal file
113
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* A set of constants used internally when processing requests.
|
||||
*/
|
||||
const Constants = {
|
||||
DefaultScope: "/.default",
|
||||
/**
|
||||
* Defines constants for use with HTTP headers.
|
||||
*/
|
||||
HeaderConstants: {
|
||||
/**
|
||||
* The Authorization header.
|
||||
*/
|
||||
AUTHORIZATION: "authorization",
|
||||
},
|
||||
};
|
||||
function isUuid(text) {
|
||||
return /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/.test(text);
|
||||
}
|
||||
/**
|
||||
* Defines a callback to handle auth challenge for Storage APIs.
|
||||
* This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge
|
||||
* Handling has specific features for storage that departs to the general AAD challenge docs.
|
||||
**/
|
||||
export const authorizeRequestOnTenantChallenge = async (challengeOptions) => {
|
||||
const requestOptions = requestToOptions(challengeOptions.request);
|
||||
const challenge = getChallenge(challengeOptions.response);
|
||||
if (challenge) {
|
||||
const challengeInfo = parseChallenge(challenge);
|
||||
const challengeScopes = buildScopes(challengeOptions, challengeInfo);
|
||||
const tenantId = extractTenantId(challengeInfo);
|
||||
if (!tenantId) {
|
||||
return false;
|
||||
}
|
||||
const accessToken = await challengeOptions.getAccessToken(challengeScopes, Object.assign(Object.assign({}, requestOptions), { tenantId }));
|
||||
if (!accessToken) {
|
||||
return false;
|
||||
}
|
||||
challengeOptions.request.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${accessToken.token}`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Extracts the tenant id from the challenge information
|
||||
* The tenant id is contained in the authorization_uri as the first
|
||||
* path part.
|
||||
*/
|
||||
function extractTenantId(challengeInfo) {
|
||||
const parsedAuthUri = new URL(challengeInfo.authorization_uri);
|
||||
const pathSegments = parsedAuthUri.pathname.split("/");
|
||||
const tenantId = pathSegments[1];
|
||||
if (tenantId && isUuid(tenantId)) {
|
||||
return tenantId;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Builds the authentication scopes based on the information that comes in the
|
||||
* challenge information. Scopes url is present in the resource_id, if it is empty
|
||||
* we keep using the original scopes.
|
||||
*/
|
||||
function buildScopes(challengeOptions, challengeInfo) {
|
||||
if (!challengeInfo.resource_id) {
|
||||
return challengeOptions.scopes;
|
||||
}
|
||||
const challengeScopes = new URL(challengeInfo.resource_id);
|
||||
challengeScopes.pathname = Constants.DefaultScope;
|
||||
let scope = challengeScopes.toString();
|
||||
if (scope === "https://disk.azure.com/.default") {
|
||||
// the extra slash is required by the service
|
||||
scope = "https://disk.azure.com//.default";
|
||||
}
|
||||
return [scope];
|
||||
}
|
||||
/**
|
||||
* We will retrieve the challenge only if the response status code was 401,
|
||||
* and if the response contained the header "WWW-Authenticate" with a non-empty value.
|
||||
*/
|
||||
function getChallenge(response) {
|
||||
const challenge = response.headers.get("WWW-Authenticate");
|
||||
if (response.status === 401 && challenge) {
|
||||
return challenge;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Converts: `Bearer a="b" c="d"`.
|
||||
* Into: `[ { a: 'b', c: 'd' }]`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
function parseChallenge(challenge) {
|
||||
const bearerChallenge = challenge.slice("Bearer ".length);
|
||||
const challengeParts = `${bearerChallenge.trim()} `.split(" ").filter((x) => x);
|
||||
const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split("=")));
|
||||
// Key-value pairs to plain object:
|
||||
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
|
||||
}
|
||||
/**
|
||||
* Extracts the options form a Pipeline Request for later re-use
|
||||
*/
|
||||
function requestToOptions(request) {
|
||||
return {
|
||||
abortSignal: request.abortSignal,
|
||||
requestOptions: {
|
||||
timeout: request.timeout,
|
||||
},
|
||||
tracingOptions: request.tracingOptions,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=authorizeRequestOnTenantChallenge.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/authorizeRequestOnTenantChallenge.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@azure/core-client/dist/browser/base64-browser.d.mts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/base64-browser.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base64-browser.d.mts","sourceRoot":"","sources":["../../src/base64-browser.mts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IAEb,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAOtD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
||||
1
node_modules/@azure/core-client/dist/browser/base64-browser.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/base64-browser.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base64-browser.mjs","sourceRoot":"","sources":["../../src/base64-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\ndeclare global {\n // stub these out for the browser\n function btoa(input: string): string;\n function atob(input: string): string;\n}\n\n/**\n * Encodes a string in base64 format.\n * @param value - the string to encode\n * @internal\n */\nexport function encodeString(value: string): string {\n return btoa(value);\n}\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - the Uint8Aray to encode\n * @internal\n */\nexport function encodeByteArray(value: Uint8Array): string {\n let str = \"\";\n for (let i = 0; i < value.length; i++) {\n str += String.fromCharCode(value[i]);\n }\n return btoa(str);\n}\n\n/**\n * Decodes a base64 string into a byte array.\n * @param value - the base64 string to decode\n * @internal\n */\nexport function decodeString(value: string): Uint8Array {\n const byteString = atob(value);\n const arr = new Uint8Array(byteString.length);\n for (let i = 0; i < byteString.length; i++) {\n arr[i] = byteString.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Decodes a base64 string into a string.\n * @param value - the base64 string to decode\n * @internal\n */\nexport function decodeStringToString(value: string): string {\n return atob(value);\n}\n"]}
|
||||
29
node_modules/@azure/core-client/dist/browser/base64.d.ts
generated
vendored
Normal file
29
node_modules/@azure/core-client/dist/browser/base64.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
declare global {
|
||||
function btoa(input: string): string;
|
||||
function atob(input: string): string;
|
||||
}
|
||||
/**
|
||||
* Encodes a string in base64 format.
|
||||
* @param value - the string to encode
|
||||
* @internal
|
||||
*/
|
||||
export declare function encodeString(value: string): string;
|
||||
/**
|
||||
* Encodes a byte array in base64 format.
|
||||
* @param value - the Uint8Aray to encode
|
||||
* @internal
|
||||
*/
|
||||
export declare function encodeByteArray(value: Uint8Array): string;
|
||||
/**
|
||||
* Decodes a base64 string into a byte array.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
export declare function decodeString(value: string): Uint8Array;
|
||||
/**
|
||||
* Decodes a base64 string into a string.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
export declare function decodeStringToString(value: string): string;
|
||||
//# sourceMappingURL=base64-browser.d.mts.map
|
||||
44
node_modules/@azure/core-client/dist/browser/base64.js
generated
vendored
Normal file
44
node_modules/@azure/core-client/dist/browser/base64.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Encodes a string in base64 format.
|
||||
* @param value - the string to encode
|
||||
* @internal
|
||||
*/
|
||||
export function encodeString(value) {
|
||||
return btoa(value);
|
||||
}
|
||||
/**
|
||||
* Encodes a byte array in base64 format.
|
||||
* @param value - the Uint8Aray to encode
|
||||
* @internal
|
||||
*/
|
||||
export function encodeByteArray(value) {
|
||||
let str = "";
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
str += String.fromCharCode(value[i]);
|
||||
}
|
||||
return btoa(str);
|
||||
}
|
||||
/**
|
||||
* Decodes a base64 string into a byte array.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
export function decodeString(value) {
|
||||
const byteString = atob(value);
|
||||
const arr = new Uint8Array(byteString.length);
|
||||
for (let i = 0; i < byteString.length; i++) {
|
||||
arr[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
/**
|
||||
* Decodes a base64 string into a string.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
export function decodeStringToString(value) {
|
||||
return atob(value);
|
||||
}
|
||||
//# sourceMappingURL=base64-browser.mjs.map
|
||||
45
node_modules/@azure/core-client/dist/browser/deserializationPolicy.d.ts
generated
vendored
Normal file
45
node_modules/@azure/core-client/dist/browser/deserializationPolicy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { SerializerOptions, XmlOptions } from "./interfaces.js";
|
||||
import { PipelinePolicy } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* The programmatic identifier of the deserializationPolicy.
|
||||
*/
|
||||
export declare const deserializationPolicyName = "deserializationPolicy";
|
||||
/**
|
||||
* Options to configure API response deserialization.
|
||||
*/
|
||||
export interface DeserializationPolicyOptions {
|
||||
/**
|
||||
* Configures the expected content types for the deserialization of
|
||||
* JSON and XML response bodies.
|
||||
*/
|
||||
expectedContentTypes?: DeserializationContentTypes;
|
||||
/**
|
||||
* A function that is able to parse XML. Required for XML support.
|
||||
*/
|
||||
parseXML?: (str: string, opts?: XmlOptions) => Promise<any>;
|
||||
/**
|
||||
* Configures behavior of xml parser and builder.
|
||||
*/
|
||||
serializerOptions?: SerializerOptions;
|
||||
}
|
||||
/**
|
||||
* The content-types that will indicate that an operation response should be deserialized in a
|
||||
* particular way.
|
||||
*/
|
||||
export interface DeserializationContentTypes {
|
||||
/**
|
||||
* The content-types that indicate that an operation response should be deserialized as JSON.
|
||||
* Defaults to [ "application/json", "text/json" ].
|
||||
*/
|
||||
json?: string[];
|
||||
/**
|
||||
* The content-types that indicate that an operation response should be deserialized as XML.
|
||||
* Defaults to [ "application/xml", "application/atom+xml" ].
|
||||
*/
|
||||
xml?: string[];
|
||||
}
|
||||
/**
|
||||
* This policy handles parsing out responses according to OperationSpecs on the request.
|
||||
*/
|
||||
export declare function deserializationPolicy(options?: DeserializationPolicyOptions): PipelinePolicy;
|
||||
//# sourceMappingURL=deserializationPolicy.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/deserializationPolicy.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/deserializationPolicy.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"deserializationPolicy.d.ts","sourceRoot":"","sources":["../../src/deserializationPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,iBAAiB,EAEjB,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAOnC;;GAEG;AACH,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,2BAA2B,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAE5D;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,4BAAiC,GAAG,cAAc,CA0BhG"}
|
||||
231
node_modules/@azure/core-client/dist/browser/deserializationPolicy.js
generated
vendored
Normal file
231
node_modules/@azure/core-client/dist/browser/deserializationPolicy.js
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { XML_CHARKEY, } from "./interfaces.js";
|
||||
import { RestError, } from "@azure/core-rest-pipeline";
|
||||
import { MapperTypeNames } from "./serializer.js";
|
||||
import { getOperationRequestInfo } from "./operationHelpers.js";
|
||||
const defaultJsonContentTypes = ["application/json", "text/json"];
|
||||
const defaultXmlContentTypes = ["application/xml", "application/atom+xml"];
|
||||
/**
|
||||
* The programmatic identifier of the deserializationPolicy.
|
||||
*/
|
||||
export const deserializationPolicyName = "deserializationPolicy";
|
||||
/**
|
||||
* This policy handles parsing out responses according to OperationSpecs on the request.
|
||||
*/
|
||||
export function deserializationPolicy(options = {}) {
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
const jsonContentTypes = (_b = (_a = options.expectedContentTypes) === null || _a === void 0 ? void 0 : _a.json) !== null && _b !== void 0 ? _b : defaultJsonContentTypes;
|
||||
const xmlContentTypes = (_d = (_c = options.expectedContentTypes) === null || _c === void 0 ? void 0 : _c.xml) !== null && _d !== void 0 ? _d : defaultXmlContentTypes;
|
||||
const parseXML = options.parseXML;
|
||||
const serializerOptions = options.serializerOptions;
|
||||
const updatedOptions = {
|
||||
xml: {
|
||||
rootName: (_e = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.rootName) !== null && _e !== void 0 ? _e : "",
|
||||
includeRoot: (_f = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.includeRoot) !== null && _f !== void 0 ? _f : false,
|
||||
xmlCharKey: (_g = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.xmlCharKey) !== null && _g !== void 0 ? _g : XML_CHARKEY,
|
||||
},
|
||||
};
|
||||
return {
|
||||
name: deserializationPolicyName,
|
||||
async sendRequest(request, next) {
|
||||
const response = await next(request);
|
||||
return deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, updatedOptions, parseXML);
|
||||
},
|
||||
};
|
||||
}
|
||||
function getOperationResponseMap(parsedResponse) {
|
||||
let result;
|
||||
const request = parsedResponse.request;
|
||||
const operationInfo = getOperationRequestInfo(request);
|
||||
const operationSpec = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationSpec;
|
||||
if (operationSpec) {
|
||||
if (!(operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationResponseGetter)) {
|
||||
result = operationSpec.responses[parsedResponse.status];
|
||||
}
|
||||
else {
|
||||
result = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationResponseGetter(operationSpec, parsedResponse);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function shouldDeserializeResponse(parsedResponse) {
|
||||
const request = parsedResponse.request;
|
||||
const operationInfo = getOperationRequestInfo(request);
|
||||
const shouldDeserialize = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.shouldDeserialize;
|
||||
let result;
|
||||
if (shouldDeserialize === undefined) {
|
||||
result = true;
|
||||
}
|
||||
else if (typeof shouldDeserialize === "boolean") {
|
||||
result = shouldDeserialize;
|
||||
}
|
||||
else {
|
||||
result = shouldDeserialize(parsedResponse);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, options, parseXML) {
|
||||
const parsedResponse = await parse(jsonContentTypes, xmlContentTypes, response, options, parseXML);
|
||||
if (!shouldDeserializeResponse(parsedResponse)) {
|
||||
return parsedResponse;
|
||||
}
|
||||
const operationInfo = getOperationRequestInfo(parsedResponse.request);
|
||||
const operationSpec = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationSpec;
|
||||
if (!operationSpec || !operationSpec.responses) {
|
||||
return parsedResponse;
|
||||
}
|
||||
const responseSpec = getOperationResponseMap(parsedResponse);
|
||||
const { error, shouldReturnResponse } = handleErrorResponse(parsedResponse, operationSpec, responseSpec, options);
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
else if (shouldReturnResponse) {
|
||||
return parsedResponse;
|
||||
}
|
||||
// An operation response spec does exist for current status code, so
|
||||
// use it to deserialize the response.
|
||||
if (responseSpec) {
|
||||
if (responseSpec.bodyMapper) {
|
||||
let valueToDeserialize = parsedResponse.parsedBody;
|
||||
if (operationSpec.isXML && responseSpec.bodyMapper.type.name === MapperTypeNames.Sequence) {
|
||||
valueToDeserialize =
|
||||
typeof valueToDeserialize === "object"
|
||||
? valueToDeserialize[responseSpec.bodyMapper.xmlElementName]
|
||||
: [];
|
||||
}
|
||||
try {
|
||||
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
|
||||
}
|
||||
catch (deserializeError) {
|
||||
const restError = new RestError(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, {
|
||||
statusCode: parsedResponse.status,
|
||||
request: parsedResponse.request,
|
||||
response: parsedResponse,
|
||||
});
|
||||
throw restError;
|
||||
}
|
||||
}
|
||||
else if (operationSpec.httpMethod === "HEAD") {
|
||||
// head methods never have a body, but we return a boolean to indicate presence/absence of the resource
|
||||
parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
|
||||
}
|
||||
if (responseSpec.headersMapper) {
|
||||
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJSON(), "operationRes.parsedHeaders", { xml: {}, ignoreUnknownProperties: true });
|
||||
}
|
||||
}
|
||||
return parsedResponse;
|
||||
}
|
||||
function isOperationSpecEmpty(operationSpec) {
|
||||
const expectedStatusCodes = Object.keys(operationSpec.responses);
|
||||
return (expectedStatusCodes.length === 0 ||
|
||||
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
|
||||
}
|
||||
function handleErrorResponse(parsedResponse, operationSpec, responseSpec, options) {
|
||||
var _a;
|
||||
const isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
|
||||
const isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
|
||||
? isSuccessByStatus
|
||||
: !!responseSpec;
|
||||
if (isExpectedStatusCode) {
|
||||
if (responseSpec) {
|
||||
if (!responseSpec.isError) {
|
||||
return { error: null, shouldReturnResponse: false };
|
||||
}
|
||||
}
|
||||
else {
|
||||
return { error: null, shouldReturnResponse: false };
|
||||
}
|
||||
}
|
||||
const errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default;
|
||||
const initialErrorMessage = ((_a = parsedResponse.request.streamResponseStatusCodes) === null || _a === void 0 ? void 0 : _a.has(parsedResponse.status))
|
||||
? `Unexpected status code: ${parsedResponse.status}`
|
||||
: parsedResponse.bodyAsText;
|
||||
const error = new RestError(initialErrorMessage, {
|
||||
statusCode: parsedResponse.status,
|
||||
request: parsedResponse.request,
|
||||
response: parsedResponse,
|
||||
});
|
||||
// If the item failed but there's no error spec or default spec to deserialize the error,
|
||||
// we should fail so we just throw the parsed response
|
||||
if (!errorResponseSpec) {
|
||||
throw error;
|
||||
}
|
||||
const defaultBodyMapper = errorResponseSpec.bodyMapper;
|
||||
const defaultHeadersMapper = errorResponseSpec.headersMapper;
|
||||
try {
|
||||
// If error response has a body, try to deserialize it using default body mapper.
|
||||
// Then try to extract error code & message from it
|
||||
if (parsedResponse.parsedBody) {
|
||||
const parsedBody = parsedResponse.parsedBody;
|
||||
let deserializedError;
|
||||
if (defaultBodyMapper) {
|
||||
let valueToDeserialize = parsedBody;
|
||||
if (operationSpec.isXML && defaultBodyMapper.type.name === MapperTypeNames.Sequence) {
|
||||
valueToDeserialize = [];
|
||||
const elementName = defaultBodyMapper.xmlElementName;
|
||||
if (typeof parsedBody === "object" && elementName) {
|
||||
valueToDeserialize = parsedBody[elementName];
|
||||
}
|
||||
}
|
||||
deserializedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody", options);
|
||||
}
|
||||
const internalError = parsedBody.error || deserializedError || parsedBody;
|
||||
error.code = internalError.code;
|
||||
if (internalError.message) {
|
||||
error.message = internalError.message;
|
||||
}
|
||||
if (defaultBodyMapper) {
|
||||
error.response.parsedBody = deserializedError;
|
||||
}
|
||||
}
|
||||
// If error response has headers, try to deserialize it using default header mapper
|
||||
if (parsedResponse.headers && defaultHeadersMapper) {
|
||||
error.response.parsedHeaders =
|
||||
operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.toJSON(), "operationRes.parsedHeaders");
|
||||
}
|
||||
}
|
||||
catch (defaultError) {
|
||||
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody - "${parsedResponse.bodyAsText}" for the default response.`;
|
||||
}
|
||||
return { error, shouldReturnResponse: false };
|
||||
}
|
||||
async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts, parseXML) {
|
||||
var _a;
|
||||
if (!((_a = operationResponse.request.streamResponseStatusCodes) === null || _a === void 0 ? void 0 : _a.has(operationResponse.status)) &&
|
||||
operationResponse.bodyAsText) {
|
||||
const text = operationResponse.bodyAsText;
|
||||
const contentType = operationResponse.headers.get("Content-Type") || "";
|
||||
const contentComponents = !contentType
|
||||
? []
|
||||
: contentType.split(";").map((component) => component.toLowerCase());
|
||||
try {
|
||||
if (contentComponents.length === 0 ||
|
||||
contentComponents.some((component) => jsonContentTypes.indexOf(component) !== -1)) {
|
||||
operationResponse.parsedBody = JSON.parse(text);
|
||||
return operationResponse;
|
||||
}
|
||||
else if (contentComponents.some((component) => xmlContentTypes.indexOf(component) !== -1)) {
|
||||
if (!parseXML) {
|
||||
throw new Error("Parsing XML not supported.");
|
||||
}
|
||||
const body = await parseXML(text, opts.xml);
|
||||
operationResponse.parsedBody = body;
|
||||
return operationResponse;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
const msg = `Error "${err}" occurred while parsing the response body - ${operationResponse.bodyAsText}.`;
|
||||
const errCode = err.code || RestError.PARSE_ERROR;
|
||||
const e = new RestError(msg, {
|
||||
code: errCode,
|
||||
statusCode: operationResponse.status,
|
||||
request: operationResponse.request,
|
||||
response: operationResponse,
|
||||
});
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return operationResponse;
|
||||
}
|
||||
//# sourceMappingURL=deserializationPolicy.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/deserializationPolicy.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/deserializationPolicy.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-client/dist/browser/httpClientCache.d.ts
generated
vendored
Normal file
3
node_modules/@azure/core-client/dist/browser/httpClientCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { HttpClient } from "@azure/core-rest-pipeline";
|
||||
export declare function getCachedDefaultHttpClient(): HttpClient;
|
||||
//# sourceMappingURL=httpClientCache.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/httpClientCache.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/httpClientCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpClientCache.d.ts","sourceRoot":"","sources":["../../src/httpClientCache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA2B,MAAM,2BAA2B,CAAC;AAIhF,wBAAgB,0BAA0B,IAAI,UAAU,CAMvD"}
|
||||
11
node_modules/@azure/core-client/dist/browser/httpClientCache.js
generated
vendored
Normal file
11
node_modules/@azure/core-client/dist/browser/httpClientCache.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { createDefaultHttpClient } from "@azure/core-rest-pipeline";
|
||||
let cachedHttpClient;
|
||||
export function getCachedDefaultHttpClient() {
|
||||
if (!cachedHttpClient) {
|
||||
cachedHttpClient = createDefaultHttpClient();
|
||||
}
|
||||
return cachedHttpClient;
|
||||
}
|
||||
//# sourceMappingURL=httpClientCache.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/httpClientCache.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/httpClientCache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpClientCache.js","sourceRoot":"","sources":["../../src/httpClientCache.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAc,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEhF,IAAI,gBAAwC,CAAC;AAE7C,MAAM,UAAU,0BAA0B;IACxC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,GAAG,uBAAuB,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { HttpClient, createDefaultHttpClient } from \"@azure/core-rest-pipeline\";\n\nlet cachedHttpClient: HttpClient | undefined;\n\nexport function getCachedDefaultHttpClient(): HttpClient {\n if (!cachedHttpClient) {\n cachedHttpClient = createDefaultHttpClient();\n }\n\n return cachedHttpClient;\n}\n"]}
|
||||
9
node_modules/@azure/core-client/dist/browser/index.d.ts
generated
vendored
Normal file
9
node_modules/@azure/core-client/dist/browser/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { createSerializer, MapperTypeNames } from "./serializer.js";
|
||||
export { ServiceClient, ServiceClientOptions } from "./serviceClient.js";
|
||||
export { createClientPipeline, InternalClientPipelineOptions } from "./pipeline.js";
|
||||
export { OperationSpec, OperationArguments, OperationOptions, OperationResponseMap, OperationParameter, OperationQueryParameter, OperationURLParameter, Serializer, BaseMapper, Mapper, MapperType, SimpleMapperType, EnumMapper, EnumMapperType, SequenceMapper, SequenceMapperType, DictionaryMapper, DictionaryMapperType, CompositeMapper, CompositeMapperType, MapperConstraints, OperationRequest, OperationRequestOptions, OperationRequestInfo, QueryCollectionFormat, ParameterPath, FullOperationResponse, PolymorphicDiscriminator, SpanConfig, XML_ATTRKEY, XML_CHARKEY, XmlOptions, SerializerOptions, RawResponseCallback, CommonClientOptions, AdditionalPolicyConfig, } from "./interfaces.js";
|
||||
export { deserializationPolicy, deserializationPolicyName, DeserializationPolicyOptions, DeserializationContentTypes, } from "./deserializationPolicy.js";
|
||||
export { serializationPolicy, serializationPolicyName, SerializationPolicyOptions, } from "./serializationPolicy.js";
|
||||
export { authorizeRequestOnClaimChallenge } from "./authorizeRequestOnClaimChallenge.js";
|
||||
export { authorizeRequestOnTenantChallenge } from "./authorizeRequestOnTenantChallenge.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC"}
|
||||
11
node_modules/@azure/core-client/dist/browser/index.js
generated
vendored
Normal file
11
node_modules/@azure/core-client/dist/browser/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
export { createSerializer, MapperTypeNames } from "./serializer.js";
|
||||
export { ServiceClient } from "./serviceClient.js";
|
||||
export { createClientPipeline } from "./pipeline.js";
|
||||
export { XML_ATTRKEY, XML_CHARKEY, } from "./interfaces.js";
|
||||
export { deserializationPolicy, deserializationPolicyName, } from "./deserializationPolicy.js";
|
||||
export { serializationPolicy, serializationPolicyName, } from "./serializationPolicy.js";
|
||||
export { authorizeRequestOnClaimChallenge } from "./authorizeRequestOnClaimChallenge.js";
|
||||
export { authorizeRequestOnTenantChallenge } from "./authorizeRequestOnTenantChallenge.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAwB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAiC,MAAM,eAAe,CAAC;AACpF,OAAO,EA8BL,WAAW,EACX,WAAW,GAMZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAG1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GAExB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { createSerializer, MapperTypeNames } from \"./serializer.js\";\nexport { ServiceClient, ServiceClientOptions } from \"./serviceClient.js\";\nexport { createClientPipeline, InternalClientPipelineOptions } from \"./pipeline.js\";\nexport {\n OperationSpec,\n OperationArguments,\n OperationOptions,\n OperationResponseMap,\n OperationParameter,\n OperationQueryParameter,\n OperationURLParameter,\n Serializer,\n BaseMapper,\n Mapper,\n MapperType,\n SimpleMapperType,\n EnumMapper,\n EnumMapperType,\n SequenceMapper,\n SequenceMapperType,\n DictionaryMapper,\n DictionaryMapperType,\n CompositeMapper,\n CompositeMapperType,\n MapperConstraints,\n OperationRequest,\n OperationRequestOptions,\n OperationRequestInfo,\n QueryCollectionFormat,\n ParameterPath,\n FullOperationResponse,\n PolymorphicDiscriminator,\n SpanConfig,\n XML_ATTRKEY,\n XML_CHARKEY,\n XmlOptions,\n SerializerOptions,\n RawResponseCallback,\n CommonClientOptions,\n AdditionalPolicyConfig,\n} from \"./interfaces.js\";\nexport {\n deserializationPolicy,\n deserializationPolicyName,\n DeserializationPolicyOptions,\n DeserializationContentTypes,\n} from \"./deserializationPolicy.js\";\nexport {\n serializationPolicy,\n serializationPolicyName,\n SerializationPolicyOptions,\n} from \"./serializationPolicy.js\";\nexport { authorizeRequestOnClaimChallenge } from \"./authorizeRequestOnClaimChallenge.js\";\nexport { authorizeRequestOnTenantChallenge } from \"./authorizeRequestOnTenantChallenge.js\";\n"]}
|
||||
14
node_modules/@azure/core-client/dist/browser/interfaceHelpers.d.ts
generated
vendored
Normal file
14
node_modules/@azure/core-client/dist/browser/interfaceHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { OperationParameter, OperationSpec } from "./interfaces.js";
|
||||
/**
|
||||
* Gets the list of status codes for streaming responses.
|
||||
* @internal
|
||||
*/
|
||||
export declare function getStreamingResponseStatusCodes(operationSpec: OperationSpec): Set<number>;
|
||||
/**
|
||||
* Get the path to this parameter's value as a dotted string (a.b.c).
|
||||
* @param parameter - The parameter to get the path string for.
|
||||
* @returns The path to this parameter's value as a dotted string.
|
||||
* @internal
|
||||
*/
|
||||
export declare function getPathStringFromParameter(parameter: OperationParameter): string;
|
||||
//# sourceMappingURL=interfaceHelpers.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/interfaceHelpers.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/interfaceHelpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaceHelpers.d.ts","sourceRoot":"","sources":["../../src/interfaceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGpE;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAYzF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,kBAAkB,GAAG,MAAM,CAWhF"}
|
||||
39
node_modules/@azure/core-client/dist/browser/interfaceHelpers.js
generated
vendored
Normal file
39
node_modules/@azure/core-client/dist/browser/interfaceHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { MapperTypeNames } from "./serializer.js";
|
||||
/**
|
||||
* Gets the list of status codes for streaming responses.
|
||||
* @internal
|
||||
*/
|
||||
export function getStreamingResponseStatusCodes(operationSpec) {
|
||||
const result = new Set();
|
||||
for (const statusCode in operationSpec.responses) {
|
||||
const operationResponse = operationSpec.responses[statusCode];
|
||||
if (operationResponse.bodyMapper &&
|
||||
operationResponse.bodyMapper.type.name === MapperTypeNames.Stream) {
|
||||
result.add(Number(statusCode));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Get the path to this parameter's value as a dotted string (a.b.c).
|
||||
* @param parameter - The parameter to get the path string for.
|
||||
* @returns The path to this parameter's value as a dotted string.
|
||||
* @internal
|
||||
*/
|
||||
export function getPathStringFromParameter(parameter) {
|
||||
const { parameterPath, mapper } = parameter;
|
||||
let result;
|
||||
if (typeof parameterPath === "string") {
|
||||
result = parameterPath;
|
||||
}
|
||||
else if (Array.isArray(parameterPath)) {
|
||||
result = parameterPath.join(".");
|
||||
}
|
||||
else {
|
||||
result = mapper.serializedName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=interfaceHelpers.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/interfaceHelpers.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/interfaceHelpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaceHelpers.js","sourceRoot":"","sources":["../../src/interfaceHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,aAA4B;IAC1E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,KAAK,MAAM,UAAU,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QACjD,MAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC9D,IACE,iBAAiB,CAAC,UAAU;YAC5B,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,MAAM,EACjE,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,SAA6B;IACtE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5C,IAAI,MAAc,CAAC;IACnB,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,GAAG,aAAa,CAAC;IACzB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,MAAM,CAAC,cAAe,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationParameter, OperationSpec } from \"./interfaces.js\";\nimport { MapperTypeNames } from \"./serializer.js\";\n\n/**\n * Gets the list of status codes for streaming responses.\n * @internal\n */\nexport function getStreamingResponseStatusCodes(operationSpec: OperationSpec): Set<number> {\n const result = new Set<number>();\n for (const statusCode in operationSpec.responses) {\n const operationResponse = operationSpec.responses[statusCode];\n if (\n operationResponse.bodyMapper &&\n operationResponse.bodyMapper.type.name === MapperTypeNames.Stream\n ) {\n result.add(Number(statusCode));\n }\n }\n return result;\n}\n\n/**\n * Get the path to this parameter's value as a dotted string (a.b.c).\n * @param parameter - The parameter to get the path string for.\n * @returns The path to this parameter's value as a dotted string.\n * @internal\n */\nexport function getPathStringFromParameter(parameter: OperationParameter): string {\n const { parameterPath, mapper } = parameter;\n let result: string;\n if (typeof parameterPath === \"string\") {\n result = parameterPath;\n } else if (Array.isArray(parameterPath)) {\n result = parameterPath.join(\".\");\n } else {\n result = mapper.serializedName!;\n }\n return result;\n}\n"]}
|
||||
664
node_modules/@azure/core-client/dist/browser/interfaces.d.ts
generated
vendored
Normal file
664
node_modules/@azure/core-client/dist/browser/interfaces.d.ts
generated
vendored
Normal file
@@ -0,0 +1,664 @@
|
||||
import { HttpClient, HttpMethods, PipelineOptions, PipelinePolicy, PipelineRequest, PipelineResponse, TransferProgressEvent } from "@azure/core-rest-pipeline";
|
||||
import { AbortSignalLike } from "@azure/abort-controller";
|
||||
import { OperationTracingOptions } from "@azure/core-tracing";
|
||||
/**
|
||||
* Default key used to access the XML attributes.
|
||||
*/
|
||||
export declare const XML_ATTRKEY = "$";
|
||||
/**
|
||||
* Default key used to access the XML value content.
|
||||
*/
|
||||
export declare const XML_CHARKEY = "_";
|
||||
/**
|
||||
* Options to govern behavior of xml parser and builder.
|
||||
*/
|
||||
export interface XmlOptions {
|
||||
/**
|
||||
* indicates the name of the root element in the resulting XML when building XML.
|
||||
*/
|
||||
rootName?: string;
|
||||
/**
|
||||
* indicates whether the root element is to be included or not in the output when parsing XML.
|
||||
*/
|
||||
includeRoot?: boolean;
|
||||
/**
|
||||
* key used to access the XML value content when parsing XML.
|
||||
*/
|
||||
xmlCharKey?: string;
|
||||
}
|
||||
/**
|
||||
* Options to configure serialization/de-serialization behavior.
|
||||
*/
|
||||
export interface SerializerOptions {
|
||||
/**
|
||||
* Options to configure xml parser/builder behavior.
|
||||
*/
|
||||
xml: XmlOptions;
|
||||
/**
|
||||
* Normally additional properties are included in the result object, even if there is no mapper for them.
|
||||
* This flag disables this behavior when true. It is used when parsing headers to avoid polluting the result object.
|
||||
*/
|
||||
ignoreUnknownProperties?: boolean;
|
||||
}
|
||||
export type RequiredSerializerOptions = {
|
||||
[K in keyof SerializerOptions]: Required<SerializerOptions[K]>;
|
||||
};
|
||||
/**
|
||||
* A type alias for future proofing.
|
||||
*/
|
||||
export type OperationRequest = PipelineRequest;
|
||||
/**
|
||||
* Metadata that is used to properly parse a response.
|
||||
*/
|
||||
export interface OperationRequestInfo {
|
||||
/**
|
||||
* Used to parse the response.
|
||||
*/
|
||||
operationSpec?: OperationSpec;
|
||||
/**
|
||||
* Used to encode the request.
|
||||
*/
|
||||
operationArguments?: OperationArguments;
|
||||
/**
|
||||
* A function that returns the proper OperationResponseMap for the given OperationSpec and
|
||||
* PipelineResponse combination. If this is undefined, then a simple status code lookup will
|
||||
* be used.
|
||||
*/
|
||||
operationResponseGetter?: (operationSpec: OperationSpec, response: PipelineResponse) => undefined | OperationResponseMap;
|
||||
/**
|
||||
* Whether or not the PipelineResponse should be deserialized. Defaults to true.
|
||||
*/
|
||||
shouldDeserialize?: boolean | ((response: PipelineResponse) => boolean);
|
||||
}
|
||||
/**
|
||||
* The base options type for all operations.
|
||||
*/
|
||||
export interface OperationOptions {
|
||||
/**
|
||||
* The signal which can be used to abort requests.
|
||||
*/
|
||||
abortSignal?: AbortSignalLike;
|
||||
/**
|
||||
* Options used when creating and sending HTTP requests for this operation.
|
||||
*/
|
||||
requestOptions?: OperationRequestOptions;
|
||||
/**
|
||||
* Options used when tracing is enabled.
|
||||
*/
|
||||
tracingOptions?: OperationTracingOptions;
|
||||
/**
|
||||
* Options to override serialization/de-serialization behavior.
|
||||
*/
|
||||
serializerOptions?: SerializerOptions;
|
||||
/**
|
||||
* A function to be called each time a response is received from the server
|
||||
* while performing the requested operation.
|
||||
* May be called multiple times.
|
||||
*/
|
||||
onResponse?: RawResponseCallback;
|
||||
}
|
||||
/**
|
||||
* Options used when creating and sending HTTP requests for this operation.
|
||||
*/
|
||||
export interface OperationRequestOptions {
|
||||
/**
|
||||
* User defined custom request headers that
|
||||
* will be applied before the request is sent.
|
||||
*/
|
||||
customHeaders?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/**
|
||||
* The number of milliseconds a request can take before automatically being terminated.
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Callback which fires upon upload progress.
|
||||
*/
|
||||
onUploadProgress?: (progress: TransferProgressEvent) => void;
|
||||
/**
|
||||
* Callback which fires upon download progress.
|
||||
*/
|
||||
onDownloadProgress?: (progress: TransferProgressEvent) => void;
|
||||
/**
|
||||
* Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the
|
||||
* HttpOperationResponse should be deserialized.
|
||||
*/
|
||||
shouldDeserialize?: boolean | ((response: PipelineResponse) => boolean);
|
||||
/**
|
||||
* Set to true if the request is sent over HTTP instead of HTTPS
|
||||
*/
|
||||
allowInsecureConnection?: boolean;
|
||||
}
|
||||
/**
|
||||
* A collection of properties that apply to a single invocation of an operation.
|
||||
*/
|
||||
export interface OperationArguments {
|
||||
/**
|
||||
* The parameters that were passed to the operation method.
|
||||
*/
|
||||
[parameterName: string]: unknown;
|
||||
/**
|
||||
* The optional arguments that are provided to an operation.
|
||||
*/
|
||||
options?: OperationOptions;
|
||||
}
|
||||
/**
|
||||
* The format that will be used to join an array of values together for a query parameter value.
|
||||
*/
|
||||
export type QueryCollectionFormat = "CSV" | "SSV" | "TSV" | "Pipes" | "Multi";
|
||||
/**
|
||||
* Encodes how to reach a particular property on an object.
|
||||
*/
|
||||
export type ParameterPath = string | string[] | {
|
||||
[propertyName: string]: ParameterPath;
|
||||
};
|
||||
/**
|
||||
* A common interface that all Operation parameter's extend.
|
||||
*/
|
||||
export interface OperationParameter {
|
||||
/**
|
||||
* The path to this parameter's value in OperationArguments or the object that contains paths for
|
||||
* each property's value in OperationArguments.
|
||||
*/
|
||||
parameterPath: ParameterPath;
|
||||
/**
|
||||
* The mapper that defines how to validate and serialize this parameter's value.
|
||||
*/
|
||||
mapper: Mapper;
|
||||
}
|
||||
/**
|
||||
* A parameter for an operation that will be substituted into the operation's request URL.
|
||||
*/
|
||||
export interface OperationURLParameter extends OperationParameter {
|
||||
/**
|
||||
* Whether or not to skip encoding the URL parameter's value before adding it to the URL.
|
||||
*/
|
||||
skipEncoding?: boolean;
|
||||
}
|
||||
/**
|
||||
* A parameter for an operation that will be added as a query parameter to the operation's HTTP
|
||||
* request.
|
||||
*/
|
||||
export interface OperationQueryParameter extends OperationParameter {
|
||||
/**
|
||||
* Whether or not to skip encoding the query parameter's value before adding it to the URL.
|
||||
*/
|
||||
skipEncoding?: boolean;
|
||||
/**
|
||||
* If this query parameter's value is a collection, what type of format should the value be
|
||||
* converted to.
|
||||
*/
|
||||
collectionFormat?: QueryCollectionFormat;
|
||||
}
|
||||
/**
|
||||
* An OperationResponse that can be returned from an operation request for a single status code.
|
||||
*/
|
||||
export interface OperationResponseMap {
|
||||
/**
|
||||
* The mapper that will be used to deserialize the response headers.
|
||||
*/
|
||||
headersMapper?: Mapper;
|
||||
/**
|
||||
* The mapper that will be used to deserialize the response body.
|
||||
*/
|
||||
bodyMapper?: Mapper;
|
||||
/**
|
||||
* Indicates if this is an error response
|
||||
*/
|
||||
isError?: boolean;
|
||||
}
|
||||
/**
|
||||
* A specification that defines an operation.
|
||||
*/
|
||||
export interface OperationSpec {
|
||||
/**
|
||||
* The serializer to use in this operation.
|
||||
*/
|
||||
readonly serializer: Serializer;
|
||||
/**
|
||||
* The HTTP method that should be used by requests for this operation.
|
||||
*/
|
||||
readonly httpMethod: HttpMethods;
|
||||
/**
|
||||
* The URL that was provided in the service's specification. This will still have all of the URL
|
||||
* template variables in it. If this is not provided when the OperationSpec is created, then it
|
||||
* will be populated by a "baseUri" property on the ServiceClient.
|
||||
*/
|
||||
readonly baseUrl?: string;
|
||||
/**
|
||||
* The fixed path for this operation's URL. This will still have all of the URL template variables
|
||||
* in it.
|
||||
*/
|
||||
readonly path?: string;
|
||||
/**
|
||||
* The content type of the request body. This value will be used as the "Content-Type" header if
|
||||
* it is provided.
|
||||
*/
|
||||
readonly contentType?: string;
|
||||
/**
|
||||
* The media type of the request body.
|
||||
* This value can be used to aide in serialization if it is provided.
|
||||
*/
|
||||
readonly mediaType?: "json" | "xml" | "form" | "binary" | "multipart" | "text" | "unknown" | string;
|
||||
/**
|
||||
* The parameter that will be used to construct the HTTP request's body.
|
||||
*/
|
||||
readonly requestBody?: OperationParameter;
|
||||
/**
|
||||
* Whether or not this operation uses XML request and response bodies.
|
||||
*/
|
||||
readonly isXML?: boolean;
|
||||
/**
|
||||
* The parameters to the operation method that will be substituted into the constructed URL.
|
||||
*/
|
||||
readonly urlParameters?: ReadonlyArray<OperationURLParameter>;
|
||||
/**
|
||||
* The parameters to the operation method that will be added to the constructed URL's query.
|
||||
*/
|
||||
readonly queryParameters?: ReadonlyArray<OperationQueryParameter>;
|
||||
/**
|
||||
* The parameters to the operation method that will be converted to headers on the operation's
|
||||
* HTTP request.
|
||||
*/
|
||||
readonly headerParameters?: ReadonlyArray<OperationParameter>;
|
||||
/**
|
||||
* The parameters to the operation method that will be used to create a formdata body for the
|
||||
* operation's HTTP request.
|
||||
*/
|
||||
readonly formDataParameters?: ReadonlyArray<OperationParameter>;
|
||||
/**
|
||||
* The different types of responses that this operation can return based on what status code is
|
||||
* returned.
|
||||
*/
|
||||
readonly responses: {
|
||||
[responseCode: string]: OperationResponseMap;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Wrapper object for http request and response. Deserialized object is stored in
|
||||
* the `parsedBody` property when the response body is received in JSON or XML.
|
||||
*/
|
||||
export interface FullOperationResponse extends PipelineResponse {
|
||||
/**
|
||||
* The parsed HTTP response headers.
|
||||
*/
|
||||
parsedHeaders?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* The response body as parsed JSON or XML.
|
||||
*/
|
||||
parsedBody?: any;
|
||||
/**
|
||||
* The request that generated the response.
|
||||
*/
|
||||
request: OperationRequest;
|
||||
}
|
||||
/**
|
||||
* A function to be called each time a response is received from the server
|
||||
* while performing the requested operation.
|
||||
* May be called multiple times.
|
||||
*/
|
||||
export type RawResponseCallback = (rawResponse: FullOperationResponse, flatResponse: unknown, error?: unknown) => void;
|
||||
/**
|
||||
* Used to map raw response objects to final shapes.
|
||||
* Helps packing and unpacking Dates and other encoded types that are not intrinsic to JSON.
|
||||
* Also allows pulling values from headers, as well as inserting default values and constants.
|
||||
*/
|
||||
export interface Serializer {
|
||||
/**
|
||||
* The provided model mapper.
|
||||
*/
|
||||
readonly modelMappers: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Whether the contents are XML or not.
|
||||
*/
|
||||
readonly isXML: boolean;
|
||||
/**
|
||||
* Validates constraints, if any. This function will throw if the provided value does not respect those constraints.
|
||||
* @param mapper - The definition of data models.
|
||||
* @param value - The value.
|
||||
* @param objectName - Name of the object. Used in the error messages.
|
||||
* @deprecated Removing the constraints validation on client side.
|
||||
*/
|
||||
validateConstraints(mapper: Mapper, value: any, objectName: string): void;
|
||||
/**
|
||||
* Serialize the given object based on its metadata defined in the mapper.
|
||||
*
|
||||
* @param mapper - The mapper which defines the metadata of the serializable object.
|
||||
* @param object - A valid Javascript object to be serialized.
|
||||
* @param objectName - Name of the serialized object.
|
||||
* @param options - additional options to deserialization.
|
||||
* @returns A valid serialized Javascript object.
|
||||
*/
|
||||
serialize(mapper: Mapper, object: any, objectName?: string, options?: SerializerOptions): any;
|
||||
/**
|
||||
* Deserialize the given object based on its metadata defined in the mapper.
|
||||
*
|
||||
* @param mapper - The mapper which defines the metadata of the serializable object.
|
||||
* @param responseBody - A valid Javascript entity to be deserialized.
|
||||
* @param objectName - Name of the deserialized object.
|
||||
* @param options - Controls behavior of XML parser and builder.
|
||||
* @returns A valid deserialized Javascript object.
|
||||
*/
|
||||
deserialize(mapper: Mapper, responseBody: any, objectName: string, options?: SerializerOptions): any;
|
||||
}
|
||||
/**
|
||||
* Description of various value constraints such as integer ranges and string regex.
|
||||
*/
|
||||
export interface MapperConstraints {
|
||||
/**
|
||||
* The value should be less than or equal to the `InclusiveMaximum` value.
|
||||
*/
|
||||
InclusiveMaximum?: number;
|
||||
/**
|
||||
* The value should be less than the `ExclusiveMaximum` value.
|
||||
*/
|
||||
ExclusiveMaximum?: number;
|
||||
/**
|
||||
* The value should be greater than or equal to the `InclusiveMinimum` value.
|
||||
*/
|
||||
InclusiveMinimum?: number;
|
||||
/**
|
||||
* The value should be greater than the `InclusiveMinimum` value.
|
||||
*/
|
||||
ExclusiveMinimum?: number;
|
||||
/**
|
||||
* The length should be smaller than the `MaxLength`.
|
||||
*/
|
||||
MaxLength?: number;
|
||||
/**
|
||||
* The length should be bigger than the `MinLength`.
|
||||
*/
|
||||
MinLength?: number;
|
||||
/**
|
||||
* The value must match the pattern.
|
||||
*/
|
||||
Pattern?: RegExp;
|
||||
/**
|
||||
* The value must contain fewer items than the MaxItems value.
|
||||
*/
|
||||
MaxItems?: number;
|
||||
/**
|
||||
* The value must contain more items than the `MinItems` value.
|
||||
*/
|
||||
MinItems?: number;
|
||||
/**
|
||||
* The value must contain only unique items.
|
||||
*/
|
||||
UniqueItems?: true;
|
||||
/**
|
||||
* The value should be exactly divisible by the `MultipleOf` value.
|
||||
*/
|
||||
MultipleOf?: number;
|
||||
}
|
||||
/**
|
||||
* Type of the mapper. Includes known mappers.
|
||||
*/
|
||||
export type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType;
|
||||
/**
|
||||
* The type of a simple mapper.
|
||||
*/
|
||||
export interface SimpleMapperType {
|
||||
/**
|
||||
* Name of the type of the property.
|
||||
*/
|
||||
name: "Base64Url" | "Boolean" | "ByteArray" | "Date" | "DateTime" | "DateTimeRfc1123" | "Object" | "Stream" | "String" | "TimeSpan" | "UnixTime" | "Uuid" | "Number" | "any";
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to map a set of properties of an object based on other mappers.
|
||||
*
|
||||
* Only one of the following properties should be present: `className`, `modelProperties` and `additionalProperties`.
|
||||
*/
|
||||
export interface CompositeMapperType {
|
||||
/**
|
||||
* Name of the composite mapper type.
|
||||
*/
|
||||
name: "Composite";
|
||||
/**
|
||||
* Use `className` to reference another type definition.
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Use `modelProperties` when the reference to the other type has been resolved.
|
||||
*/
|
||||
modelProperties?: {
|
||||
[propertyName: string]: Mapper;
|
||||
};
|
||||
/**
|
||||
* Used when a model has `additionalProperties: true`. Allows the generic processing of unnamed model properties on the response object.
|
||||
*/
|
||||
additionalProperties?: Mapper;
|
||||
/**
|
||||
* The name of the top-most parent scheme, the one that has no parents.
|
||||
*/
|
||||
uberParent?: string;
|
||||
/**
|
||||
* A polymorphic discriminator.
|
||||
*/
|
||||
polymorphicDiscriminator?: PolymorphicDiscriminator;
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to parse a sequence of mapped values.
|
||||
*/
|
||||
export interface SequenceMapperType {
|
||||
/**
|
||||
* Name of the sequence type mapper.
|
||||
*/
|
||||
name: "Sequence";
|
||||
/**
|
||||
* The mapper to use to map each one of the properties of the sequence.
|
||||
*/
|
||||
element: Mapper;
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to parse a dictionary of mapped values.
|
||||
*/
|
||||
export interface DictionaryMapperType {
|
||||
/**
|
||||
* Name of the sequence type mapper.
|
||||
*/
|
||||
name: "Dictionary";
|
||||
/**
|
||||
* The mapper to use to map the value of each property in the dictionary.
|
||||
*/
|
||||
value: Mapper;
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to parse an enum value.
|
||||
*/
|
||||
export interface EnumMapperType {
|
||||
/**
|
||||
* Name of the enum type mapper.
|
||||
*/
|
||||
name: "Enum";
|
||||
/**
|
||||
* Values allowed by this mapper.
|
||||
*/
|
||||
allowedValues: any[];
|
||||
}
|
||||
/**
|
||||
* The base definition of a mapper. Can be used for XML and plain JavaScript objects.
|
||||
*/
|
||||
export interface BaseMapper {
|
||||
/**
|
||||
* Name for the xml element
|
||||
*/
|
||||
xmlName?: string;
|
||||
/**
|
||||
* Xml element namespace
|
||||
*/
|
||||
xmlNamespace?: string;
|
||||
/**
|
||||
* Xml element namespace prefix
|
||||
*/
|
||||
xmlNamespacePrefix?: string;
|
||||
/**
|
||||
* Determines if the current property should be serialized as an attribute of the parent xml element
|
||||
*/
|
||||
xmlIsAttribute?: boolean;
|
||||
/**
|
||||
* Determines if the current property should be serialized as the inner content of the xml element
|
||||
*/
|
||||
xmlIsMsText?: boolean;
|
||||
/**
|
||||
* Name for the xml elements when serializing an array
|
||||
*/
|
||||
xmlElementName?: string;
|
||||
/**
|
||||
* Whether or not the current property should have a wrapping XML element
|
||||
*/
|
||||
xmlIsWrapped?: boolean;
|
||||
/**
|
||||
* Whether or not the current property is readonly
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
/**
|
||||
* Whether or not the current property is a constant
|
||||
*/
|
||||
isConstant?: boolean;
|
||||
/**
|
||||
* Whether or not the current property is required
|
||||
*/
|
||||
required?: boolean;
|
||||
/**
|
||||
* Whether or not the current property allows mull as a value
|
||||
*/
|
||||
nullable?: boolean;
|
||||
/**
|
||||
* The name to use when serializing
|
||||
*/
|
||||
serializedName?: string;
|
||||
/**
|
||||
* Type of the mapper
|
||||
*/
|
||||
type: MapperType;
|
||||
/**
|
||||
* Default value when one is not explicitly provided
|
||||
*/
|
||||
defaultValue?: any;
|
||||
/**
|
||||
* Constraints to test the current value against
|
||||
*/
|
||||
constraints?: MapperConstraints;
|
||||
}
|
||||
/**
|
||||
* Mappers are definitions of the data models used in the library.
|
||||
* These data models are part of the Operation or Client definitions in the responses or parameters.
|
||||
*/
|
||||
export type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper;
|
||||
/**
|
||||
* Used to disambiguate discriminated type unions.
|
||||
* For example, if response can have many shapes but also includes a 'kind' field (or similar),
|
||||
* that field can be used to determine how to deserialize the response to the correct type.
|
||||
*/
|
||||
export interface PolymorphicDiscriminator {
|
||||
/**
|
||||
* Name of the discriminant property in the original JSON payload, e.g. `@odata.kind`.
|
||||
*/
|
||||
serializedName: string;
|
||||
/**
|
||||
* Name to use on the resulting object instead of the original property name.
|
||||
* Useful since the JSON property could be difficult to work with.
|
||||
* For example: For a field received as `@odata.kind`, the final object could instead include a property simply named `kind`.
|
||||
*/
|
||||
clientName: string;
|
||||
/**
|
||||
* It may contain any other property.
|
||||
*/
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* A mapper composed of other mappers.
|
||||
*/
|
||||
export interface CompositeMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `CompositeMapper`.
|
||||
*/
|
||||
type: CompositeMapperType;
|
||||
}
|
||||
/**
|
||||
* A mapper describing arrays.
|
||||
*/
|
||||
export interface SequenceMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `SequenceMapper`.
|
||||
*/
|
||||
type: SequenceMapperType;
|
||||
}
|
||||
/**
|
||||
* A mapper describing plain JavaScript objects used as key/value pairs.
|
||||
*/
|
||||
export interface DictionaryMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `DictionaryMapper`.
|
||||
*/
|
||||
type: DictionaryMapperType;
|
||||
/**
|
||||
* Optionally, a prefix to add to the header collection.
|
||||
*/
|
||||
headerCollectionPrefix?: string;
|
||||
}
|
||||
/**
|
||||
* A mapper describing an enum value.
|
||||
*/
|
||||
export interface EnumMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `EnumMapper`.
|
||||
*/
|
||||
type: EnumMapperType;
|
||||
}
|
||||
export interface UrlParameterValue {
|
||||
value: string;
|
||||
skipUrlEncoding: boolean;
|
||||
}
|
||||
/**
|
||||
* Configuration for creating a new Tracing Span
|
||||
*/
|
||||
export interface SpanConfig {
|
||||
/**
|
||||
* Package name prefix
|
||||
*/
|
||||
packagePrefix: string;
|
||||
/**
|
||||
* Service namespace
|
||||
*/
|
||||
namespace: string;
|
||||
}
|
||||
/**
|
||||
* Used to configure additional policies added to the pipeline at construction.
|
||||
*/
|
||||
export interface AdditionalPolicyConfig {
|
||||
/**
|
||||
* A policy to be added.
|
||||
*/
|
||||
policy: PipelinePolicy;
|
||||
/**
|
||||
* Determines if this policy be applied before or after retry logic.
|
||||
* Only use `perRetry` if you need to modify the request again
|
||||
* each time the operation is retried due to retryable service
|
||||
* issues.
|
||||
*/
|
||||
position: "perCall" | "perRetry";
|
||||
}
|
||||
/**
|
||||
* The common set of options that high level clients are expected to expose.
|
||||
*/
|
||||
export interface CommonClientOptions extends PipelineOptions {
|
||||
/**
|
||||
* The HttpClient that will be used to send HTTP requests.
|
||||
*/
|
||||
httpClient?: HttpClient;
|
||||
/**
|
||||
* Set to true if the request is sent over HTTP instead of HTTPS
|
||||
*/
|
||||
allowInsecureConnection?: boolean;
|
||||
/**
|
||||
* Additional policies to include in the HTTP pipeline.
|
||||
*/
|
||||
additionalPolicies?: AdditionalPolicyConfig[];
|
||||
}
|
||||
//# sourceMappingURL=interfaces.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/interfaces.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/interfaces.d.ts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/@azure/core-client/dist/browser/interfaces.js
generated
vendored
Normal file
11
node_modules/@azure/core-client/dist/browser/interfaces.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Default key used to access the XML attributes.
|
||||
*/
|
||||
export const XML_ATTRKEY = "$";
|
||||
/**
|
||||
* Default key used to access the XML value content.
|
||||
*/
|
||||
export const XML_CHARKEY = "_";
|
||||
//# sourceMappingURL=interfaces.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/interfaces.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/@azure/core-client/dist/browser/log.d.ts
generated
vendored
Normal file
2
node_modules/@azure/core-client/dist/browser/log.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const logger: import("@azure/logger").AzureLogger;
|
||||
//# sourceMappingURL=log.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/log.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/log.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,qCAAoC,CAAC"}
|
||||
5
node_modules/@azure/core-client/dist/browser/log.js
generated
vendored
Normal file
5
node_modules/@azure/core-client/dist/browser/log.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { createClientLogger } from "@azure/logger";
|
||||
export const logger = createClientLogger("core-client");
|
||||
//# sourceMappingURL=log.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/log.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/log.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"core-client\");\n"]}
|
||||
14
node_modules/@azure/core-client/dist/browser/operationHelpers.d.ts
generated
vendored
Normal file
14
node_modules/@azure/core-client/dist/browser/operationHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { OperationArguments, OperationParameter, OperationRequest, OperationRequestInfo } from "./interfaces.js";
|
||||
/**
|
||||
* @internal
|
||||
* Retrieves the value to use for a given operation argument
|
||||
* @param operationArguments - The arguments passed from the generated client
|
||||
* @param parameter - The parameter description
|
||||
* @param fallbackObject - If something isn't found in the arguments bag, look here.
|
||||
* Generally used to look at the service client properties.
|
||||
*/
|
||||
export declare function getOperationArgumentValueFromParameter(operationArguments: OperationArguments, parameter: OperationParameter, fallbackObject?: {
|
||||
[parameterName: string]: any;
|
||||
}): any;
|
||||
export declare function getOperationRequestInfo(request: OperationRequest): OperationRequestInfo;
|
||||
//# sourceMappingURL=operationHelpers.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/operationHelpers.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/operationHelpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"operationHelpers.d.ts","sourceRoot":"","sources":["../../src/operationHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EAErB,MAAM,iBAAiB,CAAC;AAIzB;;;;;;;GAOG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,kBAAkB,EACtC,SAAS,EAAE,kBAAkB,EAC7B,cAAc,CAAC,EAAE;IAAE,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAChD,GAAG,CAsDL;AAqCD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,oBAAoB,CAWvF"}
|
||||
94
node_modules/@azure/core-client/dist/browser/operationHelpers.js
generated
vendored
Normal file
94
node_modules/@azure/core-client/dist/browser/operationHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { state } from "./state.js";
|
||||
/**
|
||||
* @internal
|
||||
* Retrieves the value to use for a given operation argument
|
||||
* @param operationArguments - The arguments passed from the generated client
|
||||
* @param parameter - The parameter description
|
||||
* @param fallbackObject - If something isn't found in the arguments bag, look here.
|
||||
* Generally used to look at the service client properties.
|
||||
*/
|
||||
export function getOperationArgumentValueFromParameter(operationArguments, parameter, fallbackObject) {
|
||||
let parameterPath = parameter.parameterPath;
|
||||
const parameterMapper = parameter.mapper;
|
||||
let value;
|
||||
if (typeof parameterPath === "string") {
|
||||
parameterPath = [parameterPath];
|
||||
}
|
||||
if (Array.isArray(parameterPath)) {
|
||||
if (parameterPath.length > 0) {
|
||||
if (parameterMapper.isConstant) {
|
||||
value = parameterMapper.defaultValue;
|
||||
}
|
||||
else {
|
||||
let propertySearchResult = getPropertyFromParameterPath(operationArguments, parameterPath);
|
||||
if (!propertySearchResult.propertyFound && fallbackObject) {
|
||||
propertySearchResult = getPropertyFromParameterPath(fallbackObject, parameterPath);
|
||||
}
|
||||
let useDefaultValue = false;
|
||||
if (!propertySearchResult.propertyFound) {
|
||||
useDefaultValue =
|
||||
parameterMapper.required ||
|
||||
(parameterPath[0] === "options" && parameterPath.length === 2);
|
||||
}
|
||||
value = useDefaultValue ? parameterMapper.defaultValue : propertySearchResult.propertyValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (parameterMapper.required) {
|
||||
value = {};
|
||||
}
|
||||
for (const propertyName in parameterPath) {
|
||||
const propertyMapper = parameterMapper.type.modelProperties[propertyName];
|
||||
const propertyPath = parameterPath[propertyName];
|
||||
const propertyValue = getOperationArgumentValueFromParameter(operationArguments, {
|
||||
parameterPath: propertyPath,
|
||||
mapper: propertyMapper,
|
||||
}, fallbackObject);
|
||||
if (propertyValue !== undefined) {
|
||||
if (!value) {
|
||||
value = {};
|
||||
}
|
||||
value[propertyName] = propertyValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function getPropertyFromParameterPath(parent, parameterPath) {
|
||||
const result = { propertyFound: false };
|
||||
let i = 0;
|
||||
for (; i < parameterPath.length; ++i) {
|
||||
const parameterPathPart = parameterPath[i];
|
||||
// Make sure to check inherited properties too, so don't use hasOwnProperty().
|
||||
if (parent && parameterPathPart in parent) {
|
||||
parent = parent[parameterPathPart];
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i === parameterPath.length) {
|
||||
result.propertyValue = parent;
|
||||
result.propertyFound = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const originalRequestSymbol = Symbol.for("@azure/core-client original request");
|
||||
function hasOriginalRequest(request) {
|
||||
return originalRequestSymbol in request;
|
||||
}
|
||||
export function getOperationRequestInfo(request) {
|
||||
if (hasOriginalRequest(request)) {
|
||||
return getOperationRequestInfo(request[originalRequestSymbol]);
|
||||
}
|
||||
let info = state.operationRequestMap.get(request);
|
||||
if (!info) {
|
||||
info = {};
|
||||
state.operationRequestMap.set(request, info);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
//# sourceMappingURL=operationHelpers.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/operationHelpers.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/operationHelpers.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-client/dist/browser/package.json
generated
vendored
Normal file
3
node_modules/@azure/core-client/dist/browser/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
34
node_modules/@azure/core-client/dist/browser/pipeline.d.ts
generated
vendored
Normal file
34
node_modules/@azure/core-client/dist/browser/pipeline.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { DeserializationPolicyOptions } from "./deserializationPolicy.js";
|
||||
import { InternalPipelineOptions, Pipeline } from "@azure/core-rest-pipeline";
|
||||
import { SerializationPolicyOptions } from "./serializationPolicy.js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
/**
|
||||
* Options for creating a Pipeline to use with ServiceClient.
|
||||
* Mostly for customizing the auth policy (if using token auth) or
|
||||
* the deserialization options when using XML.
|
||||
*/
|
||||
export interface InternalClientPipelineOptions extends InternalPipelineOptions {
|
||||
/**
|
||||
* Options to customize bearerTokenAuthenticationPolicy.
|
||||
*/
|
||||
credentialOptions?: {
|
||||
credentialScopes: string | string[];
|
||||
credential: TokenCredential;
|
||||
};
|
||||
/**
|
||||
* Options to customize deserializationPolicy.
|
||||
*/
|
||||
deserializationOptions?: DeserializationPolicyOptions;
|
||||
/**
|
||||
* Options to customize serializationPolicy.
|
||||
*/
|
||||
serializationOptions?: SerializationPolicyOptions;
|
||||
}
|
||||
/**
|
||||
* Creates a new Pipeline for use with a Service Client.
|
||||
* Adds in deserializationPolicy by default.
|
||||
* Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential.
|
||||
* @param options - Options to customize the created pipeline.
|
||||
*/
|
||||
export declare function createClientPipeline(options?: InternalClientPipelineOptions): Pipeline;
|
||||
//# sourceMappingURL=pipeline.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/pipeline.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/pipeline.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/pipeline.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAyB,MAAM,4BAA4B,CAAC;AACjG,OAAO,EACL,uBAAuB,EACvB,QAAQ,EAGT,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAuB,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;IAC5E;;OAEG;IACH,iBAAiB,CAAC,EAAE;QAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,eAAe,CAAA;KAAE,CAAC;IACzF;;OAEG;IACH,sBAAsB,CAAC,EAAE,4BAA4B,CAAC;IACtD;;OAEG;IACH,oBAAoB,CAAC,EAAE,0BAA0B,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,6BAAkC,GAAG,QAAQ,CAiB1F"}
|
||||
26
node_modules/@azure/core-client/dist/browser/pipeline.js
generated
vendored
Normal file
26
node_modules/@azure/core-client/dist/browser/pipeline.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { deserializationPolicy } from "./deserializationPolicy.js";
|
||||
import { bearerTokenAuthenticationPolicy, createPipelineFromOptions, } from "@azure/core-rest-pipeline";
|
||||
import { serializationPolicy } from "./serializationPolicy.js";
|
||||
/**
|
||||
* Creates a new Pipeline for use with a Service Client.
|
||||
* Adds in deserializationPolicy by default.
|
||||
* Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential.
|
||||
* @param options - Options to customize the created pipeline.
|
||||
*/
|
||||
export function createClientPipeline(options = {}) {
|
||||
const pipeline = createPipelineFromOptions(options !== null && options !== void 0 ? options : {});
|
||||
if (options.credentialOptions) {
|
||||
pipeline.addPolicy(bearerTokenAuthenticationPolicy({
|
||||
credential: options.credentialOptions.credential,
|
||||
scopes: options.credentialOptions.credentialScopes,
|
||||
}));
|
||||
}
|
||||
pipeline.addPolicy(serializationPolicy(options.serializationOptions), { phase: "Serialize" });
|
||||
pipeline.addPolicy(deserializationPolicy(options.deserializationOptions), {
|
||||
phase: "Deserialize",
|
||||
});
|
||||
return pipeline;
|
||||
}
|
||||
//# sourceMappingURL=pipeline.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/pipeline.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/pipeline.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/pipeline.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAgC,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAGL,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAA8B,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAuB3F;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAyC,EAAE;IAC9E,MAAM,QAAQ,GAAG,yBAAyB,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC;IAC1D,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAC9B,QAAQ,CAAC,SAAS,CAChB,+BAA+B,CAAC;YAC9B,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,UAAU;YAChD,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,gBAAgB;SACnD,CAAC,CACH,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9F,QAAQ,CAAC,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;QACxE,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DeserializationPolicyOptions, deserializationPolicy } from \"./deserializationPolicy.js\";\nimport {\n InternalPipelineOptions,\n Pipeline,\n bearerTokenAuthenticationPolicy,\n createPipelineFromOptions,\n} from \"@azure/core-rest-pipeline\";\nimport { SerializationPolicyOptions, serializationPolicy } from \"./serializationPolicy.js\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\n/**\n * Options for creating a Pipeline to use with ServiceClient.\n * Mostly for customizing the auth policy (if using token auth) or\n * the deserialization options when using XML.\n */\nexport interface InternalClientPipelineOptions extends InternalPipelineOptions {\n /**\n * Options to customize bearerTokenAuthenticationPolicy.\n */\n credentialOptions?: { credentialScopes: string | string[]; credential: TokenCredential };\n /**\n * Options to customize deserializationPolicy.\n */\n deserializationOptions?: DeserializationPolicyOptions;\n /**\n * Options to customize serializationPolicy.\n */\n serializationOptions?: SerializationPolicyOptions;\n}\n\n/**\n * Creates a new Pipeline for use with a Service Client.\n * Adds in deserializationPolicy by default.\n * Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential.\n * @param options - Options to customize the created pipeline.\n */\nexport function createClientPipeline(options: InternalClientPipelineOptions = {}): Pipeline {\n const pipeline = createPipelineFromOptions(options ?? {});\n if (options.credentialOptions) {\n pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential: options.credentialOptions.credential,\n scopes: options.credentialOptions.credentialScopes,\n }),\n );\n }\n\n pipeline.addPolicy(serializationPolicy(options.serializationOptions), { phase: \"Serialize\" });\n pipeline.addPolicy(deserializationPolicy(options.deserializationOptions), {\n phase: \"Deserialize\",\n });\n\n return pipeline;\n}\n"]}
|
||||
33
node_modules/@azure/core-client/dist/browser/serializationPolicy.d.ts
generated
vendored
Normal file
33
node_modules/@azure/core-client/dist/browser/serializationPolicy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { OperationArguments, OperationRequest, OperationSpec, SerializerOptions, XmlOptions } from "./interfaces.js";
|
||||
import { PipelinePolicy } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* The programmatic identifier of the serializationPolicy.
|
||||
*/
|
||||
export declare const serializationPolicyName = "serializationPolicy";
|
||||
/**
|
||||
* Options to configure API request serialization.
|
||||
*/
|
||||
export interface SerializationPolicyOptions {
|
||||
/**
|
||||
* A function that is able to write XML. Required for XML support.
|
||||
*/
|
||||
stringifyXML?: (obj: any, opts?: XmlOptions) => string;
|
||||
/**
|
||||
* Configures behavior of xml parser and builder.
|
||||
*/
|
||||
serializerOptions?: SerializerOptions;
|
||||
}
|
||||
/**
|
||||
* This policy handles assembling the request body and headers using
|
||||
* an OperationSpec and OperationArguments on the request.
|
||||
*/
|
||||
export declare function serializationPolicy(options?: SerializationPolicyOptions): PipelinePolicy;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function serializeHeaders(request: OperationRequest, operationArguments: OperationArguments, operationSpec: OperationSpec): void;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function serializeRequestBody(request: OperationRequest, operationArguments: OperationArguments, operationSpec: OperationSpec, stringifyXML?: (obj: any, opts?: XmlOptions) => string): void;
|
||||
//# sourceMappingURL=serializationPolicy.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/serializationPolicy.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/serializationPolicy.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"serializationPolicy.d.ts","sourceRoot":"","sources":["../../src/serializationPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAEb,iBAAiB,EAGjB,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAiC,MAAM,2BAA2B,CAAC;AAQ1F;;GAEG;AACH,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,UAAU,KAAK,MAAM,CAAC;IAEvD;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,GAAG,cAAc,CAgB5F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,GAC3B,IAAI,CA+BN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,YAAY,GAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,UAAU,KAAK,MAE9C,GACA,IAAI,CAgHN"}
|
||||
153
node_modules/@azure/core-client/dist/browser/serializationPolicy.js
generated
vendored
Normal file
153
node_modules/@azure/core-client/dist/browser/serializationPolicy.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { XML_ATTRKEY, XML_CHARKEY, } from "./interfaces.js";
|
||||
import { getOperationArgumentValueFromParameter, getOperationRequestInfo, } from "./operationHelpers.js";
|
||||
import { MapperTypeNames } from "./serializer.js";
|
||||
import { getPathStringFromParameter } from "./interfaceHelpers.js";
|
||||
/**
|
||||
* The programmatic identifier of the serializationPolicy.
|
||||
*/
|
||||
export const serializationPolicyName = "serializationPolicy";
|
||||
/**
|
||||
* This policy handles assembling the request body and headers using
|
||||
* an OperationSpec and OperationArguments on the request.
|
||||
*/
|
||||
export function serializationPolicy(options = {}) {
|
||||
const stringifyXML = options.stringifyXML;
|
||||
return {
|
||||
name: serializationPolicyName,
|
||||
async sendRequest(request, next) {
|
||||
const operationInfo = getOperationRequestInfo(request);
|
||||
const operationSpec = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationSpec;
|
||||
const operationArguments = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationArguments;
|
||||
if (operationSpec && operationArguments) {
|
||||
serializeHeaders(request, operationArguments, operationSpec);
|
||||
serializeRequestBody(request, operationArguments, operationSpec, stringifyXML);
|
||||
}
|
||||
return next(request);
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function serializeHeaders(request, operationArguments, operationSpec) {
|
||||
var _a, _b;
|
||||
if (operationSpec.headerParameters) {
|
||||
for (const headerParameter of operationSpec.headerParameters) {
|
||||
let headerValue = getOperationArgumentValueFromParameter(operationArguments, headerParameter);
|
||||
if ((headerValue !== null && headerValue !== undefined) || headerParameter.mapper.required) {
|
||||
headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter));
|
||||
const headerCollectionPrefix = headerParameter.mapper
|
||||
.headerCollectionPrefix;
|
||||
if (headerCollectionPrefix) {
|
||||
for (const key of Object.keys(headerValue)) {
|
||||
request.headers.set(headerCollectionPrefix + key, headerValue[key]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
request.headers.set(headerParameter.mapper.serializedName || getPathStringFromParameter(headerParameter), headerValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const customHeaders = (_b = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.requestOptions) === null || _b === void 0 ? void 0 : _b.customHeaders;
|
||||
if (customHeaders) {
|
||||
for (const customHeaderName of Object.keys(customHeaders)) {
|
||||
request.headers.set(customHeaderName, customHeaders[customHeaderName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function serializeRequestBody(request, operationArguments, operationSpec, stringifyXML = function () {
|
||||
throw new Error("XML serialization unsupported!");
|
||||
}) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
const serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;
|
||||
const updatedOptions = {
|
||||
xml: {
|
||||
rootName: (_b = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.rootName) !== null && _b !== void 0 ? _b : "",
|
||||
includeRoot: (_c = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.includeRoot) !== null && _c !== void 0 ? _c : false,
|
||||
xmlCharKey: (_d = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.xmlCharKey) !== null && _d !== void 0 ? _d : XML_CHARKEY,
|
||||
},
|
||||
};
|
||||
const xmlCharKey = updatedOptions.xml.xmlCharKey;
|
||||
if (operationSpec.requestBody && operationSpec.requestBody.mapper) {
|
||||
request.body = getOperationArgumentValueFromParameter(operationArguments, operationSpec.requestBody);
|
||||
const bodyMapper = operationSpec.requestBody.mapper;
|
||||
const { required, serializedName, xmlName, xmlElementName, xmlNamespace, xmlNamespacePrefix, nullable, } = bodyMapper;
|
||||
const typeName = bodyMapper.type.name;
|
||||
try {
|
||||
if ((request.body !== undefined && request.body !== null) ||
|
||||
(nullable && request.body === null) ||
|
||||
required) {
|
||||
const requestBodyParameterPathString = getPathStringFromParameter(operationSpec.requestBody);
|
||||
request.body = operationSpec.serializer.serialize(bodyMapper, request.body, requestBodyParameterPathString, updatedOptions);
|
||||
const isStream = typeName === MapperTypeNames.Stream;
|
||||
if (operationSpec.isXML) {
|
||||
const xmlnsKey = xmlNamespacePrefix ? `xmlns:${xmlNamespacePrefix}` : "xmlns";
|
||||
const value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, request.body, updatedOptions);
|
||||
if (typeName === MapperTypeNames.Sequence) {
|
||||
request.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { rootName: xmlName || serializedName, xmlCharKey });
|
||||
}
|
||||
else if (!isStream) {
|
||||
request.body = stringifyXML(value, {
|
||||
rootName: xmlName || serializedName,
|
||||
xmlCharKey,
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (typeName === MapperTypeNames.String &&
|
||||
(((_e = operationSpec.contentType) === null || _e === void 0 ? void 0 : _e.match("text/plain")) || operationSpec.mediaType === "text")) {
|
||||
// the String serializer has validated that request body is a string
|
||||
// so just send the string.
|
||||
return;
|
||||
}
|
||||
else if (!isStream) {
|
||||
request.body = JSON.stringify(request.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Error "${error.message}" occurred in serializing the payload - ${JSON.stringify(serializedName, undefined, " ")}.`);
|
||||
}
|
||||
}
|
||||
else if (operationSpec.formDataParameters && operationSpec.formDataParameters.length > 0) {
|
||||
request.formData = {};
|
||||
for (const formDataParameter of operationSpec.formDataParameters) {
|
||||
const formDataParameterValue = getOperationArgumentValueFromParameter(operationArguments, formDataParameter);
|
||||
if (formDataParameterValue !== undefined && formDataParameterValue !== null) {
|
||||
const formDataParameterPropertyName = formDataParameter.mapper.serializedName || getPathStringFromParameter(formDataParameter);
|
||||
request.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter), updatedOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds an xml namespace to the xml serialized object if needed, otherwise it just returns the value itself
|
||||
*/
|
||||
function getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, serializedValue, options) {
|
||||
// Composite and Sequence schemas already got their root namespace set during serialization
|
||||
// We just need to add xmlns to the other schema types
|
||||
if (xmlNamespace && !["Composite", "Sequence", "Dictionary"].includes(typeName)) {
|
||||
const result = {};
|
||||
result[options.xml.xmlCharKey] = serializedValue;
|
||||
result[XML_ATTRKEY] = { [xmlnsKey]: xmlNamespace };
|
||||
return result;
|
||||
}
|
||||
return serializedValue;
|
||||
}
|
||||
function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) {
|
||||
if (!Array.isArray(obj)) {
|
||||
obj = [obj];
|
||||
}
|
||||
if (!xmlNamespaceKey || !xmlNamespace) {
|
||||
return { [elementName]: obj };
|
||||
}
|
||||
const result = { [elementName]: obj };
|
||||
result[XML_ATTRKEY] = { [xmlNamespaceKey]: xmlNamespace };
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=serializationPolicy.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/serializationPolicy.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/serializationPolicy.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
31
node_modules/@azure/core-client/dist/browser/serializer.d.ts
generated
vendored
Normal file
31
node_modules/@azure/core-client/dist/browser/serializer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Serializer } from "./interfaces.js";
|
||||
/**
|
||||
* Method that creates and returns a Serializer.
|
||||
* @param modelMappers - Known models to map
|
||||
* @param isXML - If XML should be supported
|
||||
*/
|
||||
export declare function createSerializer(modelMappers?: {
|
||||
[key: string]: any;
|
||||
}, isXML?: boolean): Serializer;
|
||||
/**
|
||||
* Known types of Mappers
|
||||
*/
|
||||
export declare const MapperTypeNames: {
|
||||
readonly Base64Url: "Base64Url";
|
||||
readonly Boolean: "Boolean";
|
||||
readonly ByteArray: "ByteArray";
|
||||
readonly Composite: "Composite";
|
||||
readonly Date: "Date";
|
||||
readonly DateTime: "DateTime";
|
||||
readonly DateTimeRfc1123: "DateTimeRfc1123";
|
||||
readonly Dictionary: "Dictionary";
|
||||
readonly Enum: "Enum";
|
||||
readonly Number: "Number";
|
||||
readonly Object: "Object";
|
||||
readonly Sequence: "Sequence";
|
||||
readonly String: "String";
|
||||
readonly Stream: "Stream";
|
||||
readonly TimeSpan: "TimeSpan";
|
||||
readonly UnixTime: "UnixTime";
|
||||
};
|
||||
//# sourceMappingURL=serializer.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/serializer.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/serializer.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/serializer.ts"],"names":[],"mappings":"AAIA,OAAO,EAUL,UAAU,EAIX,MAAM,iBAAiB,CAAC;AAkTzB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAO,EACzC,KAAK,GAAE,OAAe,GACrB,UAAU,CAEZ;AAs2BD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiBlB,CAAC"}
|
||||
922
node_modules/@azure/core-client/dist/browser/serializer.js
generated
vendored
Normal file
922
node_modules/@azure/core-client/dist/browser/serializer.js
generated
vendored
Normal file
@@ -0,0 +1,922 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import * as base64 from "./base64.js";
|
||||
import { XML_ATTRKEY, XML_CHARKEY, } from "./interfaces.js";
|
||||
import { isDuration, isValidUuid } from "./utils.js";
|
||||
class SerializerImpl {
|
||||
constructor(modelMappers = {}, isXML = false) {
|
||||
this.modelMappers = modelMappers;
|
||||
this.isXML = isXML;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removing the constraints validation on client side.
|
||||
*/
|
||||
validateConstraints(mapper, value, objectName) {
|
||||
const failValidation = (constraintName, constraintValue) => {
|
||||
throw new Error(`"${objectName}" with value "${value}" should satisfy the constraint "${constraintName}": ${constraintValue}.`);
|
||||
};
|
||||
if (mapper.constraints && value !== undefined && value !== null) {
|
||||
const { ExclusiveMaximum, ExclusiveMinimum, InclusiveMaximum, InclusiveMinimum, MaxItems, MaxLength, MinItems, MinLength, MultipleOf, Pattern, UniqueItems, } = mapper.constraints;
|
||||
if (ExclusiveMaximum !== undefined && value >= ExclusiveMaximum) {
|
||||
failValidation("ExclusiveMaximum", ExclusiveMaximum);
|
||||
}
|
||||
if (ExclusiveMinimum !== undefined && value <= ExclusiveMinimum) {
|
||||
failValidation("ExclusiveMinimum", ExclusiveMinimum);
|
||||
}
|
||||
if (InclusiveMaximum !== undefined && value > InclusiveMaximum) {
|
||||
failValidation("InclusiveMaximum", InclusiveMaximum);
|
||||
}
|
||||
if (InclusiveMinimum !== undefined && value < InclusiveMinimum) {
|
||||
failValidation("InclusiveMinimum", InclusiveMinimum);
|
||||
}
|
||||
if (MaxItems !== undefined && value.length > MaxItems) {
|
||||
failValidation("MaxItems", MaxItems);
|
||||
}
|
||||
if (MaxLength !== undefined && value.length > MaxLength) {
|
||||
failValidation("MaxLength", MaxLength);
|
||||
}
|
||||
if (MinItems !== undefined && value.length < MinItems) {
|
||||
failValidation("MinItems", MinItems);
|
||||
}
|
||||
if (MinLength !== undefined && value.length < MinLength) {
|
||||
failValidation("MinLength", MinLength);
|
||||
}
|
||||
if (MultipleOf !== undefined && value % MultipleOf !== 0) {
|
||||
failValidation("MultipleOf", MultipleOf);
|
||||
}
|
||||
if (Pattern) {
|
||||
const pattern = typeof Pattern === "string" ? new RegExp(Pattern) : Pattern;
|
||||
if (typeof value !== "string" || value.match(pattern) === null) {
|
||||
failValidation("Pattern", Pattern);
|
||||
}
|
||||
}
|
||||
if (UniqueItems &&
|
||||
value.some((item, i, ar) => ar.indexOf(item) !== i)) {
|
||||
failValidation("UniqueItems", UniqueItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Serialize the given object based on its metadata defined in the mapper
|
||||
*
|
||||
* @param mapper - The mapper which defines the metadata of the serializable object
|
||||
*
|
||||
* @param object - A valid Javascript object to be serialized
|
||||
*
|
||||
* @param objectName - Name of the serialized object
|
||||
*
|
||||
* @param options - additional options to serialization
|
||||
*
|
||||
* @returns A valid serialized Javascript object
|
||||
*/
|
||||
serialize(mapper, object, objectName, options = { xml: {} }) {
|
||||
var _a, _b, _c;
|
||||
const updatedOptions = {
|
||||
xml: {
|
||||
rootName: (_a = options.xml.rootName) !== null && _a !== void 0 ? _a : "",
|
||||
includeRoot: (_b = options.xml.includeRoot) !== null && _b !== void 0 ? _b : false,
|
||||
xmlCharKey: (_c = options.xml.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
|
||||
},
|
||||
};
|
||||
let payload = {};
|
||||
const mapperType = mapper.type.name;
|
||||
if (!objectName) {
|
||||
objectName = mapper.serializedName;
|
||||
}
|
||||
if (mapperType.match(/^Sequence$/i) !== null) {
|
||||
payload = [];
|
||||
}
|
||||
if (mapper.isConstant) {
|
||||
object = mapper.defaultValue;
|
||||
}
|
||||
// This table of allowed values should help explain
|
||||
// the mapper.required and mapper.nullable properties.
|
||||
// X means "neither undefined or null are allowed".
|
||||
// || required
|
||||
// || true | false
|
||||
// nullable || ==========================
|
||||
// true || null | undefined/null
|
||||
// false || X | undefined
|
||||
// undefined || X | undefined/null
|
||||
const { required, nullable } = mapper;
|
||||
if (required && nullable && object === undefined) {
|
||||
throw new Error(`${objectName} cannot be undefined.`);
|
||||
}
|
||||
if (required && !nullable && (object === undefined || object === null)) {
|
||||
throw new Error(`${objectName} cannot be null or undefined.`);
|
||||
}
|
||||
if (!required && nullable === false && object === null) {
|
||||
throw new Error(`${objectName} cannot be null.`);
|
||||
}
|
||||
if (object === undefined || object === null) {
|
||||
payload = object;
|
||||
}
|
||||
else {
|
||||
if (mapperType.match(/^any$/i) !== null) {
|
||||
payload = object;
|
||||
}
|
||||
else if (mapperType.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i) !== null) {
|
||||
payload = serializeBasicTypes(mapperType, objectName, object);
|
||||
}
|
||||
else if (mapperType.match(/^Enum$/i) !== null) {
|
||||
const enumMapper = mapper;
|
||||
payload = serializeEnumType(objectName, enumMapper.type.allowedValues, object);
|
||||
}
|
||||
else if (mapperType.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/i) !== null) {
|
||||
payload = serializeDateTypes(mapperType, object, objectName);
|
||||
}
|
||||
else if (mapperType.match(/^ByteArray$/i) !== null) {
|
||||
payload = serializeByteArrayType(objectName, object);
|
||||
}
|
||||
else if (mapperType.match(/^Base64Url$/i) !== null) {
|
||||
payload = serializeBase64UrlType(objectName, object);
|
||||
}
|
||||
else if (mapperType.match(/^Sequence$/i) !== null) {
|
||||
payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
|
||||
}
|
||||
else if (mapperType.match(/^Dictionary$/i) !== null) {
|
||||
payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
|
||||
}
|
||||
else if (mapperType.match(/^Composite$/i) !== null) {
|
||||
payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions);
|
||||
}
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
/**
|
||||
* Deserialize the given object based on its metadata defined in the mapper
|
||||
*
|
||||
* @param mapper - The mapper which defines the metadata of the serializable object
|
||||
*
|
||||
* @param responseBody - A valid Javascript entity to be deserialized
|
||||
*
|
||||
* @param objectName - Name of the deserialized object
|
||||
*
|
||||
* @param options - Controls behavior of XML parser and builder.
|
||||
*
|
||||
* @returns A valid deserialized Javascript object
|
||||
*/
|
||||
deserialize(mapper, responseBody, objectName, options = { xml: {} }) {
|
||||
var _a, _b, _c, _d;
|
||||
const updatedOptions = {
|
||||
xml: {
|
||||
rootName: (_a = options.xml.rootName) !== null && _a !== void 0 ? _a : "",
|
||||
includeRoot: (_b = options.xml.includeRoot) !== null && _b !== void 0 ? _b : false,
|
||||
xmlCharKey: (_c = options.xml.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
|
||||
},
|
||||
ignoreUnknownProperties: (_d = options.ignoreUnknownProperties) !== null && _d !== void 0 ? _d : false,
|
||||
};
|
||||
if (responseBody === undefined || responseBody === null) {
|
||||
if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) {
|
||||
// Edge case for empty XML non-wrapped lists. xml2js can't distinguish
|
||||
// between the list being empty versus being missing,
|
||||
// so let's do the more user-friendly thing and return an empty list.
|
||||
responseBody = [];
|
||||
}
|
||||
// specifically check for undefined as default value can be a falsey value `0, "", false, null`
|
||||
if (mapper.defaultValue !== undefined) {
|
||||
responseBody = mapper.defaultValue;
|
||||
}
|
||||
return responseBody;
|
||||
}
|
||||
let payload;
|
||||
const mapperType = mapper.type.name;
|
||||
if (!objectName) {
|
||||
objectName = mapper.serializedName;
|
||||
}
|
||||
if (mapperType.match(/^Composite$/i) !== null) {
|
||||
payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions);
|
||||
}
|
||||
else {
|
||||
if (this.isXML) {
|
||||
const xmlCharKey = updatedOptions.xml.xmlCharKey;
|
||||
/**
|
||||
* If the mapper specifies this as a non-composite type value but the responseBody contains
|
||||
* both header ("$" i.e., XML_ATTRKEY) and body ("#" i.e., XML_CHARKEY) properties,
|
||||
* then just reduce the responseBody value to the body ("#" i.e., XML_CHARKEY) property.
|
||||
*/
|
||||
if (responseBody[XML_ATTRKEY] !== undefined && responseBody[xmlCharKey] !== undefined) {
|
||||
responseBody = responseBody[xmlCharKey];
|
||||
}
|
||||
}
|
||||
if (mapperType.match(/^Number$/i) !== null) {
|
||||
payload = parseFloat(responseBody);
|
||||
if (isNaN(payload)) {
|
||||
payload = responseBody;
|
||||
}
|
||||
}
|
||||
else if (mapperType.match(/^Boolean$/i) !== null) {
|
||||
if (responseBody === "true") {
|
||||
payload = true;
|
||||
}
|
||||
else if (responseBody === "false") {
|
||||
payload = false;
|
||||
}
|
||||
else {
|
||||
payload = responseBody;
|
||||
}
|
||||
}
|
||||
else if (mapperType.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i) !== null) {
|
||||
payload = responseBody;
|
||||
}
|
||||
else if (mapperType.match(/^(Date|DateTime|DateTimeRfc1123)$/i) !== null) {
|
||||
payload = new Date(responseBody);
|
||||
}
|
||||
else if (mapperType.match(/^UnixTime$/i) !== null) {
|
||||
payload = unixTimeToDate(responseBody);
|
||||
}
|
||||
else if (mapperType.match(/^ByteArray$/i) !== null) {
|
||||
payload = base64.decodeString(responseBody);
|
||||
}
|
||||
else if (mapperType.match(/^Base64Url$/i) !== null) {
|
||||
payload = base64UrlToByteArray(responseBody);
|
||||
}
|
||||
else if (mapperType.match(/^Sequence$/i) !== null) {
|
||||
payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions);
|
||||
}
|
||||
else if (mapperType.match(/^Dictionary$/i) !== null) {
|
||||
payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions);
|
||||
}
|
||||
}
|
||||
if (mapper.isConstant) {
|
||||
payload = mapper.defaultValue;
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Method that creates and returns a Serializer.
|
||||
* @param modelMappers - Known models to map
|
||||
* @param isXML - If XML should be supported
|
||||
*/
|
||||
export function createSerializer(modelMappers = {}, isXML = false) {
|
||||
return new SerializerImpl(modelMappers, isXML);
|
||||
}
|
||||
function trimEnd(str, ch) {
|
||||
let len = str.length;
|
||||
while (len - 1 >= 0 && str[len - 1] === ch) {
|
||||
--len;
|
||||
}
|
||||
return str.substr(0, len);
|
||||
}
|
||||
function bufferToBase64Url(buffer) {
|
||||
if (!buffer) {
|
||||
return undefined;
|
||||
}
|
||||
if (!(buffer instanceof Uint8Array)) {
|
||||
throw new Error(`Please provide an input of type Uint8Array for converting to Base64Url.`);
|
||||
}
|
||||
// Uint8Array to Base64.
|
||||
const str = base64.encodeByteArray(buffer);
|
||||
// Base64 to Base64Url.
|
||||
return trimEnd(str, "=").replace(/\+/g, "-").replace(/\//g, "_");
|
||||
}
|
||||
function base64UrlToByteArray(str) {
|
||||
if (!str) {
|
||||
return undefined;
|
||||
}
|
||||
if (str && typeof str.valueOf() !== "string") {
|
||||
throw new Error("Please provide an input of type string for converting to Uint8Array");
|
||||
}
|
||||
// Base64Url to Base64.
|
||||
str = str.replace(/-/g, "+").replace(/_/g, "/");
|
||||
// Base64 to Uint8Array.
|
||||
return base64.decodeString(str);
|
||||
}
|
||||
function splitSerializeName(prop) {
|
||||
const classes = [];
|
||||
let partialclass = "";
|
||||
if (prop) {
|
||||
const subwords = prop.split(".");
|
||||
for (const item of subwords) {
|
||||
if (item.charAt(item.length - 1) === "\\") {
|
||||
partialclass += item.substr(0, item.length - 1) + ".";
|
||||
}
|
||||
else {
|
||||
partialclass += item;
|
||||
classes.push(partialclass);
|
||||
partialclass = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
function dateToUnixTime(d) {
|
||||
if (!d) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof d.valueOf() === "string") {
|
||||
d = new Date(d);
|
||||
}
|
||||
return Math.floor(d.getTime() / 1000);
|
||||
}
|
||||
function unixTimeToDate(n) {
|
||||
if (!n) {
|
||||
return undefined;
|
||||
}
|
||||
return new Date(n * 1000);
|
||||
}
|
||||
function serializeBasicTypes(typeName, objectName, value) {
|
||||
if (value !== null && value !== undefined) {
|
||||
if (typeName.match(/^Number$/i) !== null) {
|
||||
if (typeof value !== "number") {
|
||||
throw new Error(`${objectName} with value ${value} must be of type number.`);
|
||||
}
|
||||
}
|
||||
else if (typeName.match(/^String$/i) !== null) {
|
||||
if (typeof value.valueOf() !== "string") {
|
||||
throw new Error(`${objectName} with value "${value}" must be of type string.`);
|
||||
}
|
||||
}
|
||||
else if (typeName.match(/^Uuid$/i) !== null) {
|
||||
if (!(typeof value.valueOf() === "string" && isValidUuid(value))) {
|
||||
throw new Error(`${objectName} with value "${value}" must be of type string and a valid uuid.`);
|
||||
}
|
||||
}
|
||||
else if (typeName.match(/^Boolean$/i) !== null) {
|
||||
if (typeof value !== "boolean") {
|
||||
throw new Error(`${objectName} with value ${value} must be of type boolean.`);
|
||||
}
|
||||
}
|
||||
else if (typeName.match(/^Stream$/i) !== null) {
|
||||
const objectType = typeof value;
|
||||
if (objectType !== "string" &&
|
||||
typeof value.pipe !== "function" && // NodeJS.ReadableStream
|
||||
typeof value.tee !== "function" && // browser ReadableStream
|
||||
!(value instanceof ArrayBuffer) &&
|
||||
!ArrayBuffer.isView(value) &&
|
||||
// File objects count as a type of Blob, so we want to use instanceof explicitly
|
||||
!((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob) &&
|
||||
objectType !== "function") {
|
||||
throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, ReadableStream, or () => ReadableStream.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function serializeEnumType(objectName, allowedValues, value) {
|
||||
if (!allowedValues) {
|
||||
throw new Error(`Please provide a set of allowedValues to validate ${objectName} as an Enum Type.`);
|
||||
}
|
||||
const isPresent = allowedValues.some((item) => {
|
||||
if (typeof item.valueOf() === "string") {
|
||||
return item.toLowerCase() === value.toLowerCase();
|
||||
}
|
||||
return item === value;
|
||||
});
|
||||
if (!isPresent) {
|
||||
throw new Error(`${value} is not a valid value for ${objectName}. The valid values are: ${JSON.stringify(allowedValues)}.`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function serializeByteArrayType(objectName, value) {
|
||||
if (value !== undefined && value !== null) {
|
||||
if (!(value instanceof Uint8Array)) {
|
||||
throw new Error(`${objectName} must be of type Uint8Array.`);
|
||||
}
|
||||
value = base64.encodeByteArray(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function serializeBase64UrlType(objectName, value) {
|
||||
if (value !== undefined && value !== null) {
|
||||
if (!(value instanceof Uint8Array)) {
|
||||
throw new Error(`${objectName} must be of type Uint8Array.`);
|
||||
}
|
||||
value = bufferToBase64Url(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function serializeDateTypes(typeName, value, objectName) {
|
||||
if (value !== undefined && value !== null) {
|
||||
if (typeName.match(/^Date$/i) !== null) {
|
||||
if (!(value instanceof Date ||
|
||||
(typeof value.valueOf() === "string" && !isNaN(Date.parse(value))))) {
|
||||
throw new Error(`${objectName} must be an instanceof Date or a string in ISO8601 format.`);
|
||||
}
|
||||
value =
|
||||
value instanceof Date
|
||||
? value.toISOString().substring(0, 10)
|
||||
: new Date(value).toISOString().substring(0, 10);
|
||||
}
|
||||
else if (typeName.match(/^DateTime$/i) !== null) {
|
||||
if (!(value instanceof Date ||
|
||||
(typeof value.valueOf() === "string" && !isNaN(Date.parse(value))))) {
|
||||
throw new Error(`${objectName} must be an instanceof Date or a string in ISO8601 format.`);
|
||||
}
|
||||
value = value instanceof Date ? value.toISOString() : new Date(value).toISOString();
|
||||
}
|
||||
else if (typeName.match(/^DateTimeRfc1123$/i) !== null) {
|
||||
if (!(value instanceof Date ||
|
||||
(typeof value.valueOf() === "string" && !isNaN(Date.parse(value))))) {
|
||||
throw new Error(`${objectName} must be an instanceof Date or a string in RFC-1123 format.`);
|
||||
}
|
||||
value = value instanceof Date ? value.toUTCString() : new Date(value).toUTCString();
|
||||
}
|
||||
else if (typeName.match(/^UnixTime$/i) !== null) {
|
||||
if (!(value instanceof Date ||
|
||||
(typeof value.valueOf() === "string" && !isNaN(Date.parse(value))))) {
|
||||
throw new Error(`${objectName} must be an instanceof Date or a string in RFC-1123/ISO8601 format ` +
|
||||
`for it to be serialized in UnixTime/Epoch format.`);
|
||||
}
|
||||
value = dateToUnixTime(value);
|
||||
}
|
||||
else if (typeName.match(/^TimeSpan$/i) !== null) {
|
||||
if (!isDuration(value)) {
|
||||
throw new Error(`${objectName} must be a string in ISO 8601 format. Instead was "${value}".`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function serializeSequenceType(serializer, mapper, object, objectName, isXml, options) {
|
||||
var _a;
|
||||
if (!Array.isArray(object)) {
|
||||
throw new Error(`${objectName} must be of type Array.`);
|
||||
}
|
||||
let elementType = mapper.type.element;
|
||||
if (!elementType || typeof elementType !== "object") {
|
||||
throw new Error(`element" metadata for an Array must be defined in the ` +
|
||||
`mapper and it must of type "object" in ${objectName}.`);
|
||||
}
|
||||
// Quirk: Composite mappers referenced by `element` might
|
||||
// not have *all* properties declared (like uberParent),
|
||||
// so let's try to look up the full definition by name.
|
||||
if (elementType.type.name === "Composite" && elementType.type.className) {
|
||||
elementType = (_a = serializer.modelMappers[elementType.type.className]) !== null && _a !== void 0 ? _a : elementType;
|
||||
}
|
||||
const tempArray = [];
|
||||
for (let i = 0; i < object.length; i++) {
|
||||
const serializedValue = serializer.serialize(elementType, object[i], objectName, options);
|
||||
if (isXml && elementType.xmlNamespace) {
|
||||
const xmlnsKey = elementType.xmlNamespacePrefix
|
||||
? `xmlns:${elementType.xmlNamespacePrefix}`
|
||||
: "xmlns";
|
||||
if (elementType.type.name === "Composite") {
|
||||
tempArray[i] = Object.assign({}, serializedValue);
|
||||
tempArray[i][XML_ATTRKEY] = { [xmlnsKey]: elementType.xmlNamespace };
|
||||
}
|
||||
else {
|
||||
tempArray[i] = {};
|
||||
tempArray[i][options.xml.xmlCharKey] = serializedValue;
|
||||
tempArray[i][XML_ATTRKEY] = { [xmlnsKey]: elementType.xmlNamespace };
|
||||
}
|
||||
}
|
||||
else {
|
||||
tempArray[i] = serializedValue;
|
||||
}
|
||||
}
|
||||
return tempArray;
|
||||
}
|
||||
function serializeDictionaryType(serializer, mapper, object, objectName, isXml, options) {
|
||||
if (typeof object !== "object") {
|
||||
throw new Error(`${objectName} must be of type object.`);
|
||||
}
|
||||
const valueType = mapper.type.value;
|
||||
if (!valueType || typeof valueType !== "object") {
|
||||
throw new Error(`"value" metadata for a Dictionary must be defined in the ` +
|
||||
`mapper and it must of type "object" in ${objectName}.`);
|
||||
}
|
||||
const tempDictionary = {};
|
||||
for (const key of Object.keys(object)) {
|
||||
const serializedValue = serializer.serialize(valueType, object[key], objectName, options);
|
||||
// If the element needs an XML namespace we need to add it within the $ property
|
||||
tempDictionary[key] = getXmlObjectValue(valueType, serializedValue, isXml, options);
|
||||
}
|
||||
// Add the namespace to the root element if needed
|
||||
if (isXml && mapper.xmlNamespace) {
|
||||
const xmlnsKey = mapper.xmlNamespacePrefix ? `xmlns:${mapper.xmlNamespacePrefix}` : "xmlns";
|
||||
const result = tempDictionary;
|
||||
result[XML_ATTRKEY] = { [xmlnsKey]: mapper.xmlNamespace };
|
||||
return result;
|
||||
}
|
||||
return tempDictionary;
|
||||
}
|
||||
/**
|
||||
* Resolves the additionalProperties property from a referenced mapper
|
||||
* @param serializer - the serializer containing the entire set of mappers
|
||||
* @param mapper - the composite mapper to resolve
|
||||
* @param objectName - name of the object being serialized
|
||||
*/
|
||||
function resolveAdditionalProperties(serializer, mapper, objectName) {
|
||||
const additionalProperties = mapper.type.additionalProperties;
|
||||
if (!additionalProperties && mapper.type.className) {
|
||||
const modelMapper = resolveReferencedMapper(serializer, mapper, objectName);
|
||||
return modelMapper === null || modelMapper === void 0 ? void 0 : modelMapper.type.additionalProperties;
|
||||
}
|
||||
return additionalProperties;
|
||||
}
|
||||
/**
|
||||
* Finds the mapper referenced by className
|
||||
* @param serializer - the serializer containing the entire set of mappers
|
||||
* @param mapper - the composite mapper to resolve
|
||||
* @param objectName - name of the object being serialized
|
||||
*/
|
||||
function resolveReferencedMapper(serializer, mapper, objectName) {
|
||||
const className = mapper.type.className;
|
||||
if (!className) {
|
||||
throw new Error(`Class name for model "${objectName}" is not provided in the mapper "${JSON.stringify(mapper, undefined, 2)}".`);
|
||||
}
|
||||
return serializer.modelMappers[className];
|
||||
}
|
||||
/**
|
||||
* Resolves a composite mapper's modelProperties.
|
||||
* @param serializer - the serializer containing the entire set of mappers
|
||||
* @param mapper - the composite mapper to resolve
|
||||
*/
|
||||
function resolveModelProperties(serializer, mapper, objectName) {
|
||||
let modelProps = mapper.type.modelProperties;
|
||||
if (!modelProps) {
|
||||
const modelMapper = resolveReferencedMapper(serializer, mapper, objectName);
|
||||
if (!modelMapper) {
|
||||
throw new Error(`mapper() cannot be null or undefined for model "${mapper.type.className}".`);
|
||||
}
|
||||
modelProps = modelMapper === null || modelMapper === void 0 ? void 0 : modelMapper.type.modelProperties;
|
||||
if (!modelProps) {
|
||||
throw new Error(`modelProperties cannot be null or undefined in the ` +
|
||||
`mapper "${JSON.stringify(modelMapper)}" of type "${mapper.type.className}" for object "${objectName}".`);
|
||||
}
|
||||
}
|
||||
return modelProps;
|
||||
}
|
||||
function serializeCompositeType(serializer, mapper, object, objectName, isXml, options) {
|
||||
if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
|
||||
mapper = getPolymorphicMapper(serializer, mapper, object, "clientName");
|
||||
}
|
||||
if (object !== undefined && object !== null) {
|
||||
const payload = {};
|
||||
const modelProps = resolveModelProperties(serializer, mapper, objectName);
|
||||
for (const key of Object.keys(modelProps)) {
|
||||
const propertyMapper = modelProps[key];
|
||||
if (propertyMapper.readOnly) {
|
||||
continue;
|
||||
}
|
||||
let propName;
|
||||
let parentObject = payload;
|
||||
if (serializer.isXML) {
|
||||
if (propertyMapper.xmlIsWrapped) {
|
||||
propName = propertyMapper.xmlName;
|
||||
}
|
||||
else {
|
||||
propName = propertyMapper.xmlElementName || propertyMapper.xmlName;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const paths = splitSerializeName(propertyMapper.serializedName);
|
||||
propName = paths.pop();
|
||||
for (const pathName of paths) {
|
||||
const childObject = parentObject[pathName];
|
||||
if ((childObject === undefined || childObject === null) &&
|
||||
((object[key] !== undefined && object[key] !== null) ||
|
||||
propertyMapper.defaultValue !== undefined)) {
|
||||
parentObject[pathName] = {};
|
||||
}
|
||||
parentObject = parentObject[pathName];
|
||||
}
|
||||
}
|
||||
if (parentObject !== undefined && parentObject !== null) {
|
||||
if (isXml && mapper.xmlNamespace) {
|
||||
const xmlnsKey = mapper.xmlNamespacePrefix
|
||||
? `xmlns:${mapper.xmlNamespacePrefix}`
|
||||
: "xmlns";
|
||||
parentObject[XML_ATTRKEY] = Object.assign(Object.assign({}, parentObject[XML_ATTRKEY]), { [xmlnsKey]: mapper.xmlNamespace });
|
||||
}
|
||||
const propertyObjectName = propertyMapper.serializedName !== ""
|
||||
? objectName + "." + propertyMapper.serializedName
|
||||
: objectName;
|
||||
let toSerialize = object[key];
|
||||
const polymorphicDiscriminator = getPolymorphicDiscriminatorRecursively(serializer, mapper);
|
||||
if (polymorphicDiscriminator &&
|
||||
polymorphicDiscriminator.clientName === key &&
|
||||
(toSerialize === undefined || toSerialize === null)) {
|
||||
toSerialize = mapper.serializedName;
|
||||
}
|
||||
const serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName, options);
|
||||
if (serializedValue !== undefined && propName !== undefined && propName !== null) {
|
||||
const value = getXmlObjectValue(propertyMapper, serializedValue, isXml, options);
|
||||
if (isXml && propertyMapper.xmlIsAttribute) {
|
||||
// XML_ATTRKEY, i.e., $ is the key attributes are kept under in xml2js.
|
||||
// This keeps things simple while preventing name collision
|
||||
// with names in user documents.
|
||||
parentObject[XML_ATTRKEY] = parentObject[XML_ATTRKEY] || {};
|
||||
parentObject[XML_ATTRKEY][propName] = serializedValue;
|
||||
}
|
||||
else if (isXml && propertyMapper.xmlIsWrapped) {
|
||||
parentObject[propName] = { [propertyMapper.xmlElementName]: value };
|
||||
}
|
||||
else {
|
||||
parentObject[propName] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const additionalPropertiesMapper = resolveAdditionalProperties(serializer, mapper, objectName);
|
||||
if (additionalPropertiesMapper) {
|
||||
const propNames = Object.keys(modelProps);
|
||||
for (const clientPropName in object) {
|
||||
const isAdditionalProperty = propNames.every((pn) => pn !== clientPropName);
|
||||
if (isAdditionalProperty) {
|
||||
payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]', options);
|
||||
}
|
||||
}
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
function getXmlObjectValue(propertyMapper, serializedValue, isXml, options) {
|
||||
if (!isXml || !propertyMapper.xmlNamespace) {
|
||||
return serializedValue;
|
||||
}
|
||||
const xmlnsKey = propertyMapper.xmlNamespacePrefix
|
||||
? `xmlns:${propertyMapper.xmlNamespacePrefix}`
|
||||
: "xmlns";
|
||||
const xmlNamespace = { [xmlnsKey]: propertyMapper.xmlNamespace };
|
||||
if (["Composite"].includes(propertyMapper.type.name)) {
|
||||
if (serializedValue[XML_ATTRKEY]) {
|
||||
return serializedValue;
|
||||
}
|
||||
else {
|
||||
const result = Object.assign({}, serializedValue);
|
||||
result[XML_ATTRKEY] = xmlNamespace;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
const result = {};
|
||||
result[options.xml.xmlCharKey] = serializedValue;
|
||||
result[XML_ATTRKEY] = xmlNamespace;
|
||||
return result;
|
||||
}
|
||||
function isSpecialXmlProperty(propertyName, options) {
|
||||
return [XML_ATTRKEY, options.xml.xmlCharKey].includes(propertyName);
|
||||
}
|
||||
function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
|
||||
var _a, _b;
|
||||
const xmlCharKey = (_a = options.xml.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
|
||||
if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
|
||||
mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
|
||||
}
|
||||
const modelProps = resolveModelProperties(serializer, mapper, objectName);
|
||||
let instance = {};
|
||||
const handledPropertyNames = [];
|
||||
for (const key of Object.keys(modelProps)) {
|
||||
const propertyMapper = modelProps[key];
|
||||
const paths = splitSerializeName(modelProps[key].serializedName);
|
||||
handledPropertyNames.push(paths[0]);
|
||||
const { serializedName, xmlName, xmlElementName } = propertyMapper;
|
||||
let propertyObjectName = objectName;
|
||||
if (serializedName !== "" && serializedName !== undefined) {
|
||||
propertyObjectName = objectName + "." + serializedName;
|
||||
}
|
||||
const headerCollectionPrefix = propertyMapper.headerCollectionPrefix;
|
||||
if (headerCollectionPrefix) {
|
||||
const dictionary = {};
|
||||
for (const headerKey of Object.keys(responseBody)) {
|
||||
if (headerKey.startsWith(headerCollectionPrefix)) {
|
||||
dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName, options);
|
||||
}
|
||||
handledPropertyNames.push(headerKey);
|
||||
}
|
||||
instance[key] = dictionary;
|
||||
}
|
||||
else if (serializer.isXML) {
|
||||
if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
|
||||
instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
|
||||
}
|
||||
else if (propertyMapper.xmlIsMsText) {
|
||||
if (responseBody[xmlCharKey] !== undefined) {
|
||||
instance[key] = responseBody[xmlCharKey];
|
||||
}
|
||||
else if (typeof responseBody === "string") {
|
||||
// The special case where xml parser parses "<Name>content</Name>" into JSON of
|
||||
// `{ name: "content"}` instead of `{ name: { "_": "content" }}`
|
||||
instance[key] = responseBody;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const propertyName = xmlElementName || xmlName || serializedName;
|
||||
if (propertyMapper.xmlIsWrapped) {
|
||||
/* a list of <xmlElementName> wrapped by <xmlName>
|
||||
For the xml example below
|
||||
<Cors>
|
||||
<CorsRule>...</CorsRule>
|
||||
<CorsRule>...</CorsRule>
|
||||
</Cors>
|
||||
the responseBody has
|
||||
{
|
||||
Cors: {
|
||||
CorsRule: [{...}, {...}]
|
||||
}
|
||||
}
|
||||
xmlName is "Cors" and xmlElementName is"CorsRule".
|
||||
*/
|
||||
const wrapped = responseBody[xmlName];
|
||||
const elementList = (_b = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _b !== void 0 ? _b : [];
|
||||
instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
|
||||
handledPropertyNames.push(xmlName);
|
||||
}
|
||||
else {
|
||||
const property = responseBody[propertyName];
|
||||
instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options);
|
||||
handledPropertyNames.push(propertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// deserialize the property if it is present in the provided responseBody instance
|
||||
let propertyInstance;
|
||||
let res = responseBody;
|
||||
// traversing the object step by step.
|
||||
let steps = 0;
|
||||
for (const item of paths) {
|
||||
if (!res)
|
||||
break;
|
||||
steps++;
|
||||
res = res[item];
|
||||
}
|
||||
// only accept null when reaching the last position of object otherwise it would be undefined
|
||||
if (res === null && steps < paths.length) {
|
||||
res = undefined;
|
||||
}
|
||||
propertyInstance = res;
|
||||
const polymorphicDiscriminator = mapper.type.polymorphicDiscriminator;
|
||||
// checking that the model property name (key)(ex: "fishtype") and the
|
||||
// clientName of the polymorphicDiscriminator {metadata} (ex: "fishtype")
|
||||
// instead of the serializedName of the polymorphicDiscriminator (ex: "fish.type")
|
||||
// is a better approach. The generator is not consistent with escaping '\.' in the
|
||||
// serializedName of the property (ex: "fish\.type") that is marked as polymorphic discriminator
|
||||
// and the serializedName of the metadata polymorphicDiscriminator (ex: "fish.type"). However,
|
||||
// the clientName transformation of the polymorphicDiscriminator (ex: "fishtype") and
|
||||
// the transformation of model property name (ex: "fishtype") is done consistently.
|
||||
// Hence, it is a safer bet to rely on the clientName of the polymorphicDiscriminator.
|
||||
if (polymorphicDiscriminator &&
|
||||
key === polymorphicDiscriminator.clientName &&
|
||||
(propertyInstance === undefined || propertyInstance === null)) {
|
||||
propertyInstance = mapper.serializedName;
|
||||
}
|
||||
let serializedValue;
|
||||
// paging
|
||||
if (Array.isArray(responseBody[key]) && modelProps[key].serializedName === "") {
|
||||
propertyInstance = responseBody[key];
|
||||
const arrayInstance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options);
|
||||
// Copy over any properties that have already been added into the instance, where they do
|
||||
// not exist on the newly de-serialized array
|
||||
for (const [k, v] of Object.entries(instance)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(arrayInstance, k)) {
|
||||
arrayInstance[k] = v;
|
||||
}
|
||||
}
|
||||
instance = arrayInstance;
|
||||
}
|
||||
else if (propertyInstance !== undefined || propertyMapper.defaultValue !== undefined) {
|
||||
serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options);
|
||||
instance[key] = serializedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
const additionalPropertiesMapper = mapper.type.additionalProperties;
|
||||
if (additionalPropertiesMapper) {
|
||||
const isAdditionalProperty = (responsePropName) => {
|
||||
for (const clientPropName in modelProps) {
|
||||
const paths = splitSerializeName(modelProps[clientPropName].serializedName);
|
||||
if (paths[0] === responsePropName) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
for (const responsePropName in responseBody) {
|
||||
if (isAdditionalProperty(responsePropName)) {
|
||||
instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]', options);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (responseBody && !options.ignoreUnknownProperties) {
|
||||
for (const key of Object.keys(responseBody)) {
|
||||
if (instance[key] === undefined &&
|
||||
!handledPropertyNames.includes(key) &&
|
||||
!isSpecialXmlProperty(key, options)) {
|
||||
instance[key] = responseBody[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
function deserializeDictionaryType(serializer, mapper, responseBody, objectName, options) {
|
||||
/* jshint validthis: true */
|
||||
const value = mapper.type.value;
|
||||
if (!value || typeof value !== "object") {
|
||||
throw new Error(`"value" metadata for a Dictionary must be defined in the ` +
|
||||
`mapper and it must of type "object" in ${objectName}`);
|
||||
}
|
||||
if (responseBody) {
|
||||
const tempDictionary = {};
|
||||
for (const key of Object.keys(responseBody)) {
|
||||
tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName, options);
|
||||
}
|
||||
return tempDictionary;
|
||||
}
|
||||
return responseBody;
|
||||
}
|
||||
function deserializeSequenceType(serializer, mapper, responseBody, objectName, options) {
|
||||
var _a;
|
||||
let element = mapper.type.element;
|
||||
if (!element || typeof element !== "object") {
|
||||
throw new Error(`element" metadata for an Array must be defined in the ` +
|
||||
`mapper and it must of type "object" in ${objectName}`);
|
||||
}
|
||||
if (responseBody) {
|
||||
if (!Array.isArray(responseBody)) {
|
||||
// xml2js will interpret a single element array as just the element, so force it to be an array
|
||||
responseBody = [responseBody];
|
||||
}
|
||||
// Quirk: Composite mappers referenced by `element` might
|
||||
// not have *all* properties declared (like uberParent),
|
||||
// so let's try to look up the full definition by name.
|
||||
if (element.type.name === "Composite" && element.type.className) {
|
||||
element = (_a = serializer.modelMappers[element.type.className]) !== null && _a !== void 0 ? _a : element;
|
||||
}
|
||||
const tempArray = [];
|
||||
for (let i = 0; i < responseBody.length; i++) {
|
||||
tempArray[i] = serializer.deserialize(element, responseBody[i], `${objectName}[${i}]`, options);
|
||||
}
|
||||
return tempArray;
|
||||
}
|
||||
return responseBody;
|
||||
}
|
||||
function getIndexDiscriminator(discriminators, discriminatorValue, typeName) {
|
||||
const typeNamesToCheck = [typeName];
|
||||
while (typeNamesToCheck.length) {
|
||||
const currentName = typeNamesToCheck.shift();
|
||||
const indexDiscriminator = discriminatorValue === currentName
|
||||
? discriminatorValue
|
||||
: currentName + "." + discriminatorValue;
|
||||
if (Object.prototype.hasOwnProperty.call(discriminators, indexDiscriminator)) {
|
||||
return discriminators[indexDiscriminator];
|
||||
}
|
||||
else {
|
||||
for (const [name, mapper] of Object.entries(discriminators)) {
|
||||
if (name.startsWith(currentName + ".") &&
|
||||
mapper.type.uberParent === currentName &&
|
||||
mapper.type.className) {
|
||||
typeNamesToCheck.push(mapper.type.className);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getPolymorphicMapper(serializer, mapper, object, polymorphicPropertyName) {
|
||||
var _a;
|
||||
const polymorphicDiscriminator = getPolymorphicDiscriminatorRecursively(serializer, mapper);
|
||||
if (polymorphicDiscriminator) {
|
||||
let discriminatorName = polymorphicDiscriminator[polymorphicPropertyName];
|
||||
if (discriminatorName) {
|
||||
// The serializedName might have \\, which we just want to ignore
|
||||
if (polymorphicPropertyName === "serializedName") {
|
||||
discriminatorName = discriminatorName.replace(/\\/gi, "");
|
||||
}
|
||||
const discriminatorValue = object[discriminatorName];
|
||||
const typeName = (_a = mapper.type.uberParent) !== null && _a !== void 0 ? _a : mapper.type.className;
|
||||
if (typeof discriminatorValue === "string" && typeName) {
|
||||
const polymorphicMapper = getIndexDiscriminator(serializer.modelMappers.discriminators, discriminatorValue, typeName);
|
||||
if (polymorphicMapper) {
|
||||
mapper = polymorphicMapper;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return mapper;
|
||||
}
|
||||
function getPolymorphicDiscriminatorRecursively(serializer, mapper) {
|
||||
return (mapper.type.polymorphicDiscriminator ||
|
||||
getPolymorphicDiscriminatorSafely(serializer, mapper.type.uberParent) ||
|
||||
getPolymorphicDiscriminatorSafely(serializer, mapper.type.className));
|
||||
}
|
||||
function getPolymorphicDiscriminatorSafely(serializer, typeName) {
|
||||
return (typeName &&
|
||||
serializer.modelMappers[typeName] &&
|
||||
serializer.modelMappers[typeName].type.polymorphicDiscriminator);
|
||||
}
|
||||
/**
|
||||
* Known types of Mappers
|
||||
*/
|
||||
export const MapperTypeNames = {
|
||||
Base64Url: "Base64Url",
|
||||
Boolean: "Boolean",
|
||||
ByteArray: "ByteArray",
|
||||
Composite: "Composite",
|
||||
Date: "Date",
|
||||
DateTime: "DateTime",
|
||||
DateTimeRfc1123: "DateTimeRfc1123",
|
||||
Dictionary: "Dictionary",
|
||||
Enum: "Enum",
|
||||
Number: "Number",
|
||||
Object: "Object",
|
||||
Sequence: "Sequence",
|
||||
String: "String",
|
||||
Stream: "Stream",
|
||||
TimeSpan: "TimeSpan",
|
||||
UnixTime: "UnixTime",
|
||||
};
|
||||
//# sourceMappingURL=serializer.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/serializer.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/serializer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
82
node_modules/@azure/core-client/dist/browser/serviceClient.d.ts
generated
vendored
Normal file
82
node_modules/@azure/core-client/dist/browser/serviceClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
import { CommonClientOptions, OperationArguments, OperationSpec } from "./interfaces.js";
|
||||
import { Pipeline, PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
/**
|
||||
* Options to be provided while creating the client.
|
||||
*/
|
||||
export interface ServiceClientOptions extends CommonClientOptions {
|
||||
/**
|
||||
* If specified, this is the base URI that requests will be made against for this ServiceClient.
|
||||
* If it is not specified, then all OperationSpecs must contain a baseUrl property.
|
||||
* @deprecated This property is deprecated and will be removed soon, please use endpoint instead
|
||||
*/
|
||||
baseUri?: string;
|
||||
/**
|
||||
* If specified, this is the endpoint that requests will be made against for this ServiceClient.
|
||||
* If it is not specified, then all OperationSpecs must contain a baseUrl property.
|
||||
* to encourage customer to use endpoint, we mark the baseUri as deprecated.
|
||||
*/
|
||||
endpoint?: string;
|
||||
/**
|
||||
* If specified, will be used to build the BearerTokenAuthenticationPolicy.
|
||||
*/
|
||||
credentialScopes?: string | string[];
|
||||
/**
|
||||
* The default request content type for the service.
|
||||
* Used if no requestContentType is present on an OperationSpec.
|
||||
*/
|
||||
requestContentType?: string;
|
||||
/**
|
||||
* Credential used to authenticate the request.
|
||||
*/
|
||||
credential?: TokenCredential;
|
||||
/**
|
||||
* A customized pipeline to use, otherwise a default one will be created.
|
||||
*/
|
||||
pipeline?: Pipeline;
|
||||
}
|
||||
/**
|
||||
* Initializes a new instance of the ServiceClient.
|
||||
*/
|
||||
export declare class ServiceClient {
|
||||
/**
|
||||
* If specified, this is the base URI that requests will be made against for this ServiceClient.
|
||||
* If it is not specified, then all OperationSpecs must contain a baseUrl property.
|
||||
*/
|
||||
private readonly _endpoint?;
|
||||
/**
|
||||
* The default request content type for the service.
|
||||
* Used if no requestContentType is present on an OperationSpec.
|
||||
*/
|
||||
private readonly _requestContentType?;
|
||||
/**
|
||||
* Set to true if the request is sent over HTTP instead of HTTPS
|
||||
*/
|
||||
private readonly _allowInsecureConnection?;
|
||||
/**
|
||||
* The HTTP client that will be used to send requests.
|
||||
*/
|
||||
private readonly _httpClient;
|
||||
/**
|
||||
* The pipeline used by this client to make requests
|
||||
*/
|
||||
readonly pipeline: Pipeline;
|
||||
/**
|
||||
* The ServiceClient constructor
|
||||
* @param credential - The credentials used for authentication with the service.
|
||||
* @param options - The service client options that govern the behavior of the client.
|
||||
*/
|
||||
constructor(options?: ServiceClientOptions);
|
||||
/**
|
||||
* Send the provided httpRequest.
|
||||
*/
|
||||
sendRequest(request: PipelineRequest): Promise<PipelineResponse>;
|
||||
/**
|
||||
* Send an HTTP request that is populated using the provided OperationSpec.
|
||||
* @typeParam T - The typed result of the request, based on the OperationSpec.
|
||||
* @param operationArguments - The arguments that the HTTP request's templated values will be populated from.
|
||||
* @param operationSpec - The OperationSpec to use to populate the httpRequest.
|
||||
*/
|
||||
sendOperationRequest<T>(operationArguments: OperationArguments, operationSpec: OperationSpec): Promise<T>;
|
||||
}
|
||||
//# sourceMappingURL=serviceClient.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/serviceClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/serviceClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"serviceClient.d.ts","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAElB,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,QAAQ,EACR,eAAe,EACf,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IAEpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAS;IAE9C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAU;IAEpD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC;;OAEG;IACH,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC;;;;OAIG;gBACS,OAAO,GAAE,oBAAyB;IAwB9C;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAItE;;;;;OAKG;IACG,oBAAoB,CAAC,CAAC,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,CAAC,CAAC;CA8Fd"}
|
||||
149
node_modules/@azure/core-client/dist/browser/serviceClient.js
generated
vendored
Normal file
149
node_modules/@azure/core-client/dist/browser/serviceClient.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { createPipelineRequest, } from "@azure/core-rest-pipeline";
|
||||
import { createClientPipeline } from "./pipeline.js";
|
||||
import { flattenResponse } from "./utils.js";
|
||||
import { getCachedDefaultHttpClient } from "./httpClientCache.js";
|
||||
import { getOperationRequestInfo } from "./operationHelpers.js";
|
||||
import { getRequestUrl } from "./urlHelpers.js";
|
||||
import { getStreamingResponseStatusCodes } from "./interfaceHelpers.js";
|
||||
import { logger } from "./log.js";
|
||||
/**
|
||||
* Initializes a new instance of the ServiceClient.
|
||||
*/
|
||||
export class ServiceClient {
|
||||
/**
|
||||
* The ServiceClient constructor
|
||||
* @param credential - The credentials used for authentication with the service.
|
||||
* @param options - The service client options that govern the behavior of the client.
|
||||
*/
|
||||
constructor(options = {}) {
|
||||
var _a, _b;
|
||||
this._requestContentType = options.requestContentType;
|
||||
this._endpoint = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri;
|
||||
if (options.baseUri) {
|
||||
logger.warning("The baseUri option for SDK Clients has been deprecated, please use endpoint instead.");
|
||||
}
|
||||
this._allowInsecureConnection = options.allowInsecureConnection;
|
||||
this._httpClient = options.httpClient || getCachedDefaultHttpClient();
|
||||
this.pipeline = options.pipeline || createDefaultPipeline(options);
|
||||
if ((_b = options.additionalPolicies) === null || _b === void 0 ? void 0 : _b.length) {
|
||||
for (const { policy, position } of options.additionalPolicies) {
|
||||
// Sign happens after Retry and is commonly needed to occur
|
||||
// before policies that intercept post-retry.
|
||||
const afterPhase = position === "perRetry" ? "Sign" : undefined;
|
||||
this.pipeline.addPolicy(policy, {
|
||||
afterPhase,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send the provided httpRequest.
|
||||
*/
|
||||
async sendRequest(request) {
|
||||
return this.pipeline.sendRequest(this._httpClient, request);
|
||||
}
|
||||
/**
|
||||
* Send an HTTP request that is populated using the provided OperationSpec.
|
||||
* @typeParam T - The typed result of the request, based on the OperationSpec.
|
||||
* @param operationArguments - The arguments that the HTTP request's templated values will be populated from.
|
||||
* @param operationSpec - The OperationSpec to use to populate the httpRequest.
|
||||
*/
|
||||
async sendOperationRequest(operationArguments, operationSpec) {
|
||||
const endpoint = operationSpec.baseUrl || this._endpoint;
|
||||
if (!endpoint) {
|
||||
throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.");
|
||||
}
|
||||
// Templatized URLs sometimes reference properties on the ServiceClient child class,
|
||||
// so we have to pass `this` below in order to search these properties if they're
|
||||
// not part of OperationArguments
|
||||
const url = getRequestUrl(endpoint, operationSpec, operationArguments, this);
|
||||
const request = createPipelineRequest({
|
||||
url,
|
||||
});
|
||||
request.method = operationSpec.httpMethod;
|
||||
const operationInfo = getOperationRequestInfo(request);
|
||||
operationInfo.operationSpec = operationSpec;
|
||||
operationInfo.operationArguments = operationArguments;
|
||||
const contentType = operationSpec.contentType || this._requestContentType;
|
||||
if (contentType && operationSpec.requestBody) {
|
||||
request.headers.set("Content-Type", contentType);
|
||||
}
|
||||
const options = operationArguments.options;
|
||||
if (options) {
|
||||
const requestOptions = options.requestOptions;
|
||||
if (requestOptions) {
|
||||
if (requestOptions.timeout) {
|
||||
request.timeout = requestOptions.timeout;
|
||||
}
|
||||
if (requestOptions.onUploadProgress) {
|
||||
request.onUploadProgress = requestOptions.onUploadProgress;
|
||||
}
|
||||
if (requestOptions.onDownloadProgress) {
|
||||
request.onDownloadProgress = requestOptions.onDownloadProgress;
|
||||
}
|
||||
if (requestOptions.shouldDeserialize !== undefined) {
|
||||
operationInfo.shouldDeserialize = requestOptions.shouldDeserialize;
|
||||
}
|
||||
if (requestOptions.allowInsecureConnection) {
|
||||
request.allowInsecureConnection = true;
|
||||
}
|
||||
}
|
||||
if (options.abortSignal) {
|
||||
request.abortSignal = options.abortSignal;
|
||||
}
|
||||
if (options.tracingOptions) {
|
||||
request.tracingOptions = options.tracingOptions;
|
||||
}
|
||||
}
|
||||
if (this._allowInsecureConnection) {
|
||||
request.allowInsecureConnection = true;
|
||||
}
|
||||
if (request.streamResponseStatusCodes === undefined) {
|
||||
request.streamResponseStatusCodes = getStreamingResponseStatusCodes(operationSpec);
|
||||
}
|
||||
try {
|
||||
const rawResponse = await this.sendRequest(request);
|
||||
const flatResponse = flattenResponse(rawResponse, operationSpec.responses[rawResponse.status]);
|
||||
if (options === null || options === void 0 ? void 0 : options.onResponse) {
|
||||
options.onResponse(rawResponse, flatResponse);
|
||||
}
|
||||
return flatResponse;
|
||||
}
|
||||
catch (error) {
|
||||
if (typeof error === "object" && (error === null || error === void 0 ? void 0 : error.response)) {
|
||||
const rawResponse = error.response;
|
||||
const flatResponse = flattenResponse(rawResponse, operationSpec.responses[error.statusCode] || operationSpec.responses["default"]);
|
||||
error.details = flatResponse;
|
||||
if (options === null || options === void 0 ? void 0 : options.onResponse) {
|
||||
options.onResponse(rawResponse, flatResponse, error);
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
function createDefaultPipeline(options) {
|
||||
const credentialScopes = getCredentialScopes(options);
|
||||
const credentialOptions = options.credential && credentialScopes
|
||||
? { credentialScopes, credential: options.credential }
|
||||
: undefined;
|
||||
return createClientPipeline(Object.assign(Object.assign({}, options), { credentialOptions }));
|
||||
}
|
||||
function getCredentialScopes(options) {
|
||||
if (options.credentialScopes) {
|
||||
return options.credentialScopes;
|
||||
}
|
||||
if (options.endpoint) {
|
||||
return `${options.endpoint}/.default`;
|
||||
}
|
||||
if (options.baseUri) {
|
||||
return `${options.baseUri}/.default`;
|
||||
}
|
||||
if (options.credential && !options.credentialScopes) {
|
||||
throw new Error(`When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
//# sourceMappingURL=serviceClient.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/serviceClient.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/serviceClient.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@azure/core-client/dist/browser/state-browser.d.mts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/state-browser.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"state-browser.d.mts","sourceRoot":"","sources":["../../src/state-browser.mts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,KAAK;;CAEjB,CAAC"}
|
||||
1
node_modules/@azure/core-client/dist/browser/state-browser.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/state-browser.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"state-browser.mjs","sourceRoot":"","sources":["../../src/state-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,mBAAmB,EAAE,IAAI,OAAO,EAA0C;CAC3E,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationRequest, OperationRequestInfo } from \"./interfaces.js\";\n\n/**\n * Browser-only implementation of the module's state. The browser esm variant will not load the commonjs state, so we do not need to share state between the two.\n */\nexport const state = {\n operationRequestMap: new WeakMap<OperationRequest, OperationRequestInfo>(),\n};\n"]}
|
||||
8
node_modules/@azure/core-client/dist/browser/state.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-client/dist/browser/state.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { OperationRequestInfo } from "./interfaces.js";
|
||||
/**
|
||||
* Browser-only implementation of the module's state. The browser esm variant will not load the commonjs state, so we do not need to share state between the two.
|
||||
*/
|
||||
export declare const state: {
|
||||
operationRequestMap: WeakMap<import("@azure/core-rest-pipeline").PipelineRequest, OperationRequestInfo>;
|
||||
};
|
||||
//# sourceMappingURL=state-browser.d.mts.map
|
||||
9
node_modules/@azure/core-client/dist/browser/state.js
generated
vendored
Normal file
9
node_modules/@azure/core-client/dist/browser/state.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Browser-only implementation of the module's state. The browser esm variant will not load the commonjs state, so we do not need to share state between the two.
|
||||
*/
|
||||
export const state = {
|
||||
operationRequestMap: new WeakMap(),
|
||||
};
|
||||
//# sourceMappingURL=state-browser.mjs.map
|
||||
7
node_modules/@azure/core-client/dist/browser/urlHelpers.d.ts
generated
vendored
Normal file
7
node_modules/@azure/core-client/dist/browser/urlHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { OperationArguments, OperationSpec } from "./interfaces.js";
|
||||
export declare function getRequestUrl(baseUri: string, operationSpec: OperationSpec, operationArguments: OperationArguments, fallbackObject: {
|
||||
[parameterName: string]: any;
|
||||
}): string;
|
||||
/** @internal */
|
||||
export declare function appendQueryParams(url: string, queryParams: Map<string, string | string[]>, sequenceParams: Set<string>, noOverwrite?: boolean): string;
|
||||
//# sourceMappingURL=urlHelpers.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/urlHelpers.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/urlHelpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"urlHelpers.d.ts","sourceRoot":"","sources":["../../src/urlHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AAY3F,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE;IAAE,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC/C,MAAM,CA2CR;AA+LD,gBAAgB;AAChB,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC3C,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,EAC3B,WAAW,GAAE,OAAe,GAC3B,MAAM,CAqDR"}
|
||||
235
node_modules/@azure/core-client/dist/browser/urlHelpers.js
generated
vendored
Normal file
235
node_modules/@azure/core-client/dist/browser/urlHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { getOperationArgumentValueFromParameter } from "./operationHelpers.js";
|
||||
import { getPathStringFromParameter } from "./interfaceHelpers.js";
|
||||
const CollectionFormatToDelimiterMap = {
|
||||
CSV: ",",
|
||||
SSV: " ",
|
||||
Multi: "Multi",
|
||||
TSV: "\t",
|
||||
Pipes: "|",
|
||||
};
|
||||
export function getRequestUrl(baseUri, operationSpec, operationArguments, fallbackObject) {
|
||||
const urlReplacements = calculateUrlReplacements(operationSpec, operationArguments, fallbackObject);
|
||||
let isAbsolutePath = false;
|
||||
let requestUrl = replaceAll(baseUri, urlReplacements);
|
||||
if (operationSpec.path) {
|
||||
let path = replaceAll(operationSpec.path, urlReplacements);
|
||||
// QUIRK: sometimes we get a path component like /{nextLink}
|
||||
// which may be a fully formed URL with a leading /. In that case, we should
|
||||
// remove the leading /
|
||||
if (operationSpec.path === "/{nextLink}" && path.startsWith("/")) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
// QUIRK: sometimes we get a path component like {nextLink}
|
||||
// which may be a fully formed URL. In that case, we should
|
||||
// ignore the baseUri.
|
||||
if (isAbsoluteUrl(path)) {
|
||||
requestUrl = path;
|
||||
isAbsolutePath = true;
|
||||
}
|
||||
else {
|
||||
requestUrl = appendPath(requestUrl, path);
|
||||
}
|
||||
}
|
||||
const { queryParams, sequenceParams } = calculateQueryParameters(operationSpec, operationArguments, fallbackObject);
|
||||
/**
|
||||
* Notice that this call sets the `noOverwrite` parameter to true if the `requestUrl`
|
||||
* is an absolute path. This ensures that existing query parameter values in `requestUrl`
|
||||
* do not get overwritten. On the other hand when `requestUrl` is not absolute path, it
|
||||
* is still being built so there is nothing to overwrite.
|
||||
*/
|
||||
requestUrl = appendQueryParams(requestUrl, queryParams, sequenceParams, isAbsolutePath);
|
||||
return requestUrl;
|
||||
}
|
||||
function replaceAll(input, replacements) {
|
||||
let result = input;
|
||||
for (const [searchValue, replaceValue] of replacements) {
|
||||
result = result.split(searchValue).join(replaceValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function calculateUrlReplacements(operationSpec, operationArguments, fallbackObject) {
|
||||
var _a;
|
||||
const result = new Map();
|
||||
if ((_a = operationSpec.urlParameters) === null || _a === void 0 ? void 0 : _a.length) {
|
||||
for (const urlParameter of operationSpec.urlParameters) {
|
||||
let urlParameterValue = getOperationArgumentValueFromParameter(operationArguments, urlParameter, fallbackObject);
|
||||
const parameterPathString = getPathStringFromParameter(urlParameter);
|
||||
urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, parameterPathString);
|
||||
if (!urlParameter.skipEncoding) {
|
||||
urlParameterValue = encodeURIComponent(urlParameterValue);
|
||||
}
|
||||
result.set(`{${urlParameter.mapper.serializedName || parameterPathString}}`, urlParameterValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function isAbsoluteUrl(url) {
|
||||
return url.includes("://");
|
||||
}
|
||||
function appendPath(url, pathToAppend) {
|
||||
if (!pathToAppend) {
|
||||
return url;
|
||||
}
|
||||
const parsedUrl = new URL(url);
|
||||
let newPath = parsedUrl.pathname;
|
||||
if (!newPath.endsWith("/")) {
|
||||
newPath = `${newPath}/`;
|
||||
}
|
||||
if (pathToAppend.startsWith("/")) {
|
||||
pathToAppend = pathToAppend.substring(1);
|
||||
}
|
||||
const searchStart = pathToAppend.indexOf("?");
|
||||
if (searchStart !== -1) {
|
||||
const path = pathToAppend.substring(0, searchStart);
|
||||
const search = pathToAppend.substring(searchStart + 1);
|
||||
newPath = newPath + path;
|
||||
if (search) {
|
||||
parsedUrl.search = parsedUrl.search ? `${parsedUrl.search}&${search}` : search;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newPath = newPath + pathToAppend;
|
||||
}
|
||||
parsedUrl.pathname = newPath;
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
function calculateQueryParameters(operationSpec, operationArguments, fallbackObject) {
|
||||
var _a;
|
||||
const result = new Map();
|
||||
const sequenceParams = new Set();
|
||||
if ((_a = operationSpec.queryParameters) === null || _a === void 0 ? void 0 : _a.length) {
|
||||
for (const queryParameter of operationSpec.queryParameters) {
|
||||
if (queryParameter.mapper.type.name === "Sequence" && queryParameter.mapper.serializedName) {
|
||||
sequenceParams.add(queryParameter.mapper.serializedName);
|
||||
}
|
||||
let queryParameterValue = getOperationArgumentValueFromParameter(operationArguments, queryParameter, fallbackObject);
|
||||
if ((queryParameterValue !== undefined && queryParameterValue !== null) ||
|
||||
queryParameter.mapper.required) {
|
||||
queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter));
|
||||
const delimiter = queryParameter.collectionFormat
|
||||
? CollectionFormatToDelimiterMap[queryParameter.collectionFormat]
|
||||
: "";
|
||||
if (Array.isArray(queryParameterValue)) {
|
||||
// replace null and undefined
|
||||
queryParameterValue = queryParameterValue.map((item) => {
|
||||
if (item === null || item === undefined) {
|
||||
return "";
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
if (queryParameter.collectionFormat === "Multi" && queryParameterValue.length === 0) {
|
||||
continue;
|
||||
}
|
||||
else if (Array.isArray(queryParameterValue) &&
|
||||
(queryParameter.collectionFormat === "SSV" || queryParameter.collectionFormat === "TSV")) {
|
||||
queryParameterValue = queryParameterValue.join(delimiter);
|
||||
}
|
||||
if (!queryParameter.skipEncoding) {
|
||||
if (Array.isArray(queryParameterValue)) {
|
||||
queryParameterValue = queryParameterValue.map((item) => {
|
||||
return encodeURIComponent(item);
|
||||
});
|
||||
}
|
||||
else {
|
||||
queryParameterValue = encodeURIComponent(queryParameterValue);
|
||||
}
|
||||
}
|
||||
// Join pipes and CSV *after* encoding, or the server will be upset.
|
||||
if (Array.isArray(queryParameterValue) &&
|
||||
(queryParameter.collectionFormat === "CSV" || queryParameter.collectionFormat === "Pipes")) {
|
||||
queryParameterValue = queryParameterValue.join(delimiter);
|
||||
}
|
||||
result.set(queryParameter.mapper.serializedName || getPathStringFromParameter(queryParameter), queryParameterValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
queryParams: result,
|
||||
sequenceParams,
|
||||
};
|
||||
}
|
||||
function simpleParseQueryParams(queryString) {
|
||||
const result = new Map();
|
||||
if (!queryString || queryString[0] !== "?") {
|
||||
return result;
|
||||
}
|
||||
// remove the leading ?
|
||||
queryString = queryString.slice(1);
|
||||
const pairs = queryString.split("&");
|
||||
for (const pair of pairs) {
|
||||
const [name, value] = pair.split("=", 2);
|
||||
const existingValue = result.get(name);
|
||||
if (existingValue) {
|
||||
if (Array.isArray(existingValue)) {
|
||||
existingValue.push(value);
|
||||
}
|
||||
else {
|
||||
result.set(name, [existingValue, value]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.set(name, value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/** @internal */
|
||||
export function appendQueryParams(url, queryParams, sequenceParams, noOverwrite = false) {
|
||||
if (queryParams.size === 0) {
|
||||
return url;
|
||||
}
|
||||
const parsedUrl = new URL(url);
|
||||
// QUIRK: parsedUrl.searchParams will have their name/value pairs decoded, which
|
||||
// can change their meaning to the server, such as in the case of a SAS signature.
|
||||
// To avoid accidentally un-encoding a query param, we parse the key/values ourselves
|
||||
const combinedParams = simpleParseQueryParams(parsedUrl.search);
|
||||
for (const [name, value] of queryParams) {
|
||||
const existingValue = combinedParams.get(name);
|
||||
if (Array.isArray(existingValue)) {
|
||||
if (Array.isArray(value)) {
|
||||
existingValue.push(...value);
|
||||
const valueSet = new Set(existingValue);
|
||||
combinedParams.set(name, Array.from(valueSet));
|
||||
}
|
||||
else {
|
||||
existingValue.push(value);
|
||||
}
|
||||
}
|
||||
else if (existingValue) {
|
||||
if (Array.isArray(value)) {
|
||||
value.unshift(existingValue);
|
||||
}
|
||||
else if (sequenceParams.has(name)) {
|
||||
combinedParams.set(name, [existingValue, value]);
|
||||
}
|
||||
if (!noOverwrite) {
|
||||
combinedParams.set(name, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
combinedParams.set(name, value);
|
||||
}
|
||||
}
|
||||
const searchPieces = [];
|
||||
for (const [name, value] of combinedParams) {
|
||||
if (typeof value === "string") {
|
||||
searchPieces.push(`${name}=${value}`);
|
||||
}
|
||||
else if (Array.isArray(value)) {
|
||||
// QUIRK: If we get an array of values, include multiple key/value pairs
|
||||
for (const subValue of value) {
|
||||
searchPieces.push(`${name}=${subValue}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
searchPieces.push(`${name}=${value}`);
|
||||
}
|
||||
}
|
||||
// QUIRK: we have to set search manually as searchParams will encode comma when it shouldn't.
|
||||
parsedUrl.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
//# sourceMappingURL=urlHelpers.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/urlHelpers.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/urlHelpers.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
node_modules/@azure/core-client/dist/browser/utils.d.ts
generated
vendored
Normal file
37
node_modules/@azure/core-client/dist/browser/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { FullOperationResponse, OperationResponseMap } from "./interfaces.js";
|
||||
/**
|
||||
* The union of all possible types for a primitive response body.
|
||||
* @internal
|
||||
*/
|
||||
export type BodyPrimitive = number | string | boolean | Date | Uint8Array | undefined | null;
|
||||
/**
|
||||
* A type guard for a primitive response body.
|
||||
* @param value - Value to test
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare function isPrimitiveBody(value: unknown, mapperTypeName?: string): value is BodyPrimitive;
|
||||
/**
|
||||
* Returns true if the given string is in ISO 8601 format.
|
||||
* @param value - The value to be validated for ISO 8601 duration format.
|
||||
* @internal
|
||||
*/
|
||||
export declare function isDuration(value: string): boolean;
|
||||
/**
|
||||
* Returns true if the provided uuid is valid.
|
||||
*
|
||||
* @param uuid - The uuid that needs to be validated.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare function isValidUuid(uuid: string): boolean;
|
||||
/**
|
||||
* Take a `FullOperationResponse` and turn it into a flat
|
||||
* response object to hand back to the consumer.
|
||||
* @param fullResponse - The processed response from the operation request
|
||||
* @param responseSpec - The response map from the OperationSpec
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare function flattenResponse(fullResponse: FullOperationResponse, responseSpec: OperationResponseMap | undefined): unknown;
|
||||
//# sourceMappingURL=utils.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/browser/utils.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/utils.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AAE7F;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAY/F;AAKD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD;AAKD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAyDD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,qBAAqB,EACnC,YAAY,EAAE,oBAAoB,GAAG,SAAS,GAC7C,OAAO,CA4DT"}
|
||||
115
node_modules/@azure/core-client/dist/browser/utils.js
generated
vendored
Normal file
115
node_modules/@azure/core-client/dist/browser/utils.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* A type guard for a primitive response body.
|
||||
* @param value - Value to test
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function isPrimitiveBody(value, mapperTypeName) {
|
||||
return (mapperTypeName !== "Composite" &&
|
||||
mapperTypeName !== "Dictionary" &&
|
||||
(typeof value === "string" ||
|
||||
typeof value === "number" ||
|
||||
typeof value === "boolean" ||
|
||||
(mapperTypeName === null || mapperTypeName === void 0 ? void 0 : mapperTypeName.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i)) !==
|
||||
null ||
|
||||
value === undefined ||
|
||||
value === null));
|
||||
}
|
||||
const validateISODuration = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
|
||||
/**
|
||||
* Returns true if the given string is in ISO 8601 format.
|
||||
* @param value - The value to be validated for ISO 8601 duration format.
|
||||
* @internal
|
||||
*/
|
||||
export function isDuration(value) {
|
||||
return validateISODuration.test(value);
|
||||
}
|
||||
const validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
|
||||
/**
|
||||
* Returns true if the provided uuid is valid.
|
||||
*
|
||||
* @param uuid - The uuid that needs to be validated.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function isValidUuid(uuid) {
|
||||
return validUuidRegex.test(uuid);
|
||||
}
|
||||
/**
|
||||
* Maps the response as follows:
|
||||
* - wraps the response body if needed (typically if its type is primitive).
|
||||
* - returns null if the combination of the headers and the body is empty.
|
||||
* - otherwise, returns the combination of the headers and the body.
|
||||
*
|
||||
* @param responseObject - a representation of the parsed response
|
||||
* @returns the response that will be returned to the user which can be null and/or wrapped
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
function handleNullableResponseAndWrappableBody(responseObject) {
|
||||
const combinedHeadersAndBody = Object.assign(Object.assign({}, responseObject.headers), responseObject.body);
|
||||
if (responseObject.hasNullableType &&
|
||||
Object.getOwnPropertyNames(combinedHeadersAndBody).length === 0) {
|
||||
return responseObject.shouldWrapBody ? { body: null } : null;
|
||||
}
|
||||
else {
|
||||
return responseObject.shouldWrapBody
|
||||
? Object.assign(Object.assign({}, responseObject.headers), { body: responseObject.body }) : combinedHeadersAndBody;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Take a `FullOperationResponse` and turn it into a flat
|
||||
* response object to hand back to the consumer.
|
||||
* @param fullResponse - The processed response from the operation request
|
||||
* @param responseSpec - The response map from the OperationSpec
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function flattenResponse(fullResponse, responseSpec) {
|
||||
var _a, _b;
|
||||
const parsedHeaders = fullResponse.parsedHeaders;
|
||||
// head methods never have a body, but we return a boolean set to body property
|
||||
// to indicate presence/absence of the resource
|
||||
if (fullResponse.request.method === "HEAD") {
|
||||
return Object.assign(Object.assign({}, parsedHeaders), { body: fullResponse.parsedBody });
|
||||
}
|
||||
const bodyMapper = responseSpec && responseSpec.bodyMapper;
|
||||
const isNullable = Boolean(bodyMapper === null || bodyMapper === void 0 ? void 0 : bodyMapper.nullable);
|
||||
const expectedBodyTypeName = bodyMapper === null || bodyMapper === void 0 ? void 0 : bodyMapper.type.name;
|
||||
/** If the body is asked for, we look at the expected body type to handle it */
|
||||
if (expectedBodyTypeName === "Stream") {
|
||||
return Object.assign(Object.assign({}, parsedHeaders), { blobBody: fullResponse.blobBody, readableStreamBody: fullResponse.readableStreamBody });
|
||||
}
|
||||
const modelProperties = (expectedBodyTypeName === "Composite" &&
|
||||
bodyMapper.type.modelProperties) ||
|
||||
{};
|
||||
const isPageableResponse = Object.keys(modelProperties).some((k) => modelProperties[k].serializedName === "");
|
||||
if (expectedBodyTypeName === "Sequence" || isPageableResponse) {
|
||||
const arrayResponse = (_a = fullResponse.parsedBody) !== null && _a !== void 0 ? _a : [];
|
||||
for (const key of Object.keys(modelProperties)) {
|
||||
if (modelProperties[key].serializedName) {
|
||||
arrayResponse[key] = (_b = fullResponse.parsedBody) === null || _b === void 0 ? void 0 : _b[key];
|
||||
}
|
||||
}
|
||||
if (parsedHeaders) {
|
||||
for (const key of Object.keys(parsedHeaders)) {
|
||||
arrayResponse[key] = parsedHeaders[key];
|
||||
}
|
||||
}
|
||||
return isNullable &&
|
||||
!fullResponse.parsedBody &&
|
||||
!parsedHeaders &&
|
||||
Object.getOwnPropertyNames(modelProperties).length === 0
|
||||
? null
|
||||
: arrayResponse;
|
||||
}
|
||||
return handleNullableResponseAndWrappableBody({
|
||||
body: fullResponse.parsedBody,
|
||||
headers: parsedHeaders,
|
||||
hasNullableType: isNullable,
|
||||
shouldWrapBody: isPrimitiveBody(fullResponse.parsedBody, expectedBodyTypeName),
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/@azure/core-client/dist/browser/utils.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/browser/utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
43
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.d.ts
generated
vendored
Normal file
43
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { AuthorizeRequestOnChallengeOptions } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* Converts: `Bearer a="b", c="d", Bearer d="e", f="g"`.
|
||||
* Into: `[ { a: 'b', c: 'd' }, { d: 'e', f: 'g' } ]`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare function parseCAEChallenge(challenges: string): any[];
|
||||
/**
|
||||
* CAE Challenge structure
|
||||
*/
|
||||
export interface CAEChallenge {
|
||||
scope: string;
|
||||
claims: string;
|
||||
}
|
||||
/**
|
||||
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
|
||||
* [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
|
||||
*
|
||||
* Call the `bearerTokenAuthenticationPolicy` with the following options:
|
||||
*
|
||||
* ```ts
|
||||
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
||||
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
|
||||
*
|
||||
* const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
|
||||
* authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Once provided, the `bearerTokenAuthenticationPolicy` policy will internally handle Continuous Access Evaluation (CAE) challenges.
|
||||
* When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
|
||||
*
|
||||
* Example challenge with claims:
|
||||
*
|
||||
* ```
|
||||
* Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
|
||||
* error_description="User session has been revoked",
|
||||
* claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
|
||||
* ```
|
||||
*/
|
||||
export declare function authorizeRequestOnClaimChallenge(onChallengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>;
|
||||
//# sourceMappingURL=authorizeRequestOnClaimChallenge.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"authorizeRequestOnClaimChallenge.d.ts","sourceRoot":"","sources":["../../src/authorizeRequestOnClaimChallenge.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAI/E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,EAAE,CAU3D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,gCAAgC,CACpD,kBAAkB,EAAE,kCAAkC,GACrD,OAAO,CAAC,OAAO,CAAC,CAkClB"}
|
||||
74
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.js
generated
vendored
Normal file
74
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.authorizeRequestOnClaimChallenge = exports.parseCAEChallenge = void 0;
|
||||
const log_js_1 = require("./log.js");
|
||||
const base64_js_1 = require("./base64.js");
|
||||
/**
|
||||
* Converts: `Bearer a="b", c="d", Bearer d="e", f="g"`.
|
||||
* Into: `[ { a: 'b', c: 'd' }, { d: 'e', f: 'g' } ]`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
function parseCAEChallenge(challenges) {
|
||||
const bearerChallenges = `, ${challenges.trim()}`.split(", Bearer ").filter((x) => x);
|
||||
return bearerChallenges.map((challenge) => {
|
||||
const challengeParts = `${challenge.trim()}, `.split('", ').filter((x) => x);
|
||||
const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split('="')));
|
||||
// Key-value pairs to plain object:
|
||||
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
|
||||
});
|
||||
}
|
||||
exports.parseCAEChallenge = parseCAEChallenge;
|
||||
/**
|
||||
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
|
||||
* [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
|
||||
*
|
||||
* Call the `bearerTokenAuthenticationPolicy` with the following options:
|
||||
*
|
||||
* ```ts
|
||||
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
||||
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
|
||||
*
|
||||
* const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
|
||||
* authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Once provided, the `bearerTokenAuthenticationPolicy` policy will internally handle Continuous Access Evaluation (CAE) challenges.
|
||||
* When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
|
||||
*
|
||||
* Example challenge with claims:
|
||||
*
|
||||
* ```
|
||||
* Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
|
||||
* error_description="User session has been revoked",
|
||||
* claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
|
||||
* ```
|
||||
*/
|
||||
async function authorizeRequestOnClaimChallenge(onChallengeOptions) {
|
||||
const { scopes, response } = onChallengeOptions;
|
||||
const logger = onChallengeOptions.logger || log_js_1.logger;
|
||||
const challenge = response.headers.get("WWW-Authenticate");
|
||||
if (!challenge) {
|
||||
logger.info(`The WWW-Authenticate header was missing. Failed to perform the Continuous Access Evaluation authentication flow.`);
|
||||
return false;
|
||||
}
|
||||
const challenges = parseCAEChallenge(challenge) || [];
|
||||
const parsedChallenge = challenges.find((x) => x.claims);
|
||||
if (!parsedChallenge) {
|
||||
logger.info(`The WWW-Authenticate header was missing the necessary "claims" to perform the Continuous Access Evaluation authentication flow.`);
|
||||
return false;
|
||||
}
|
||||
const accessToken = await onChallengeOptions.getAccessToken(parsedChallenge.scope ? [parsedChallenge.scope] : scopes, {
|
||||
claims: (0, base64_js_1.decodeStringToString)(parsedChallenge.claims),
|
||||
});
|
||||
if (!accessToken) {
|
||||
return false;
|
||||
}
|
||||
onChallengeOptions.request.headers.set("Authorization", `Bearer ${accessToken.token}`);
|
||||
return true;
|
||||
}
|
||||
exports.authorizeRequestOnClaimChallenge = authorizeRequestOnClaimChallenge;
|
||||
//# sourceMappingURL=authorizeRequestOnClaimChallenge.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnClaimChallenge.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { AuthorizeRequestOnChallengeOptions } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* Defines a callback to handle auth challenge for Storage APIs.
|
||||
* This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge
|
||||
* Handling has specific features for storage that departs to the general AAD challenge docs.
|
||||
**/
|
||||
export declare const authorizeRequestOnTenantChallenge: (challengeOptions: AuthorizeRequestOnChallengeOptions) => Promise<boolean>;
|
||||
//# sourceMappingURL=authorizeRequestOnTenantChallenge.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"authorizeRequestOnTenantChallenge.d.ts","sourceRoot":"","sources":["../../src/authorizeRequestOnTenantChallenge.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kCAAkC,EAGnC,MAAM,2BAA2B,CAAC;AA0BnC;;;;IAII;AACJ,eAAO,MAAM,iCAAiC,EAAE,CAC9C,gBAAgB,EAAE,kCAAkC,KACjD,OAAO,CAAC,OAAO,CA0BnB,CAAC"}
|
||||
117
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.js
generated
vendored
Normal file
117
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.authorizeRequestOnTenantChallenge = void 0;
|
||||
/**
|
||||
* A set of constants used internally when processing requests.
|
||||
*/
|
||||
const Constants = {
|
||||
DefaultScope: "/.default",
|
||||
/**
|
||||
* Defines constants for use with HTTP headers.
|
||||
*/
|
||||
HeaderConstants: {
|
||||
/**
|
||||
* The Authorization header.
|
||||
*/
|
||||
AUTHORIZATION: "authorization",
|
||||
},
|
||||
};
|
||||
function isUuid(text) {
|
||||
return /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/.test(text);
|
||||
}
|
||||
/**
|
||||
* Defines a callback to handle auth challenge for Storage APIs.
|
||||
* This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge
|
||||
* Handling has specific features for storage that departs to the general AAD challenge docs.
|
||||
**/
|
||||
const authorizeRequestOnTenantChallenge = async (challengeOptions) => {
|
||||
const requestOptions = requestToOptions(challengeOptions.request);
|
||||
const challenge = getChallenge(challengeOptions.response);
|
||||
if (challenge) {
|
||||
const challengeInfo = parseChallenge(challenge);
|
||||
const challengeScopes = buildScopes(challengeOptions, challengeInfo);
|
||||
const tenantId = extractTenantId(challengeInfo);
|
||||
if (!tenantId) {
|
||||
return false;
|
||||
}
|
||||
const accessToken = await challengeOptions.getAccessToken(challengeScopes, Object.assign(Object.assign({}, requestOptions), { tenantId }));
|
||||
if (!accessToken) {
|
||||
return false;
|
||||
}
|
||||
challengeOptions.request.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${accessToken.token}`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.authorizeRequestOnTenantChallenge = authorizeRequestOnTenantChallenge;
|
||||
/**
|
||||
* Extracts the tenant id from the challenge information
|
||||
* The tenant id is contained in the authorization_uri as the first
|
||||
* path part.
|
||||
*/
|
||||
function extractTenantId(challengeInfo) {
|
||||
const parsedAuthUri = new URL(challengeInfo.authorization_uri);
|
||||
const pathSegments = parsedAuthUri.pathname.split("/");
|
||||
const tenantId = pathSegments[1];
|
||||
if (tenantId && isUuid(tenantId)) {
|
||||
return tenantId;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Builds the authentication scopes based on the information that comes in the
|
||||
* challenge information. Scopes url is present in the resource_id, if it is empty
|
||||
* we keep using the original scopes.
|
||||
*/
|
||||
function buildScopes(challengeOptions, challengeInfo) {
|
||||
if (!challengeInfo.resource_id) {
|
||||
return challengeOptions.scopes;
|
||||
}
|
||||
const challengeScopes = new URL(challengeInfo.resource_id);
|
||||
challengeScopes.pathname = Constants.DefaultScope;
|
||||
let scope = challengeScopes.toString();
|
||||
if (scope === "https://disk.azure.com/.default") {
|
||||
// the extra slash is required by the service
|
||||
scope = "https://disk.azure.com//.default";
|
||||
}
|
||||
return [scope];
|
||||
}
|
||||
/**
|
||||
* We will retrieve the challenge only if the response status code was 401,
|
||||
* and if the response contained the header "WWW-Authenticate" with a non-empty value.
|
||||
*/
|
||||
function getChallenge(response) {
|
||||
const challenge = response.headers.get("WWW-Authenticate");
|
||||
if (response.status === 401 && challenge) {
|
||||
return challenge;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Converts: `Bearer a="b" c="d"`.
|
||||
* Into: `[ { a: 'b', c: 'd' }]`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
function parseChallenge(challenge) {
|
||||
const bearerChallenge = challenge.slice("Bearer ".length);
|
||||
const challengeParts = `${bearerChallenge.trim()} `.split(" ").filter((x) => x);
|
||||
const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split("=")));
|
||||
// Key-value pairs to plain object:
|
||||
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
|
||||
}
|
||||
/**
|
||||
* Extracts the options form a Pipeline Request for later re-use
|
||||
*/
|
||||
function requestToOptions(request) {
|
||||
return {
|
||||
abortSignal: request.abortSignal,
|
||||
requestOptions: {
|
||||
timeout: request.timeout,
|
||||
},
|
||||
tracingOptions: request.tracingOptions,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=authorizeRequestOnTenantChallenge.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/authorizeRequestOnTenantChallenge.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
node_modules/@azure/core-client/dist/commonjs/base64.d.ts
generated
vendored
Normal file
25
node_modules/@azure/core-client/dist/commonjs/base64.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Encodes a string in base64 format.
|
||||
* @param value - the string to encode
|
||||
* @internal
|
||||
*/
|
||||
export declare function encodeString(value: string): string;
|
||||
/**
|
||||
* Encodes a byte array in base64 format.
|
||||
* @param value - the Uint8Aray to encode
|
||||
* @internal
|
||||
*/
|
||||
export declare function encodeByteArray(value: Uint8Array): string;
|
||||
/**
|
||||
* Decodes a base64 string into a byte array.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
export declare function decodeString(value: string): Uint8Array;
|
||||
/**
|
||||
* Decodes a base64 string into a string.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
export declare function decodeStringToString(value: string): string;
|
||||
//# sourceMappingURL=base64.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/base64.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/base64.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/base64.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
||||
43
node_modules/@azure/core-client/dist/commonjs/base64.js
generated
vendored
Normal file
43
node_modules/@azure/core-client/dist/commonjs/base64.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeStringToString = exports.decodeString = exports.encodeByteArray = exports.encodeString = void 0;
|
||||
/**
|
||||
* Encodes a string in base64 format.
|
||||
* @param value - the string to encode
|
||||
* @internal
|
||||
*/
|
||||
function encodeString(value) {
|
||||
return Buffer.from(value).toString("base64");
|
||||
}
|
||||
exports.encodeString = encodeString;
|
||||
/**
|
||||
* Encodes a byte array in base64 format.
|
||||
* @param value - the Uint8Aray to encode
|
||||
* @internal
|
||||
*/
|
||||
function encodeByteArray(value) {
|
||||
const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
|
||||
return bufferValue.toString("base64");
|
||||
}
|
||||
exports.encodeByteArray = encodeByteArray;
|
||||
/**
|
||||
* Decodes a base64 string into a byte array.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
function decodeString(value) {
|
||||
return Buffer.from(value, "base64");
|
||||
}
|
||||
exports.decodeString = decodeString;
|
||||
/**
|
||||
* Decodes a base64 string into a string.
|
||||
* @param value - the base64 string to decode
|
||||
* @internal
|
||||
*/
|
||||
function decodeStringToString(value) {
|
||||
return Buffer.from(value, "base64").toString();
|
||||
}
|
||||
exports.decodeStringToString = decodeStringToString;
|
||||
//# sourceMappingURL=base64.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/base64.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/base64.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/base64.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAFD,oCAEC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,KAAiB;IAC/C,MAAM,WAAW,GAAG,KAAK,YAAY,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAqB,CAAC,CAAC;IAC/F,OAAO,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC;AAHD,0CAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AACjD,CAAC;AAFD,oDAEC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Encodes a string in base64 format.\n * @param value - the string to encode\n * @internal\n */\nexport function encodeString(value: string): string {\n return Buffer.from(value).toString(\"base64\");\n}\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - the Uint8Aray to encode\n * @internal\n */\nexport function encodeByteArray(value: Uint8Array): string {\n const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer as ArrayBuffer);\n return bufferValue.toString(\"base64\");\n}\n\n/**\n * Decodes a base64 string into a byte array.\n * @param value - the base64 string to decode\n * @internal\n */\nexport function decodeString(value: string): Uint8Array {\n return Buffer.from(value, \"base64\");\n}\n\n/**\n * Decodes a base64 string into a string.\n * @param value - the base64 string to decode\n * @internal\n */\nexport function decodeStringToString(value: string): string {\n return Buffer.from(value, \"base64\").toString();\n}\n"]}
|
||||
45
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.d.ts
generated
vendored
Normal file
45
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { SerializerOptions, XmlOptions } from "./interfaces.js";
|
||||
import { PipelinePolicy } from "@azure/core-rest-pipeline";
|
||||
/**
|
||||
* The programmatic identifier of the deserializationPolicy.
|
||||
*/
|
||||
export declare const deserializationPolicyName = "deserializationPolicy";
|
||||
/**
|
||||
* Options to configure API response deserialization.
|
||||
*/
|
||||
export interface DeserializationPolicyOptions {
|
||||
/**
|
||||
* Configures the expected content types for the deserialization of
|
||||
* JSON and XML response bodies.
|
||||
*/
|
||||
expectedContentTypes?: DeserializationContentTypes;
|
||||
/**
|
||||
* A function that is able to parse XML. Required for XML support.
|
||||
*/
|
||||
parseXML?: (str: string, opts?: XmlOptions) => Promise<any>;
|
||||
/**
|
||||
* Configures behavior of xml parser and builder.
|
||||
*/
|
||||
serializerOptions?: SerializerOptions;
|
||||
}
|
||||
/**
|
||||
* The content-types that will indicate that an operation response should be deserialized in a
|
||||
* particular way.
|
||||
*/
|
||||
export interface DeserializationContentTypes {
|
||||
/**
|
||||
* The content-types that indicate that an operation response should be deserialized as JSON.
|
||||
* Defaults to [ "application/json", "text/json" ].
|
||||
*/
|
||||
json?: string[];
|
||||
/**
|
||||
* The content-types that indicate that an operation response should be deserialized as XML.
|
||||
* Defaults to [ "application/xml", "application/atom+xml" ].
|
||||
*/
|
||||
xml?: string[];
|
||||
}
|
||||
/**
|
||||
* This policy handles parsing out responses according to OperationSpecs on the request.
|
||||
*/
|
||||
export declare function deserializationPolicy(options?: DeserializationPolicyOptions): PipelinePolicy;
|
||||
//# sourceMappingURL=deserializationPolicy.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"deserializationPolicy.d.ts","sourceRoot":"","sources":["../../src/deserializationPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,iBAAiB,EAEjB,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAOnC;;GAEG;AACH,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,2BAA2B,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAE5D;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,4BAAiC,GAAG,cAAc,CA0BhG"}
|
||||
235
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.js
generated
vendored
Normal file
235
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.deserializationPolicy = exports.deserializationPolicyName = void 0;
|
||||
const interfaces_js_1 = require("./interfaces.js");
|
||||
const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
|
||||
const serializer_js_1 = require("./serializer.js");
|
||||
const operationHelpers_js_1 = require("./operationHelpers.js");
|
||||
const defaultJsonContentTypes = ["application/json", "text/json"];
|
||||
const defaultXmlContentTypes = ["application/xml", "application/atom+xml"];
|
||||
/**
|
||||
* The programmatic identifier of the deserializationPolicy.
|
||||
*/
|
||||
exports.deserializationPolicyName = "deserializationPolicy";
|
||||
/**
|
||||
* This policy handles parsing out responses according to OperationSpecs on the request.
|
||||
*/
|
||||
function deserializationPolicy(options = {}) {
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
const jsonContentTypes = (_b = (_a = options.expectedContentTypes) === null || _a === void 0 ? void 0 : _a.json) !== null && _b !== void 0 ? _b : defaultJsonContentTypes;
|
||||
const xmlContentTypes = (_d = (_c = options.expectedContentTypes) === null || _c === void 0 ? void 0 : _c.xml) !== null && _d !== void 0 ? _d : defaultXmlContentTypes;
|
||||
const parseXML = options.parseXML;
|
||||
const serializerOptions = options.serializerOptions;
|
||||
const updatedOptions = {
|
||||
xml: {
|
||||
rootName: (_e = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.rootName) !== null && _e !== void 0 ? _e : "",
|
||||
includeRoot: (_f = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.includeRoot) !== null && _f !== void 0 ? _f : false,
|
||||
xmlCharKey: (_g = serializerOptions === null || serializerOptions === void 0 ? void 0 : serializerOptions.xml.xmlCharKey) !== null && _g !== void 0 ? _g : interfaces_js_1.XML_CHARKEY,
|
||||
},
|
||||
};
|
||||
return {
|
||||
name: exports.deserializationPolicyName,
|
||||
async sendRequest(request, next) {
|
||||
const response = await next(request);
|
||||
return deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, updatedOptions, parseXML);
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.deserializationPolicy = deserializationPolicy;
|
||||
function getOperationResponseMap(parsedResponse) {
|
||||
let result;
|
||||
const request = parsedResponse.request;
|
||||
const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request);
|
||||
const operationSpec = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationSpec;
|
||||
if (operationSpec) {
|
||||
if (!(operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationResponseGetter)) {
|
||||
result = operationSpec.responses[parsedResponse.status];
|
||||
}
|
||||
else {
|
||||
result = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationResponseGetter(operationSpec, parsedResponse);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function shouldDeserializeResponse(parsedResponse) {
|
||||
const request = parsedResponse.request;
|
||||
const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(request);
|
||||
const shouldDeserialize = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.shouldDeserialize;
|
||||
let result;
|
||||
if (shouldDeserialize === undefined) {
|
||||
result = true;
|
||||
}
|
||||
else if (typeof shouldDeserialize === "boolean") {
|
||||
result = shouldDeserialize;
|
||||
}
|
||||
else {
|
||||
result = shouldDeserialize(parsedResponse);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, options, parseXML) {
|
||||
const parsedResponse = await parse(jsonContentTypes, xmlContentTypes, response, options, parseXML);
|
||||
if (!shouldDeserializeResponse(parsedResponse)) {
|
||||
return parsedResponse;
|
||||
}
|
||||
const operationInfo = (0, operationHelpers_js_1.getOperationRequestInfo)(parsedResponse.request);
|
||||
const operationSpec = operationInfo === null || operationInfo === void 0 ? void 0 : operationInfo.operationSpec;
|
||||
if (!operationSpec || !operationSpec.responses) {
|
||||
return parsedResponse;
|
||||
}
|
||||
const responseSpec = getOperationResponseMap(parsedResponse);
|
||||
const { error, shouldReturnResponse } = handleErrorResponse(parsedResponse, operationSpec, responseSpec, options);
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
else if (shouldReturnResponse) {
|
||||
return parsedResponse;
|
||||
}
|
||||
// An operation response spec does exist for current status code, so
|
||||
// use it to deserialize the response.
|
||||
if (responseSpec) {
|
||||
if (responseSpec.bodyMapper) {
|
||||
let valueToDeserialize = parsedResponse.parsedBody;
|
||||
if (operationSpec.isXML && responseSpec.bodyMapper.type.name === serializer_js_1.MapperTypeNames.Sequence) {
|
||||
valueToDeserialize =
|
||||
typeof valueToDeserialize === "object"
|
||||
? valueToDeserialize[responseSpec.bodyMapper.xmlElementName]
|
||||
: [];
|
||||
}
|
||||
try {
|
||||
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
|
||||
}
|
||||
catch (deserializeError) {
|
||||
const restError = new core_rest_pipeline_1.RestError(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, {
|
||||
statusCode: parsedResponse.status,
|
||||
request: parsedResponse.request,
|
||||
response: parsedResponse,
|
||||
});
|
||||
throw restError;
|
||||
}
|
||||
}
|
||||
else if (operationSpec.httpMethod === "HEAD") {
|
||||
// head methods never have a body, but we return a boolean to indicate presence/absence of the resource
|
||||
parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
|
||||
}
|
||||
if (responseSpec.headersMapper) {
|
||||
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJSON(), "operationRes.parsedHeaders", { xml: {}, ignoreUnknownProperties: true });
|
||||
}
|
||||
}
|
||||
return parsedResponse;
|
||||
}
|
||||
function isOperationSpecEmpty(operationSpec) {
|
||||
const expectedStatusCodes = Object.keys(operationSpec.responses);
|
||||
return (expectedStatusCodes.length === 0 ||
|
||||
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
|
||||
}
|
||||
function handleErrorResponse(parsedResponse, operationSpec, responseSpec, options) {
|
||||
var _a;
|
||||
const isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
|
||||
const isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
|
||||
? isSuccessByStatus
|
||||
: !!responseSpec;
|
||||
if (isExpectedStatusCode) {
|
||||
if (responseSpec) {
|
||||
if (!responseSpec.isError) {
|
||||
return { error: null, shouldReturnResponse: false };
|
||||
}
|
||||
}
|
||||
else {
|
||||
return { error: null, shouldReturnResponse: false };
|
||||
}
|
||||
}
|
||||
const errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default;
|
||||
const initialErrorMessage = ((_a = parsedResponse.request.streamResponseStatusCodes) === null || _a === void 0 ? void 0 : _a.has(parsedResponse.status))
|
||||
? `Unexpected status code: ${parsedResponse.status}`
|
||||
: parsedResponse.bodyAsText;
|
||||
const error = new core_rest_pipeline_1.RestError(initialErrorMessage, {
|
||||
statusCode: parsedResponse.status,
|
||||
request: parsedResponse.request,
|
||||
response: parsedResponse,
|
||||
});
|
||||
// If the item failed but there's no error spec or default spec to deserialize the error,
|
||||
// we should fail so we just throw the parsed response
|
||||
if (!errorResponseSpec) {
|
||||
throw error;
|
||||
}
|
||||
const defaultBodyMapper = errorResponseSpec.bodyMapper;
|
||||
const defaultHeadersMapper = errorResponseSpec.headersMapper;
|
||||
try {
|
||||
// If error response has a body, try to deserialize it using default body mapper.
|
||||
// Then try to extract error code & message from it
|
||||
if (parsedResponse.parsedBody) {
|
||||
const parsedBody = parsedResponse.parsedBody;
|
||||
let deserializedError;
|
||||
if (defaultBodyMapper) {
|
||||
let valueToDeserialize = parsedBody;
|
||||
if (operationSpec.isXML && defaultBodyMapper.type.name === serializer_js_1.MapperTypeNames.Sequence) {
|
||||
valueToDeserialize = [];
|
||||
const elementName = defaultBodyMapper.xmlElementName;
|
||||
if (typeof parsedBody === "object" && elementName) {
|
||||
valueToDeserialize = parsedBody[elementName];
|
||||
}
|
||||
}
|
||||
deserializedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody", options);
|
||||
}
|
||||
const internalError = parsedBody.error || deserializedError || parsedBody;
|
||||
error.code = internalError.code;
|
||||
if (internalError.message) {
|
||||
error.message = internalError.message;
|
||||
}
|
||||
if (defaultBodyMapper) {
|
||||
error.response.parsedBody = deserializedError;
|
||||
}
|
||||
}
|
||||
// If error response has headers, try to deserialize it using default header mapper
|
||||
if (parsedResponse.headers && defaultHeadersMapper) {
|
||||
error.response.parsedHeaders =
|
||||
operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.toJSON(), "operationRes.parsedHeaders");
|
||||
}
|
||||
}
|
||||
catch (defaultError) {
|
||||
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody - "${parsedResponse.bodyAsText}" for the default response.`;
|
||||
}
|
||||
return { error, shouldReturnResponse: false };
|
||||
}
|
||||
async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts, parseXML) {
|
||||
var _a;
|
||||
if (!((_a = operationResponse.request.streamResponseStatusCodes) === null || _a === void 0 ? void 0 : _a.has(operationResponse.status)) &&
|
||||
operationResponse.bodyAsText) {
|
||||
const text = operationResponse.bodyAsText;
|
||||
const contentType = operationResponse.headers.get("Content-Type") || "";
|
||||
const contentComponents = !contentType
|
||||
? []
|
||||
: contentType.split(";").map((component) => component.toLowerCase());
|
||||
try {
|
||||
if (contentComponents.length === 0 ||
|
||||
contentComponents.some((component) => jsonContentTypes.indexOf(component) !== -1)) {
|
||||
operationResponse.parsedBody = JSON.parse(text);
|
||||
return operationResponse;
|
||||
}
|
||||
else if (contentComponents.some((component) => xmlContentTypes.indexOf(component) !== -1)) {
|
||||
if (!parseXML) {
|
||||
throw new Error("Parsing XML not supported.");
|
||||
}
|
||||
const body = await parseXML(text, opts.xml);
|
||||
operationResponse.parsedBody = body;
|
||||
return operationResponse;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
const msg = `Error "${err}" occurred while parsing the response body - ${operationResponse.bodyAsText}.`;
|
||||
const errCode = err.code || core_rest_pipeline_1.RestError.PARSE_ERROR;
|
||||
const e = new core_rest_pipeline_1.RestError(msg, {
|
||||
code: errCode,
|
||||
statusCode: operationResponse.status,
|
||||
request: operationResponse.request,
|
||||
response: operationResponse,
|
||||
});
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return operationResponse;
|
||||
}
|
||||
//# sourceMappingURL=deserializationPolicy.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/deserializationPolicy.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-client/dist/commonjs/httpClientCache.d.ts
generated
vendored
Normal file
3
node_modules/@azure/core-client/dist/commonjs/httpClientCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { HttpClient } from "@azure/core-rest-pipeline";
|
||||
export declare function getCachedDefaultHttpClient(): HttpClient;
|
||||
//# sourceMappingURL=httpClientCache.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/httpClientCache.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/httpClientCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpClientCache.d.ts","sourceRoot":"","sources":["../../src/httpClientCache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA2B,MAAM,2BAA2B,CAAC;AAIhF,wBAAgB,0BAA0B,IAAI,UAAU,CAMvD"}
|
||||
15
node_modules/@azure/core-client/dist/commonjs/httpClientCache.js
generated
vendored
Normal file
15
node_modules/@azure/core-client/dist/commonjs/httpClientCache.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getCachedDefaultHttpClient = void 0;
|
||||
const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
|
||||
let cachedHttpClient;
|
||||
function getCachedDefaultHttpClient() {
|
||||
if (!cachedHttpClient) {
|
||||
cachedHttpClient = (0, core_rest_pipeline_1.createDefaultHttpClient)();
|
||||
}
|
||||
return cachedHttpClient;
|
||||
}
|
||||
exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient;
|
||||
//# sourceMappingURL=httpClientCache.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/httpClientCache.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/httpClientCache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpClientCache.js","sourceRoot":"","sources":["../../src/httpClientCache.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,kEAAgF;AAEhF,IAAI,gBAAwC,CAAC;AAE7C,SAAgB,0BAA0B;IACxC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,GAAG,IAAA,4CAAuB,GAAE,CAAC;IAC/C,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAND,gEAMC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { HttpClient, createDefaultHttpClient } from \"@azure/core-rest-pipeline\";\n\nlet cachedHttpClient: HttpClient | undefined;\n\nexport function getCachedDefaultHttpClient(): HttpClient {\n if (!cachedHttpClient) {\n cachedHttpClient = createDefaultHttpClient();\n }\n\n return cachedHttpClient;\n}\n"]}
|
||||
9
node_modules/@azure/core-client/dist/commonjs/index.d.ts
generated
vendored
Normal file
9
node_modules/@azure/core-client/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { createSerializer, MapperTypeNames } from "./serializer.js";
|
||||
export { ServiceClient, ServiceClientOptions } from "./serviceClient.js";
|
||||
export { createClientPipeline, InternalClientPipelineOptions } from "./pipeline.js";
|
||||
export { OperationSpec, OperationArguments, OperationOptions, OperationResponseMap, OperationParameter, OperationQueryParameter, OperationURLParameter, Serializer, BaseMapper, Mapper, MapperType, SimpleMapperType, EnumMapper, EnumMapperType, SequenceMapper, SequenceMapperType, DictionaryMapper, DictionaryMapperType, CompositeMapper, CompositeMapperType, MapperConstraints, OperationRequest, OperationRequestOptions, OperationRequestInfo, QueryCollectionFormat, ParameterPath, FullOperationResponse, PolymorphicDiscriminator, SpanConfig, XML_ATTRKEY, XML_CHARKEY, XmlOptions, SerializerOptions, RawResponseCallback, CommonClientOptions, AdditionalPolicyConfig, } from "./interfaces.js";
|
||||
export { deserializationPolicy, deserializationPolicyName, DeserializationPolicyOptions, DeserializationContentTypes, } from "./deserializationPolicy.js";
|
||||
export { serializationPolicy, serializationPolicyName, SerializationPolicyOptions, } from "./serializationPolicy.js";
|
||||
export { authorizeRequestOnClaimChallenge } from "./authorizeRequestOnClaimChallenge.js";
|
||||
export { authorizeRequestOnTenantChallenge } from "./authorizeRequestOnTenantChallenge.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC"}
|
||||
26
node_modules/@azure/core-client/dist/commonjs/index.js
generated
vendored
Normal file
26
node_modules/@azure/core-client/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.authorizeRequestOnTenantChallenge = exports.authorizeRequestOnClaimChallenge = exports.serializationPolicyName = exports.serializationPolicy = exports.deserializationPolicyName = exports.deserializationPolicy = exports.XML_CHARKEY = exports.XML_ATTRKEY = exports.createClientPipeline = exports.ServiceClient = exports.MapperTypeNames = exports.createSerializer = void 0;
|
||||
var serializer_js_1 = require("./serializer.js");
|
||||
Object.defineProperty(exports, "createSerializer", { enumerable: true, get: function () { return serializer_js_1.createSerializer; } });
|
||||
Object.defineProperty(exports, "MapperTypeNames", { enumerable: true, get: function () { return serializer_js_1.MapperTypeNames; } });
|
||||
var serviceClient_js_1 = require("./serviceClient.js");
|
||||
Object.defineProperty(exports, "ServiceClient", { enumerable: true, get: function () { return serviceClient_js_1.ServiceClient; } });
|
||||
var pipeline_js_1 = require("./pipeline.js");
|
||||
Object.defineProperty(exports, "createClientPipeline", { enumerable: true, get: function () { return pipeline_js_1.createClientPipeline; } });
|
||||
var interfaces_js_1 = require("./interfaces.js");
|
||||
Object.defineProperty(exports, "XML_ATTRKEY", { enumerable: true, get: function () { return interfaces_js_1.XML_ATTRKEY; } });
|
||||
Object.defineProperty(exports, "XML_CHARKEY", { enumerable: true, get: function () { return interfaces_js_1.XML_CHARKEY; } });
|
||||
var deserializationPolicy_js_1 = require("./deserializationPolicy.js");
|
||||
Object.defineProperty(exports, "deserializationPolicy", { enumerable: true, get: function () { return deserializationPolicy_js_1.deserializationPolicy; } });
|
||||
Object.defineProperty(exports, "deserializationPolicyName", { enumerable: true, get: function () { return deserializationPolicy_js_1.deserializationPolicyName; } });
|
||||
var serializationPolicy_js_1 = require("./serializationPolicy.js");
|
||||
Object.defineProperty(exports, "serializationPolicy", { enumerable: true, get: function () { return serializationPolicy_js_1.serializationPolicy; } });
|
||||
Object.defineProperty(exports, "serializationPolicyName", { enumerable: true, get: function () { return serializationPolicy_js_1.serializationPolicyName; } });
|
||||
var authorizeRequestOnClaimChallenge_js_1 = require("./authorizeRequestOnClaimChallenge.js");
|
||||
Object.defineProperty(exports, "authorizeRequestOnClaimChallenge", { enumerable: true, get: function () { return authorizeRequestOnClaimChallenge_js_1.authorizeRequestOnClaimChallenge; } });
|
||||
var authorizeRequestOnTenantChallenge_js_1 = require("./authorizeRequestOnTenantChallenge.js");
|
||||
Object.defineProperty(exports, "authorizeRequestOnTenantChallenge", { enumerable: true, get: function () { return authorizeRequestOnTenantChallenge_js_1.authorizeRequestOnTenantChallenge; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,iDAAoE;AAA3D,iHAAA,gBAAgB,OAAA;AAAE,gHAAA,eAAe,OAAA;AAC1C,uDAAyE;AAAhE,iHAAA,aAAa,OAAA;AACtB,6CAAoF;AAA3E,mHAAA,oBAAoB,OAAA;AAC7B,iDAqCyB;AAPvB,4GAAA,WAAW,OAAA;AACX,4GAAA,WAAW,OAAA;AAOb,uEAKoC;AAJlC,iIAAA,qBAAqB,OAAA;AACrB,qIAAA,yBAAyB,OAAA;AAI3B,mEAIkC;AAHhC,6HAAA,mBAAmB,OAAA;AACnB,iIAAA,uBAAuB,OAAA;AAGzB,6FAAyF;AAAhF,uJAAA,gCAAgC,OAAA;AACzC,+FAA2F;AAAlF,yJAAA,iCAAiC,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { createSerializer, MapperTypeNames } from \"./serializer.js\";\nexport { ServiceClient, ServiceClientOptions } from \"./serviceClient.js\";\nexport { createClientPipeline, InternalClientPipelineOptions } from \"./pipeline.js\";\nexport {\n OperationSpec,\n OperationArguments,\n OperationOptions,\n OperationResponseMap,\n OperationParameter,\n OperationQueryParameter,\n OperationURLParameter,\n Serializer,\n BaseMapper,\n Mapper,\n MapperType,\n SimpleMapperType,\n EnumMapper,\n EnumMapperType,\n SequenceMapper,\n SequenceMapperType,\n DictionaryMapper,\n DictionaryMapperType,\n CompositeMapper,\n CompositeMapperType,\n MapperConstraints,\n OperationRequest,\n OperationRequestOptions,\n OperationRequestInfo,\n QueryCollectionFormat,\n ParameterPath,\n FullOperationResponse,\n PolymorphicDiscriminator,\n SpanConfig,\n XML_ATTRKEY,\n XML_CHARKEY,\n XmlOptions,\n SerializerOptions,\n RawResponseCallback,\n CommonClientOptions,\n AdditionalPolicyConfig,\n} from \"./interfaces.js\";\nexport {\n deserializationPolicy,\n deserializationPolicyName,\n DeserializationPolicyOptions,\n DeserializationContentTypes,\n} from \"./deserializationPolicy.js\";\nexport {\n serializationPolicy,\n serializationPolicyName,\n SerializationPolicyOptions,\n} from \"./serializationPolicy.js\";\nexport { authorizeRequestOnClaimChallenge } from \"./authorizeRequestOnClaimChallenge.js\";\nexport { authorizeRequestOnTenantChallenge } from \"./authorizeRequestOnTenantChallenge.js\";\n"]}
|
||||
14
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.d.ts
generated
vendored
Normal file
14
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { OperationParameter, OperationSpec } from "./interfaces.js";
|
||||
/**
|
||||
* Gets the list of status codes for streaming responses.
|
||||
* @internal
|
||||
*/
|
||||
export declare function getStreamingResponseStatusCodes(operationSpec: OperationSpec): Set<number>;
|
||||
/**
|
||||
* Get the path to this parameter's value as a dotted string (a.b.c).
|
||||
* @param parameter - The parameter to get the path string for.
|
||||
* @returns The path to this parameter's value as a dotted string.
|
||||
* @internal
|
||||
*/
|
||||
export declare function getPathStringFromParameter(parameter: OperationParameter): string;
|
||||
//# sourceMappingURL=interfaceHelpers.d.ts.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaceHelpers.d.ts","sourceRoot":"","sources":["../../src/interfaceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGpE;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAYzF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,kBAAkB,GAAG,MAAM,CAWhF"}
|
||||
44
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.js
generated
vendored
Normal file
44
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPathStringFromParameter = exports.getStreamingResponseStatusCodes = void 0;
|
||||
const serializer_js_1 = require("./serializer.js");
|
||||
/**
|
||||
* Gets the list of status codes for streaming responses.
|
||||
* @internal
|
||||
*/
|
||||
function getStreamingResponseStatusCodes(operationSpec) {
|
||||
const result = new Set();
|
||||
for (const statusCode in operationSpec.responses) {
|
||||
const operationResponse = operationSpec.responses[statusCode];
|
||||
if (operationResponse.bodyMapper &&
|
||||
operationResponse.bodyMapper.type.name === serializer_js_1.MapperTypeNames.Stream) {
|
||||
result.add(Number(statusCode));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.getStreamingResponseStatusCodes = getStreamingResponseStatusCodes;
|
||||
/**
|
||||
* Get the path to this parameter's value as a dotted string (a.b.c).
|
||||
* @param parameter - The parameter to get the path string for.
|
||||
* @returns The path to this parameter's value as a dotted string.
|
||||
* @internal
|
||||
*/
|
||||
function getPathStringFromParameter(parameter) {
|
||||
const { parameterPath, mapper } = parameter;
|
||||
let result;
|
||||
if (typeof parameterPath === "string") {
|
||||
result = parameterPath;
|
||||
}
|
||||
else if (Array.isArray(parameterPath)) {
|
||||
result = parameterPath.join(".");
|
||||
}
|
||||
else {
|
||||
result = mapper.serializedName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.getPathStringFromParameter = getPathStringFromParameter;
|
||||
//# sourceMappingURL=interfaceHelpers.js.map
|
||||
1
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-client/dist/commonjs/interfaceHelpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaceHelpers.js","sourceRoot":"","sources":["../../src/interfaceHelpers.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,mDAAkD;AAElD;;;GAGG;AACH,SAAgB,+BAA+B,CAAC,aAA4B;IAC1E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,KAAK,MAAM,UAAU,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QACjD,MAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC9D,IACE,iBAAiB,CAAC,UAAU;YAC5B,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,+BAAe,CAAC,MAAM,EACjE,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,0EAYC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,SAA6B;IACtE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5C,IAAI,MAAc,CAAC;IACnB,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,GAAG,aAAa,CAAC;IACzB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,MAAM,CAAC,cAAe,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,gEAWC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationParameter, OperationSpec } from \"./interfaces.js\";\nimport { MapperTypeNames } from \"./serializer.js\";\n\n/**\n * Gets the list of status codes for streaming responses.\n * @internal\n */\nexport function getStreamingResponseStatusCodes(operationSpec: OperationSpec): Set<number> {\n const result = new Set<number>();\n for (const statusCode in operationSpec.responses) {\n const operationResponse = operationSpec.responses[statusCode];\n if (\n operationResponse.bodyMapper &&\n operationResponse.bodyMapper.type.name === MapperTypeNames.Stream\n ) {\n result.add(Number(statusCode));\n }\n }\n return result;\n}\n\n/**\n * Get the path to this parameter's value as a dotted string (a.b.c).\n * @param parameter - The parameter to get the path string for.\n * @returns The path to this parameter's value as a dotted string.\n * @internal\n */\nexport function getPathStringFromParameter(parameter: OperationParameter): string {\n const { parameterPath, mapper } = parameter;\n let result: string;\n if (typeof parameterPath === \"string\") {\n result = parameterPath;\n } else if (Array.isArray(parameterPath)) {\n result = parameterPath.join(\".\");\n } else {\n result = mapper.serializedName!;\n }\n return result;\n}\n"]}
|
||||
664
node_modules/@azure/core-client/dist/commonjs/interfaces.d.ts
generated
vendored
Normal file
664
node_modules/@azure/core-client/dist/commonjs/interfaces.d.ts
generated
vendored
Normal file
@@ -0,0 +1,664 @@
|
||||
import { HttpClient, HttpMethods, PipelineOptions, PipelinePolicy, PipelineRequest, PipelineResponse, TransferProgressEvent } from "@azure/core-rest-pipeline";
|
||||
import { AbortSignalLike } from "@azure/abort-controller";
|
||||
import { OperationTracingOptions } from "@azure/core-tracing";
|
||||
/**
|
||||
* Default key used to access the XML attributes.
|
||||
*/
|
||||
export declare const XML_ATTRKEY = "$";
|
||||
/**
|
||||
* Default key used to access the XML value content.
|
||||
*/
|
||||
export declare const XML_CHARKEY = "_";
|
||||
/**
|
||||
* Options to govern behavior of xml parser and builder.
|
||||
*/
|
||||
export interface XmlOptions {
|
||||
/**
|
||||
* indicates the name of the root element in the resulting XML when building XML.
|
||||
*/
|
||||
rootName?: string;
|
||||
/**
|
||||
* indicates whether the root element is to be included or not in the output when parsing XML.
|
||||
*/
|
||||
includeRoot?: boolean;
|
||||
/**
|
||||
* key used to access the XML value content when parsing XML.
|
||||
*/
|
||||
xmlCharKey?: string;
|
||||
}
|
||||
/**
|
||||
* Options to configure serialization/de-serialization behavior.
|
||||
*/
|
||||
export interface SerializerOptions {
|
||||
/**
|
||||
* Options to configure xml parser/builder behavior.
|
||||
*/
|
||||
xml: XmlOptions;
|
||||
/**
|
||||
* Normally additional properties are included in the result object, even if there is no mapper for them.
|
||||
* This flag disables this behavior when true. It is used when parsing headers to avoid polluting the result object.
|
||||
*/
|
||||
ignoreUnknownProperties?: boolean;
|
||||
}
|
||||
export type RequiredSerializerOptions = {
|
||||
[K in keyof SerializerOptions]: Required<SerializerOptions[K]>;
|
||||
};
|
||||
/**
|
||||
* A type alias for future proofing.
|
||||
*/
|
||||
export type OperationRequest = PipelineRequest;
|
||||
/**
|
||||
* Metadata that is used to properly parse a response.
|
||||
*/
|
||||
export interface OperationRequestInfo {
|
||||
/**
|
||||
* Used to parse the response.
|
||||
*/
|
||||
operationSpec?: OperationSpec;
|
||||
/**
|
||||
* Used to encode the request.
|
||||
*/
|
||||
operationArguments?: OperationArguments;
|
||||
/**
|
||||
* A function that returns the proper OperationResponseMap for the given OperationSpec and
|
||||
* PipelineResponse combination. If this is undefined, then a simple status code lookup will
|
||||
* be used.
|
||||
*/
|
||||
operationResponseGetter?: (operationSpec: OperationSpec, response: PipelineResponse) => undefined | OperationResponseMap;
|
||||
/**
|
||||
* Whether or not the PipelineResponse should be deserialized. Defaults to true.
|
||||
*/
|
||||
shouldDeserialize?: boolean | ((response: PipelineResponse) => boolean);
|
||||
}
|
||||
/**
|
||||
* The base options type for all operations.
|
||||
*/
|
||||
export interface OperationOptions {
|
||||
/**
|
||||
* The signal which can be used to abort requests.
|
||||
*/
|
||||
abortSignal?: AbortSignalLike;
|
||||
/**
|
||||
* Options used when creating and sending HTTP requests for this operation.
|
||||
*/
|
||||
requestOptions?: OperationRequestOptions;
|
||||
/**
|
||||
* Options used when tracing is enabled.
|
||||
*/
|
||||
tracingOptions?: OperationTracingOptions;
|
||||
/**
|
||||
* Options to override serialization/de-serialization behavior.
|
||||
*/
|
||||
serializerOptions?: SerializerOptions;
|
||||
/**
|
||||
* A function to be called each time a response is received from the server
|
||||
* while performing the requested operation.
|
||||
* May be called multiple times.
|
||||
*/
|
||||
onResponse?: RawResponseCallback;
|
||||
}
|
||||
/**
|
||||
* Options used when creating and sending HTTP requests for this operation.
|
||||
*/
|
||||
export interface OperationRequestOptions {
|
||||
/**
|
||||
* User defined custom request headers that
|
||||
* will be applied before the request is sent.
|
||||
*/
|
||||
customHeaders?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/**
|
||||
* The number of milliseconds a request can take before automatically being terminated.
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Callback which fires upon upload progress.
|
||||
*/
|
||||
onUploadProgress?: (progress: TransferProgressEvent) => void;
|
||||
/**
|
||||
* Callback which fires upon download progress.
|
||||
*/
|
||||
onDownloadProgress?: (progress: TransferProgressEvent) => void;
|
||||
/**
|
||||
* Whether or not the HttpOperationResponse should be deserialized. If this is undefined, then the
|
||||
* HttpOperationResponse should be deserialized.
|
||||
*/
|
||||
shouldDeserialize?: boolean | ((response: PipelineResponse) => boolean);
|
||||
/**
|
||||
* Set to true if the request is sent over HTTP instead of HTTPS
|
||||
*/
|
||||
allowInsecureConnection?: boolean;
|
||||
}
|
||||
/**
|
||||
* A collection of properties that apply to a single invocation of an operation.
|
||||
*/
|
||||
export interface OperationArguments {
|
||||
/**
|
||||
* The parameters that were passed to the operation method.
|
||||
*/
|
||||
[parameterName: string]: unknown;
|
||||
/**
|
||||
* The optional arguments that are provided to an operation.
|
||||
*/
|
||||
options?: OperationOptions;
|
||||
}
|
||||
/**
|
||||
* The format that will be used to join an array of values together for a query parameter value.
|
||||
*/
|
||||
export type QueryCollectionFormat = "CSV" | "SSV" | "TSV" | "Pipes" | "Multi";
|
||||
/**
|
||||
* Encodes how to reach a particular property on an object.
|
||||
*/
|
||||
export type ParameterPath = string | string[] | {
|
||||
[propertyName: string]: ParameterPath;
|
||||
};
|
||||
/**
|
||||
* A common interface that all Operation parameter's extend.
|
||||
*/
|
||||
export interface OperationParameter {
|
||||
/**
|
||||
* The path to this parameter's value in OperationArguments or the object that contains paths for
|
||||
* each property's value in OperationArguments.
|
||||
*/
|
||||
parameterPath: ParameterPath;
|
||||
/**
|
||||
* The mapper that defines how to validate and serialize this parameter's value.
|
||||
*/
|
||||
mapper: Mapper;
|
||||
}
|
||||
/**
|
||||
* A parameter for an operation that will be substituted into the operation's request URL.
|
||||
*/
|
||||
export interface OperationURLParameter extends OperationParameter {
|
||||
/**
|
||||
* Whether or not to skip encoding the URL parameter's value before adding it to the URL.
|
||||
*/
|
||||
skipEncoding?: boolean;
|
||||
}
|
||||
/**
|
||||
* A parameter for an operation that will be added as a query parameter to the operation's HTTP
|
||||
* request.
|
||||
*/
|
||||
export interface OperationQueryParameter extends OperationParameter {
|
||||
/**
|
||||
* Whether or not to skip encoding the query parameter's value before adding it to the URL.
|
||||
*/
|
||||
skipEncoding?: boolean;
|
||||
/**
|
||||
* If this query parameter's value is a collection, what type of format should the value be
|
||||
* converted to.
|
||||
*/
|
||||
collectionFormat?: QueryCollectionFormat;
|
||||
}
|
||||
/**
|
||||
* An OperationResponse that can be returned from an operation request for a single status code.
|
||||
*/
|
||||
export interface OperationResponseMap {
|
||||
/**
|
||||
* The mapper that will be used to deserialize the response headers.
|
||||
*/
|
||||
headersMapper?: Mapper;
|
||||
/**
|
||||
* The mapper that will be used to deserialize the response body.
|
||||
*/
|
||||
bodyMapper?: Mapper;
|
||||
/**
|
||||
* Indicates if this is an error response
|
||||
*/
|
||||
isError?: boolean;
|
||||
}
|
||||
/**
|
||||
* A specification that defines an operation.
|
||||
*/
|
||||
export interface OperationSpec {
|
||||
/**
|
||||
* The serializer to use in this operation.
|
||||
*/
|
||||
readonly serializer: Serializer;
|
||||
/**
|
||||
* The HTTP method that should be used by requests for this operation.
|
||||
*/
|
||||
readonly httpMethod: HttpMethods;
|
||||
/**
|
||||
* The URL that was provided in the service's specification. This will still have all of the URL
|
||||
* template variables in it. If this is not provided when the OperationSpec is created, then it
|
||||
* will be populated by a "baseUri" property on the ServiceClient.
|
||||
*/
|
||||
readonly baseUrl?: string;
|
||||
/**
|
||||
* The fixed path for this operation's URL. This will still have all of the URL template variables
|
||||
* in it.
|
||||
*/
|
||||
readonly path?: string;
|
||||
/**
|
||||
* The content type of the request body. This value will be used as the "Content-Type" header if
|
||||
* it is provided.
|
||||
*/
|
||||
readonly contentType?: string;
|
||||
/**
|
||||
* The media type of the request body.
|
||||
* This value can be used to aide in serialization if it is provided.
|
||||
*/
|
||||
readonly mediaType?: "json" | "xml" | "form" | "binary" | "multipart" | "text" | "unknown" | string;
|
||||
/**
|
||||
* The parameter that will be used to construct the HTTP request's body.
|
||||
*/
|
||||
readonly requestBody?: OperationParameter;
|
||||
/**
|
||||
* Whether or not this operation uses XML request and response bodies.
|
||||
*/
|
||||
readonly isXML?: boolean;
|
||||
/**
|
||||
* The parameters to the operation method that will be substituted into the constructed URL.
|
||||
*/
|
||||
readonly urlParameters?: ReadonlyArray<OperationURLParameter>;
|
||||
/**
|
||||
* The parameters to the operation method that will be added to the constructed URL's query.
|
||||
*/
|
||||
readonly queryParameters?: ReadonlyArray<OperationQueryParameter>;
|
||||
/**
|
||||
* The parameters to the operation method that will be converted to headers on the operation's
|
||||
* HTTP request.
|
||||
*/
|
||||
readonly headerParameters?: ReadonlyArray<OperationParameter>;
|
||||
/**
|
||||
* The parameters to the operation method that will be used to create a formdata body for the
|
||||
* operation's HTTP request.
|
||||
*/
|
||||
readonly formDataParameters?: ReadonlyArray<OperationParameter>;
|
||||
/**
|
||||
* The different types of responses that this operation can return based on what status code is
|
||||
* returned.
|
||||
*/
|
||||
readonly responses: {
|
||||
[responseCode: string]: OperationResponseMap;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Wrapper object for http request and response. Deserialized object is stored in
|
||||
* the `parsedBody` property when the response body is received in JSON or XML.
|
||||
*/
|
||||
export interface FullOperationResponse extends PipelineResponse {
|
||||
/**
|
||||
* The parsed HTTP response headers.
|
||||
*/
|
||||
parsedHeaders?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* The response body as parsed JSON or XML.
|
||||
*/
|
||||
parsedBody?: any;
|
||||
/**
|
||||
* The request that generated the response.
|
||||
*/
|
||||
request: OperationRequest;
|
||||
}
|
||||
/**
|
||||
* A function to be called each time a response is received from the server
|
||||
* while performing the requested operation.
|
||||
* May be called multiple times.
|
||||
*/
|
||||
export type RawResponseCallback = (rawResponse: FullOperationResponse, flatResponse: unknown, error?: unknown) => void;
|
||||
/**
|
||||
* Used to map raw response objects to final shapes.
|
||||
* Helps packing and unpacking Dates and other encoded types that are not intrinsic to JSON.
|
||||
* Also allows pulling values from headers, as well as inserting default values and constants.
|
||||
*/
|
||||
export interface Serializer {
|
||||
/**
|
||||
* The provided model mapper.
|
||||
*/
|
||||
readonly modelMappers: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Whether the contents are XML or not.
|
||||
*/
|
||||
readonly isXML: boolean;
|
||||
/**
|
||||
* Validates constraints, if any. This function will throw if the provided value does not respect those constraints.
|
||||
* @param mapper - The definition of data models.
|
||||
* @param value - The value.
|
||||
* @param objectName - Name of the object. Used in the error messages.
|
||||
* @deprecated Removing the constraints validation on client side.
|
||||
*/
|
||||
validateConstraints(mapper: Mapper, value: any, objectName: string): void;
|
||||
/**
|
||||
* Serialize the given object based on its metadata defined in the mapper.
|
||||
*
|
||||
* @param mapper - The mapper which defines the metadata of the serializable object.
|
||||
* @param object - A valid Javascript object to be serialized.
|
||||
* @param objectName - Name of the serialized object.
|
||||
* @param options - additional options to deserialization.
|
||||
* @returns A valid serialized Javascript object.
|
||||
*/
|
||||
serialize(mapper: Mapper, object: any, objectName?: string, options?: SerializerOptions): any;
|
||||
/**
|
||||
* Deserialize the given object based on its metadata defined in the mapper.
|
||||
*
|
||||
* @param mapper - The mapper which defines the metadata of the serializable object.
|
||||
* @param responseBody - A valid Javascript entity to be deserialized.
|
||||
* @param objectName - Name of the deserialized object.
|
||||
* @param options - Controls behavior of XML parser and builder.
|
||||
* @returns A valid deserialized Javascript object.
|
||||
*/
|
||||
deserialize(mapper: Mapper, responseBody: any, objectName: string, options?: SerializerOptions): any;
|
||||
}
|
||||
/**
|
||||
* Description of various value constraints such as integer ranges and string regex.
|
||||
*/
|
||||
export interface MapperConstraints {
|
||||
/**
|
||||
* The value should be less than or equal to the `InclusiveMaximum` value.
|
||||
*/
|
||||
InclusiveMaximum?: number;
|
||||
/**
|
||||
* The value should be less than the `ExclusiveMaximum` value.
|
||||
*/
|
||||
ExclusiveMaximum?: number;
|
||||
/**
|
||||
* The value should be greater than or equal to the `InclusiveMinimum` value.
|
||||
*/
|
||||
InclusiveMinimum?: number;
|
||||
/**
|
||||
* The value should be greater than the `InclusiveMinimum` value.
|
||||
*/
|
||||
ExclusiveMinimum?: number;
|
||||
/**
|
||||
* The length should be smaller than the `MaxLength`.
|
||||
*/
|
||||
MaxLength?: number;
|
||||
/**
|
||||
* The length should be bigger than the `MinLength`.
|
||||
*/
|
||||
MinLength?: number;
|
||||
/**
|
||||
* The value must match the pattern.
|
||||
*/
|
||||
Pattern?: RegExp;
|
||||
/**
|
||||
* The value must contain fewer items than the MaxItems value.
|
||||
*/
|
||||
MaxItems?: number;
|
||||
/**
|
||||
* The value must contain more items than the `MinItems` value.
|
||||
*/
|
||||
MinItems?: number;
|
||||
/**
|
||||
* The value must contain only unique items.
|
||||
*/
|
||||
UniqueItems?: true;
|
||||
/**
|
||||
* The value should be exactly divisible by the `MultipleOf` value.
|
||||
*/
|
||||
MultipleOf?: number;
|
||||
}
|
||||
/**
|
||||
* Type of the mapper. Includes known mappers.
|
||||
*/
|
||||
export type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType;
|
||||
/**
|
||||
* The type of a simple mapper.
|
||||
*/
|
||||
export interface SimpleMapperType {
|
||||
/**
|
||||
* Name of the type of the property.
|
||||
*/
|
||||
name: "Base64Url" | "Boolean" | "ByteArray" | "Date" | "DateTime" | "DateTimeRfc1123" | "Object" | "Stream" | "String" | "TimeSpan" | "UnixTime" | "Uuid" | "Number" | "any";
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to map a set of properties of an object based on other mappers.
|
||||
*
|
||||
* Only one of the following properties should be present: `className`, `modelProperties` and `additionalProperties`.
|
||||
*/
|
||||
export interface CompositeMapperType {
|
||||
/**
|
||||
* Name of the composite mapper type.
|
||||
*/
|
||||
name: "Composite";
|
||||
/**
|
||||
* Use `className` to reference another type definition.
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Use `modelProperties` when the reference to the other type has been resolved.
|
||||
*/
|
||||
modelProperties?: {
|
||||
[propertyName: string]: Mapper;
|
||||
};
|
||||
/**
|
||||
* Used when a model has `additionalProperties: true`. Allows the generic processing of unnamed model properties on the response object.
|
||||
*/
|
||||
additionalProperties?: Mapper;
|
||||
/**
|
||||
* The name of the top-most parent scheme, the one that has no parents.
|
||||
*/
|
||||
uberParent?: string;
|
||||
/**
|
||||
* A polymorphic discriminator.
|
||||
*/
|
||||
polymorphicDiscriminator?: PolymorphicDiscriminator;
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to parse a sequence of mapped values.
|
||||
*/
|
||||
export interface SequenceMapperType {
|
||||
/**
|
||||
* Name of the sequence type mapper.
|
||||
*/
|
||||
name: "Sequence";
|
||||
/**
|
||||
* The mapper to use to map each one of the properties of the sequence.
|
||||
*/
|
||||
element: Mapper;
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to parse a dictionary of mapped values.
|
||||
*/
|
||||
export interface DictionaryMapperType {
|
||||
/**
|
||||
* Name of the sequence type mapper.
|
||||
*/
|
||||
name: "Dictionary";
|
||||
/**
|
||||
* The mapper to use to map the value of each property in the dictionary.
|
||||
*/
|
||||
value: Mapper;
|
||||
}
|
||||
/**
|
||||
* Helps build a mapper that describes how to parse an enum value.
|
||||
*/
|
||||
export interface EnumMapperType {
|
||||
/**
|
||||
* Name of the enum type mapper.
|
||||
*/
|
||||
name: "Enum";
|
||||
/**
|
||||
* Values allowed by this mapper.
|
||||
*/
|
||||
allowedValues: any[];
|
||||
}
|
||||
/**
|
||||
* The base definition of a mapper. Can be used for XML and plain JavaScript objects.
|
||||
*/
|
||||
export interface BaseMapper {
|
||||
/**
|
||||
* Name for the xml element
|
||||
*/
|
||||
xmlName?: string;
|
||||
/**
|
||||
* Xml element namespace
|
||||
*/
|
||||
xmlNamespace?: string;
|
||||
/**
|
||||
* Xml element namespace prefix
|
||||
*/
|
||||
xmlNamespacePrefix?: string;
|
||||
/**
|
||||
* Determines if the current property should be serialized as an attribute of the parent xml element
|
||||
*/
|
||||
xmlIsAttribute?: boolean;
|
||||
/**
|
||||
* Determines if the current property should be serialized as the inner content of the xml element
|
||||
*/
|
||||
xmlIsMsText?: boolean;
|
||||
/**
|
||||
* Name for the xml elements when serializing an array
|
||||
*/
|
||||
xmlElementName?: string;
|
||||
/**
|
||||
* Whether or not the current property should have a wrapping XML element
|
||||
*/
|
||||
xmlIsWrapped?: boolean;
|
||||
/**
|
||||
* Whether or not the current property is readonly
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
/**
|
||||
* Whether or not the current property is a constant
|
||||
*/
|
||||
isConstant?: boolean;
|
||||
/**
|
||||
* Whether or not the current property is required
|
||||
*/
|
||||
required?: boolean;
|
||||
/**
|
||||
* Whether or not the current property allows mull as a value
|
||||
*/
|
||||
nullable?: boolean;
|
||||
/**
|
||||
* The name to use when serializing
|
||||
*/
|
||||
serializedName?: string;
|
||||
/**
|
||||
* Type of the mapper
|
||||
*/
|
||||
type: MapperType;
|
||||
/**
|
||||
* Default value when one is not explicitly provided
|
||||
*/
|
||||
defaultValue?: any;
|
||||
/**
|
||||
* Constraints to test the current value against
|
||||
*/
|
||||
constraints?: MapperConstraints;
|
||||
}
|
||||
/**
|
||||
* Mappers are definitions of the data models used in the library.
|
||||
* These data models are part of the Operation or Client definitions in the responses or parameters.
|
||||
*/
|
||||
export type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper;
|
||||
/**
|
||||
* Used to disambiguate discriminated type unions.
|
||||
* For example, if response can have many shapes but also includes a 'kind' field (or similar),
|
||||
* that field can be used to determine how to deserialize the response to the correct type.
|
||||
*/
|
||||
export interface PolymorphicDiscriminator {
|
||||
/**
|
||||
* Name of the discriminant property in the original JSON payload, e.g. `@odata.kind`.
|
||||
*/
|
||||
serializedName: string;
|
||||
/**
|
||||
* Name to use on the resulting object instead of the original property name.
|
||||
* Useful since the JSON property could be difficult to work with.
|
||||
* For example: For a field received as `@odata.kind`, the final object could instead include a property simply named `kind`.
|
||||
*/
|
||||
clientName: string;
|
||||
/**
|
||||
* It may contain any other property.
|
||||
*/
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* A mapper composed of other mappers.
|
||||
*/
|
||||
export interface CompositeMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `CompositeMapper`.
|
||||
*/
|
||||
type: CompositeMapperType;
|
||||
}
|
||||
/**
|
||||
* A mapper describing arrays.
|
||||
*/
|
||||
export interface SequenceMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `SequenceMapper`.
|
||||
*/
|
||||
type: SequenceMapperType;
|
||||
}
|
||||
/**
|
||||
* A mapper describing plain JavaScript objects used as key/value pairs.
|
||||
*/
|
||||
export interface DictionaryMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `DictionaryMapper`.
|
||||
*/
|
||||
type: DictionaryMapperType;
|
||||
/**
|
||||
* Optionally, a prefix to add to the header collection.
|
||||
*/
|
||||
headerCollectionPrefix?: string;
|
||||
}
|
||||
/**
|
||||
* A mapper describing an enum value.
|
||||
*/
|
||||
export interface EnumMapper extends BaseMapper {
|
||||
/**
|
||||
* The type descriptor of the `EnumMapper`.
|
||||
*/
|
||||
type: EnumMapperType;
|
||||
}
|
||||
export interface UrlParameterValue {
|
||||
value: string;
|
||||
skipUrlEncoding: boolean;
|
||||
}
|
||||
/**
|
||||
* Configuration for creating a new Tracing Span
|
||||
*/
|
||||
export interface SpanConfig {
|
||||
/**
|
||||
* Package name prefix
|
||||
*/
|
||||
packagePrefix: string;
|
||||
/**
|
||||
* Service namespace
|
||||
*/
|
||||
namespace: string;
|
||||
}
|
||||
/**
|
||||
* Used to configure additional policies added to the pipeline at construction.
|
||||
*/
|
||||
export interface AdditionalPolicyConfig {
|
||||
/**
|
||||
* A policy to be added.
|
||||
*/
|
||||
policy: PipelinePolicy;
|
||||
/**
|
||||
* Determines if this policy be applied before or after retry logic.
|
||||
* Only use `perRetry` if you need to modify the request again
|
||||
* each time the operation is retried due to retryable service
|
||||
* issues.
|
||||
*/
|
||||
position: "perCall" | "perRetry";
|
||||
}
|
||||
/**
|
||||
* The common set of options that high level clients are expected to expose.
|
||||
*/
|
||||
export interface CommonClientOptions extends PipelineOptions {
|
||||
/**
|
||||
* The HttpClient that will be used to send HTTP requests.
|
||||
*/
|
||||
httpClient?: HttpClient;
|
||||
/**
|
||||
* Set to true if the request is sent over HTTP instead of HTTPS
|
||||
*/
|
||||
allowInsecureConnection?: boolean;
|
||||
/**
|
||||
* Additional policies to include in the HTTP pipeline.
|
||||
*/
|
||||
additionalPolicies?: AdditionalPolicyConfig[];
|
||||
}
|
||||
//# sourceMappingURL=interfaces.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user