UNPKG

type2docfx

Version:

A tool to convert json format output from TypeDoc to universal reference model for DocFx to consume.

1,241 lines (1,183 loc) 232 kB
var msRest = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 17); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [0, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); var uuid = __webpack_require__(18); var FormData = __webpack_require__(21); var webResource_1 = __webpack_require__(3); var constants_1 = __webpack_require__(2); var restError_1 = __webpack_require__(7); var httpOperationResponse_1 = __webpack_require__(8); /** * Provides the fetch() method based on the environment. * @returns {fetch} fetch - The fetch() method available in the environment to make requests */ function getFetch() { // using window.Fetch in Edge gives a TypeMismatchError // (https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8546263/). // Hence we will be using the fetch-ponyfill for Edge. if (typeof window !== "undefined" && window.fetch && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf("Edge/") === -1) { return window.fetch.bind(window); } return __webpack_require__(22)({ useCookie: true }).fetch; } exports.getFetch = getFetch; /** * A constant that provides the fetch() method based on the environment. */ exports.myFetch = getFetch(); /** * A constant that indicates whether the environment is node.js or browser based. */ exports.isNode = typeof navigator === "undefined" && typeof process !== "undefined"; /** * Checks if a parsed URL is HTTPS * * @param {object} urlToCheck The url to check * @return {boolean} True if the URL is HTTPS; false otherwise. */ function urlIsHTTPS(urlToCheck) { return urlToCheck.protocol.toLowerCase() === constants_1.Constants.HTTPS; } exports.urlIsHTTPS = urlIsHTTPS; /** * Checks if a value is null or undefined. * * @param {object} value The value to check for null or undefined. * @return {boolean} True if the value is null or undefined, false otherwise. */ // TODO: Audit the usages of this and remove them. // Read: https://medium.com/@basarat/null-vs-undefined-in-typescript-land-dc0c7a5f240a // https://github.com/Microsoft/TypeScript/issues/7426 function objectIsNull(value) { return value === null || value === undefined; } exports.objectIsNull = objectIsNull; /** * Encodes an URI. * * @param {string} uri The URI to be encoded. * @return {string} The encoded URI. */ function encodeUri(uri) { return encodeURIComponent(uri) .replace(/!/g, "%21") .replace(/"/g, "%27") .replace(/\(/g, "%28") .replace(/\)/g, "%29") .replace(/\*/g, "%2A"); } exports.encodeUri = encodeUri; /** * Returns a stripped version of the Http Response which only contains body, * headers and the status. * * @param {nodeFetch.Response} response - The Http Response * * @return {object} strippedResponse - The stripped version of Http Response. */ function stripResponse(response) { var strippedResponse = {}; strippedResponse.body = response.body; strippedResponse.headers = response.headers; strippedResponse.status = response.status; return strippedResponse; } exports.stripResponse = stripResponse; /** * Returns a stripped version of the Http Request that does not contain the * Authorization header. * * @param {object} request - The Http Request object * * @return {object} strippedRequest - The stripped version of Http Request. */ function stripRequest(request) { var strippedRequest = new webResource_1.WebResource(); try { strippedRequest = JSON.parse(JSON.stringify(request)); if (strippedRequest.headers && strippedRequest.headers.Authorization) { delete strippedRequest.headers.Authorization; } else if (strippedRequest.headers && strippedRequest.headers.authorization) { delete strippedRequest.headers.authorization; } } catch (err) { var errMsg = err.message; err.message = "Error - \"" + errMsg + "\" occured while creating a stripped version of the request object - \"" + request + "\"."; return err; } return strippedRequest; } exports.stripRequest = stripRequest; /** * Validates the given uuid as a string * * @param {string} uuid - The uuid as a string that needs to be validated * * @return {boolean} result - True if the uuid is valid; false otherwise. */ 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); } exports.isValidUuid = isValidUuid; /** * 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 {array} result - An array of values of the given object. */ 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; } exports.objectValues = objectValues; /** * Generated UUID * * @return {string} RFC4122 v4 UUID. */ function generateUuid() { return uuid.v4(); } exports.generateUuid = generateUuid; /* * 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 */ function executePromisesSequentially(promiseFactories, kickstart) { var result = Promise.resolve(kickstart); promiseFactories.forEach(function (promiseFactory) { result = result.then(promiseFactory); }); return result; } exports.executePromisesSequentially = executePromisesSequentially; /* * 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} target - Returns the merged target object. */ function mergeObjects(source, target) { Object.keys(source).forEach(function (key) { target[key] = source[key]; }); return target; } exports.mergeObjects = mergeObjects; /** * 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 */ function delay(t, value) { return new Promise(function (resolve) { return setTimeout(function () { return resolve(value); }, t); }); } exports.delay = delay; /** * Utility function to create a K:V from a list of strings */ function strEnum(o) { /* tslint:disable:no-null-keyword */ return o.reduce(function (res, key) { res[key] = key; return res; }, Object.create(null)); /* tslint:enable:no-null-keyword */ } exports.strEnum = strEnum; /** * Converts a Promise to a callback. * @param {Promise<any>} promise - The Promise to be converted to a callback * @returns {Function} fn - A function that takes the callback (cb: Function): void */ 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) { process.nextTick(cb, undefined, data); }, function (err) { process.nextTick(cb, err); }); }; } exports.promiseToCallback = promiseToCallback; /** * Converts a Promise to a service callback. * @param {Promise<HttpOperationResponse>} promise - The Promise of HttpOperationResponse to be converted to a service callback * @returns {Function} fn - A function that takes the service callback (cb: ServiceCallback<T>): void */ 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.bodyAsJson, data.request, data.response); }, function (err) { process.nextTick(cb, err); }); }; } exports.promiseToServiceCallback = promiseToServiceCallback; /** * Sends the request and returns the received response. * @param {WebResource} options - The request to be sent. * @returns {Promise<HttpOperationResponse} operationResponse - The response object. */ function dispatchRequest(options) { return __awaiter(this, void 0, void 0, function () { var formData, requestForm_1, appendFormValue, formKey, formValue, j, res, err_1, operationResponse, _a, err_2, msg, errCode, e, msg, errCode, e; return __generator(this, function (_b) { switch (_b.label) { case 0: if (!options) { return [2 /*return*/, Promise.reject(new Error("options (WebResource) cannot be null or undefined and must be of type object."))]; } if (options.formData) { formData = options.formData; requestForm_1 = new FormData(); appendFormValue = function (key, value) { if (value && value.hasOwnProperty("value") && value.hasOwnProperty("options")) { requestForm_1.append(key, value.value, value.options); } else { requestForm_1.append(key, value); } }; for (formKey in formData) { if (formData.hasOwnProperty(formKey)) { formValue = formData[formKey]; if (formValue instanceof Array) { for (j = 0; j < formValue.length; j++) { appendFormValue(formKey, formValue[j]); } } else { appendFormValue(formKey, formValue); } } } options.body = requestForm_1; options.formData = undefined; if (options.headers && options.headers["Content-Type"] && options.headers["Content-Type"].indexOf("multipart/form-data") > -1 && typeof requestForm_1.getBoundary === "function") { options.headers["Content-Type"] = "multipart/form-data; boundary=" + requestForm_1.getBoundary(); } } _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); return [4 /*yield*/, exports.myFetch(options.url, options)]; case 2: res = _b.sent(); return [3 /*break*/, 4]; case 3: err_1 = _b.sent(); return [2 /*return*/, Promise.reject(err_1)]; case 4: operationResponse = new httpOperationResponse_1.HttpOperationResponse(options, res); if (!!options.rawResponse) return [3 /*break*/, 9]; _b.label = 5; case 5: _b.trys.push([5, 7, , 8]); _a = operationResponse; return [4 /*yield*/, res.text()]; case 6: _a.bodyAsText = _b.sent(); return [3 /*break*/, 8]; case 7: err_2 = _b.sent(); msg = "Error \"" + err_2 + "\" occured while converting the raw response body into string."; errCode = err_2.code || "RAWTEXT_CONVERSION_ERROR"; e = new restError_1.RestError(msg, errCode, res.status, options, res, res.body); return [2 /*return*/, Promise.reject(e)]; case 8: try { if (operationResponse.bodyAsText) { operationResponse.bodyAsJson = JSON.parse(operationResponse.bodyAsText); } } catch (err) { msg = "Error \"" + err + "\" occured while executing JSON.parse on the response body - " + operationResponse.bodyAsText + "."; errCode = err.code || "JSON_PARSE_ERROR"; e = new restError_1.RestError(msg, errCode, res.status, options, res, operationResponse.bodyAsText); return [2 /*return*/, Promise.reject(e)]; } _b.label = 9; case 9: return [2 /*return*/, Promise.resolve(operationResponse)]; } }); }); } exports.dispatchRequest = dispatchRequest; /** * 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. */ function applyMixins(targetCtor, sourceCtors) { sourceCtors.forEach(function (sourceCtors) { Object.getOwnPropertyNames(sourceCtors.prototype).forEach(function (name) { targetCtor.prototype[name] = sourceCtors.prototype[name]; }); }); } exports.applyMixins = applyMixins; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. Object.defineProperty(exports, "__esModule", { value: true }); var BaseFilter = /** @class */ (function () { function BaseFilter() { } BaseFilter.prototype.before = function (request) { return Promise.resolve(request); }; BaseFilter.prototype.after = function (response) { return Promise.resolve(response); }; return BaseFilter; }()); exports.BaseFilter = BaseFilter; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.Constants = { /** * The ms-rest version * @const * @type {string} */ msRestVersion: "0.1.0", /** * 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", HttpConstants: { /** * Http Verbs * * @const * @enum {string} */ HttpVerbs: { PUT: "PUT", GET: "GET", DELETE: "DELETE", POST: "POST", MERGE: "MERGE", HEAD: "HEAD", PATCH: "PATCH" }, }, /** * Defines constants for use with HTTP headers. */ HeaderConstants: { /** * The Authorization header. * * @const * @type {string} */ AUTHORIZATION: "authorization", AUTHORIZATION_SCHEME: "Bearer", /** * The UserAgent header. * * @const * @type {string} */ USER_AGENT: "User-Agent" } }; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = __webpack_require__(0); var serializer_1 = __webpack_require__(9); /** * Creates a new WebResource object. * * This class provides an abstraction over a REST call by being library / implementation agnostic and wrapping the necessary * properties to initiate a request. * * @constructor */ var WebResource = /** @class */ (function () { function WebResource(url, method, body, query, headers, rawResponse) { if (headers === void 0) { headers = {}; } if (rawResponse === void 0) { rawResponse = false; } this.headers = {}; this.rawResponse = rawResponse; this.url = url || ""; this.method = method || "GET"; this.headers = headers || {}; this.body = body; this.query = query; this.formData = undefined; } /** * Validates that the required properties such as method, url, headers["Content-Type"], * headers["accept-language"] are defined. It will throw an error if one of the above * mentioned properties are not defined. */ WebResource.prototype.validateRequestProperties = function () { if (!this.method || !this.url || !this.headers["Content-Type"] || !this.headers["accept-language"]) { throw new Error("method, url, headers[\"Content-Type\"], headers[\"accept-language\"] are " + "required properties before making a request. Either provide them or use WebResource.prepare() method."); } return; }; /** * Prepares the request. * @param {RequestPrepareOptions} options - Options to provide for preparing the request. * @returns {object} WebResource Returns the prepared WebResource (HTTP Request) object that needs to be given to the request pipeline. */ WebResource.prototype.prepare = function (options) { if (options === null || options === undefined || typeof options !== "object") { throw new Error("options cannot be null or undefined and must be of type object"); } if (options.method === null || options.method === undefined || typeof options.method.valueOf() !== "string") { throw new Error("options.method cannot be null or undefined and it must be of type string."); } if (options.url && options.pathTemplate) { throw new Error("options.url and options.pathTemplate are mutually exclusive. Please provide either of them."); } if ((options.pathTemplate === null || options.pathTemplate === undefined || typeof options.pathTemplate.valueOf() !== "string") && (options.url === null || options.url === undefined || typeof options.url.valueOf() !== "string")) { throw new Error("Please provide either options.pathTemplate or options.url. Currently none of them were provided."); } // set the url if it is provided. if (options.url) { if (typeof options.url !== "string") { throw new Error("options.url must be of type \"string\"."); } this.url = options.url; } // set the method if (options.method) { var validMethods = ["GET", "PUT", "HEAD", "DELETE", "OPTIONS", "POST", "PATCH", "TRACE"]; if (validMethods.indexOf(options.method.toUpperCase()) === -1) { throw new Error("The provided method \"" + options.method + "\" is invalid. Supported HTTP methods are: " + JSON.stringify(validMethods)); } } this.method = options.method.toUpperCase(); // construct the url if path template is provided if (options.pathTemplate) { if (typeof options.pathTemplate !== "string") { throw new Error("options.pathTemplate must be of type \"string\"."); } if (!options.baseUrl) { options.baseUrl = "https://management.azure.com"; } var baseUrl = options.baseUrl; var url_1 = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + (options.pathTemplate.startsWith("/") ? options.pathTemplate.slice(1) : options.pathTemplate); var segments = url_1.match(/({\w*\s*\w*})/ig); if (segments && segments.length) { if (options.pathParameters === null || options.pathParameters === undefined || typeof options.pathParameters !== "object") { throw new Error("pathTemplate: " + options.pathTemplate + " has been provided. Hence, options.pathParameters " + "cannot be null or undefined and must be of type \"object\"."); } segments.forEach(function (item) { var pathParamName = item.slice(1, -1); var pathParam = options.pathParameters[pathParamName]; if (pathParam === null || pathParam === undefined || !(typeof pathParam === "string" || typeof pathParam === "object")) { throw new Error("pathTemplate: " + options.pathTemplate + " contains the path parameter " + pathParamName + (" however, it is not present in " + options.pathParameters + " - " + JSON.stringify(options.pathParameters, undefined, 2) + ".") + ("The value of the path parameter can either be a \"string\" of the form { " + pathParamName + ": \"some sample value\" } or ") + ("it can be an \"object\" of the form { \"" + pathParamName + "\": { value: \"some sample value\", skipUrlEncoding: true } }.")); } if (typeof pathParam.valueOf() === "string") { url_1 = url_1.replace(item, encodeURIComponent(pathParam)); } if (typeof pathParam.valueOf() === "object") { if (!pathParam.value) { throw new Error("options.pathParameters[" + pathParamName + "] is of type \"object\" but it does not contain a \"value\" property."); } if (pathParam.skipUrlEncoding) { url_1 = url_1.replace(item, pathParam.value); } else { url_1 = url_1.replace(item, encodeURIComponent(pathParam.value)); } } }); } this.url = url_1; } // append query parameters to the url if they are provided. They can be provided with pathTemplate or url option. if (options.queryParameters) { if (typeof options.queryParameters !== "object") { throw new Error("options.queryParameters must be of type object. It should be a JSON object " + "of \"query-parameter-name\" as the key and the \"query-parameter-value\" as the value. " + "The \"query-parameter-value\" may be fo type \"string\" or an \"object\" of the form { value: \"query-parameter-value\", skipUrlEncoding: true }."); } // append question mark if it is not present in the url if (this.url && this.url.indexOf("?") === -1) { this.url += "?"; } // construct queryString var queryParams = []; var queryParameters = options.queryParameters; // We need to populate this.query as a dictionary if the request is being used for Sway's validateRequest(). this.query = {}; for (var queryParamName in queryParameters) { var queryParam = queryParameters[queryParamName]; if (queryParam) { if (typeof queryParam === "string") { queryParams.push(queryParamName + "=" + encodeURIComponent(queryParam)); this.query[queryParamName] = encodeURIComponent(queryParam); } else if (typeof queryParam === "object") { if (!queryParam.value) { throw new Error("options.queryParameters[" + queryParamName + "] is of type \"object\" but it does not contain a \"value\" property."); } if (queryParam.skipUrlEncoding) { queryParams.push(queryParamName + "=" + queryParam.value); this.query[queryParamName] = queryParam.value; } else { queryParams.push(queryParamName + "=" + encodeURIComponent(queryParam.value)); this.query[queryParamName] = encodeURIComponent(queryParam.value); } } } } // end-of-for // append the queryString this.url += queryParams.join("&"); } // add headers to the request if they are provided if (options.headers) { var headers = options.headers; for (var headerName in headers) { if (headers.hasOwnProperty(headerName)) { this.headers[headerName] = headers[headerName]; } } } // ensure accept-language is set correctly if (!this.headers["accept-language"]) { this.headers["accept-language"] = "en-US"; } // ensure the request-id is set correctly if (!this.headers["x-ms-client-request-id"] && !options.disableClientRequestId) { this.headers["x-ms-client-request-id"] = utils_1.generateUuid(); } // default if (!this.headers["Content-Type"]) { this.headers["Content-Type"] = "application/json; charset=utf-8"; } // set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicilty this.body = undefined; if (options.body !== null && options.body !== undefined) { // body as a stream special case. set the body as-is and check for some special request headers specific to sending a stream. if (options.bodyIsStream) { this.body = options.body; if (!this.headers["Transfer-Encoding"]) { this.headers["Transfer-Encoding"] = "chunked"; } if (this.headers["Content-Type"] !== "application/octet-stream") { this.headers["Content-Type"] = "application/octet-stream"; } } else { var serializedBody = undefined; if (options.serializationMapper) { serializedBody = new serializer_1.Serializer(options.mappers).serialize(options.serializationMapper, options.body, "requestBody"); } if (options.disableJsonStringifyOnBody) { this.body = serializedBody || options.body; } else { this.body = serializedBody ? JSON.stringify(serializedBody) : JSON.stringify(options.body); } } } return this; }; return WebResource; }()); exports.WebResource = WebResource; /***/ }), /* 4 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 5 */ /***/ (function(module, exports) { // Unique ID creation requires a high quality random # generator. In the // browser this is a little complicated due to unknown quality of Math.random() // and inconsistent support for the `crypto` API. We do the best we can via // feature-detection // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues.bind(crypto)) || (typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues.bind(msCrypto)); if (getRandomValues) { // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef module.exports = function whatwgRNG() { getRandomValues(rnds8); return rnds8; }; } else { // Math.random()-based (RNG) // // If all else fails, use Math.random(). It's fast, but is of unspecified // quality. var rnds = new Array(16); module.exports = function mathRNG() { for (var i = 0, r; i < 16; i++) { if ((i & 0x03) === 0) r = Math.random() * 0x100000000; rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; } return rnds; }; } /***/ }), /* 6 */ /***/ (function(module, exports) { /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ var byteToHex = []; for (var i = 0; i < 256; ++i) { byteToHex[i] = (i + 0x100).toString(16).substr(1); } function bytesToUuid(buf, offset) { var i = offset || 0; var bth = byteToHex; return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; } module.exports = bytesToUuid; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var RestError = /** @class */ (function (_super) { __extends(RestError, _super); function RestError(message, code, statusCode, request, response, body) { var _this = _super.call(this, message) || this; _this.code = code; _this.statusCode = statusCode; _this.request = request; _this.response = response; _this.body = body; return _this; } return RestError; }(Error)); exports.RestError = RestError; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. Object.defineProperty(exports, "__esModule", { value: true }); /** * Wrapper object for http request and response. Deserialized object is stored in * the `bodyAsJson` property when the response body is received in JSON. * @class * Initializes a new instance of the HttpOperationResponse class. * @constructor */ var HttpOperationResponse = /** @class */ (function () { function HttpOperationResponse(request, response) { /** * Reference to the original request object. * [WebResource] object. * @type {object} */ this.request = request; /** * Reference to the original response object. * [ServerResponse] object. * @type {object} */ this.response = response; /* tslint:disable:no-null-keyword */ this.bodyAsText = null; this.bodyAsJson = null; } return HttpOperationResponse; }()); exports.HttpOperationResponse = HttpOperationResponse; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. Object.defineProperty(exports, "__esModule", { value: true }); var utils = __webpack_require__(0); var moment_1 = __webpack_require__(23); var isBuffer = __webpack_require__(25); var isStream = __webpack_require__(10); var Serializer = /** @class */ (function () { function Serializer(mappers) { this.modelMappers = mappers; } Serializer.prototype.validateConstraints = function (mapper, value, objectName) { if (mapper.constraints && (value !== null || value !== undefined)) { for (var _i = 0, _a = Object.keys(mapper.constraints); _i < _a.length; _i++) { var constraintType = _a[_i]; if (constraintType.match(/^ExclusiveMaximum$/ig) !== null) { if (value >= mapper.constraints.ExclusiveMaximum) { throw new Error("\"" + objectName + "\" with value \"" + value + "\" should satify the constraint \"ExclusiveMaximum\": " + mapper.constraints.ExclusiveMaximum + "."); } } else if (constraintType.match(/^ExclusiveMinimum$/ig) !== null) { if (value <= mapper.constraints.ExclusiveMinimum) { throw new Error(objectName + " \" with value \"" + value + " \" should satify the constraint \"ExclusiveMinimum\": " + mapper.constraints.ExclusiveMinimum + "."); } } else if (constraintType.match(/^InclusiveMaximum$/ig) !== null) { if (value > mapper.constraints.InclusiveMaximum) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"InclusiveMaximum\": " + mapper.constraints.InclusiveMaximum + "."); } } else if (constraintType.match(/^InclusiveMinimum$/ig) !== null) { if (value < mapper.constraints.InclusiveMinimum) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"InclusiveMinimum\": " + mapper.constraints.InclusiveMinimum + "."); } } else if (constraintType.match(/^MaxItems$/ig) !== null) { if (value.length > mapper.constraints.MaxItems) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"MaxItems\": " + mapper.constraints.MaxItems + "."); } } else if (constraintType.match(/^MaxLength$/ig) !== null) { if (value.length > mapper.constraints.MaxLength) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"MaxLength\": " + mapper.constraints.MaxLength + "."); } } else if (constraintType.match(/^MinItems$/ig) !== null) { if (value.length < mapper.constraints.MinItems) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"MinItems\": " + mapper.constraints.MinItems + "."); } } else if (constraintType.match(/^MinLength$/ig) !== null) { if (value.length < mapper.constraints.MinLength) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"MinLength\": " + mapper.constraints.MinLength + "."); } } else if (constraintType.match(/^MultipleOf$/ig) !== null) { if (value.length % mapper.constraints.MultipleOf !== 0) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"MultipleOf\": " + mapper.constraints.MultipleOf + "."); } } else if (constraintType.match(/^Pattern$/ig) !== null) { if (value.match(mapper.constraints.Pattern.split("/").join("\/")) === null) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"Pattern\": " + mapper.constraints.Pattern + "."); } } else if (constraintType.match(/^UniqueItems/ig) !== null) { if (mapper.constraints.UniqueItems) { if (value.length !== value.filter(function (item, i, ar) { { return ar.indexOf(item) === i; } }).length) { throw new Error(objectName + "\" with value \"" + value + "\" should satify the constraint \"UniqueItems\": " + mapper.constraints.UniqueItems); } } } } } }; Serializer.prototype.trimEnd = function (str, ch) { var len = str.length; while ((len - 1) >= 0 && str[len - 1] === ch) { --len; } return str.substr(0, len); }; Serializer.prototype.bufferToBase64Url = function (buffer) { if (!buffer) { return undefined; } if (!isBuffer(buffer)) { throw new Error("Please provide an input of type Buffer for converting to Base64Url."); } // Buffer to Base64. var str = buffer.toString("base64"); // Base64 to Base64Url. return this.trimEnd(str, "=").replace(/\+/g, "-").replace(/\//g, "_"); }; Serializer.prototype.base64UrlToBuffer = function (str) { if (!str) { return undefined; } if (str && typeof str.valueOf() !== "string") { throw new Error("Please provide an input of type string for converting to Buffer"); } // Base64Url to Base64. str = str.replace(/\-/g, "+").replace(/\_/g, "/"); // Base64 to Buffer. return Buffer.from(str, "base64"); }; Serializer.prototype.splitSerializeName = function (prop) { var classes = []; var partialclass = ""; var subwords = prop.split("."); for (var _i = 0, subwords_1 = subwords; _i < subwords_1.length; _i++) { var item = subwords_1[_i]; if (item.charAt(item.length - 1) === "\\") { partialclass += item.substr(0, item.length - 1) + "."; } els