feat: add @actions/cache

This commit is contained in:
xHyroM 2022-07-12 09:00:22 +02:00
parent b15fb7d098
commit 16e8c96a41
1932 changed files with 261172 additions and 10 deletions

View file

@ -0,0 +1,16 @@
/**
* Encodes a string in base64 format.
* @param value the string to encode
*/
export declare function encodeString(value: string): string;
/**
* Encodes a byte array in base64 format.
* @param value the Uint8Aray to encode
*/
export declare function encodeByteArray(value: Uint8Array): string;
/**
* Decodes a base64 string into a byte array.
* @param value the base64 string to decode
*/
export declare function decodeString(value: string): Uint8Array;
//# sourceMappingURL=base64.browser.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"base64.browser.d.ts","sourceRoot":"","sources":["../../../lib/util/base64.browser.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMzD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAOtD"}

View file

@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
/**
* Encodes a string in base64 format.
* @param value the string to encode
*/
export function encodeString(value) {
return btoa(value);
}
/**
* Encodes a byte array in base64 format.
* @param value the Uint8Aray to encode
*/
export function encodeByteArray(value) {
var str = "";
for (var 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
*/
export function decodeString(value) {
var byteString = atob(value);
var arr = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
arr[i] = byteString.charCodeAt(i);
}
return arr;
}
//# sourceMappingURL=base64.browser.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"base64.browser.js","sourceRoot":"","sources":["../../../lib/util/base64.browser.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED;;;GAGG;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;QACrC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACtC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAM,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;QAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACnC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}

16
node_modules/@azure/ms-rest-js/es/lib/util/base64.d.ts generated vendored Normal file
View file

@ -0,0 +1,16 @@
/**
* Encodes a string in base64 format.
* @param value the string to encode
*/
export declare function encodeString(value: string): string;
/**
* Encodes a byte array in base64 format.
* @param value the Uint8Aray to encode
*/
export declare function encodeByteArray(value: Uint8Array): string;
/**
* Decodes a base64 string into a byte array.
* @param value the base64 string to decode
*/
export declare function decodeString(value: string): Uint8Array;
//# sourceMappingURL=base64.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../lib/util/base64.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAKzD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD"}

27
node_modules/@azure/ms-rest-js/es/lib/util/base64.js generated vendored Normal file
View file

@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
/**
* Encodes a string in base64 format.
* @param value the string to encode
*/
export function encodeString(value) {
return Buffer.from(value).toString("base64");
}
/**
* Encodes a byte array in base64 format.
* @param value the Uint8Aray to encode
*/
export function encodeByteArray(value) {
// Buffer.from accepts <ArrayBuffer> | <SharedArrayBuffer>-- the TypeScript definition is off here
// https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
var bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
return bufferValue.toString("base64");
}
/**
* Decodes a base64 string into a byte array.
* @param value the base64 string to decode
*/
export function decodeString(value) {
return Buffer.from(value, "base64");
}
//# sourceMappingURL=base64.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../lib/util/base64.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,kGAAkG;IAClG,mGAAmG;IACnG,IAAM,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;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC"}

View file

@ -0,0 +1,94 @@
export declare const Constants: {
/**
* The ms-rest version
* @const
* @type {string}
*/
msRestVersion: string;
/**
* Specifies HTTP.
*
* @const
* @type {string}
*/
HTTP: string;
/**
* Specifies HTTPS.
*
* @const
* @type {string}
*/
HTTPS: string;
/**
* Specifies HTTP Proxy.
*
* @const
* @type {string}
*/
HTTP_PROXY: string;
/**
* Specifies HTTPS Proxy.
*
* @const
* @type {string}
*/
HTTPS_PROXY: string;
/**
* Specifies NO Proxy.
*/
NO_PROXY: string;
/**
* Specifies ALL Proxy.
*/
ALL_PROXY: string;
HttpConstants: {
/**
* Http Verbs
*
* @const
* @enum {string}
*/
HttpVerbs: {
PUT: string;
GET: string;
DELETE: string;
POST: string;
MERGE: string;
HEAD: string;
PATCH: string;
};
StatusCodes: {
TooManyRequests: number;
};
};
/**
* Defines constants for use with HTTP headers.
*/
HeaderConstants: {
/**
* The Authorization header.
*
* @const
* @type {string}
*/
AUTHORIZATION: string;
AUTHORIZATION_SCHEME: string;
/**
* The Retry-After response-header field can be used with a 503 (Service
* Unavailable) or 349 (Too Many Requests) responses to indicate how long
* the service is expected to be unavailable to the requesting client.
*
* @const
* @type {string}
*/
RETRY_AFTER: string;
/**
* The UserAgent header.
*
* @const
* @type {string}
*/
USER_AGENT: string;
};
};
//# sourceMappingURL=constants.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../lib/util/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;IACpB;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH;;OAEG;;;QAID;;;;;WAKG;;;;;;;;;;;;;;IAgBL;;OAEG;;QAED;;;;;WAKG;;;QAKH;;;;;;;WAOG;;QAGH;;;;;WAKG;;;CAGN,CAAC"}

View file

@ -0,0 +1,96 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
export var Constants = {
/**
* The ms-rest version
* @const
* @type {string}
*/
msRestVersion: "2.6.1",
/**
* Specifies HTTP.
*
* @const
* @type {string}
*/
HTTP: "http:",
/**
* Specifies HTTPS.
*
* @const
* @type {string}
*/
HTTPS: "https:",
/**
* Specifies HTTP Proxy.
*
* @const
* @type {string}
*/
HTTP_PROXY: "HTTP_PROXY",
/**
* Specifies HTTPS Proxy.
*
* @const
* @type {string}
*/
HTTPS_PROXY: "HTTPS_PROXY",
/**
* Specifies NO Proxy.
*/
NO_PROXY: "NO_PROXY",
/**
* Specifies ALL Proxy.
*/
ALL_PROXY: "ALL_PROXY",
HttpConstants: {
/**
* Http Verbs
*
* @const
* @enum {string}
*/
HttpVerbs: {
PUT: "PUT",
GET: "GET",
DELETE: "DELETE",
POST: "POST",
MERGE: "MERGE",
HEAD: "HEAD",
PATCH: "PATCH",
},
StatusCodes: {
TooManyRequests: 429,
},
},
/**
* Defines constants for use with HTTP headers.
*/
HeaderConstants: {
/**
* The Authorization header.
*
* @const
* @type {string}
*/
AUTHORIZATION: "authorization",
AUTHORIZATION_SCHEME: "Bearer",
/**
* The Retry-After response-header field can be used with a 503 (Service
* Unavailable) or 349 (Too Many Requests) responses to indicate how long
* the service is expected to be unavailable to the requesting client.
*
* @const
* @type {string}
*/
RETRY_AFTER: "Retry-After",
/**
* The UserAgent header.
*
* @const
* @type {string}
*/
USER_AGENT: "User-Agent",
},
};
//# sourceMappingURL=constants.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../lib/util/constants.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,MAAM,CAAC,IAAM,SAAS,GAAG;IACvB;;;;OAIG;IACH,aAAa,EAAE,OAAO;IAEtB;;;;;OAKG;IACH,IAAI,EAAE,OAAO;IAEb;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,UAAU,EAAE,YAAY;IAExB;;;;;OAKG;IACH,WAAW,EAAE,aAAa;IAE1B;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB,aAAa,EAAE;QACb;;;;;WAKG;QACH,SAAS,EAAE;YACT,GAAG,EAAE,KAAK;YACV,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;SACf;QAED,WAAW,EAAE;YACX,eAAe,EAAE,GAAG;SACrB;KACF;IAED;;OAEG;IACH,eAAe,EAAE;QACf;;;;;WAKG;QACH,aAAa,EAAE,eAAe;QAE9B,oBAAoB,EAAE,QAAQ;QAE9B;;;;;;;WAOG;QACH,WAAW,EAAE,aAAa;QAE1B;;;;;WAKG;QACH,UAAU,EAAE,YAAY;KACzB;CACF,CAAC"}

157
node_modules/@azure/ms-rest-js/es/lib/util/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,157 @@
import { HttpOperationResponse } from "../httpOperationResponse";
import { RestError } from "../restError";
import { WebResourceLike } from "../webResource";
/**
* A constant that indicates whether the environment is node.js or browser based.
*/
export declare const isNode: boolean;
/**
* Checks if a parsed URL is HTTPS
*
* @param {object} urlToCheck The url to check
* @return {boolean} True if the URL is HTTPS; false otherwise.
*/
export declare function urlIsHTTPS(urlToCheck: {
protocol: string;
}): boolean;
/**
* Encodes an URI.
*
* @param {string} uri The URI to be encoded.
* @return {string} The encoded URI.
*/
export declare function encodeUri(uri: string): string;
/**
* Returns a stripped version of the Http Response which only contains body,
* headers and the status.
*
* @param {HttpOperationResponse} response The Http Response
*
* @return {object} The stripped version of Http Response.
*/
export declare function stripResponse(response: HttpOperationResponse): any;
/**
* Returns a stripped version of the Http Request that does not contain the
* Authorization header.
*
* @param {WebResource} request The Http Request object
*
* @return {WebResource} The stripped version of Http Request.
*/
export declare function stripRequest(request: WebResourceLike): WebResourceLike;
/**
* Validates the given uuid as a string
*
* @param {string} uuid The uuid as a string that needs to be validated
*
* @return {boolean} True if the uuid is valid; false otherwise.
*/
export declare function isValidUuid(uuid: string): boolean;
/**
* Provides an array of values of an object. For example
* for a given object { "a": "foo", "b": "bar" }, the method returns ["foo", "bar"].
*
* @param {object} obj An object whose properties need to be enumerated so that it"s values can be provided as an array
*
* @return {any[]} An array of values of the given object.
*/
export declare function objectValues(obj: {
[key: string]: any;
}): any[];
/**
* Generated UUID
*
* @return {string} RFC4122 v4 UUID.
*/
export declare function generateUuid(): string;
/**
* Executes an array of promises sequentially. Inspiration of this method is here:
* https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html. An awesome blog on promises!
*
* @param {Array} promiseFactories An array of promise factories(A function that return a promise)
*
* @param {any} [kickstart] Input to the first promise that is used to kickstart the promise chain.
* If not provided then the promise chain starts with undefined.
*
* @return A chain of resolved or rejected promises
*/
export declare function executePromisesSequentially(promiseFactories: Array<any>, kickstart: any): Promise<any>;
/**
* Merges source object into the target object
* @param {object} source The object that needs to be merged
*
* @param {object} target The object to be merged into
*
* @returns {object} Returns the merged target object.
*/
export declare function mergeObjects(source: {
[key: string]: any;
}, target: {
[key: string]: any;
}): {
[key: string]: any;
};
/**
* A wrapper for setTimeout that resolves a promise after t milliseconds.
* @param {number} t The number of milliseconds to be delayed.
* @param {T} value The value to be resolved with after a timeout of t milliseconds.
* @returns {Promise<T>} Resolved promise
*/
export declare function delay<T>(t: number, value?: T): Promise<T>;
/**
* Service callback that is returned for REST requests initiated by the service client.
*/
export interface ServiceCallback<TResult> {
/**
* A method that will be invoked as a callback to a service function.
* @param {Error | RestError | null} err The error occurred if any, while executing the request; otherwise null.
* @param {TResult} [result] The deserialized response body if an error did not occur.
* @param {WebResourceLike} [request] The raw/actual request sent to the server if an error did not occur.
* @param {HttpOperationResponse} [response] The raw/actual response from the server if an error did not occur.
*/
(err: Error | RestError | null, result?: TResult, request?: WebResourceLike, response?: HttpOperationResponse): void;
}
/**
* Converts a Promise to a callback.
* @param {Promise<any>} promise The Promise to be converted to a callback
* @returns {Function} A function that takes the callback (cb: Function): void
* @deprecated generated code should instead depend on responseToBody
*/
export declare function promiseToCallback(promise: Promise<any>): Function;
/**
* Converts a Promise to a service callback.
* @param {Promise<HttpOperationResponse>} promise - The Promise of HttpOperationResponse to be converted to a service callback
* @returns {Function} A function that takes the service callback (cb: ServiceCallback<T>): void
*/
export declare function promiseToServiceCallback<T>(promise: Promise<HttpOperationResponse>): Function;
export declare function prepareXMLRootList(obj: any, elementName: string): {
[x: string]: any;
};
/**
* Applies the properties on the prototype of sourceCtors to the prototype of targetCtor
* @param {object} targetCtor The target object on which the properties need to be applied.
* @param {Array<object>} sourceCtors An array of source objects from which the properties need to be taken.
*/
export declare function applyMixins(targetCtor: any, sourceCtors: any[]): void;
/**
* Indicates whether the given string is in ISO 8601 format.
* @param {string} value The value to be validated for ISO 8601 duration format.
* @return {boolean} `true` if valid, `false` otherwise.
*/
export declare function isDuration(value: string): boolean;
/**
* Replace all of the instances of searchValue in value with the provided replaceValue.
* @param {string | undefined} value The value to search and replace in.
* @param {string} searchValue The value to search for in the value argument.
* @param {string} replaceValue The value to replace searchValue with in the value argument.
* @returns {string | undefined} The value where each instance of searchValue was replaced with replacedValue.
*/
export declare function replaceAll(value: string | undefined, searchValue: string, replaceValue: string): string | undefined;
/**
* Determines whether the given enity is a basic/primitive type
* (string, number, boolean, null, undefined).
* @param value Any entity
* @return boolean - true is it is primitive type, false otherwise.
*/
export declare function isPrimitiveType(value: any): boolean;
//# sourceMappingURL=utils.d.ts.map

View file

@ -0,0 +1 @@
{"version":3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AAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO;IACtC;;;;;;OAMG;IACH,CACE,GAAG,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,EAC7B,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,IAAI,CAAC;CACT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAcjE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,QAAQ,CAc7F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM;;EAK/D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI,CAMrE;AAID;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAEnD"}

229
node_modules/@azure/ms-rest-js/es/lib/util/utils.js generated vendored Normal file
View file

@ -0,0 +1,229 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
import { v4 as uuidv4 } from "uuid";
import { Constants } from "./constants";
/**
* A constant that indicates whether the environment is node.js or browser based.
*/
export var isNode = typeof process !== "undefined" &&
!!process.version &&
!!process.versions &&
!!process.versions.node;
/**
* Checks if a parsed URL is HTTPS
*
* @param {object} urlToCheck The url to check
* @return {boolean} True if the URL is HTTPS; false otherwise.
*/
export function urlIsHTTPS(urlToCheck) {
return urlToCheck.protocol.toLowerCase() === Constants.HTTPS;
}
/**
* Encodes an URI.
*
* @param {string} uri The URI to be encoded.
* @return {string} The encoded URI.
*/
export function encodeUri(uri) {
return encodeURIComponent(uri)
.replace(/!/g, "%21")
.replace(/"/g, "%27")
.replace(/\(/g, "%28")
.replace(/\)/g, "%29")
.replace(/\*/g, "%2A");
}
/**
* Returns a stripped version of the Http Response which only contains body,
* headers and the status.
*
* @param {HttpOperationResponse} response The Http Response
*
* @return {object} The stripped version of Http Response.
*/
export function stripResponse(response) {
var strippedResponse = {};
strippedResponse.body = response.bodyAsText;
strippedResponse.headers = response.headers;
strippedResponse.status = response.status;
return strippedResponse;
}
/**
* Returns a stripped version of the Http Request that does not contain the
* Authorization header.
*
* @param {WebResource} request The Http Request object
*
* @return {WebResource} The stripped version of Http Request.
*/
export function stripRequest(request) {
var strippedRequest = request.clone();
if (strippedRequest.headers) {
strippedRequest.headers.remove("authorization");
}
return strippedRequest;
}
/**
* Validates the given uuid as a string
*
* @param {string} uuid The uuid as a string that needs to be validated
*
* @return {boolean} True if the uuid is valid; false otherwise.
*/
export function isValidUuid(uuid) {
var validUuidRegex = new RegExp("^[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}$", "ig");
return validUuidRegex.test(uuid);
}
/**
* Provides an array of values of an object. For example
* for a given object { "a": "foo", "b": "bar" }, the method returns ["foo", "bar"].
*
* @param {object} obj An object whose properties need to be enumerated so that it"s values can be provided as an array
*
* @return {any[]} An array of values of the given object.
*/
export function objectValues(obj) {
var result = [];
if (obj && obj instanceof Object) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
result.push(obj[key]);
}
}
}
else {
throw new Error("The provided object " + JSON.stringify(obj, undefined, 2) + " is not a valid object that can be " + "enumerated to provide its values as an array.");
}
return result;
}
/**
* Generated UUID
*
* @return {string} RFC4122 v4 UUID.
*/
export function generateUuid() {
return uuidv4();
}
/**
* Executes an array of promises sequentially. Inspiration of this method is here:
* https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html. An awesome blog on promises!
*
* @param {Array} promiseFactories An array of promise factories(A function that return a promise)
*
* @param {any} [kickstart] Input to the first promise that is used to kickstart the promise chain.
* If not provided then the promise chain starts with undefined.
*
* @return A chain of resolved or rejected promises
*/
export function executePromisesSequentially(promiseFactories, kickstart) {
var result = Promise.resolve(kickstart);
promiseFactories.forEach(function (promiseFactory) {
result = result.then(promiseFactory);
});
return result;
}
/**
* Merges source object into the target object
* @param {object} source The object that needs to be merged
*
* @param {object} target The object to be merged into
*
* @returns {object} Returns the merged target object.
*/
export function mergeObjects(source, target) {
Object.keys(source).forEach(function (key) {
target[key] = source[key];
});
return target;
}
/**
* A wrapper for setTimeout that resolves a promise after t milliseconds.
* @param {number} t The number of milliseconds to be delayed.
* @param {T} value The value to be resolved with after a timeout of t milliseconds.
* @returns {Promise<T>} Resolved promise
*/
export function delay(t, value) {
return new Promise(function (resolve) { return setTimeout(function () { return resolve(value); }, t); });
}
/**
* Converts a Promise to a callback.
* @param {Promise<any>} promise The Promise to be converted to a callback
* @returns {Function} A function that takes the callback (cb: Function): void
* @deprecated generated code should instead depend on responseToBody
*/
export function promiseToCallback(promise) {
if (typeof promise.then !== "function") {
throw new Error("The provided input is not a Promise.");
}
return function (cb) {
promise.then(function (data) {
cb(undefined, data);
}, function (err) {
cb(err);
});
};
}
/**
* Converts a Promise to a service callback.
* @param {Promise<HttpOperationResponse>} promise - The Promise of HttpOperationResponse to be converted to a service callback
* @returns {Function} A function that takes the service callback (cb: ServiceCallback<T>): void
*/
export function promiseToServiceCallback(promise) {
if (typeof promise.then !== "function") {
throw new Error("The provided input is not a Promise.");
}
return function (cb) {
promise.then(function (data) {
process.nextTick(cb, undefined, data.parsedBody, data.request, data);
}, function (err) {
process.nextTick(cb, err);
});
};
}
export function prepareXMLRootList(obj, elementName) {
var _a;
if (!Array.isArray(obj)) {
obj = [obj];
}
return _a = {}, _a[elementName] = obj, _a;
}
/**
* Applies the properties on the prototype of sourceCtors to the prototype of targetCtor
* @param {object} targetCtor The target object on which the properties need to be applied.
* @param {Array<object>} sourceCtors An array of source objects from which the properties need to be taken.
*/
export function applyMixins(targetCtor, sourceCtors) {
sourceCtors.forEach(function (sourceCtors) {
Object.getOwnPropertyNames(sourceCtors.prototype).forEach(function (name) {
targetCtor.prototype[name] = sourceCtors.prototype[name];
});
});
}
var validateISODuration = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
/**
* Indicates whether the given string is in ISO 8601 format.
* @param {string} value The value to be validated for ISO 8601 duration format.
* @return {boolean} `true` if valid, `false` otherwise.
*/
export function isDuration(value) {
return validateISODuration.test(value);
}
/**
* Replace all of the instances of searchValue in value with the provided replaceValue.
* @param {string | undefined} value The value to search and replace in.
* @param {string} searchValue The value to search for in the value argument.
* @param {string} replaceValue The value to replace searchValue with in the value argument.
* @returns {string | undefined} The value where each instance of searchValue was replaced with replacedValue.
*/
export function replaceAll(value, searchValue, replaceValue) {
return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || "");
}
/**
* Determines whether the given enity is a basic/primitive type
* (string, number, boolean, null, undefined).
* @param value Any entity
* @return boolean - true is it is primitive type, false otherwise.
*/
export function isPrimitiveType(value) {
return (typeof value !== "object" && typeof value !== "function") || value === null;
}
//# sourceMappingURL=utils.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot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AK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC;AACtF,CAAC"}

View file

@ -0,0 +1,5 @@
export declare function parseXML(str: string): Promise<any>;
export declare function stringifyXML(obj: any, opts?: {
rootName?: string;
}): string;
//# sourceMappingURL=xml.browser.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"xml.browser.d.ts","sourceRoot":"","sources":["../../../lib/util/xml.browser.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAUlD;AAsFD,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,UAMlE"}

View file

@ -0,0 +1,145 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
var parser = new DOMParser();
export function parseXML(str) {
try {
var dom = parser.parseFromString(str, "application/xml");
throwIfError(dom);
var obj = domToObject(dom.childNodes[0]);
return Promise.resolve(obj);
}
catch (err) {
return Promise.reject(err);
}
}
var errorNS = "";
try {
errorNS = parser.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0]
.namespaceURI;
}
catch (ignored) {
// Most browsers will return a document containing <parsererror>, but IE will throw.
}
function throwIfError(dom) {
if (errorNS) {
var parserErrors = dom.getElementsByTagNameNS(errorNS, "parsererror");
if (parserErrors.length) {
throw new Error(parserErrors.item(0).innerHTML);
}
}
}
function isElement(node) {
return !!node.attributes;
}
/**
* Get the Element-typed version of the provided Node if the provided node is an element with
* attributes. If it isn't, then undefined is returned.
*/
function asElementWithAttributes(node) {
return isElement(node) && node.hasAttributes() ? node : undefined;
}
function domToObject(node) {
var result = {};
var childNodeCount = node.childNodes.length;
var firstChildNode = node.childNodes[0];
var onlyChildTextValue = (firstChildNode &&
childNodeCount === 1 &&
firstChildNode.nodeType === Node.TEXT_NODE &&
firstChildNode.nodeValue) ||
undefined;
var elementWithAttributes = asElementWithAttributes(node);
if (elementWithAttributes) {
result["$"] = {};
for (var i = 0; i < elementWithAttributes.attributes.length; i++) {
var attr = elementWithAttributes.attributes[i];
result["$"][attr.nodeName] = attr.nodeValue;
}
if (onlyChildTextValue) {
result["_"] = onlyChildTextValue;
}
}
else if (childNodeCount === 0) {
result = "";
}
else if (onlyChildTextValue) {
result = onlyChildTextValue;
}
if (!onlyChildTextValue) {
for (var i = 0; i < childNodeCount; i++) {
var child = node.childNodes[i];
// Ignore leading/trailing whitespace nodes
if (child.nodeType !== Node.TEXT_NODE) {
var childObject = domToObject(child);
if (!result[child.nodeName]) {
result[child.nodeName] = childObject;
}
else if (Array.isArray(result[child.nodeName])) {
result[child.nodeName].push(childObject);
}
else {
result[child.nodeName] = [result[child.nodeName], childObject];
}
}
}
}
return result;
}
// tslint:disable-next-line:no-null-keyword
var doc = document.implementation.createDocument(null, null, null);
var serializer = new XMLSerializer();
export function stringifyXML(obj, opts) {
var rootName = (opts && opts.rootName) || "root";
var dom = buildNode(obj, rootName)[0];
return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + serializer.serializeToString(dom));
}
function buildAttributes(attrs) {
var result = [];
for (var _i = 0, _a = Object.keys(attrs); _i < _a.length; _i++) {
var key = _a[_i];
var attr = doc.createAttribute(key);
attr.value = attrs[key].toString();
result.push(attr);
}
return result;
}
function buildNode(obj, elementName) {
if (typeof obj === "string" || typeof obj === "number" || typeof obj === "boolean") {
var elem = doc.createElement(elementName);
elem.textContent = obj.toString();
return [elem];
}
else if (Array.isArray(obj)) {
var result = [];
for (var _i = 0, obj_1 = obj; _i < obj_1.length; _i++) {
var arrayElem = obj_1[_i];
for (var _a = 0, _b = buildNode(arrayElem, elementName); _a < _b.length; _a++) {
var child = _b[_a];
result.push(child);
}
}
return result;
}
else if (typeof obj === "object") {
var elem = doc.createElement(elementName);
for (var _c = 0, _d = Object.keys(obj); _c < _d.length; _c++) {
var key = _d[_c];
if (key === "$") {
for (var _e = 0, _f = buildAttributes(obj[key]); _e < _f.length; _e++) {
var attr = _f[_e];
elem.attributes.setNamedItem(attr);
}
}
else {
for (var _g = 0, _h = buildNode(obj[key], key); _g < _h.length; _g++) {
var child = _h[_g];
elem.appendChild(child);
}
}
}
return [elem];
}
else {
throw new Error("Illegal value passed to buildObject: " + obj);
}
}
//# sourceMappingURL=xml.browser.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"xml.browser.js","sourceRoot":"","sources":["../../../lib/util/xml.browser.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,IAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAC/B,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,IAAI;QACF,IAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;QAC3D,YAAY,CAAC,GAAG,CAAC,CAAC;QAElB,IAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;KAC7B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAC5B;AACH,CAAC;AAED,IAAI,OAAO,GAAG,EAAE,CAAC;AACjB,IAAI;IACF,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;SAC3F,YAAa,CAAC;CAClB;AAAC,OAAO,OAAO,EAAE;IAChB,oFAAoF;CACrF;AAED,SAAS,YAAY,CAAC,GAAa;IACjC,IAAI,OAAO,EAAE;QACX,IAAM,YAAY,GAAG,GAAG,CAAC,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACx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AC,EAAjC,cAAiC,EAAjC,IAAiC,EAAE;gBAAlD,IAAM,KAAK,SAAA;gBACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;QACD,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAClC,IAAM,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAC5C,KAAkB,UAAgB,EAAhB,KAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,EAAE;YAA/B,IAAM,GAAG,SAAA;YACZ,IAAI,GAAG,KAAK,GAAG,EAAE;gBACf,KAAmB,UAAyB,EAAzB,KAAA,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAzB,cAAyB,EAAzB,IAAyB,EAAE;oBAAzC,IAAM,IAAI,SAAA;oBACb,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;iBACpC;aACF;iBAAM;gBACL,KAAoB,UAAwB,EAAxB,KAAA,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAxB,cAAwB,EAAxB,IAAwB,EAAE;oBAAzC,IAAM,KAAK,SAAA;oBACd,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;iBACzB;aACF;SACF;QACD,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,0CAAwC,GAAK,CAAC,CAAC;KAChE;AACH,CAAC"}

5
node_modules/@azure/ms-rest-js/es/lib/util/xml.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
export declare function stringifyXML(obj: any, opts?: {
rootName?: string;
}): string;
export declare function parseXML(str: string): Promise<any>;
//# sourceMappingURL=xml.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../lib/util/xml.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,UAQlE;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAmBlD"}

35
node_modules/@azure/ms-rest-js/es/lib/util/xml.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
import * as xml2js from "xml2js";
export function stringifyXML(obj, opts) {
var builder = new xml2js.Builder({
rootName: (opts || {}).rootName,
renderOpts: {
pretty: false,
},
});
return builder.buildObject(obj);
}
export function parseXML(str) {
var xmlParser = new xml2js.Parser({
explicitArray: false,
explicitCharkey: false,
explicitRoot: false,
});
return new Promise(function (resolve, reject) {
if (!str) {
reject(new Error("Document is empty"));
}
else {
xmlParser.parseString(str, function (err, res) {
if (err) {
reject(err);
}
else {
resolve(res);
}
});
}
});
}
//# sourceMappingURL=xml.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../lib/util/xml.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,UAAU,YAAY,CAAC,GAAQ,EAAE,IAA4B;IACjE,IAAM,OAAO,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;QACjC,QAAQ,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,QAAQ;QAC/B,UAAU,EAAE;YACV,MAAM,EAAE,KAAK;SACd;KACF,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,IAAM,SAAS,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC;QAClC,aAAa,EAAE,KAAK;QACpB,eAAe,EAAE,KAAK;QACtB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IACH,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACjC,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;SACxC;aAAM;YACL,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,UAAC,GAAW,EAAE,GAAS;gBAChD,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}