From b17663e3d8248111f7401ef86f910db20a8220dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Dec 2020 08:25:39 +0000 Subject: [PATCH 1/3] build(deps-dev): bump eslint-plugin-simple-import-sort Bumps [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort) from 5.0.3 to 7.0.0. - [Release notes](https://github.com/lydell/eslint-plugin-simple-import-sort/releases) - [Changelog](https://github.com/lydell/eslint-plugin-simple-import-sort/blob/main/CHANGELOG.md) - [Commits](https://github.com/lydell/eslint-plugin-simple-import-sort/compare/v5.0.3...v7.0.0) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 66ba57d994..837d7b71c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1093,9 +1093,9 @@ } }, "eslint-plugin-simple-import-sort": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-5.0.3.tgz", - "integrity": "sha512-1rf3AWiHeWNCQdAq0iXNnlccnH1UDnelGgrPbjBBHE8d2hXVtOudcmy0vTF4hri3iJ0MKz8jBhmH6lJ0ZWZLHQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", "dev": true }, "eslint-scope": { diff --git a/package.json b/package.json index 75d3c8dbde..bf1654befb 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "eslint-config-prettier": "^6.15.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-prettier": "^3.3.0", - "eslint-plugin-simple-import-sort": "^5.0.2", + "eslint-plugin-simple-import-sort": "^7.0.0", "prettier": "^2.2.1", "typescript": "^4.1.3" } From 993f7d3fe9c792a672911a0f3a4fc6bfa86d08bf Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Mon, 28 Dec 2020 22:31:11 -0600 Subject: [PATCH 2/3] update dist --- dist/post_run/index.js | 16120 +++++++++++++++++++++++++-------------- dist/run/index.js | 16120 +++++++++++++++++++++++++-------------- package-lock.json | 2984 +++++++- 3 files changed, 23801 insertions(+), 11423 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index f6cae10795..0123f1f42d 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -350,8 +350,8 @@ function copyFile(srcFile, destFile, force) { "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -366,6 +366,7 @@ function copyFile(srcFile, destFile, force) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultGetter = void 0; /** * Default getter which just does a simple property access. Returns * undefined if the key is not set. @@ -1482,7 +1483,9 @@ function resolvePaths(patterns) { try { for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { const file = _d.value; - const relativeFile = path.relative(workspace, file); + const relativeFile = path + .relative(workspace, file) + .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); core.debug(`Matched: ${relativeFile}`); // Paths are made relative so the tar entries are all relative to the root of the workspace. paths.push(`${relativeFile}`); @@ -1647,14 +1650,13 @@ module.exports = eval("require")("encoding"); /***/ }), /* 20 */, -/* 21 */, -/* 22 */ +/* 21 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1669,33 +1671,38 @@ module.exports = eval("require")("encoding"); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const getter_1 = __webpack_require__(2); -const NoopHttpTextPropagator_1 = __webpack_require__(744); -const setter_1 = __webpack_require__(553); -const context_1 = __webpack_require__(492); -const contextApi = context_1.ContextAPI.getInstance(); +exports.PropagationAPI = void 0; +var getter_1 = __webpack_require__(2); +var NoopHttpTextPropagator_1 = __webpack_require__(744); +var setter_1 = __webpack_require__(553); +var context_1 = __webpack_require__(492); +var global_utils_1 = __webpack_require__(976); +var contextApi = context_1.ContextAPI.getInstance(); /** * Singleton object which represents the entry point to the OpenTelemetry Propagation API */ -class PropagationAPI { +var PropagationAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._propagator = NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR; + function PropagationAPI() { } /** Get the singleton instance of the Propagator API */ - static getInstance() { + PropagationAPI.getInstance = function () { if (!this._instance) { this._instance = new PropagationAPI(); } return this._instance; - } + }; /** * Set the current propagator. Returns the initialized propagator */ - setGlobalPropagator(propagator) { - this._propagator = propagator; + PropagationAPI.prototype.setGlobalPropagator = function (propagator) { + if (global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) { + // global propagator has already been set + return this._getGlobalPropagator(); + } + global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, propagator, NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); return propagator; - } + }; /** * Inject context into a carrier to be propagated inter-process * @@ -1703,9 +1710,11 @@ class PropagationAPI { * @param setter Function used to set values on the carrier * @param context Context carrying tracing data to inject. Defaults to the currently active context. */ - inject(carrier, setter = setter_1.defaultSetter, context = contextApi.active()) { - return this._propagator.inject(context, carrier, setter); - } + PropagationAPI.prototype.inject = function (carrier, setter, context) { + if (setter === void 0) { setter = setter_1.defaultSetter; } + if (context === void 0) { context = contextApi.active(); } + return this._getGlobalPropagator().inject(context, carrier, setter); + }; /** * Extract context from a carrier * @@ -1713,163 +1722,709 @@ class PropagationAPI { * @param getter Function used to extract keys from a carrier * @param context Context which the newly created context will inherit from. Defaults to the currently active context. */ - extract(carrier, getter = getter_1.defaultGetter, context = contextApi.active()) { - return this._propagator.extract(context, carrier, getter); - } -} + PropagationAPI.prototype.extract = function (carrier, getter, context) { + if (getter === void 0) { getter = getter_1.defaultGetter; } + if (context === void 0) { context = contextApi.active(); } + return this._getGlobalPropagator().extract(context, carrier, getter); + }; + /** Remove the global propagator */ + PropagationAPI.prototype.disable = function () { + delete global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]; + }; + PropagationAPI.prototype._getGlobalPropagator = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); + }; + return PropagationAPI; +}()); exports.PropagationAPI = PropagationAPI; //# sourceMappingURL=propagation.js.map /***/ }), -/* 23 */, -/* 24 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _default = '00000000-0000-0000-0000-000000000000'; -exports.default = _default; - -/***/ }), -/* 25 */, -/* 26 */, -/* 27 */, -/* 28 */, -/* 29 */, -/* 30 */, -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { +/* 22 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - 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) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", { value: true }); -const semver = __importStar(__webpack_require__(864)); -const core_1 = __webpack_require__(470); -// needs to be require for core node modules to be mocked -/* eslint @typescript-eslint/no-require-imports: 0 */ -const os = __webpack_require__(87); -const cp = __webpack_require__(129); -const fs = __webpack_require__(747); -function _findMatch(versionSpec, stable, candidates, archFilter) { - return __awaiter(this, void 0, void 0, function* () { - const platFilter = os.platform(); - let result; - let match; - let file; - for (const candidate of candidates) { - const version = candidate.version; - core_1.debug(`check ${version} satisfies ${versionSpec}`); - if (semver.satisfies(version, versionSpec) && - (!stable || candidate.stable === stable)) { - file = candidate.files.find(item => { - core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); - let chk = item.arch === archFilter && item.platform === platFilter; - if (chk && item.platform_version) { - const osVersion = module.exports._getOsVersion(); - if (osVersion === item.platform_version) { - chk = true; - } - else { - chk = semver.satisfies(osVersion, item.platform_version); - } +const http = __webpack_require__(605); +const https = __webpack_require__(211); +const pm = __webpack_require__(618); +let tunnel; +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + let proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return new Promise(async (resolve, reject) => { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + let parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + } + get(requestUrl, additionalHeaders) { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + } + del(requestUrl, additionalHeaders) { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + } + post(requestUrl, data, additionalHeaders) { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + } + patch(requestUrl, data, additionalHeaders) { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + } + put(requestUrl, data, additionalHeaders) { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + } + head(requestUrl, additionalHeaders) { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return this.request(verb, requestUrl, stream, additionalHeaders); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + async getJson(requestUrl, additionalHeaders = {}) { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + let res = await this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async postJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async putJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async patchJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + async request(verb, requestUrl, data, headers) { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + let parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + while (numTries < maxTries) { + response = await this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (let i = 0; i < this.handlers.length; i++) { + if (this.handlers[i].canHandleAuthentication(response)) { + authenticationHandler = this.handlers[i]; + break; } - return chk; - }); - if (file) { - core_1.debug(`matched ${candidate.version}`); - match = candidate; + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't break; } + let parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol == 'https:' && + parsedUrl.protocol != parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + await response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (let header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = await this.requestRaw(info, data); + redirectsRemaining--; + } + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + await response.readBody(); + await this._performExponentialBackoff(numTries); } } - if (match && file) { - // clone since we're mutating the file list to be only the file that matches - result = Object.assign({}, match); - result.files = [file]; + return response; + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); } - return result; - }); -} -exports._findMatch = _findMatch; -function _getOsVersion() { - // TODO: add windows and other linux, arm variants - // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python) - const plat = os.platform(); - let version = ''; - if (plat === 'darwin') { - version = cp.execSync('sw_vers -productVersion').toString(); + this._disposed = true; } - else if (plat === 'linux') { - // lsb_release process not in some containers, readfile - // Run cat /etc/lsb-release - // DISTRIB_ID=Ubuntu - // DISTRIB_RELEASE=18.04 - // DISTRIB_CODENAME=bionic - // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" - const lsbContents = module.exports._readLinuxVersionFile(); - if (lsbContents) { - const lines = lsbContents.split('\n'); - for (const line of lines) { - const parts = line.split('='); - if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') { - version = parts[1].trim(); - break; + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return new Promise((resolve, reject) => { + let callbackForResult = function (err, res) { + if (err) { + reject(err); } + resolve(res); + }; + this.requestRawWithCallback(info, data, callbackForResult); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + let socket; + if (typeof data === 'string') { + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + let handleResult = (err, res) => { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + }; + let req = info.httpModule.request(info.options, (msg) => { + let res = new HttpClientResponse(msg); + handleResult(null, res); + }); + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); } + handleResult(new Error('Request timeout: ' + info.options.path), null); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err, null); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); } } - return version; -} -exports._getOsVersion = _getOsVersion; -function _readLinuxVersionFile() { - const lsbFile = '/etc/lsb-release'; - let contents = ''; - if (fs.existsSync(lsbFile)) { - contents = fs.readFileSync(lsbFile).toString(); + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + let parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); } - return contents; -} -exports._readLinuxVersionFile = _readLinuxVersionFile; -//# sourceMappingURL=manifest.js.map - -/***/ }), -/* 32 */, -/* 33 */, -/* 34 */, -/* 35 */, -/* 36 */, -/* 37 */, -/* 38 */, -/* 39 */, -/* 40 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/*! - * Copyright 2019, OpenTelemetry Authors - * + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + this.handlers.forEach(handler => { + handler.prepareRequest(info.options); + }); + } + return info; + } + _mergeHeaders(headers) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + let proxyUrl = pm.getProxyUrl(parsedUrl); + let useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (!!agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (!!this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + if (useProxy) { + // If using proxy, need tunnel + if (!tunnel) { + tunnel = __webpack_require__(413); + } + const agentOptions = { + maxSockets: maxSockets, + keepAlive: this._keepAlive, + proxy: { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`, + host: proxyUrl.hostname, + port: proxyUrl.port + } + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + } + static dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + let a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + async _processResponse(res, options) { + return new Promise(async (resolve, reject) => { + const statusCode = res.message.statusCode; + const response = { + statusCode: statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode == HttpCodes.NotFound) { + resolve(response); + } + let obj; + let contents; + // get the result from the body + try { + contents = await res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = 'Failed request: (' + statusCode + ')'; + } + let err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + }); + } +} +exports.HttpClient = HttpClient; + + +/***/ }), +/* 23 */, +/* 24 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports.default = _default; + +/***/ }), +/* 25 */, +/* 26 */, +/* 27 */, +/* 28 */, +/* 29 */, +/* 30 */, +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const semver = __importStar(__webpack_require__(864)); +const core_1 = __webpack_require__(470); +// needs to be require for core node modules to be mocked +/* eslint @typescript-eslint/no-require-imports: 0 */ +const os = __webpack_require__(87); +const cp = __webpack_require__(129); +const fs = __webpack_require__(747); +function _findMatch(versionSpec, stable, candidates, archFilter) { + return __awaiter(this, void 0, void 0, function* () { + const platFilter = os.platform(); + let result; + let match; + let file; + for (const candidate of candidates) { + const version = candidate.version; + core_1.debug(`check ${version} satisfies ${versionSpec}`); + if (semver.satisfies(version, versionSpec) && + (!stable || candidate.stable === stable)) { + file = candidate.files.find(item => { + core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); + let chk = item.arch === archFilter && item.platform === platFilter; + if (chk && item.platform_version) { + const osVersion = module.exports._getOsVersion(); + if (osVersion === item.platform_version) { + chk = true; + } + else { + chk = semver.satisfies(osVersion, item.platform_version); + } + } + return chk; + }); + if (file) { + core_1.debug(`matched ${candidate.version}`); + match = candidate; + break; + } + } + } + if (match && file) { + // clone since we're mutating the file list to be only the file that matches + result = Object.assign({}, match); + result.files = [file]; + } + return result; + }); +} +exports._findMatch = _findMatch; +function _getOsVersion() { + // TODO: add windows and other linux, arm variants + // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python) + const plat = os.platform(); + let version = ''; + if (plat === 'darwin') { + version = cp.execSync('sw_vers -productVersion').toString(); + } + else if (plat === 'linux') { + // lsb_release process not in some containers, readfile + // Run cat /etc/lsb-release + // DISTRIB_ID=Ubuntu + // DISTRIB_RELEASE=18.04 + // DISTRIB_CODENAME=bionic + // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" + const lsbContents = module.exports._readLinuxVersionFile(); + if (lsbContents) { + const lines = lsbContents.split('\n'); + for (const line of lines) { + const parts = line.split('='); + if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') { + version = parts[1].trim(); + break; + } + } + } + } + return version; +} +exports._getOsVersion = _getOsVersion; +function _readLinuxVersionFile() { + const lsbFile = '/etc/lsb-release'; + let contents = ''; + if (fs.existsSync(lsbFile)) { + contents = fs.readFileSync(lsbFile).toString(); + } + return contents; +} +exports._readLinuxVersionFile = _readLinuxVersionFile; +//# sourceMappingURL=manifest.js.map + +/***/ }), +/* 32 */, +/* 33 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -1883,6 +2438,22 @@ exports._readLinuxVersionFile = _readLinuxVersionFile; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=HttpTextPropagator.js.map + +/***/ }), +/* 34 */, +/* 35 */, +/* 36 */, +/* 37 */, +/* 38 */, +/* 39 */, +/* 40 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EntryTtl = void 0; /** * EntryTtl is an integer that represents number of hops an entry can propagate. * @@ -1908,8 +2479,8 @@ var EntryTtl; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1924,6 +2495,7 @@ var EntryTtl; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueType = void 0; /** The Type of value. It describes how the data is reported. */ var ValueType; (function (ValueType) { @@ -1936,30 +2508,7 @@ var ValueType; /* 44 */, /* 45 */, /* 46 */, -/* 47 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map - -/***/ }), +/* 47 */, /* 48 */, /* 49 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -2068,12 +2617,13 @@ const parseVersion = (s) => { patch: match[3] === undefined ? null : parseInt(match[3]), }; }; -exports.stringifyVersion = (v) => { +const stringifyVersion = (v) => { if (v == null) { return "latest"; } return `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}`; }; +exports.stringifyVersion = stringifyVersion; const minVersion = { major: 1, minor: 28, @@ -2157,49 +2707,7 @@ exports.findLintVersion = findLintVersion; /***/ }), -/* 53 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -const context_1 = __webpack_require__(560); -class NoopContextManager { - active() { - return context_1.Context.ROOT_CONTEXT; - } - with(context, fn) { - return fn(); - } - bind(target, context) { - return target; - } - enable() { - return this; - } - disable() { - return this; - } -} -exports.NoopContextManager = NoopContextManager; -//# sourceMappingURL=NoopContextManager.js.map - -/***/ }), +/* 53 */, /* 54 */, /* 55 */, /* 56 */, @@ -2233,7 +2741,15 @@ exports.NoopContextManager = NoopContextManager; /* 67 */, /* 68 */, /* 69 */, -/* 70 */, +/* 70 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=trace_state.js.map + +/***/ }), /* 71 */ /***/ (function() { @@ -3458,12 +3974,7 @@ function regExpEscape (s) { /***/ }), /* 94 */, -/* 95 */, -/* 96 */, -/* 97 */, -/* 98 */, -/* 99 */, -/* 100 */ +/* 95 */ /***/ (function(__unusedmodule, exports) { "use strict"; @@ -3487,6 +3998,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=link.js.map /***/ }), +/* 96 */, +/* 97 */, +/* 98 */, +/* 99 */, +/* 100 */, /* 101 */, /* 102 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -3855,490 +4371,33 @@ exports.AbortSignal = AbortSignal; /***/ }), -/* 107 */, -/* 108 */, -/* 109 */ +/* 107 */ /***/ (function(__unusedmodule, exports) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Time.js.map - -/***/ }), -/* 110 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; -/*! - * Copyright (c) Microsoft and contributors. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Azure Core LRO SDK for JavaScript - 1.0.2 - */ - - -Object.defineProperty(exports, '__esModule', { value: true }); - -var tslib = __webpack_require__(422); - -// Copyright (c) Microsoft Corporation. -/** - * When a poller is manually stopped through the `stopPolling` method, - * the poller will be rejected with an instance of the PollerStoppedError. - */ -var PollerStoppedError = /** @class */ (function (_super) { - tslib.__extends(PollerStoppedError, _super); - function PollerStoppedError(message) { - var _this = _super.call(this, message) || this; - _this.name = "PollerStoppedError"; - Object.setPrototypeOf(_this, PollerStoppedError.prototype); - return _this; - } - return PollerStoppedError; -}(Error)); -/** - * When a poller is cancelled through the `cancelOperation` method, - * the poller will be rejected with an instance of the PollerCancelledError. - */ -var PollerCancelledError = /** @class */ (function (_super) { - tslib.__extends(PollerCancelledError, _super); - function PollerCancelledError(message) { - var _this = _super.call(this, message) || this; - _this.name = "PollerCancelledError"; - Object.setPrototypeOf(_this, PollerCancelledError.prototype); - return _this; - } - return PollerCancelledError; -}(Error)); -/** - * A class that represents the definition of a program that polls through consecutive requests - * until it reaches a state of completion. - * - * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. - * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. - * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. - * - * ```ts - * const poller = new MyPoller(); - * - * // Polling just once: - * await poller.poll(); - * - * // We can try to cancel the request here, by calling: - * // - * // await poller.cancelOperation(); - * // - * - * // Getting the final result: - * const result = await poller.pollUntilDone(); - * ``` - * - * The Poller is defined by two types, a type representing the state of the poller, which - * must include a basic set of properties from `PollOperationState`, - * and a return type defined by `TResult`, which can be anything. - * - * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having - * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. - * - * ```ts - * class Client { - * public async makePoller: PollerLike { - * const poller = new MyPoller({}); - * // It might be preferred to return the poller after the first request is made, - * // so that some information can be obtained right away. - * await poller.poll(); - * return poller; - * } - * } - * - * const poller: PollerLike = myClient.makePoller(); - * ``` - * - * A poller can be created through its constructor, then it can be polled until it's completed. - * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. - * At any point in time, the intermediate forms of the result type can be requested without delay. - * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. - * - * ```ts - * const poller = myClient.makePoller(); - * const state: MyOperationState = poller.getOperationState(); +/* + * Copyright The OpenTelemetry Authors * - * // The intermediate result can be obtained at any time. - * const result: MyResult | undefined = poller.getResult(); + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * // The final result can only be obtained after the poller finishes. - * const result: MyResult = await poller.pollUntilDone(); - * ``` + * https://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ -var Poller = /** @class */ (function () { - /** - * A poller needs to be initialized by passing in at least the basic properties of the PollOperation. - * - * When writing an implementation of a Poller, this implementation needs to deal with the initialization - * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's - * operation has already been defined, at least its basic properties. The code below shows how to approach - * the definition of the constructor of a new custom poller. - * - * ```ts - * export class MyPoller extends Poller { - * constructor({ - * // Anything you might need outside of the basics - * }) { - * let state: MyOperationState = { - * privateProperty: private, - * publicProperty: public, - * }; - * - * const operation = { - * state, - * update, - * cancel, - * toString - * } - * - * // Sending the operation to the parent's constructor. - * super(operation); - * - * // You can assign more local properties here. - * } - * } - * ``` - * - * Inside of this constructor, a new promise is created. This will be used to - * tell the user when the poller finishes (see `pollUntilDone()`). The promise's - * resolve and reject methods are also used internally to control when to resolve - * or reject anyone waiting for the poller to finish. - * - * The constructor of a custom implementation of a poller is where any serialized version of - * a previous poller's operation should be deserialized into the operation sent to the - * base constructor. For example: - * - * ```ts - * export class MyPoller extends Poller { - * constructor( - * baseOperation: string | undefined - * ) { - * let state: MyOperationState = {}; - * if (baseOperation) { - * state = { - * ...JSON.parse(baseOperation).state, - * ...state - * }; - * } - * const operation = { - * state, - * // ... - * } - * super(operation); - * } - * } - * ``` - * - * @param operation Must contain the basic properties of PollOperation. - */ - function Poller(operation) { - var _this = this; - this.stopped = true; - this.pollProgressCallbacks = []; - this.operation = operation; - this.promise = new Promise(function (resolve, reject) { - _this.resolve = resolve; - _this.reject = reject; - }); - // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. - // The above warning would get thrown if `poller.poll` is called, it returns an error, - // and pullUntilDone did not have a .catch or await try/catch on it's return value. - this.promise.catch(function () { }); - } - /** - * @internal - * @ignore - * Starts a loop that will break only if the poller is done - * or if the poller is stopped. - */ - Poller.prototype.startPolling = function () { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - if (this.stopped) { - this.stopped = false; - } - _a.label = 1; - case 1: - if (!(!this.isStopped() && !this.isDone())) return [3 /*break*/, 4]; - return [4 /*yield*/, this.poll()]; - case 2: - _a.sent(); - return [4 /*yield*/, this.delay()]; - case 3: - _a.sent(); - return [3 /*break*/, 1]; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * @internal - * @ignore - * pollOnce does one polling, by calling to the update method of the underlying - * poll operation to make any relevant change effective. - * - * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. - * - * @param options Optional properties passed to the operation's update method. - */ - Poller.prototype.pollOnce = function (options) { - if (options === void 0) { options = {}; } - return tslib.__awaiter(this, void 0, void 0, function () { - var state, _a, e_1; - return tslib.__generator(this, function (_b) { - switch (_b.label) { - case 0: - state = this.operation.state; - _b.label = 1; - case 1: - _b.trys.push([1, 4, , 5]); - if (!!this.isDone()) return [3 /*break*/, 3]; - _a = this; - return [4 /*yield*/, this.operation.update({ - abortSignal: options.abortSignal, - fireProgress: this.fireProgress.bind(this) - })]; - case 2: - _a.operation = _b.sent(); - if (this.isDone() && this.resolve) { - this.resolve(state.result); - } - _b.label = 3; - case 3: return [3 /*break*/, 5]; - case 4: - e_1 = _b.sent(); - state.error = e_1; - if (this.reject) { - this.reject(e_1); - } - throw e_1; - case 5: return [2 /*return*/]; - } - }); - }); - }; - /** - * @internal - * @ignore - * fireProgress calls the functions passed in via onProgress the method of the poller. - * - * It loops over all of the callbacks received from onProgress, and executes them, sending them - * the current operation state. - * - * @param state The current operation state. - */ - Poller.prototype.fireProgress = function (state) { - for (var _i = 0, _a = this.pollProgressCallbacks; _i < _a.length; _i++) { - var callback = _a[_i]; - callback(state); - } - }; - /** - * @internal - * @ignore - * Invokes the underlying operation's cancel method, and rejects the - * pollUntilDone promise. - */ - Poller.prototype.cancelOnce = function (options) { - if (options === void 0) { options = {}; } - return tslib.__awaiter(this, void 0, void 0, function () { - var _a; - return tslib.__generator(this, function (_b) { - switch (_b.label) { - case 0: - _a = this; - return [4 /*yield*/, this.operation.cancel(options)]; - case 1: - _a.operation = _b.sent(); - if (this.reject) { - this.reject(new PollerCancelledError("Poller cancelled")); - } - return [2 /*return*/]; - } - }); - }); - }; - /** - * Returns a promise that will resolve once a single polling request finishes. - * It does this by calling the update method of the Poller's operation. - * - * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. - * - * @param options Optional properties passed to the operation's update method. - */ - Poller.prototype.poll = function (options) { - var _this = this; - if (options === void 0) { options = {}; } - if (!this.pollOncePromise) { - this.pollOncePromise = this.pollOnce(options); - var clearPollOncePromise = function () { - _this.pollOncePromise = undefined; - }; - this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise); - } - return this.pollOncePromise; - }; - /** - * Returns a promise that will resolve once the underlying operation is completed. - */ - Poller.prototype.pollUntilDone = function () { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - if (this.stopped) { - this.startPolling().catch(this.reject); - } - return [2 /*return*/, this.promise]; - }); - }); - }; - /** - * Invokes the provided callback after each polling is completed, - * sending the current state of the poller's operation. - * - * It returns a method that can be used to stop receiving updates on the given callback function. - */ - Poller.prototype.onProgress = function (callback) { - var _this = this; - this.pollProgressCallbacks.push(callback); - return function () { - _this.pollProgressCallbacks = _this.pollProgressCallbacks.filter(function (c) { return c !== callback; }); - }; - }; - /** - * Returns true if the poller has finished polling. - */ - Poller.prototype.isDone = function () { - var state = this.operation.state; - return Boolean(state.isCompleted || state.isCancelled || state.error); - }; - /** - * Stops the poller from continuing to poll. - */ - Poller.prototype.stopPolling = function () { - if (!this.stopped) { - this.stopped = true; - if (this.reject) { - this.reject(new PollerStoppedError("This poller is already stopped")); - } - } - }; - /** - * Returns true if the poller is stopped. - */ - Poller.prototype.isStopped = function () { - return this.stopped; - }; - /** - * Attempts to cancel the underlying operation. - * - * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. - * - * If it's called again before it finishes, it will throw an error. - * - * @param options Optional properties passed to the operation's update method. - */ - Poller.prototype.cancelOperation = function (options) { - if (options === void 0) { options = {}; } - if (!this.stopped) { - this.stopped = true; - } - if (!this.cancelPromise) { - this.cancelPromise = this.cancelOnce(options); - } - else if (options.abortSignal) { - throw new Error("A cancel request is currently pending"); - } - return this.cancelPromise; - }; - /** - * Returns the state of the operation. - * - * Even though TState will be the same type inside any of the methods of any extension of the Poller class, - * implementations of the pollers can customize what's shared with the public by writing their own - * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller - * and a public type representing a safe to share subset of the properties of the internal state. - * Their definition of getOperationState can then return their public type. - * - * Example: - * - * ```ts - * // Let's say we have our poller's operation state defined as: - * interface MyOperationState extends PollOperationState { - * privateProperty?: string; - * publicProperty?: string; - * } - * - * // To allow us to have a true separation of public and private state, we have to define another interface: - * interface PublicState extends PollOperationState { - * publicProperty?: string; - * } - * - * // Then, we define our Poller as follows: - * export class MyPoller extends Poller { - * // ... More content is needed here ... - * - * public getOperationState(): PublicState { - * const state: PublicState = this.operation.state; - * return { - * // Properties from PollOperationState - * isStarted: state.isStarted, - * isCompleted: state.isCompleted, - * isCancelled: state.isCancelled, - * error: state.error, - * result: state.result, - * - * // The only other property needed by PublicState. - * publicProperty: state.publicProperty - * } - * } - * } - * ``` - * - * You can see this in the tests of this repository, go to the file: - * `../test/utils/testPoller.ts` - * and look for the getOperationState implementation. - */ - Poller.prototype.getOperationState = function () { - return this.operation.state; - }; - /** - * Returns the result value of the operation, - * regardless of the state of the poller. - * It can return undefined or an incomplete form of the final TResult value - * depending on the implementation. - */ - Poller.prototype.getResult = function () { - var state = this.operation.state; - return state.result; - }; - /** - * Returns a serialized version of the poller's operation - * by invoking the operation's toString method. - */ - Poller.prototype.toString = function () { - return this.operation.toString(); - }; - return Poller; -}()); - -exports.Poller = Poller; -exports.PollerCancelledError = PollerCancelledError; -exports.PollerStoppedError = PollerStoppedError; -//# sourceMappingURL=index.js.map - +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Observation.js.map /***/ }), +/* 108 */, +/* 109 */, +/* 110 */, /* 111 */, /* 112 */, /* 113 */, @@ -4365,8 +4424,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const http_client_1 = __webpack_require__(539); -const auth_1 = __webpack_require__(226); +const http_client_1 = __webpack_require__(22); +const auth_1 = __webpack_require__(733); const crypto = __importStar(__webpack_require__(417)); const fs = __importStar(__webpack_require__(747)); const url_1 = __webpack_require__(835); @@ -4490,9 +4549,12 @@ function uploadChunk(httpClient, resourceUrl, openStream, start, end) { 'Content-Type': 'application/octet-stream', 'Content-Range': getContentRange(start, end) }; - yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { + const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders); })); + if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) { + throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`); + } }); } function uploadFile(httpClient, cacheId, archivePath, options) { @@ -4872,39 +4934,16 @@ exports.realpath = function realpath(p, cache, cb) { /***/ }), /* 118 */, -/* 119 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Observation.js.map - -/***/ }), -/* 120 */, -/* 121 */, -/* 122 */, -/* 123 */, -/* 124 */, -/* 125 */, -/* 126 */, -/* 127 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 119 */, +/* 120 */, +/* 121 */, +/* 122 */, +/* 123 */, +/* 124 */, +/* 125 */, +/* 126 */, +/* 127 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -4970,8 +5009,8 @@ module.exports = require("child_process"); "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -4986,42 +5025,53 @@ module.exports = require("child_process"); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopMeterProvider_1 = __webpack_require__(450); +exports.MetricsAPI = void 0; +var NoopMeterProvider_1 = __webpack_require__(450); +var global_utils_1 = __webpack_require__(976); /** * Singleton object which represents the entry point to the OpenTelemetry Metrics API */ -class MetricsAPI { +var MetricsAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._meterProvider = NoopMeterProvider_1.NOOP_METER_PROVIDER; + function MetricsAPI() { } /** Get the singleton instance of the Metrics API */ - static getInstance() { + MetricsAPI.getInstance = function () { if (!this._instance) { this._instance = new MetricsAPI(); } return this._instance; - } + }; /** * Set the current global meter. Returns the initialized global meter provider. */ - setGlobalMeterProvider(provider) { - this._meterProvider = provider; + MetricsAPI.prototype.setGlobalMeterProvider = function (provider) { + if (global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) { + // global meter provider has already been set + return this.getMeterProvider(); + } + global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopMeterProvider_1.NOOP_METER_PROVIDER); return provider; - } + }; /** * Returns the global meter provider. */ - getMeterProvider() { - return this._meterProvider; - } + MetricsAPI.prototype.getMeterProvider = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopMeterProvider_1.NOOP_METER_PROVIDER); + }; /** * Returns a meter from the global meter provider. */ - getMeter(name, version) { + MetricsAPI.prototype.getMeter = function (name, version) { return this.getMeterProvider().getMeter(name, version); - } -} + }; + /** Remove the global meter provider */ + MetricsAPI.prototype.disable = function () { + delete global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]; + }; + return MetricsAPI; +}()); exports.MetricsAPI = MetricsAPI; //# sourceMappingURL=metrics.js.map @@ -5316,8 +5366,332 @@ exports.debug = debug; // for test /***/ }), /* 142 */, /* 143 */, -/* 144 */, -/* 145 */, +/* 144 */ +/***/ (function(module) { + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __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 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, 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 }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); + + +/***/ }), +/* 145 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports._globalThis = void 0; +/** only globals that common to node and browsers are allowed */ +// eslint-disable-next-line node/no-unsupported-features/es-builtins +exports._globalThis = typeof globalThis === 'object' ? globalThis : global; +//# sourceMappingURL=globalThis.js.map + +/***/ }), /* 146 */, /* 147 */ /***/ (function(__unusedmodule, exports) { @@ -6144,8 +6518,8 @@ module.exports.setGracefulCleanup = setGracefulCleanup; "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -6160,25 +6534,29 @@ module.exports.setGracefulCleanup = setGracefulCleanup; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopSpan_1 = __webpack_require__(767); +exports.NOOP_TRACER = exports.NoopTracer = void 0; +var NoopSpan_1 = __webpack_require__(767); /** * No-op implementations of {@link Tracer}. */ -class NoopTracer { - getCurrentSpan() { - return NoopSpan_1.NOOP_SPAN; +var NoopTracer = /** @class */ (function () { + function NoopTracer() { } + NoopTracer.prototype.getCurrentSpan = function () { + return NoopSpan_1.NOOP_SPAN; + }; // startSpan starts a noop span. - startSpan(name, options) { + NoopTracer.prototype.startSpan = function (name, options) { return NoopSpan_1.NOOP_SPAN; - } - withSpan(span, fn) { + }; + NoopTracer.prototype.withSpan = function (span, fn) { return fn(); - } - bind(target, span) { + }; + NoopTracer.prototype.bind = function (target, span) { return target; - } -} + }; + return NoopTracer; +}()); exports.NoopTracer = NoopTracer; exports.NOOP_TRACER = new NoopTracer(); //# sourceMappingURL=NoopTracer.js.map @@ -6382,7 +6760,15 @@ function runJob(iterator, key, item, callback) /***/ }), -/* 158 */, +/* 158 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Time.js.map + +/***/ }), /* 159 */, /* 160 */, /* 161 */, @@ -6391,8 +6777,8 @@ function runJob(iterator, key, item, callback) "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -6407,16 +6793,22 @@ function runJob(iterator, key, item, callback) * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopTracer_1 = __webpack_require__(151); +exports.NOOP_TRACER_PROVIDER = exports.NoopTracerProvider = void 0; +var NoopTracer_1 = __webpack_require__(151); /** - * An implementation of the {@link TracerProvider} which returns an impotent Tracer - * for all calls to `getTracer` + * An implementation of the {@link TracerProvider} which returns an impotent + * Tracer for all calls to `getTracer`. + * + * All operations are no-op. */ -class NoopTracerProvider { - getTracer(_name, _version) { - return NoopTracer_1.NOOP_TRACER; +var NoopTracerProvider = /** @class */ (function () { + function NoopTracerProvider() { } -} + NoopTracerProvider.prototype.getTracer = function (_name, _version) { + return NoopTracer_1.NOOP_TRACER; + }; + return NoopTracerProvider; +}()); exports.NoopTracerProvider = NoopTracerProvider; exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); //# sourceMappingURL=NoopTracerProvider.js.map @@ -6425,7 +6817,7 @@ exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); /* 163 */, /* 164 */, /* 165 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -6444,71 +6836,14 @@ exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); * See the License for the specific language governing permissions and * limitations under the License. */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(__webpack_require__(514), exports); -//# sourceMappingURL=index.js.map +//# sourceMappingURL=Plugin.js.map /***/ }), /* 166 */, /* 167 */, -/* 168 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=CorrelationContext.js.map - -/***/ }), -/* 169 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=ObserverResult.js.map - -/***/ }), +/* 168 */, +/* 169 */, /* 170 */, /* 171 */, /* 172 */, @@ -6523,7 +6858,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _rng = _interopRequireDefault(__webpack_require__(733)); +var _rng = _interopRequireDefault(__webpack_require__(944)); var _stringify = _interopRequireDefault(__webpack_require__(855)); @@ -6628,30 +6963,7 @@ exports.default = _default; /* 174 */, /* 175 */, /* 176 */, -/* 177 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=HttpTextPropagator.js.map - -/***/ }), +/* 177 */, /* 178 */, /* 179 */, /* 180 */ @@ -6889,14 +7201,64 @@ exports.postRun = postRun; /* 186 */, /* 187 */, /* 188 */, -/* 189 */, +/* 189 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=ObserverResult.js.map + +/***/ }), /* 190 */, /* 191 */, /* 192 */, /* 193 */, /* 194 */, /* 195 */, -/* 196 */, +/* 196 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RefKey = exports.Events = exports.State = exports.Inputs = void 0; +var Inputs; +(function (Inputs) { + Inputs["Key"] = "key"; + Inputs["Path"] = "path"; + Inputs["RestoreKeys"] = "restore-keys"; +})(Inputs = exports.Inputs || (exports.Inputs = {})); +var State; +(function (State) { + State["CachePrimaryKey"] = "CACHE_KEY"; + State["CacheMatchedKey"] = "CACHE_RESULT"; +})(State = exports.State || (exports.State = {})); +var Events; +(function (Events) { + Events["Key"] = "GITHUB_EVENT_NAME"; + Events["Push"] = "push"; + Events["PullRequest"] = "pull_request"; +})(Events = exports.Events || (exports.Events = {})); +exports.RefKey = "GITHUB_REF"; + + +/***/ }), /* 197 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -6997,10 +7359,8 @@ module.exports = require("punycode"); /* 217 */, /* 218 */, /* 219 */, -/* 220 */, -/* 221 */, -/* 222 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 220 */ +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -7020,118 +7380,15 @@ module.exports = require("punycode"); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_TRACER_PROVIDER = exports.NoopTracerProvider = void 0; -var NoopTracer_1 = __webpack_require__(980); -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -var NoopTracerProvider = /** @class */ (function () { - function NoopTracerProvider() { - } - NoopTracerProvider.prototype.getTracer = function (_name, _version) { - return NoopTracer_1.NOOP_TRACER; - }; - return NoopTracerProvider; -}()); -exports.NoopTracerProvider = NoopTracerProvider; -exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); -//# sourceMappingURL=NoopTracerProvider.js.map +//# sourceMappingURL=SpanOptions.js.map /***/ }), +/* 221 */, +/* 222 */, /* 223 */, /* 224 */, -/* 225 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Sampler.js.map - -/***/ }), -/* 226 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -class BasicCredentialHandler { - constructor(username, password) { - this.username = username; - this.password = password; - } - prepareRequest(options) { - options.headers['Authorization'] = - 'Basic ' + - Buffer.from(this.username + ':' + this.password).toString('base64'); - } - // This handler cannot handle 401 - canHandleAuthentication(response) { - return false; - } - handleAuthentication(httpClient, requestInfo, objs) { - return null; - } -} -exports.BasicCredentialHandler = BasicCredentialHandler; -class BearerCredentialHandler { - constructor(token) { - this.token = token; - } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - options.headers['Authorization'] = 'Bearer ' + this.token; - } - // This handler cannot handle 401 - canHandleAuthentication(response) { - return false; - } - handleAuthentication(httpClient, requestInfo, objs) { - return null; - } -} -exports.BearerCredentialHandler = BearerCredentialHandler; -class PersonalAccessTokenCredentialHandler { - constructor(token) { - this.token = token; - } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - options.headers['Authorization'] = - 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); - } - // This handler cannot handle 401 - canHandleAuthentication(response) { - return false; - } - handleAuthentication(httpClient, requestInfo, objs) { - return null; - } -} -exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; - - -/***/ }), +/* 225 */, +/* 226 */, /* 227 */, /* 228 */, /* 229 */ @@ -7210,14 +7467,8 @@ exports.isTokenCredential = isTokenCredential; /***/ }), /* 230 */, -/* 231 */, -/* 232 */, -/* 233 */, -/* 234 */, -/* 235 */, -/* 236 */, -/* 237 */ -/***/ (function(__unusedmodule, exports) { +/* 231 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -7236,10 +7487,29 @@ exports.isTokenCredential = isTokenCredential; * See the License for the specific language governing permissions and * limitations under the License. */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=BoundInstrument.js.map +__exportStar(__webpack_require__(328), exports); +__exportStar(__webpack_require__(715), exports); +__exportStar(__webpack_require__(924), exports); +//# sourceMappingURL=index.js.map /***/ }), +/* 232 */, +/* 233 */, +/* 234 */, +/* 235 */, +/* 236 */, +/* 237 */, /* 238 */ /***/ (function(__unusedmodule, exports) { @@ -7340,16 +7610,7 @@ function _default(name, version, hashfunc) { } /***/ }), -/* 242 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -__webpack_require__(71); - - -/***/ }), +/* 242 */, /* 243 */, /* 244 */, /* 245 */ @@ -7844,30 +8105,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 246 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=span.js.map - -/***/ }), +/* 246 */, /* 247 */, /* 248 */, /* 249 */, @@ -7895,7 +8133,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const http_client_1 = __webpack_require__(539); +const http_client_1 = __webpack_require__(22); const storage_blob_1 = __webpack_require__(373); const buffer = __importStar(__webpack_require__(293)); const fs = __importStar(__webpack_require__(747)); @@ -8973,9 +9211,9 @@ exports.Context = Context; Object.defineProperty(exports, '__esModule', { value: true }); var api = __webpack_require__(440); -var tslib = __webpack_require__(422); +var tslib = __webpack_require__(144); -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. /** * A no-op implementation of Span that can safely be used without side-effects. */ @@ -9046,7 +9284,7 @@ var NoOpSpan = /** @class */ (function () { return NoOpSpan; }()); -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. /** * A no-op implementation of Tracer that can be used when tracing * is disabled. @@ -9087,13 +9325,13 @@ var NoOpTracer = /** @class */ (function () { return NoOpTracer; }()); -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. function getGlobalObject() { return global; } -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // V1 = OpenTelemetry 0.1 // V2 = OpenTelemetry 0.2 // V3 = OpenTelemetry 0.6.1 @@ -9134,7 +9372,7 @@ function getCache() { return cache; } -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. var defaultTracer; function getDefaultTracer() { if (!defaultTracer) { @@ -9162,8 +9400,8 @@ function getTracer() { return cache.tracer; } -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. /** * @ignore * @internal @@ -9187,6 +9425,7 @@ var OpenCensusTraceStateWrapper = /** @class */ (function () { return OpenCensusTraceStateWrapper; }()); +// Copyright (c) Microsoft Corporation. function isWrappedSpan(span) { return !!span && span.getWrappedSpan !== undefined; } @@ -9296,6 +9535,7 @@ var OpenCensusSpanWrapper = /** @class */ (function () { return OpenCensusSpanWrapper; }()); +// Copyright (c) Microsoft Corporation. /** * An implementation of OpenTelemetry Tracer that wraps an OpenCensus Tracer. */ @@ -9346,6 +9586,7 @@ var OpenCensusTracerWrapper = /** @class */ (function () { return OpenCensusTracerWrapper; }()); +// Copyright (c) Microsoft Corporation. /** * A mock span useful for testing. */ @@ -9433,6 +9674,7 @@ var TestSpan = /** @class */ (function (_super) { return TestSpan; }(NoOpSpan)); +// Copyright (c) Microsoft Corporation. /** * A mock tracer useful for testing */ @@ -9553,8 +9795,8 @@ var TestTracer = /** @class */ (function (_super) { return TestTracer; }(NoOpTracer)); -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. var VERSION = "00"; /** * Generates a `SpanContext` given a `traceparent` header value. @@ -9651,8 +9893,17 @@ exports.setTracer = setTracer; /***/ }), /* 266 */, -/* 267 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 267 */, +/* 268 */, +/* 269 */, +/* 270 */, +/* 271 */, +/* 272 */, +/* 273 */, +/* 274 */, +/* 275 */, +/* 276 */ +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -9672,37 +9923,11 @@ exports.setTracer = setTracer; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.NoopContextManager = void 0; -var context_1 = __webpack_require__(966); -var NoopContextManager = /** @class */ (function () { - function NoopContextManager() { - } - NoopContextManager.prototype.active = function () { - return context_1.Context.ROOT_CONTEXT; - }; - NoopContextManager.prototype.with = function (context, fn) { - return fn(); - }; - NoopContextManager.prototype.bind = function (target, context) { - return target; - }; - NoopContextManager.prototype.enable = function () { - return this; - }; - NoopContextManager.prototype.disable = function () { - return this; - }; - return NoopContextManager; -}()); -exports.NoopContextManager = NoopContextManager; -//# sourceMappingURL=NoopContextManager.js.map +//# sourceMappingURL=Logger.js.map /***/ }), -/* 268 */, -/* 269 */, -/* 270 */, -/* 271 */, -/* 272 */ +/* 277 */, +/* 278 */ /***/ (function(__unusedmodule, exports) { "use strict"; @@ -9723,15 +9948,9 @@ exports.NoopContextManager = NoopContextManager; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=MeterProvider.js.map +//# sourceMappingURL=CorrelationContext.js.map /***/ }), -/* 273 */, -/* 274 */, -/* 275 */, -/* 276 */, -/* 277 */, -/* 278 */, /* 279 */, /* 280 */ /***/ (function(module) { @@ -9800,96 +10019,7 @@ exports.create = create; /***/ }), /* 282 */, /* 283 */, -/* 284 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContextAPI = void 0; -var context_base_1 = __webpack_require__(581); -var global_utils_1 = __webpack_require__(591); -var NOOP_CONTEXT_MANAGER = new context_base_1.NoopContextManager(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - */ -var ContextAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function ContextAPI() { - } - /** Get the singleton instance of the Context API */ - ContextAPI.getInstance = function () { - if (!this._instance) { - this._instance = new ContextAPI(); - } - return this._instance; - }; - /** - * Set the current context manager. Returns the initialized context manager - */ - ContextAPI.prototype.setGlobalContextManager = function (contextManager) { - if (global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) { - // global context manager has already been set - return this._getContextManager(); - } - global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, contextManager, NOOP_CONTEXT_MANAGER); - return contextManager; - }; - /** - * Get the currently active context - */ - ContextAPI.prototype.active = function () { - return this._getContextManager().active(); - }; - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - */ - ContextAPI.prototype.with = function (context, fn) { - return this._getContextManager().with(context, fn); - }; - /** - * Bind a context to a target function or event emitter - * - * @param target function or event emitter to bind - * @param context context to bind to the event emitter or function. Defaults to the currently active context - */ - ContextAPI.prototype.bind = function (target, context) { - if (context === void 0) { context = this.active(); } - return this._getContextManager().bind(target, context); - }; - ContextAPI.prototype._getContextManager = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NOOP_CONTEXT_MANAGER); - }; - /** Disable and remove the global context manager */ - ContextAPI.prototype.disable = function () { - this._getContextManager().disable(); - delete global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]; - }; - return ContextAPI; -}()); -exports.ContextAPI = ContextAPI; -//# sourceMappingURL=context.js.map - -/***/ }), +/* 284 */, /* 285 */, /* 286 */, /* 287 */, @@ -9940,12 +10070,19 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const core = __webpack_require__(470); -const fs = __webpack_require__(747); -const globOptionsHelper = __webpack_require__(601); -const path = __webpack_require__(622); -const patternHelper = __webpack_require__(597); +const core = __importStar(__webpack_require__(470)); +const fs = __importStar(__webpack_require__(747)); +const globOptionsHelper = __importStar(__webpack_require__(601)); +const path = __importStar(__webpack_require__(622)); +const patternHelper = __importStar(__webpack_require__(597)); const internal_match_kind_1 = __webpack_require__(327); const internal_pattern_1 = __webpack_require__(923); const internal_search_state_1 = __webpack_require__(728); @@ -10689,7 +10826,30 @@ if (typeof Object.create === 'function') { /***/ }), /* 316 */, /* 317 */, -/* 318 */, +/* 318 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=BatchObserverResult.js.map + +/***/ }), /* 319 */, /* 320 */, /* 321 */, @@ -10721,10 +10881,7 @@ var MatchKind; //# sourceMappingURL=internal-match-kind.js.map /***/ }), -/* 328 */, -/* 329 */, -/* 330 */, -/* 331 */ +/* 328 */ /***/ (function(__unusedmodule, exports) { "use strict"; @@ -10745,21 +10902,12 @@ var MatchKind; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.defaultGetter = void 0; -/** - * Default getter which just does a simple property access. Returns - * undefined if the key is not set. - * - * @param carrier - * @param key - */ -function defaultGetter(carrier, key) { - return carrier[key]; -} -exports.defaultGetter = defaultGetter; -//# sourceMappingURL=getter.js.map +//# sourceMappingURL=types.js.map /***/ }), +/* 329 */, +/* 330 */, +/* 331 */, /* 332 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -11058,7 +11206,7 @@ exports.Store = Store; /***/ }), /* 339 */, /* 340 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -11078,60 +11226,30 @@ exports.Store = Store; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_SPAN = exports.NoopSpan = exports.INVALID_SPAN_ID = exports.INVALID_TRACE_ID = void 0; -var trace_flags_1 = __webpack_require__(917); -exports.INVALID_TRACE_ID = '0'; -exports.INVALID_SPAN_ID = '0'; -var INVALID_SPAN_CONTEXT = { - traceId: exports.INVALID_TRACE_ID, - spanId: exports.INVALID_SPAN_ID, - traceFlags: trace_flags_1.TraceFlags.NONE, -}; +exports.SamplingDecision = void 0; /** - * The NoopSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. + * A sampling decision that determines how a {@link Span} will be recorded + * and collected. */ -var NoopSpan = /** @class */ (function () { - function NoopSpan(_spanContext) { - if (_spanContext === void 0) { _spanContext = INVALID_SPAN_CONTEXT; } - this._spanContext = _spanContext; - } - // Returns a SpanContext. - NoopSpan.prototype.context = function () { - return this._spanContext; - }; - // By default does nothing - NoopSpan.prototype.setAttribute = function (key, value) { - return this; - }; - // By default does nothing - NoopSpan.prototype.setAttributes = function (attributes) { - return this; - }; - // By default does nothing - NoopSpan.prototype.addEvent = function (name, attributes) { - return this; - }; - // By default does nothing - NoopSpan.prototype.setStatus = function (status) { - return this; - }; - // By default does nothing - NoopSpan.prototype.updateName = function (name) { - return this; - }; - // By default does nothing - NoopSpan.prototype.end = function (endTime) { }; - // isRecording always returns false for noopSpan. - NoopSpan.prototype.isRecording = function () { - return false; - }; - return NoopSpan; -}()); -exports.NoopSpan = NoopSpan; -exports.NOOP_SPAN = new NoopSpan(); -//# sourceMappingURL=NoopSpan.js.map +var SamplingDecision; +(function (SamplingDecision) { + /** + * `Span.isRecording() === false`, span will not be recorded and all events + * and attributes will be dropped. + */ + SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; + /** + * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} + * MUST NOT be set. + */ + SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; + /** + * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} + * MUST be set. + */ + SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; +})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); +//# sourceMappingURL=SamplingResult.js.map /***/ }), /* 341 */, @@ -11311,30 +11429,7 @@ module.exports = require("assert"); /* 359 */, /* 360 */, /* 361 */, -/* 362 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Logger.js.map - -/***/ }), +/* 362 */, /* 363 */, /* 364 */, /* 365 */, @@ -11354,19 +11449,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, '__esModule', { value: true }); var coreHttp = __webpack_require__(999); -var tslib = __webpack_require__(422); +var tslib = __webpack_require__(815); var api = __webpack_require__(440); var logger$1 = __webpack_require__(928); var abortController = __webpack_require__(106); var os = __webpack_require__(87); var stream = __webpack_require__(794); -var fs = __webpack_require__(747); -var util = __webpack_require__(669); +__webpack_require__(711); var crypto = __webpack_require__(417); +var coreLro = __webpack_require__(889); var events = __webpack_require__(614); var coreTracing = __webpack_require__(263); -var coreLro = __webpack_require__(110); -__webpack_require__(242); +var fs = __webpack_require__(747); +var util = __webpack_require__(669); /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -11477,6 +11572,13 @@ var StorageError = { type: { name: "String" } + }, + code: { + xmlName: "Code", + serializedName: "Code", + type: { + name: "String" + } } } } @@ -11510,7 +11612,7 @@ var DataLakeStorageError = { name: "Composite", className: "DataLakeStorageError", modelProperties: { - error: { + dataLakeStorageErrorDetails: { xmlName: "error", serializedName: "error", type: { @@ -11551,12 +11653,12 @@ var AccessPolicy = { } } }; -var BlobProperties = { +var BlobPropertiesInternal = { xmlName: "Properties", - serializedName: "BlobProperties", + serializedName: "BlobPropertiesInternal", type: { name: "Composite", - className: "BlobProperties", + className: "BlobPropertiesInternal", modelProperties: { createdOn: { xmlName: "Creation-Time", @@ -11809,83 +11911,90 @@ var BlobProperties = { type: { name: "DateTimeRfc1123" } - } - } - } -}; -var BlobItem = { - xmlName: "Blob", - serializedName: "BlobItem", - type: { - name: "Composite", - className: "BlobItem", - modelProperties: { - name: { - xmlName: "Name", - required: true, - serializedName: "Name", + }, + tagCount: { + xmlName: "TagCount", + serializedName: "TagCount", type: { - name: "String" + name: "Number" } }, - deleted: { - xmlName: "Deleted", - required: true, - serializedName: "Deleted", + expiresOn: { + xmlName: "Expiry-Time", + serializedName: "Expiry-Time", + type: { + name: "DateTimeRfc1123" + } + }, + isSealed: { + xmlName: "Sealed", + serializedName: "Sealed", type: { name: "Boolean" } }, - snapshot: { - xmlName: "Snapshot", - required: true, - serializedName: "Snapshot", + rehydratePriority: { + xmlName: "RehydratePriority", + serializedName: "RehydratePriority", type: { name: "String" } }, - properties: { - xmlName: "Properties", + lastAccessedOn: { + xmlName: "LastAccessTime", + serializedName: "LastAccessTime", + type: { + name: "DateTimeRfc1123" + } + } + } + } +}; +var BlobTag = { + xmlName: "Tag", + serializedName: "BlobTag", + type: { + name: "Composite", + className: "BlobTag", + modelProperties: { + key: { + xmlName: "Key", required: true, - serializedName: "Properties", + serializedName: "Key", type: { - name: "Composite", - className: "BlobProperties" + name: "String" } }, - metadata: { - xmlName: "Metadata", - serializedName: "Metadata", + value: { + xmlName: "Value", + required: true, + serializedName: "Value", type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } + name: "String" } } } } }; -var BlobFlatListSegment = { - xmlName: "Blobs", - serializedName: "BlobFlatListSegment", +var BlobTags = { + xmlName: "Tags", + serializedName: "BlobTags", type: { name: "Composite", - className: "BlobFlatListSegment", + className: "BlobTags", modelProperties: { - blobItems: { - xmlName: "BlobItems", - xmlElementName: "Blob", + blobTagSet: { + xmlIsWrapped: true, + xmlName: "TagSet", + xmlElementName: "Tag", required: true, - serializedName: "BlobItems", + serializedName: "BlobTagSet", type: { name: "Sequence", element: { type: { name: "Composite", - className: "BlobItem" + className: "BlobTag" } } } @@ -11893,109 +12002,102 @@ var BlobFlatListSegment = { } } }; -var ListBlobsFlatSegmentResponse = { - xmlName: "EnumerationResults", - serializedName: "ListBlobsFlatSegmentResponse", +var BlobItemInternal = { + xmlName: "Blob", + serializedName: "BlobItemInternal", type: { name: "Composite", - className: "ListBlobsFlatSegmentResponse", + className: "BlobItemInternal", modelProperties: { - serviceEndpoint: { - xmlIsAttribute: true, - xmlName: "ServiceEndpoint", + name: { + xmlName: "Name", required: true, - serializedName: "ServiceEndpoint", + serializedName: "Name", type: { name: "String" } }, - containerName: { - xmlIsAttribute: true, - xmlName: "ContainerName", + deleted: { + xmlName: "Deleted", required: true, - serializedName: "ContainerName", + serializedName: "Deleted", type: { - name: "String" + name: "Boolean" } }, - prefix: { - xmlName: "Prefix", - serializedName: "Prefix", + snapshot: { + xmlName: "Snapshot", + required: true, + serializedName: "Snapshot", type: { name: "String" } }, - marker: { - xmlName: "Marker", - serializedName: "Marker", + versionId: { + xmlName: "VersionId", + serializedName: "VersionId", type: { name: "String" } }, - maxPageSize: { - xmlName: "MaxResults", - serializedName: "MaxResults", + isCurrentVersion: { + xmlName: "IsCurrentVersion", + serializedName: "IsCurrentVersion", type: { - name: "Number" + name: "Boolean" } }, - segment: { - xmlName: "Blobs", + properties: { + xmlName: "Properties", required: true, - serializedName: "Segment", + serializedName: "Properties", type: { name: "Composite", - className: "BlobFlatListSegment" + className: "BlobPropertiesInternal" } }, - continuationToken: { - xmlName: "NextMarker", - serializedName: "NextMarker", + metadata: { + xmlName: "Metadata", + serializedName: "Metadata", type: { - name: "String" + name: "Dictionary", + value: { + type: { + name: "String" + } + } } - } - } - } -}; -var BlobPrefix = { - serializedName: "BlobPrefix", - type: { - name: "Composite", - className: "BlobPrefix", - modelProperties: { - name: { - xmlName: "Name", - required: true, - serializedName: "Name", + }, + blobTags: { + xmlName: "Tags", + serializedName: "BlobTags", type: { - name: "String" + name: "Composite", + className: "BlobTags" + } + }, + objectReplicationMetadata: { + xmlName: "OrMetadata", + serializedName: "ObjectReplicationMetadata", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } } } } } }; -var BlobHierarchyListSegment = { +var BlobFlatListSegment = { xmlName: "Blobs", - serializedName: "BlobHierarchyListSegment", + serializedName: "BlobFlatListSegment", type: { name: "Composite", - className: "BlobHierarchyListSegment", + className: "BlobFlatListSegment", modelProperties: { - blobPrefixes: { - xmlName: "BlobPrefixes", - xmlElementName: "BlobPrefix", - serializedName: "BlobPrefixes", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BlobPrefix" - } - } - } - }, blobItems: { xmlName: "BlobItems", xmlElementName: "Blob", @@ -12006,7 +12108,7 @@ var BlobHierarchyListSegment = { element: { type: { name: "Composite", - className: "BlobItem" + className: "BlobItemInternal" } } } @@ -12014,12 +12116,133 @@ var BlobHierarchyListSegment = { } } }; -var ListBlobsHierarchySegmentResponse = { +var ListBlobsFlatSegmentResponse = { xmlName: "EnumerationResults", - serializedName: "ListBlobsHierarchySegmentResponse", + serializedName: "ListBlobsFlatSegmentResponse", type: { name: "Composite", - className: "ListBlobsHierarchySegmentResponse", + className: "ListBlobsFlatSegmentResponse", + modelProperties: { + serviceEndpoint: { + xmlIsAttribute: true, + xmlName: "ServiceEndpoint", + required: true, + serializedName: "ServiceEndpoint", + type: { + name: "String" + } + }, + containerName: { + xmlIsAttribute: true, + xmlName: "ContainerName", + required: true, + serializedName: "ContainerName", + type: { + name: "String" + } + }, + prefix: { + xmlName: "Prefix", + serializedName: "Prefix", + type: { + name: "String" + } + }, + marker: { + xmlName: "Marker", + serializedName: "Marker", + type: { + name: "String" + } + }, + maxPageSize: { + xmlName: "MaxResults", + serializedName: "MaxResults", + type: { + name: "Number" + } + }, + segment: { + xmlName: "Blobs", + required: true, + serializedName: "Segment", + type: { + name: "Composite", + className: "BlobFlatListSegment" + } + }, + continuationToken: { + xmlName: "NextMarker", + serializedName: "NextMarker", + type: { + name: "String" + } + } + } + } +}; +var BlobPrefix = { + serializedName: "BlobPrefix", + type: { + name: "Composite", + className: "BlobPrefix", + modelProperties: { + name: { + xmlName: "Name", + required: true, + serializedName: "Name", + type: { + name: "String" + } + } + } + } +}; +var BlobHierarchyListSegment = { + xmlName: "Blobs", + serializedName: "BlobHierarchyListSegment", + type: { + name: "Composite", + className: "BlobHierarchyListSegment", + modelProperties: { + blobPrefixes: { + xmlName: "BlobPrefixes", + xmlElementName: "BlobPrefix", + serializedName: "BlobPrefixes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BlobPrefix" + } + } + } + }, + blobItems: { + xmlName: "BlobItems", + xmlElementName: "Blob", + required: true, + serializedName: "BlobItems", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BlobItemInternal" + } + } + } + } + } + } +}; +var ListBlobsHierarchySegmentResponse = { + xmlName: "EnumerationResults", + serializedName: "ListBlobsHierarchySegmentResponse", + type: { + name: "Composite", + className: "ListBlobsHierarchySegmentResponse", modelProperties: { serviceEndpoint: { xmlIsAttribute: true, @@ -12291,6 +12514,20 @@ var ContainerProperties = { type: { name: "Boolean" } + }, + deletedOn: { + xmlName: "DeletedTime", + serializedName: "DeletedTime", + type: { + name: "DateTimeRfc1123" + } + }, + remainingRetentionDays: { + xmlName: "RemainingRetentionDays", + serializedName: "RemainingRetentionDays", + type: { + name: "Number" + } } } } @@ -12310,6 +12547,20 @@ var ContainerItem = { name: "String" } }, + deleted: { + xmlName: "Deleted", + serializedName: "Deleted", + type: { + name: "Boolean" + } + }, + version: { + xmlName: "Version", + serializedName: "Version", + type: { + name: "String" + } + }, properties: { xmlName: "Properties", required: true, @@ -12334,6 +12585,136 @@ var ContainerItem = { } } }; +var DelimitedTextConfiguration = { + serializedName: "DelimitedTextConfiguration", + type: { + name: "Composite", + className: "DelimitedTextConfiguration", + modelProperties: { + columnSeparator: { + xmlName: "ColumnSeparator", + required: true, + serializedName: "ColumnSeparator", + type: { + name: "String" + } + }, + fieldQuote: { + xmlName: "FieldQuote", + required: true, + serializedName: "FieldQuote", + type: { + name: "String" + } + }, + recordSeparator: { + xmlName: "RecordSeparator", + required: true, + serializedName: "RecordSeparator", + type: { + name: "String" + } + }, + escapeChar: { + xmlName: "EscapeChar", + required: true, + serializedName: "EscapeChar", + type: { + name: "String" + } + }, + headersPresent: { + xmlName: "HasHeaders", + required: true, + serializedName: "HeadersPresent", + type: { + name: "Boolean" + } + } + } + } +}; +var JsonTextConfiguration = { + serializedName: "JsonTextConfiguration", + type: { + name: "Composite", + className: "JsonTextConfiguration", + modelProperties: { + recordSeparator: { + xmlName: "RecordSeparator", + required: true, + serializedName: "RecordSeparator", + type: { + name: "String" + } + } + } + } +}; +var ArrowField = { + xmlName: "Field", + serializedName: "ArrowField", + type: { + name: "Composite", + className: "ArrowField", + modelProperties: { + type: { + xmlName: "Type", + required: true, + serializedName: "Type", + type: { + name: "String" + } + }, + name: { + xmlName: "Name", + serializedName: "Name", + type: { + name: "String" + } + }, + precision: { + xmlName: "Precision", + serializedName: "Precision", + type: { + name: "Number" + } + }, + scale: { + xmlName: "Scale", + serializedName: "Scale", + type: { + name: "Number" + } + } + } + } +}; +var ArrowConfiguration = { + serializedName: "ArrowConfiguration", + type: { + name: "Composite", + className: "ArrowConfiguration", + modelProperties: { + schema: { + xmlIsWrapped: true, + xmlName: "Schema", + xmlElementName: "Field", + required: true, + serializedName: "Schema", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ArrowField" + } + } + } + } + } + } +}; var ListContainersSegmentResponse = { xmlName: "EnumerationResults", serializedName: "ListContainersSegmentResponse", @@ -12449,6 +12830,90 @@ var CorsRule = { } } }; +var FilterBlobItem = { + xmlName: "Blob", + serializedName: "FilterBlobItem", + type: { + name: "Composite", + className: "FilterBlobItem", + modelProperties: { + name: { + xmlName: "Name", + required: true, + serializedName: "Name", + type: { + name: "String" + } + }, + containerName: { + xmlName: "ContainerName", + required: true, + serializedName: "ContainerName", + type: { + name: "String" + } + }, + tagValue: { + xmlName: "TagValue", + required: true, + serializedName: "TagValue", + type: { + name: "String" + } + } + } + } +}; +var FilterBlobSegment = { + xmlName: "EnumerationResults", + serializedName: "FilterBlobSegment", + type: { + name: "Composite", + className: "FilterBlobSegment", + modelProperties: { + serviceEndpoint: { + xmlIsAttribute: true, + xmlName: "ServiceEndpoint", + required: true, + serializedName: "ServiceEndpoint", + type: { + name: "String" + } + }, + where: { + xmlName: "Where", + required: true, + serializedName: "Where", + type: { + name: "String" + } + }, + blobs: { + xmlIsWrapped: true, + xmlName: "Blobs", + xmlElementName: "Blob", + required: true, + serializedName: "Blobs", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FilterBlobItem" + } + } + } + }, + continuationToken: { + xmlName: "NextMarker", + serializedName: "NextMarker", + type: { + name: "String" + } + } + } + } +}; var GeoReplication = { serializedName: "GeoReplication", type: { @@ -12677,6 +13142,112 @@ var PageList = { } } }; +var QueryFormat = { + serializedName: "QueryFormat", + type: { + name: "Composite", + className: "QueryFormat", + modelProperties: { + type: { + xmlName: "Type", + serializedName: "Type", + type: { + name: "Enum", + allowedValues: [ + "delimited", + "json", + "arrow" + ] + } + }, + delimitedTextConfiguration: { + xmlName: "DelimitedTextConfiguration", + serializedName: "DelimitedTextConfiguration", + type: { + name: "Composite", + className: "DelimitedTextConfiguration" + } + }, + jsonTextConfiguration: { + xmlName: "JsonTextConfiguration", + serializedName: "JsonTextConfiguration", + type: { + name: "Composite", + className: "JsonTextConfiguration" + } + }, + arrowConfiguration: { + xmlName: "ArrowConfiguration", + serializedName: "ArrowConfiguration", + type: { + name: "Composite", + className: "ArrowConfiguration" + } + } + } + } +}; +var QuerySerialization = { + serializedName: "QuerySerialization", + type: { + name: "Composite", + className: "QuerySerialization", + modelProperties: { + format: { + xmlName: "Format", + required: true, + serializedName: "Format", + type: { + name: "Composite", + className: "QueryFormat" + } + } + } + } +}; +var QueryRequest = { + serializedName: "QueryRequest", + type: { + name: "Composite", + className: "QueryRequest", + modelProperties: { + queryType: { + xmlName: "QueryType", + required: true, + isConstant: true, + serializedName: "QueryType", + defaultValue: 'SQL', + type: { + name: "String" + } + }, + expression: { + xmlName: "Expression", + required: true, + serializedName: "Expression", + type: { + name: "String" + } + }, + inputSerialization: { + xmlName: "InputSerialization", + serializedName: "InputSerialization", + type: { + name: "Composite", + className: "QuerySerialization" + } + }, + outputSerialization: { + xmlName: "OutputSerialization", + serializedName: "OutputSerialization", + type: { + name: "Composite", + className: "QuerySerialization" + } + } + } + } +}; var SignedIdentifier = { serializedName: "SignedIdentifier", type: { @@ -12730,6 +13301,13 @@ var StaticWebsite = { type: { name: "String" } + }, + defaultIndexDocumentPath: { + xmlName: "DefaultIndexDocumentPath", + serializedName: "DefaultIndexDocumentPath", + type: { + name: "String" + } } } } @@ -13051,7 +13629,9 @@ var ServiceGetAccountInfoHeaders = { allowedValues: [ "Storage", "BlobStorage", - "StorageV2" + "StorageV2", + "FileStorage", + "BlockBlobStorage" ] } }, @@ -13103,6 +13683,45 @@ var ServiceSubmitBatchHeaders = { } } }; +var ServiceFilterBlobsHeaders = { + serializedName: "service-filterblobs-headers", + type: { + name: "Composite", + className: "ServiceFilterBlobsHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; var ContainerCreateHeaders = { serializedName: "container-create-headers", type: { @@ -13478,6 +14097,45 @@ var ContainerSetAccessPolicyHeaders = { } } }; +var ContainerRestoreHeaders = { + serializedName: "container-restore-headers", + type: { + name: "Composite", + className: "ContainerRestoreHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; var ContainerAcquireLeaseHeaders = { serializedName: "container-acquirelease-headers", type: { @@ -13897,7 +14555,9 @@ var ContainerGetAccountInfoHeaders = { allowedValues: [ "Storage", "BlobStorage", - "StorageV2" + "StorageV2", + "FileStorage", + "BlockBlobStorage" ] } }, @@ -13934,6 +14594,24 @@ var BlobDownloadHeaders = { }, headerCollectionPrefix: "x-ms-meta-" }, + objectReplicationPolicyId: { + serializedName: "x-ms-or-policy-id", + type: { + name: "String" + } + }, + objectReplicationRules: { + serializedName: "x-ms-or", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + }, + headerCollectionPrefix: "x-ms-or-" + }, contentLength: { serializedName: "content-length", type: { @@ -14098,6 +14776,12 @@ var BlobDownloadHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, acceptRanges: { serializedName: "accept-ranges", type: { @@ -14140,6 +14824,24 @@ var BlobDownloadHeaders = { name: "ByteArray" } }, + tagCount: { + serializedName: "x-ms-tag-count", + type: { + name: "Number" + } + }, + isSealed: { + serializedName: "x-ms-blob-sealed", + type: { + name: "Boolean" + } + }, + lastAccessed: { + serializedName: "x-ms-last-access-time", + type: { + name: "DateTimeRfc1123" + } + }, contentCrc64: { serializedName: "x-ms-content-crc64", type: { @@ -14185,6 +14887,24 @@ var BlobGetPropertiesHeaders = { }, headerCollectionPrefix: "x-ms-meta-" }, + objectReplicationPolicyId: { + serializedName: "x-ms-or-policy-id", + type: { + name: "String" + } + }, + objectReplicationRules: { + serializedName: "x-ms-or", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + }, + headerCollectionPrefix: "x-ms-or-" + }, blobType: { serializedName: "x-ms-blob-type", type: { @@ -14415,6 +15135,48 @@ var BlobGetPropertiesHeaders = { name: "DateTimeRfc1123" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, + isCurrentVersion: { + serializedName: "x-ms-is-current-version", + type: { + name: "Boolean" + } + }, + tagCount: { + serializedName: "x-ms-tag-count", + type: { + name: "Number" + } + }, + expiresOn: { + serializedName: "x-ms-expiry-time", + type: { + name: "DateTimeRfc1123" + } + }, + isSealed: { + serializedName: "x-ms-blob-sealed", + type: { + name: "Boolean" + } + }, + rehydratePriority: { + serializedName: "x-ms-rehydrate-priority", + type: { + name: "String" + } + }, + lastAccessed: { + serializedName: "x-ms-last-access-time", + type: { + name: "DateTimeRfc1123" + } + }, errorCode: { serializedName: "x-ms-error-code", type: { @@ -14670,6 +15432,12 @@ var PageBlobCreateHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -14745,6 +15513,12 @@ var AppendBlobCreateHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -14820,6 +15594,12 @@ var BlockBlobUploadHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -14892,6 +15672,57 @@ var BlobUndeleteHeaders = { } } }; +var BlobSetExpiryHeaders = { + serializedName: "blob-setexpiry-headers", + type: { + name: "Composite", + className: "BlobSetExpiryHeaders", + modelProperties: { + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + lastModified: { + serializedName: "last-modified", + type: { + name: "DateTimeRfc1123" + } + }, + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; var BlobSetHTTPHeadersHeaders = { serializedName: "blob-sethttpheaders-headers", type: { @@ -14985,6 +15816,12 @@ var BlobSetMetadataHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15339,6 +16176,12 @@ var BlobCreateSnapshotHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15396,6 +16239,12 @@ var BlobStartCopyFromURLHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15465,6 +16314,12 @@ var BlobCopyFromURLHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15629,7 +16484,9 @@ var BlobGetAccountInfoHeaders = { allowedValues: [ "Storage", "BlobStorage", - "StorageV2" + "StorageV2", + "FileStorage", + "BlockBlobStorage" ] } }, @@ -15828,6 +16685,12 @@ var BlockBlobCommitBlockListHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -16638,6 +17501,386 @@ var AppendBlobAppendBlockFromUrlHeaders = { } } }; +var AppendBlobSealHeaders = { + serializedName: "appendblob-seal-headers", + type: { + name: "Composite", + className: "AppendBlobSealHeaders", + modelProperties: { + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + lastModified: { + serializedName: "last-modified", + type: { + name: "DateTimeRfc1123" + } + }, + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + isSealed: { + serializedName: "x-ms-blob-sealed", + type: { + name: "Boolean" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; +var BlobQueryHeaders = { + serializedName: "blob-query-headers", + type: { + name: "Composite", + className: "BlobQueryHeaders", + modelProperties: { + lastModified: { + serializedName: "last-modified", + type: { + name: "DateTimeRfc1123" + } + }, + metadata: { + serializedName: "x-ms-meta", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + }, + headerCollectionPrefix: "x-ms-meta-" + }, + contentLength: { + serializedName: "content-length", + type: { + name: "Number" + } + }, + contentType: { + serializedName: "content-type", + type: { + name: "String" + } + }, + contentRange: { + serializedName: "content-range", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + contentMD5: { + serializedName: "content-md5", + type: { + name: "ByteArray" + } + }, + contentEncoding: { + serializedName: "content-encoding", + type: { + name: "String" + } + }, + cacheControl: { + serializedName: "cache-control", + type: { + name: "String" + } + }, + contentDisposition: { + serializedName: "content-disposition", + type: { + name: "String" + } + }, + contentLanguage: { + serializedName: "content-language", + type: { + name: "String" + } + }, + blobSequenceNumber: { + serializedName: "x-ms-blob-sequence-number", + type: { + name: "Number" + } + }, + blobType: { + serializedName: "x-ms-blob-type", + type: { + name: "Enum", + allowedValues: [ + "BlockBlob", + "PageBlob", + "AppendBlob" + ] + } + }, + copyCompletionTime: { + serializedName: "x-ms-copy-completion-time", + type: { + name: "DateTimeRfc1123" + } + }, + copyStatusDescription: { + serializedName: "x-ms-copy-status-description", + type: { + name: "String" + } + }, + copyId: { + serializedName: "x-ms-copy-id", + type: { + name: "String" + } + }, + copyProgress: { + serializedName: "x-ms-copy-progress", + type: { + name: "String" + } + }, + copySource: { + serializedName: "x-ms-copy-source", + type: { + name: "String" + } + }, + copyStatus: { + serializedName: "x-ms-copy-status", + type: { + name: "Enum", + allowedValues: [ + "pending", + "success", + "aborted", + "failed" + ] + } + }, + leaseDuration: { + serializedName: "x-ms-lease-duration", + type: { + name: "Enum", + allowedValues: [ + "infinite", + "fixed" + ] + } + }, + leaseState: { + serializedName: "x-ms-lease-state", + type: { + name: "Enum", + allowedValues: [ + "available", + "leased", + "expired", + "breaking", + "broken" + ] + } + }, + leaseStatus: { + serializedName: "x-ms-lease-status", + type: { + name: "Enum", + allowedValues: [ + "locked", + "unlocked" + ] + } + }, + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + acceptRanges: { + serializedName: "accept-ranges", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + blobCommittedBlockCount: { + serializedName: "x-ms-blob-committed-block-count", + type: { + name: "Number" + } + }, + isServerEncrypted: { + serializedName: "x-ms-server-encrypted", + type: { + name: "Boolean" + } + }, + encryptionKeySha256: { + serializedName: "x-ms-encryption-key-sha256", + type: { + name: "String" + } + }, + encryptionScope: { + serializedName: "x-ms-encryption-scope", + type: { + name: "String" + } + }, + blobContentMD5: { + serializedName: "x-ms-blob-content-md5", + type: { + name: "ByteArray" + } + }, + contentCrc64: { + serializedName: "x-ms-content-crc64", + type: { + name: "ByteArray" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; +var BlobGetTagsHeaders = { + serializedName: "blob-gettags-headers", + type: { + name: "Composite", + className: "BlobGetTagsHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; +var BlobSetTagsHeaders = { + serializedName: "blob-settags-headers", + type: { + name: "Composite", + className: "BlobSetTagsHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -16654,12 +17897,15 @@ var Mappers = /*#__PURE__*/Object.freeze({ ContainerItem: ContainerItem, ContainerProperties: ContainerProperties, CorsRule: CorsRule, + FilterBlobItem: FilterBlobItem, + FilterBlobSegment: FilterBlobSegment, GeoReplication: GeoReplication, KeyInfo: KeyInfo, ListContainersSegmentResponse: ListContainersSegmentResponse, Logging: Logging, Metrics: Metrics, RetentionPolicy: RetentionPolicy, + ServiceFilterBlobsHeaders: ServiceFilterBlobsHeaders, ServiceGetAccountInfoHeaders: ServiceGetAccountInfoHeaders, ServiceGetPropertiesHeaders: ServiceGetPropertiesHeaders, ServiceGetStatisticsHeaders: ServiceGetStatisticsHeaders, @@ -16891,6 +18137,18 @@ var blobSequenceNumber = { } } }; +var blobTagsString = { + parameterPath: [ + "options", + "blobTagsString" + ], + mapper: { + serializedName: "x-ms-tags", + type: { + name: "String" + } + } +}; var blobType0 = { parameterPath: "blobType", mapper: { @@ -16992,7 +18250,7 @@ var comp10 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'copy', + defaultValue: 'expiry', type: { name: "String" } @@ -17004,7 +18262,7 @@ var comp11 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'tier', + defaultValue: 'snapshot', type: { name: "String" } @@ -17016,7 +18274,7 @@ var comp12 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'page', + defaultValue: 'copy', type: { name: "String" } @@ -17028,7 +18286,7 @@ var comp13 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'pagelist', + defaultValue: 'tier', type: { name: "String" } @@ -17040,7 +18298,7 @@ var comp14 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'incrementalcopy', + defaultValue: 'query', type: { name: "String" } @@ -17052,7 +18310,7 @@ var comp15 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'appendblock', + defaultValue: 'tags', type: { name: "String" } @@ -17064,7 +18322,7 @@ var comp16 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'block', + defaultValue: 'page', type: { name: "String" } @@ -17076,7 +18334,31 @@ var comp17 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'blocklist', + defaultValue: 'pagelist', + type: { + name: "String" + } + } +}; +var comp18 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'incrementalcopy', + type: { + name: "String" + } + } +}; +var comp19 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'appendblock', type: { name: "String" } @@ -17094,6 +18376,42 @@ var comp2 = { } } }; +var comp20 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'seal', + type: { + name: "String" + } + } +}; +var comp21 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'block', + type: { + name: "String" + } + } +}; +var comp22 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'blocklist', + type: { + name: "String" + } + } +}; var comp3 = { parameterPath: "comp", mapper: { @@ -17124,7 +18442,7 @@ var comp5 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'metadata', + defaultValue: 'blobs', type: { name: "String" } @@ -17136,7 +18454,7 @@ var comp6 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'acl', + defaultValue: 'metadata', type: { name: "String" } @@ -17148,7 +18466,7 @@ var comp7 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'lease', + defaultValue: 'acl', type: { name: "String" } @@ -17172,7 +18490,7 @@ var comp9 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'snapshot', + defaultValue: 'lease', type: { name: "String" } @@ -17285,6 +18603,30 @@ var defaultEncryptionScope = { } } }; +var deletedContainerName = { + parameterPath: [ + "options", + "deletedContainerName" + ], + mapper: { + serializedName: "x-ms-deleted-container-name", + type: { + name: "String" + } + } +}; +var deletedContainerVersion = { + parameterPath: [ + "options", + "deletedContainerVersion" + ], + mapper: { + serializedName: "x-ms-deleted-container-version", + type: { + name: "String" + } + } +}; var deleteSnapshots = { parameterPath: [ "options", @@ -17389,6 +18731,28 @@ var encryptionScope = { } } }; +var expiresOn = { + parameterPath: [ + "options", + "expiresOn" + ], + mapper: { + serializedName: "x-ms-expiry-time", + type: { + name: "String" + } + } +}; +var expiryOptions = { + parameterPath: "expiryOptions", + mapper: { + required: true, + serializedName: "x-ms-expiry-option", + type: { + name: "String" + } + } +}; var group = { parameterPath: [ "options", @@ -17479,6 +18843,19 @@ var ifSequenceNumberLessThanOrEqualTo = { } } }; +var ifTags = { + parameterPath: [ + "options", + "modifiedAccessConditions", + "ifTags" + ], + mapper: { + serializedName: "x-ms-if-tags", + type: { + name: "String" + } + } +}; var ifUnmodifiedSince = { parameterPath: [ "options", @@ -17500,12 +18877,19 @@ var include0 = { mapper: { serializedName: "include", type: { - name: "Enum", - allowedValues: [ - "metadata" - ] + name: "Sequence", + element: { + type: { + name: "Enum", + allowedValues: [ + "metadata", + "deleted" + ] + } + } } - } + }, + collectionFormat: coreHttp.QueryCollectionFormat.Csv }; var include1 = { parameterPath: [ @@ -17524,7 +18908,9 @@ var include1 = { "deleted", "metadata", "snapshots", - "uncommittedblobs" + "uncommittedblobs", + "versions", + "tags" ] } } @@ -17914,6 +19300,18 @@ var restype2 = { } } }; +var sealBlob = { + parameterPath: [ + "options", + "sealBlob" + ], + mapper: { + serializedName: "x-ms-seal-blob", + type: { + name: "Boolean" + } + } +}; var sequenceNumberAction = { parameterPath: "sequenceNumberAction", mapper: { @@ -18004,6 +19402,19 @@ var sourceIfNoneMatch = { } } }; +var sourceIfTags = { + parameterPath: [ + "options", + "sourceModifiedAccessConditions", + "sourceIfTags" + ], + mapper: { + serializedName: "x-ms-source-if-tags", + type: { + name: "String" + } + } +}; var sourceIfUnmodifiedSince = { parameterPath: [ "options", @@ -18152,7 +19563,31 @@ var version = { required: true, isConstant: true, serializedName: "x-ms-version", - defaultValue: '2019-07-07', + defaultValue: '2020-02-10', + type: { + name: "String" + } + } +}; +var versionId = { + parameterPath: [ + "options", + "versionId" + ], + mapper: { + serializedName: "versionid", + type: { + name: "String" + } + } +}; +var where = { + parameterPath: [ + "options", + "where" + ], + mapper: { + serializedName: "where", type: { name: "String" } @@ -18229,6 +19664,11 @@ var Service = /** @class */ (function () { options: options }, submitBatchOperationSpec, callback); }; + Service.prototype.filterBlobs = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, filterBlobsOperationSpec, callback); + }; return Service; }()); // Operation Specifications @@ -18448,6 +19888,35 @@ var submitBatchOperationSpec = { isXML: true, serializer: serializer }; +var filterBlobsOperationSpec = { + httpMethod: "GET", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + where, + marker0, + maxPageSize, + comp5 + ], + headerParameters: [ + version, + requestId + ], + responses: { + 200: { + bodyMapper: FilterBlobSegment, + headersMapper: ServiceFilterBlobsHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: ServiceFilterBlobsHeaders + } + }, + isXML: true, + serializer: serializer +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -18462,9 +19931,11 @@ var Mappers$1 = /*#__PURE__*/Object.freeze({ AccessPolicy: AccessPolicy, BlobFlatListSegment: BlobFlatListSegment, BlobHierarchyListSegment: BlobHierarchyListSegment, - BlobItem: BlobItem, + BlobItemInternal: BlobItemInternal, BlobPrefix: BlobPrefix, - BlobProperties: BlobProperties, + BlobPropertiesInternal: BlobPropertiesInternal, + BlobTag: BlobTag, + BlobTags: BlobTags, ContainerAcquireLeaseHeaders: ContainerAcquireLeaseHeaders, ContainerBreakLeaseHeaders: ContainerBreakLeaseHeaders, ContainerChangeLeaseHeaders: ContainerChangeLeaseHeaders, @@ -18477,6 +19948,7 @@ var Mappers$1 = /*#__PURE__*/Object.freeze({ ContainerListBlobHierarchySegmentHeaders: ContainerListBlobHierarchySegmentHeaders, ContainerReleaseLeaseHeaders: ContainerReleaseLeaseHeaders, ContainerRenewLeaseHeaders: ContainerRenewLeaseHeaders, + ContainerRestoreHeaders: ContainerRestoreHeaders, ContainerSetAccessPolicyHeaders: ContainerSetAccessPolicyHeaders, ContainerSetMetadataHeaders: ContainerSetMetadataHeaders, ListBlobsFlatSegmentResponse: ListBlobsFlatSegmentResponse, @@ -18533,6 +20005,11 @@ var Container = /** @class */ (function () { options: options }, setAccessPolicyOperationSpec, callback); }; + Container.prototype.restore = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, restoreOperationSpec, callback); + }; Container.prototype.acquireLease = function (options, callback) { return this.client.sendOperationRequest({ options: options @@ -18677,7 +20154,7 @@ var setMetadataOperationSpec = { queryParameters: [ timeoutInSeconds, restype2, - comp5 + comp6 ], headerParameters: [ metadata, @@ -18707,7 +20184,7 @@ var getAccessPolicyOperationSpec = { queryParameters: [ timeoutInSeconds, restype2, - comp6 + comp7 ], headerParameters: [ version, @@ -18748,7 +20225,7 @@ var setAccessPolicyOperationSpec = { queryParameters: [ timeoutInSeconds, restype2, - comp6 + comp7 ], headerParameters: [ access, @@ -18791,6 +20268,35 @@ var setAccessPolicyOperationSpec = { isXML: true, serializer: serializer$1 }; +var restoreOperationSpec = { + httpMethod: "PUT", + path: "{containerName}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + restype2, + comp8 + ], + headerParameters: [ + version, + requestId, + deletedContainerName, + deletedContainerVersion + ], + responses: { + 201: { + headersMapper: ContainerRestoreHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: ContainerRestoreHeaders + } + }, + isXML: true, + serializer: serializer$1 +}; var acquireLeaseOperationSpec = { httpMethod: "PUT", path: "{containerName}", @@ -18799,7 +20305,7 @@ var acquireLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18831,7 +20337,7 @@ var releaseLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18862,7 +20368,7 @@ var renewLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18893,7 +20399,7 @@ var breakLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18924,7 +20430,7 @@ var changeLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -19049,6 +20555,8 @@ var getAccountInfoOperationSpec$1 = { var Mappers$2 = /*#__PURE__*/Object.freeze({ __proto__: null, + ArrowConfiguration: ArrowConfiguration, + ArrowField: ArrowField, BlobAbortCopyFromURLHeaders: BlobAbortCopyFromURLHeaders, BlobAcquireLeaseHeaders: BlobAcquireLeaseHeaders, BlobBreakLeaseHeaders: BlobBreakLeaseHeaders, @@ -19060,17 +20568,28 @@ var Mappers$2 = /*#__PURE__*/Object.freeze({ BlobGetAccessControlHeaders: BlobGetAccessControlHeaders, BlobGetAccountInfoHeaders: BlobGetAccountInfoHeaders, BlobGetPropertiesHeaders: BlobGetPropertiesHeaders, + BlobGetTagsHeaders: BlobGetTagsHeaders, + BlobQueryHeaders: BlobQueryHeaders, BlobReleaseLeaseHeaders: BlobReleaseLeaseHeaders, BlobRenameHeaders: BlobRenameHeaders, BlobRenewLeaseHeaders: BlobRenewLeaseHeaders, BlobSetAccessControlHeaders: BlobSetAccessControlHeaders, + BlobSetExpiryHeaders: BlobSetExpiryHeaders, BlobSetHTTPHeadersHeaders: BlobSetHTTPHeadersHeaders, BlobSetMetadataHeaders: BlobSetMetadataHeaders, + BlobSetTagsHeaders: BlobSetTagsHeaders, BlobSetTierHeaders: BlobSetTierHeaders, BlobStartCopyFromURLHeaders: BlobStartCopyFromURLHeaders, + BlobTag: BlobTag, + BlobTags: BlobTags, BlobUndeleteHeaders: BlobUndeleteHeaders, DataLakeStorageError: DataLakeStorageError, DataLakeStorageErrorError: DataLakeStorageErrorError, + DelimitedTextConfiguration: DelimitedTextConfiguration, + JsonTextConfiguration: JsonTextConfiguration, + QueryFormat: QueryFormat, + QueryRequest: QueryRequest, + QuerySerialization: QuerySerialization, StorageError: StorageError }); @@ -19128,6 +20647,12 @@ var Blob$1 = /** @class */ (function () { options: options }, undeleteOperationSpec, callback); }; + Blob.prototype.setExpiry = function (expiryOptions, options, callback) { + return this.client.sendOperationRequest({ + expiryOptions: expiryOptions, + options: options + }, setExpiryOperationSpec, callback); + }; Blob.prototype.setHTTPHeaders = function (options, callback) { return this.client.sendOperationRequest({ options: options @@ -19201,6 +20726,21 @@ var Blob$1 = /** @class */ (function () { options: options }, getAccountInfoOperationSpec$2, callback); }; + Blob.prototype.query = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, queryOperationSpec, callback); + }; + Blob.prototype.getTags = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, getTagsOperationSpec, callback); + }; + Blob.prototype.setTags = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, setTagsOperationSpec, callback); + }; return Blob; }()); // Operation Specifications @@ -19213,6 +20753,7 @@ var downloadOperationSpec = { ], queryParameters: [ snapshot, + versionId, timeoutInSeconds ], headerParameters: [ @@ -19228,7 +20769,8 @@ var downloadOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19265,6 +20807,7 @@ var getPropertiesOperationSpec$2 = { ], queryParameters: [ snapshot, + versionId, timeoutInSeconds ], headerParameters: [ @@ -19277,7 +20820,8 @@ var getPropertiesOperationSpec$2 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19299,6 +20843,7 @@ var deleteMethodOperationSpec$1 = { ], queryParameters: [ snapshot, + versionId, timeoutInSeconds ], headerParameters: [ @@ -19309,7 +20854,8 @@ var deleteMethodOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 202: { @@ -19461,6 +21007,34 @@ var undeleteOperationSpec = { isXML: true, serializer: serializer$2 }; +var setExpiryOperationSpec = { + httpMethod: "PUT", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + comp10 + ], + headerParameters: [ + version, + requestId, + expiryOptions, + expiresOn + ], + responses: { + 200: { + headersMapper: BlobSetExpiryHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobSetExpiryHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; var setHTTPHeadersOperationSpec = { httpMethod: "PUT", path: "{containerName}/{blob}", @@ -19484,7 +21058,8 @@ var setHTTPHeadersOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19506,7 +21081,7 @@ var setMetadataOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp5 + comp6 ], headerParameters: [ metadata, @@ -19520,7 +21095,8 @@ var setMetadataOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19542,7 +21118,7 @@ var acquireLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ duration, @@ -19553,7 +21129,8 @@ var acquireLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -19575,7 +21152,7 @@ var releaseLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ leaseId1, @@ -19585,7 +21162,8 @@ var releaseLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19607,7 +21185,7 @@ var renewLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ leaseId1, @@ -19617,7 +21195,8 @@ var renewLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19639,7 +21218,7 @@ var changeLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ leaseId1, @@ -19650,7 +21229,8 @@ var changeLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19672,7 +21252,7 @@ var breakLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ breakPeriod, @@ -19682,7 +21262,8 @@ var breakLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 202: { @@ -19704,7 +21285,7 @@ var createSnapshotOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp9 + comp11 ], headerParameters: [ metadata, @@ -19718,6 +21299,7 @@ var createSnapshotOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, leaseId0 ], responses: { @@ -19748,14 +21330,18 @@ var startCopyFromURLOperationSpec = { copySource, version, requestId, + blobTagsString, + sealBlob, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, + sourceIfTags, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, leaseId0 ], responses: { @@ -19786,6 +21372,7 @@ var copyFromURLOperationSpec = { version, requestId, sourceContentMD5, + blobTagsString, xMsRequiresSync, sourceIfModifiedSince, sourceIfUnmodifiedSince, @@ -19795,6 +21382,7 @@ var copyFromURLOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, leaseId0 ], responses: { @@ -19818,7 +21406,7 @@ var abortCopyFromURLOperationSpec = { queryParameters: [ copyId, timeoutInSeconds, - comp10 + comp12 ], headerParameters: [ version, @@ -19845,15 +21433,18 @@ var setTierOperationSpec = { url ], queryParameters: [ + snapshot, + versionId, timeoutInSeconds, - comp11 + comp13 ], headerParameters: [ tier1, rehydratePriority, version, requestId, - leaseId0 + leaseId0, + ifTags ], responses: { 200: { @@ -19895,6 +21486,133 @@ var getAccountInfoOperationSpec$2 = { isXML: true, serializer: serializer$2 }; +var queryOperationSpec = { + httpMethod: "POST", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + snapshot, + timeoutInSeconds, + comp14 + ], + headerParameters: [ + version, + requestId, + leaseId0, + encryptionKey, + encryptionKeySha256, + encryptionAlgorithm, + ifModifiedSince, + ifUnmodifiedSince, + ifMatch, + ifNoneMatch, + ifTags + ], + requestBody: { + parameterPath: [ + "options", + "queryRequest" + ], + mapper: QueryRequest + }, + contentType: "application/xml; charset=utf-8", + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Stream" + } + }, + headersMapper: BlobQueryHeaders + }, + 206: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Stream" + } + }, + headersMapper: BlobQueryHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobQueryHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; +var getTagsOperationSpec = { + httpMethod: "GET", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + snapshot, + versionId, + comp15 + ], + headerParameters: [ + version, + requestId, + ifTags + ], + responses: { + 200: { + bodyMapper: BlobTags, + headersMapper: BlobGetTagsHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobGetTagsHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; +var setTagsOperationSpec = { + httpMethod: "PUT", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + versionId, + comp15 + ], + headerParameters: [ + version, + transactionalContentMD5, + transactionalContentCrc64, + requestId, + ifTags + ], + requestBody: { + parameterPath: [ + "options", + "tags" + ], + mapper: BlobTags + }, + contentType: "application/xml; charset=utf-8", + responses: { + 204: { + headersMapper: BlobSetTagsHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobSetTagsHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -20018,6 +21736,7 @@ var createOperationSpec$1 = { blobSequenceNumber, version, requestId, + blobTagsString, blobType0, blobContentType, blobContentEncoding, @@ -20032,7 +21751,8 @@ var createOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -20054,7 +21774,7 @@ var uploadPagesOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp12 + comp16 ], headerParameters: [ contentLength, @@ -20075,7 +21795,8 @@ var uploadPagesOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "body", @@ -20108,7 +21829,7 @@ var clearPagesOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp12 + comp16 ], headerParameters: [ contentLength, @@ -20127,7 +21848,8 @@ var clearPagesOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -20149,7 +21871,7 @@ var uploadPagesFromURLOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp12 + comp16 ], headerParameters: [ sourceUrl, @@ -20173,6 +21895,7 @@ var uploadPagesFromURLOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, @@ -20199,7 +21922,7 @@ var getPageRangesOperationSpec = { queryParameters: [ snapshot, timeoutInSeconds, - comp13 + comp17 ], headerParameters: [ range0, @@ -20209,7 +21932,8 @@ var getPageRangesOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20234,7 +21958,7 @@ var getPageRangesDiffOperationSpec = { snapshot, timeoutInSeconds, prevsnapshot, - comp13 + comp17 ], headerParameters: [ prevSnapshotUrl, @@ -20245,7 +21969,8 @@ var getPageRangesDiffOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20282,7 +22007,8 @@ var resizeOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20315,7 +22041,8 @@ var updateSequenceNumberOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20337,7 +22064,7 @@ var copyIncrementalOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp14 + comp18 ], headerParameters: [ copySource, @@ -20346,7 +22073,8 @@ var copyIncrementalOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 202: { @@ -20374,6 +22102,7 @@ var Mappers$4 = /*#__PURE__*/Object.freeze({ AppendBlobAppendBlockFromUrlHeaders: AppendBlobAppendBlockFromUrlHeaders, AppendBlobAppendBlockHeaders: AppendBlobAppendBlockHeaders, AppendBlobCreateHeaders: AppendBlobCreateHeaders, + AppendBlobSealHeaders: AppendBlobSealHeaders, StorageError: StorageError }); @@ -20415,6 +22144,11 @@ var AppendBlob = /** @class */ (function () { options: options }, appendBlockFromUrlOperationSpec, callback); }; + AppendBlob.prototype.seal = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, sealOperationSpec, callback); + }; return AppendBlob; }()); // Operation Specifications @@ -20434,6 +22168,7 @@ var createOperationSpec$2 = { encryptionScope, version, requestId, + blobTagsString, blobType1, blobContentType, blobContentEncoding, @@ -20448,7 +22183,8 @@ var createOperationSpec$2 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -20470,7 +22206,7 @@ var appendBlockOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp15 + comp19 ], headerParameters: [ contentLength, @@ -20488,7 +22224,8 @@ var appendBlockOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "body", @@ -20521,7 +22258,7 @@ var appendBlockFromUrlOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp15 + comp19 ], headerParameters: [ sourceUrl, @@ -20543,6 +22280,7 @@ var appendBlockFromUrlOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, @@ -20560,6 +22298,38 @@ var appendBlockFromUrlOperationSpec = { isXML: true, serializer: serializer$4 }; +var sealOperationSpec = { + httpMethod: "PUT", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + comp20 + ], + headerParameters: [ + version, + requestId, + leaseId0, + ifModifiedSince, + ifUnmodifiedSince, + ifMatch, + ifNoneMatch, + appendPosition + ], + responses: { + 200: { + headersMapper: AppendBlobSealHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: AppendBlobSealHeaders + } + }, + isXML: true, + serializer: serializer$4 +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -20656,6 +22426,7 @@ var uploadOperationSpec = { tier0, version, requestId, + blobTagsString, blobType2, blobContentType, blobContentEncoding, @@ -20670,7 +22441,8 @@ var uploadOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "body", @@ -20704,7 +22476,7 @@ var stageBlockOperationSpec = { queryParameters: [ blockId, timeoutInSeconds, - comp16 + comp21 ], headerParameters: [ contentLength, @@ -20750,7 +22522,7 @@ var stageBlockFromURLOperationSpec = { queryParameters: [ blockId, timeoutInSeconds, - comp16 + comp21 ], headerParameters: [ contentLength, @@ -20790,7 +22562,7 @@ var commitBlockListOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp17 + comp22 ], headerParameters: [ transactionalContentMD5, @@ -20800,6 +22572,7 @@ var commitBlockListOperationSpec = { tier0, version, requestId, + blobTagsString, blobCacheControl, blobContentType, blobContentEncoding, @@ -20813,7 +22586,8 @@ var commitBlockListOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "blocks", @@ -20842,12 +22616,13 @@ var getBlockListOperationSpec = { snapshot, listType, timeoutInSeconds, - comp17 + comp22 ], headerParameters: [ version, requestId, - leaseId0 + leaseId0, + ifTags ], responses: { 200: { @@ -20871,10 +22646,10 @@ var logger = logger$1.createClientLogger("storage-blob"); // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -var SDK_VERSION = "12.1.2"; -var SERVICE_VERSION = "2019-07-07"; +var SDK_VERSION = "12.3.0"; +var SERVICE_VERSION = "2020-02-10"; var BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB -var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 100 * 1024 * 1024; // 100MB +var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB var BLOCK_BLOB_MAX_BLOCKS = 50000; var DEFAULT_BLOCK_BUFFER_SIZE_BYTES = 8 * 1024 * 1024; // 8MB var DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES = 4 * 1024 * 1024; // 4MB @@ -20888,6 +22663,7 @@ var URLConstants = { FORCE_BROWSER_NO_CACHE: "_", SIGNATURE: "sig", SNAPSHOT: "snapshot", + VERSIONID: "versionid", TIMEOUT: "timeout" } }; @@ -20924,6 +22700,7 @@ var HeaderConstants = { X_MS_VERSION: "x-ms-version" }; var ETagNone = ""; +var ETagAny = "*"; var SIZE_1_MB = 1 * 1024 * 1024; var BATCH_MAX_REQUEST = 256; var BATCH_MAX_PAYLOAD_IN_BYTES = 4 * SIZE_1_MB; @@ -21023,7 +22800,9 @@ var StorageBlobLoggingAllowedHeaderNames = [ "x-ms-source-if-none-match", "x-ms-source-if-unmodified-since", "x-ms-tag-count", - "x-ms-encryption-key-sha256" + "x-ms-encryption-key-sha256", + "x-ms-if-tags", + "x-ms-source-if-tags" ]; var StorageBlobLoggingAllowedQueryParameters = [ "comp", @@ -21067,7 +22846,7 @@ var StorageBlobLoggingAllowedQueryParameters = [ * * ## URL encode and escape strategy for JS SDKs * - * When customers pass a URL string into XxxClient classes constrcutor, the URL string may already be URL encoded or not. + * When customers pass a URL string into XxxClient classes constructor, the URL string may already be URL encoded or not. * But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL * string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors. * @@ -21097,7 +22876,7 @@ var StorageBlobLoggingAllowedQueryParameters = [ * * This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string * is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL. - * If customer needs to create a blob with "%" in it's blob name, use "%25" insead of "%". Just like above 3rd sample. + * If customer needs to create a blob with "%" in it's blob name, use "%25" instead of "%". Just like above 3rd sample. * And following URL strings are invalid: * - "http://account.blob.core.windows.net/con/b%" * - "http://account.blob.core.windows.net/con/b%2" @@ -21217,14 +22996,11 @@ function extractConnectionStringParts(connectionString) { else if (!accountSas) { throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String"); } - else if (!accountName) { - throw new Error("Invalid AccountName in the provided SAS Connection String"); - } return { kind: "SASConnString", url: blobEndpoint, accountName: accountName, accountSas: accountSas }; } } /** - * Internal escape method implmented Strategy Two mentioned in escapeURL() description. + * Internal escape method implemented Strategy Two mentioned in escapeURL() description. * * @param {string} text * @returns {string} @@ -21443,6 +23219,8 @@ function delay(timeInMs, aborter, abortError) { */ function padStart(currentString, targetLength, padString) { if (padString === void 0) { padString = " "; } + // TS doesn't know this code needs to run downlevel sometimes. + // @ts-expect-error if (String.prototype.padStart) { return currentString.padStart(targetLength, padString); } @@ -21482,14 +23260,15 @@ function getAccountNameFromUrl(url) { // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; accountName = parsedUrl.getHost().split(".")[0]; } - else { + else if (isIpEndpointStyle(parsedUrl)) { // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/ // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/ // .getPath() -> /devstoreaccount1/ accountName = parsedUrl.getPath().split("/")[1]; } - if (!accountName) { - throw new Error("Provided accountName is invalid."); + else { + // Custom domain case: "https://customdomain.com/containername/blob". + accountName = ""; } return accountName; } @@ -21497,6 +23276,163 @@ function getAccountNameFromUrl(url) { throw new Error("Unable to extract accountName with provided information."); } } +function isIpEndpointStyle(parsedUrl) { + if (parsedUrl.getHost() == undefined) { + return false; + } + var host = parsedUrl.getHost() + (parsedUrl.getPort() == undefined ? "" : ":" + parsedUrl.getPort()); + // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. + // Case 2: localhost(:port), use broad regex to match port part. + // Case 3: Ipv4, use broad regex which just check if host contains Ipv4. + // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html. + return /^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host); +} +/** + * Convert Tags to encoded string. + * + * @export + * @param {Tags} tags + * @returns {string | undefined} + */ +function toBlobTagsString(tags) { + if (tags === undefined) { + return undefined; + } + var tagPairs = []; + for (var key in tags) { + if (tags.hasOwnProperty(key)) { + var value = tags[key]; + tagPairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(value)); + } + } + return tagPairs.join("&"); +} +/** + * Convert Tags type to BlobTags. + * + * @export + * @param {Tags} [tags] + * @returns {(BlobTags | undefined)} + */ +function toBlobTags(tags) { + if (tags === undefined) { + return undefined; + } + var res = { + blobTagSet: [] + }; + for (var key in tags) { + if (tags.hasOwnProperty(key)) { + var value = tags[key]; + res.blobTagSet.push({ + key: key, + value: value + }); + } + } + return res; +} +/** + * Covert BlobTags to Tags type. + * + * @export + * @param {BlobTags} [tags] + * @returns {(Tags | undefined)} + */ +function toTags(tags) { + if (tags === undefined) { + return undefined; + } + var res = {}; + for (var _i = 0, _a = tags.blobTagSet; _i < _a.length; _i++) { + var blobTag = _a[_i]; + res[blobTag.key] = blobTag.value; + } + return res; +} +/** + * Convert BlobQueryTextConfiguration to QuerySerialization type. + * + * @export + * @param {(BlobQueryJsonTextConfiguration | BlobQueryCsvTextConfiguration | BlobQueryArrowConfiguration)} [textConfiguration] + * @returns {(QuerySerialization | undefined)} + */ +function toQuerySerialization(textConfiguration) { + if (textConfiguration === undefined) { + return undefined; + } + switch (textConfiguration.kind) { + case "csv": + return { + format: { + type: "delimited", + delimitedTextConfiguration: { + columnSeparator: textConfiguration.columnSeparator || ",", + fieldQuote: textConfiguration.fieldQuote || "", + recordSeparator: textConfiguration.recordSeparator, + escapeChar: textConfiguration.escapeCharacter || "", + headersPresent: textConfiguration.hasHeaders || false + } + } + }; + case "json": + return { + format: { + type: "json", + jsonTextConfiguration: { + recordSeparator: textConfiguration.recordSeparator + } + } + }; + case "arrow": + return { + format: { + type: "arrow", + arrowConfiguration: { + schema: textConfiguration.schema + } + } + }; + default: + throw Error("Invalid BlobQueryTextConfiguration."); + } +} +function parseObjectReplicationRecord(objectReplicationRecord) { + if (!objectReplicationRecord) { + return undefined; + } + if ("policy-id" in objectReplicationRecord) { + // If the dictionary contains a key with policy id, we are not required to do any parsing since + // the policy id should already be stored in the ObjectReplicationDestinationPolicyId. + return undefined; + } + var orProperties = []; + var _loop_1 = function (key) { + var ids = key.split("_"); + var policyPrefix = "or-"; + if (ids[0].startsWith(policyPrefix)) { + ids[0] = ids[0].substring(policyPrefix.length); + } + var rule = { + ruleId: ids[1], + replicationStatus: objectReplicationRecord[key] + }; + var policyIndex = orProperties.findIndex(function (policy) { return policy.policyId === ids[0]; }); + if (policyIndex > -1) { + orProperties[policyIndex].rules.push(rule); + } + else { + orProperties.push({ + policyId: ids[0], + rules: [rule] + }); + } + }; + for (var key in objectReplicationRecord) { + _loop_1(key); + } + return orProperties; +} // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -21834,6 +23770,133 @@ var StorageRetryPolicyFactory = /** @class */ (function () { return StorageRetryPolicyFactory; }()); +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * Credential policy used to sign HTTP(S) requests before sending. This is an + * abstract class. + * + * @export + * @abstract + * @class CredentialPolicy + * @extends {BaseRequestPolicy} + */ +var CredentialPolicy = /** @class */ (function (_super) { + tslib.__extends(CredentialPolicy, _super); + function CredentialPolicy() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Sends out request. + * + * @param {WebResource} request + * @returns {Promise} + * @memberof CredentialPolicy + */ + CredentialPolicy.prototype.sendRequest = function (request) { + return this._nextPolicy.sendRequest(this.signRequest(request)); + }; + /** + * Child classes must implement this method with request signing. This method + * will be executed in {@link sendRequest}. + * + * @protected + * @abstract + * @param {WebResource} request + * @returns {WebResource} + * @memberof CredentialPolicy + */ + CredentialPolicy.prototype.signRequest = function (request) { + // Child classes must override this method with request signing. This method + // will be executed in sendRequest(). + return request; + }; + return CredentialPolicy; +}(coreHttp.BaseRequestPolicy)); + +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources + * or for use with Shared Access Signatures (SAS). + * + * @export + * @class AnonymousCredentialPolicy + * @extends {CredentialPolicy} + */ +var AnonymousCredentialPolicy = /** @class */ (function (_super) { + tslib.__extends(AnonymousCredentialPolicy, _super); + /** + * Creates an instance of AnonymousCredentialPolicy. + * @param {RequestPolicy} nextPolicy + * @param {RequestPolicyOptions} options + * @memberof AnonymousCredentialPolicy + */ + function AnonymousCredentialPolicy(nextPolicy, options) { + return _super.call(this, nextPolicy, options) || this; + } + return AnonymousCredentialPolicy; +}(CredentialPolicy)); + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +/** + * Credential is an abstract class for Azure Storage HTTP requests signing. This + * class will host an credentialPolicyCreator factory which generates CredentialPolicy. + * + * @export + * @abstract + * @class Credential + */ +var Credential = /** @class */ (function () { + function Credential() { + } + /** + * Creates a RequestPolicy object. + * + * @param {RequestPolicy} _nextPolicy + * @param {RequestPolicyOptions} _options + * @returns {RequestPolicy} + * @memberof Credential + */ + Credential.prototype.create = function ( + // tslint:disable-next-line:variable-name + _nextPolicy, + // tslint:disable-next-line:variable-name + _options) { + throw new Error("Method should be implemented in children classes."); + }; + return Credential; +}()); + +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * AnonymousCredential provides a credentialPolicyCreator member used to create + * AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with + * HTTP(S) requests that read public resources or for use with Shared Access + * Signatures (SAS). + * + * @export + * @class AnonymousCredential + * @extends {Credential} + */ +var AnonymousCredential = /** @class */ (function (_super) { + tslib.__extends(AnonymousCredential, _super); + function AnonymousCredential() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Creates an {@link AnonymousCredentialPolicy} object. + * + * @param {RequestPolicy} nextPolicy + * @param {RequestPolicyOptions} options + * @returns {AnonymousCredentialPolicy} + * @memberof AnonymousCredential + */ + AnonymousCredential.prototype.create = function (nextPolicy, options) { + return new AnonymousCredentialPolicy(nextPolicy, options); + }; + return AnonymousCredential; +}(Credential)); + // Copyright (c) Microsoft Corporation. All rights reserved. /** * TelemetryPolicy is a policy used to tag user-agent header for every requests. @@ -21898,6 +23961,8 @@ var TelemetryPolicyFactory = /** @class */ (function () { var userAgentInfo = []; { if (telemetry) { + // FIXME: replace() only replaces the first space. And we have no idea why we need to replace spaces in the first place. + // But fixing this would be a breaking change. Logged an issue here: https://github.com/Azure/azure-sdk-for-js/issues/10793 var telemetryString = (telemetry.userAgentPrefix || "").replace(" ", ""); if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) { userAgentInfo.push(telemetryString); @@ -21987,10 +24052,13 @@ var Pipeline = /** @class */ (function () { * @returns {Pipeline} A new Pipeline object. */ function newPipeline(credential, pipelineOptions) { + if (pipelineOptions === void 0) { pipelineOptions = {}; } + if (credential === undefined) { + credential = new AnonymousCredential(); + } // Order is important. Closer to the API at the top & closer to the network at the bottom. // The credential's policy factory must appear close to the wire so it can sign any // changes made by other factories (like UniqueRequestIDPolicyFactory) - if (pipelineOptions === void 0) { pipelineOptions = {}; } var telemetryPolicy = new TelemetryPolicyFactory(pipelineOptions.userAgentOptions); var factories = [ coreHttp.tracingPolicy({ userAgent: telemetryPolicy.telemetryString }), @@ -22007,7 +24075,7 @@ function newPipeline(credential, pipelineOptions) { }) ]; { - // policies only avaiable in Node.js runtime, not in browsers + // policies only available in Node.js runtime, not in browsers factories.push(coreHttp.proxyPolicy(pipelineOptions.proxyOptions)); factories.push(coreHttp.disableResponseDecompressionPolicy()); } @@ -22145,7 +24213,7 @@ var RetriableReadableStream = /** @class */ (function (_super) { /** * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * BlobDownloadResponse implements BlobDownloadResponseModel interface, and in Node.js runtime it will + * BlobDownloadResponse implements BlobDownloadResponseParsed interface, and in Node.js runtime it will * automatically retry when internal read stream unexpected ends. (This kind of unexpected ends cannot * trigger retries defined in pipeline retry policy.) * @@ -22154,13 +24222,13 @@ var RetriableReadableStream = /** @class */ (function (_super) { * * @export * @class BlobDownloadResponse - * @implements {BlobDownloadResponseModel} + * @implements {BlobDownloadResponseParsed} */ var BlobDownloadResponse = /** @class */ (function () { /** * Creates an instance of BlobDownloadResponse. * - * @param {BlobDownloadResponseModel} originalResponse + * @param {BlobDownloadResponseParsed} originalResponse * @param {ReadableStreamGetter} getter * @param {number} offset * @param {number} count @@ -22184,7 +24252,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.acceptRanges; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "cacheControl", { @@ -22199,7 +24267,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.cacheControl; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentDisposition", { @@ -22215,7 +24283,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentDisposition; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentEncoding", { @@ -22230,7 +24298,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentEncoding; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentLanguage", { @@ -22245,7 +24313,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentLanguage; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobSequenceNumber", { @@ -22260,7 +24328,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobSequenceNumber; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobType", { @@ -22275,7 +24343,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobType; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentLength", { @@ -22290,7 +24358,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentLength; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentMD5", { @@ -22311,7 +24379,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentMD5; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentRange", { @@ -22327,7 +24395,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentRange; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentType", { @@ -22342,7 +24410,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentType; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyCompletedOn", { @@ -22358,7 +24426,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyCompletedOn; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyId", { @@ -22373,7 +24441,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyProgress", { @@ -22390,7 +24458,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyProgress; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copySource", { @@ -22406,7 +24474,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copySource; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyStatus", { @@ -22422,7 +24490,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyStatus; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyStatusDescription", { @@ -22438,7 +24506,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyStatusDescription; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "leaseDuration", { @@ -22454,7 +24522,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.leaseDuration; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "leaseState", { @@ -22469,7 +24537,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.leaseState; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "leaseStatus", { @@ -22484,7 +24552,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.leaseStatus; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "date", { @@ -22499,7 +24567,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.date; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobCommittedBlockCount", { @@ -22514,7 +24582,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobCommittedBlockCount; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "etag", { @@ -22529,7 +24597,21 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.etag; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "tagCount", { + /** + * The number of tags associated with the blob + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.tagCount; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "errorCode", { @@ -22543,7 +24625,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.errorCode; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "isServerEncrypted", { @@ -22561,7 +24643,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.isServerEncrypted; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobContentMD5", { @@ -22579,7 +24661,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobContentMD5; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "lastModified", { @@ -22595,7 +24677,22 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.lastModified; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "lastAccessed", { + /** + * Returns the UTC date and time generated by the service that indicates the time at which the blob was + * last read or written to. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.lastAccessed; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "metadata", { @@ -22610,7 +24707,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.metadata; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "requestId", { @@ -22625,7 +24722,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.requestId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "clientRequestId", { @@ -22640,12 +24737,12 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.clientRequestId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "version", { /** - * Indicates the version of the File service used + * Indicates the version of the Blob service used * to execute the request. * * @readonly @@ -22655,7 +24752,21 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.version; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "versionId", { + /** + * Indicates the versionId of the downloaded blob version. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.versionId; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "encryptionKeySha256", { @@ -22670,7 +24781,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.encryptionKeySha256; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentCrc64", { @@ -22686,7 +24797,49 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentCrc64; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "objectReplicationDestinationPolicyId", { + /** + * Object Replication Policy Id of the destination blob. + * + * @readonly + * @type {(string| undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.objectReplicationDestinationPolicyId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "objectReplicationSourceProperties", { + /** + * Parsed Object Replication Policy Id, Rule Id(s) and status of the source blob. + * + * @readonly + * @type {(ObjectReplicationPolicy[] | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.objectReplicationSourceProperties; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "isSealed", { + /** + * If this blob has been sealed. + * + * @readonly + * @type {(boolean | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.isSealed; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentAsBlob", { @@ -22701,7 +24854,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobBody; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "readableStreamBody", { @@ -22718,7 +24871,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return coreHttp.isNode ? this.blobDownloadStream : undefined; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "_response", { @@ -22731,275 +24884,1605 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse._response; }, - enumerable: true, + enumerable: false, configurable: true }); return BlobDownloadResponse; }()); -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -/** - * Generate a range string. For example: - * - * "bytes=255-" or "bytes=0-511" - * - * @export - * @param {Range} iRange - * @returns {string} - */ -function rangeToString(iRange) { - if (iRange.offset < 0) { - throw new RangeError("Range.offset cannot be smaller than 0."); - } - if (iRange.count && iRange.count <= 0) { - throw new RangeError("Range.count must be larger than 0. Leave it undefined if you want a range from offset to the end."); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +var AVRO_SYNC_MARKER_SIZE = 16; +var AVRO_INIT_BYTES = new Uint8Array([79, 98, 106, 1]); +var AVRO_CODEC_KEY = "avro.codec"; +var AVRO_SCHEMA_KEY = "avro.schema"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +function arraysEqual(a, b) { + if (a === b) + return true; + if (a == null || b == null) + return false; + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; } - return iRange.count - ? "bytes=" + iRange.offset + "-" + (iRange.offset + iRange.count - 1) - : "bytes=" + iRange.offset + "-"; + return true; } -// Copyright (c) Microsoft Corporation. All rights reserved. -(function (BlockBlobTier) { - /** - * Optmized for storing data that is accessed frequently. - */ - BlockBlobTier["Hot"] = "Hot"; - /** - * Optimized for storing data that is infrequently accessed and stored for at least 30 days. - */ - BlockBlobTier["Cool"] = "Cool"; - /** - * Optimized for storing data that is rarely accessed and stored for at least 180 days - * with flexible latency requirements (on the order of hours). - */ - BlockBlobTier["Archive"] = "Archive"; -})(exports.BlockBlobTier || (exports.BlockBlobTier = {})); -(function (PremiumPageBlobTier) { - /** - * P4 Tier. - */ - PremiumPageBlobTier["P4"] = "P4"; - /** - * P6 Tier. - */ - PremiumPageBlobTier["P6"] = "P6"; - /** - * P10 Tier. - */ - PremiumPageBlobTier["P10"] = "P10"; - /** - * P15 Tier. - */ - PremiumPageBlobTier["P15"] = "P15"; - /** - * P20 Tier. - */ - PremiumPageBlobTier["P20"] = "P20"; - /** - * P30 Tier. - */ - PremiumPageBlobTier["P30"] = "P30"; - /** - * P40 Tier. - */ - PremiumPageBlobTier["P40"] = "P40"; - /** - * P50 Tier. - */ - PremiumPageBlobTier["P50"] = "P50"; - /** - * P60 Tier. - */ - PremiumPageBlobTier["P60"] = "P60"; +// Copyright (c) Microsoft Corporation. +var AvroParser = /** @class */ (function () { + function AvroParser() { + } /** - * P70 Tier. + * Reads a fixed number of bytes from the stream. + * + * @static + * @param {AvroReadable} [stream] + * @param {number} [length] + * @param {AvroParserReadOptions} [options={}] + * @returns {Promise} + * @memberof AvroParser */ - PremiumPageBlobTier["P70"] = "P70"; + AvroParser.readFixedBytes = function (stream, length, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var bytes; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, stream.read(length, { abortSignal: options.abortSignal })]; + case 1: + bytes = _a.sent(); + if (bytes.length != length) { + throw new Error("Hit stream end."); + } + return [2 /*return*/, bytes]; + } + }); + }); + }; /** - * P80 Tier. + * Reads a single byte from the stream. + * + * @static + * @param {AvroReadable} [stream] + * @param {AvroParserReadOptions} [options={}] + * @returns {Promise} + * @memberof AvroParser */ - PremiumPageBlobTier["P80"] = "P80"; -})(exports.PremiumPageBlobTier || (exports.PremiumPageBlobTier = {})); -function toAccessTier(tier) { - if (tier == undefined) { - return undefined; - } - return tier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service). -} -function ensureCpkIfSpecified(cpk, isHttps) { - if (cpk && !isHttps) { - throw new RangeError("Customer-provided encryption key must be used over HTTPS."); - } - if (cpk && !cpk.encryptionAlgorithm) { - cpk.encryptionAlgorithm = EncryptionAlgorithmAES25; - } -} - -// Copyright (c) Microsoft Corporation. All rights reserved. -/** - * Reads a readable stream into buffer. Fill the buffer from offset to end. - * - * @export - * @param {NodeJS.ReadableStream} stream A Node.js Readable stream - * @param {Buffer} buffer Buffer to be filled, length must >= offset - * @param {number} offset From which position in the buffer to be filled, inclusive - * @param {number} end To which position in the buffer to be filled, exclusive - * @param {string} [encoding] Encoding of the Readable stream - * @returns {Promise} - */ -function streamToBuffer(stream, buffer, offset, end, encoding) { - return tslib.__awaiter(this, void 0, void 0, function () { - var pos, count; - return tslib.__generator(this, function (_a) { - pos = 0; - count = end - offset; - return [2 /*return*/, new Promise(function (resolve, reject) { - stream.on("readable", function () { - if (pos >= count) { - resolve(); - return; - } - var chunk = stream.read(); - if (!chunk) { - return; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); - } - // How much data needed in this chunk - var chunkLength = pos + chunk.length > count ? count - pos : chunk.length; - buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); - pos += chunkLength; - }); - stream.on("end", function () { - if (pos < count) { - reject(new Error("Stream drains before getting enough data needed. Data read: " + pos + ", data need: " + count)); + AvroParser.readByte = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var buf; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(stream, 1, options)]; + case 1: + buf = _a.sent(); + return [2 /*return*/, buf[0]]; + } + }); + }); + }; + // int and long are stored in variable-length zig-zag coding. + // variable-length: https://lucene.apache.org/core/3_5_0/fileformats.html#VInt + // zig-zag: https://developers.google.com/protocol-buffers/docs/encoding?csw=1#types + AvroParser.readZigZagLong = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var zigZagEncoded, significanceInBit, byte, haveMoreByte, significanceInFloat, res; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + zigZagEncoded = 0; + significanceInBit = 0; + _a.label = 1; + case 1: return [4 /*yield*/, AvroParser.readByte(stream, options)]; + case 2: + byte = _a.sent(); + haveMoreByte = byte & 0x80; + zigZagEncoded |= (byte & 0x7f) << significanceInBit; + significanceInBit += 7; + _a.label = 3; + case 3: + if (haveMoreByte && significanceInBit < 28) return [3 /*break*/, 1]; + _a.label = 4; + case 4: + if (!haveMoreByte) return [3 /*break*/, 9]; + // Switch to float arithmetic + zigZagEncoded = zigZagEncoded; + significanceInFloat = 268435456; // 2 ** 28. + _a.label = 5; + case 5: return [4 /*yield*/, AvroParser.readByte(stream, options)]; + case 6: + byte = _a.sent(); + zigZagEncoded += (byte & 0x7f) * significanceInFloat; + significanceInFloat *= 128; // 2 ** 7 + _a.label = 7; + case 7: + if (byte & 0x80) return [3 /*break*/, 5]; + _a.label = 8; + case 8: + res = (zigZagEncoded % 2 ? -(zigZagEncoded + 1) : zigZagEncoded) / 2; + if (res < Number.MIN_SAFE_INTEGER || res > Number.MAX_SAFE_INTEGER) { + throw new Error("Integer overflow."); } - resolve(); - }); - stream.on("error", reject); - })]; + return [2 /*return*/, res]; + case 9: return [2 /*return*/, (zigZagEncoded >> 1) ^ -(zigZagEncoded & 1)]; + } + }); }); - }); -} -/** - * Reads a readable stream into buffer entirely. - * - * @export - * @param {NodeJS.ReadableStream} stream A Node.js Readable stream - * @param {Buffer} buffer Buffer to be filled, length must >= offset - * @param {string} [encoding] Encoding of the Readable stream - * @returns {Promise} with the count of bytes read. - * @throws {RangeError} If buffer size is not big enough. - */ -function streamToBuffer2(stream, buffer, encoding) { - return tslib.__awaiter(this, void 0, void 0, function () { - var pos, bufferSize; - return tslib.__generator(this, function (_a) { - pos = 0; - bufferSize = buffer.length; - return [2 /*return*/, new Promise(function (resolve, reject) { - stream.on("readable", function () { - var chunk = stream.read(); - if (!chunk) { - return; + }; + AvroParser.readLong = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, AvroParser.readZigZagLong(stream, options)]; + }); + }); + }; + AvroParser.readInt = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, AvroParser.readZigZagLong(stream, options)]; + }); + }); + }; + AvroParser.readNull = function () { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, null]; + }); + }); + }; + AvroParser.readBoolean = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var b; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readByte(stream, options)]; + case 1: + b = _a.sent(); + if (b == 1) { + return [2 /*return*/, true]; } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); + else if (b == 0) { + return [2 /*return*/, false]; } - if (pos + chunk.length > bufferSize) { - reject(new Error("Stream exceeds buffer size. Buffer size: " + bufferSize)); - return; + else { + throw new Error("Byte was not a boolean."); } - buffer.fill(chunk, pos, pos + chunk.length); - pos += chunk.length; - }); - stream.on("end", function () { - resolve(pos); - }); - stream.on("error", reject); - })]; + } + }); + }); + }; + AvroParser.readFloat = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var u8arr, view; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(stream, 4, options)]; + case 1: + u8arr = _a.sent(); + view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); + return [2 /*return*/, view.getFloat32(0, true)]; // littleEndian = true + } + }); + }); + }; + AvroParser.readDouble = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var u8arr, view; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(stream, 8, options)]; + case 1: + u8arr = _a.sent(); + view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); + return [2 /*return*/, view.getFloat64(0, true)]; // littleEndian = true + } + }); + }); + }; + AvroParser.readBytes = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var size; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 1: + size = _a.sent(); + if (size < 0) { + throw new Error("Bytes size was negative."); + } + return [4 /*yield*/, stream.read(size, { abortSignal: options.abortSignal })]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + AvroParser.readString = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var u8arr, utf8decoder; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readBytes(stream, options)]; + case 1: + u8arr = _a.sent(); + // polyfill TextDecoder to be backward compatible with older + // nodejs that doesn't expose TextDecoder as a global variable + if (typeof TextDecoder === "undefined" && "function" !== "undefined") { + global.TextDecoder = __webpack_require__(669).TextDecoder; + } + utf8decoder = new TextDecoder(); + return [2 /*return*/, utf8decoder.decode(u8arr)]; + } + }); + }); + }; + AvroParser.readMapPair = function (stream, readItemMethod, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var key, value; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readString(stream, options)]; + case 1: + key = _a.sent(); + return [4 /*yield*/, readItemMethod(stream, options)]; + case 2: + value = _a.sent(); + return [2 /*return*/, { key: key, value: value }]; + } + }); + }); + }; + AvroParser.readMap = function (stream, readItemMethod, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var readPairMethod, pairs, dict, _i, pairs_1, pair; + var _this = this; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + readPairMethod = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(_this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readMapPair(stream, readItemMethod, options)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + return [4 /*yield*/, AvroParser.readArray(stream, readPairMethod, options)]; + case 1: + pairs = _a.sent(); + dict = {}; + for (_i = 0, pairs_1 = pairs; _i < pairs_1.length; _i++) { + pair = pairs_1[_i]; + dict[pair.key] = pair.value; + } + return [2 /*return*/, dict]; + } + }); + }); + }; + AvroParser.readArray = function (stream, readItemMethod, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var items, count, item; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + items = []; + return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 1: + count = _a.sent(); + _a.label = 2; + case 2: + if (!(count != 0)) return [3 /*break*/, 8]; + if (!(count < 0)) return [3 /*break*/, 4]; + // Ignore block sizes + return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 3: + // Ignore block sizes + _a.sent(); + count = -count; + _a.label = 4; + case 4: + if (!count--) return [3 /*break*/, 6]; + return [4 /*yield*/, readItemMethod(stream, options)]; + case 5: + item = _a.sent(); + items.push(item); + return [3 /*break*/, 4]; + case 6: return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 7: + count = _a.sent(); + return [3 /*break*/, 2]; + case 8: return [2 /*return*/, items]; + } + }); + }); + }; + return AvroParser; +}()); +var AvroComplex; +(function (AvroComplex) { + AvroComplex["RECORD"] = "record"; + AvroComplex["ENUM"] = "enum"; + AvroComplex["ARRAY"] = "array"; + AvroComplex["MAP"] = "map"; + AvroComplex["UNION"] = "union"; + AvroComplex["FIXED"] = "fixed"; +})(AvroComplex || (AvroComplex = {})); +var AvroType = /** @class */ (function () { + function AvroType() { + } + /** + * Determines the AvroType from the Avro Schema. + */ + AvroType.fromSchema = function (schema) { + if (typeof schema == "string") { + return AvroType.fromStringSchema(schema); + } + else if (Array.isArray(schema)) { + return AvroType.fromArraySchema(schema); + } + else { + return AvroType.fromObjectSchema(schema); + } + }; + AvroType.fromStringSchema = function (schema) { + switch (schema) { + case AvroPrimitive.NULL: + case AvroPrimitive.BOOLEAN: + case AvroPrimitive.INT: + case AvroPrimitive.LONG: + case AvroPrimitive.FLOAT: + case AvroPrimitive.DOUBLE: + case AvroPrimitive.BYTES: + case AvroPrimitive.STRING: + return new AvroPrimitiveType(schema); + default: + throw new Error("Unexpected Avro type " + schema); + } + }; + AvroType.fromArraySchema = function (schema) { + return new AvroUnionType(schema.map(AvroType.fromSchema)); + }; + AvroType.fromObjectSchema = function (schema) { + var type = schema.type; + // Primitives can be defined as strings or objects + try { + return AvroType.fromStringSchema(type); + } + catch (err) { } + switch (type) { + case AvroComplex.RECORD: + if (schema.aliases) { + throw new Error("aliases currently is not supported, schema: " + schema); + } + if (!schema.name) { + throw new Error("Required attribute 'name' doesn't exist on schema: " + schema); + } + var fields = {}; + if (!schema.fields) { + throw new Error("Required attribute 'fields' doesn't exist on schema: " + schema); + } + for (var _i = 0, _a = schema.fields; _i < _a.length; _i++) { + var field = _a[_i]; + fields[field.name] = AvroType.fromSchema(field.type); + } + return new AvroRecordType(fields, schema.name); + case AvroComplex.ENUM: + if (schema.aliases) { + throw new Error("aliases currently is not supported, schema: " + schema); + } + if (!schema.symbols) { + throw new Error("Required attribute 'symbols' doesn't exist on schema: " + schema); + } + return new AvroEnumType(schema.symbols); + case AvroComplex.MAP: + if (!schema.values) { + throw new Error("Required attribute 'values' doesn't exist on schema: " + schema); + } + return new AvroMapType(AvroType.fromSchema(schema.values)); + case AvroComplex.ARRAY: // Unused today + case AvroComplex.FIXED: // Unused today + default: + throw new Error("Unexpected Avro type " + type + " in " + schema); + } + }; + return AvroType; +}()); +var AvroPrimitive; +(function (AvroPrimitive) { + AvroPrimitive["NULL"] = "null"; + AvroPrimitive["BOOLEAN"] = "boolean"; + AvroPrimitive["INT"] = "int"; + AvroPrimitive["LONG"] = "long"; + AvroPrimitive["FLOAT"] = "float"; + AvroPrimitive["DOUBLE"] = "double"; + AvroPrimitive["BYTES"] = "bytes"; + AvroPrimitive["STRING"] = "string"; +})(AvroPrimitive || (AvroPrimitive = {})); +var AvroPrimitiveType = /** @class */ (function (_super) { + tslib.__extends(AvroPrimitiveType, _super); + function AvroPrimitiveType(primitive) { + var _this = _super.call(this) || this; + _this._primitive = primitive; + return _this; + } + AvroPrimitiveType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = this._primitive; + switch (_a) { + case AvroPrimitive.NULL: return [3 /*break*/, 1]; + case AvroPrimitive.BOOLEAN: return [3 /*break*/, 3]; + case AvroPrimitive.INT: return [3 /*break*/, 5]; + case AvroPrimitive.LONG: return [3 /*break*/, 7]; + case AvroPrimitive.FLOAT: return [3 /*break*/, 9]; + case AvroPrimitive.DOUBLE: return [3 /*break*/, 11]; + case AvroPrimitive.BYTES: return [3 /*break*/, 13]; + case AvroPrimitive.STRING: return [3 /*break*/, 15]; + } + return [3 /*break*/, 17]; + case 1: return [4 /*yield*/, AvroParser.readNull()]; + case 2: return [2 /*return*/, _b.sent()]; + case 3: return [4 /*yield*/, AvroParser.readBoolean(stream, options)]; + case 4: return [2 /*return*/, _b.sent()]; + case 5: return [4 /*yield*/, AvroParser.readInt(stream, options)]; + case 6: return [2 /*return*/, _b.sent()]; + case 7: return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 8: return [2 /*return*/, _b.sent()]; + case 9: return [4 /*yield*/, AvroParser.readFloat(stream, options)]; + case 10: return [2 /*return*/, _b.sent()]; + case 11: return [4 /*yield*/, AvroParser.readDouble(stream, options)]; + case 12: return [2 /*return*/, _b.sent()]; + case 13: return [4 /*yield*/, AvroParser.readBytes(stream, options)]; + case 14: return [2 /*return*/, _b.sent()]; + case 15: return [4 /*yield*/, AvroParser.readString(stream, options)]; + case 16: return [2 /*return*/, _b.sent()]; + case 17: throw new Error("Unknown Avro Primitive"); + } + }); + }); + }; + return AvroPrimitiveType; +}(AvroType)); +var AvroEnumType = /** @class */ (function (_super) { + tslib.__extends(AvroEnumType, _super); + function AvroEnumType(symbols) { + var _this = _super.call(this) || this; + _this._symbols = symbols; + return _this; + } + AvroEnumType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var value; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readInt(stream, options)]; + case 1: + value = _a.sent(); + return [2 /*return*/, this._symbols[value]]; + } + }); }); + }; + return AvroEnumType; +}(AvroType)); +var AvroUnionType = /** @class */ (function (_super) { + tslib.__extends(AvroUnionType, _super); + function AvroUnionType(types) { + var _this = _super.call(this) || this; + _this._types = types; + return _this; + } + AvroUnionType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var typeIndex; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readInt(stream, options)]; + case 1: + typeIndex = _a.sent(); + return [4 /*yield*/, this._types[typeIndex].read(stream, options)]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + return AvroUnionType; +}(AvroType)); +var AvroMapType = /** @class */ (function (_super) { + tslib.__extends(AvroMapType, _super); + function AvroMapType(itemType) { + var _this = _super.call(this) || this; + _this._itemType = itemType; + return _this; + } + AvroMapType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var readItemMethod; + var _this = this; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + readItemMethod = function (s, options) { return tslib.__awaiter(_this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this._itemType.read(s, options)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); }; + return [4 /*yield*/, AvroParser.readMap(stream, readItemMethod, options)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + return AvroMapType; +}(AvroType)); +var AvroRecordType = /** @class */ (function (_super) { + tslib.__extends(AvroRecordType, _super); + function AvroRecordType(fields, name) { + var _this = _super.call(this) || this; + _this._fields = fields; + _this._name = name; + return _this; + } + AvroRecordType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var record, _a, _b, _i, key, _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + record = {}; + record["$schema"] = this._name; + _a = []; + for (_b in this._fields) + _a.push(_b); + _i = 0; + _e.label = 1; + case 1: + if (!(_i < _a.length)) return [3 /*break*/, 4]; + key = _a[_i]; + if (!this._fields.hasOwnProperty(key)) return [3 /*break*/, 3]; + _c = record; + _d = key; + return [4 /*yield*/, this._fields[key].read(stream, options)]; + case 2: + _c[_d] = _e.sent(); + _e.label = 3; + case 3: + _i++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/, record]; + } + }); + }); + }; + return AvroRecordType; +}(AvroType)); + +// Copyright (c) Microsoft Corporation. +var AvroReader = /** @class */ (function () { + function AvroReader(dataStream, headerStream, currentBlockOffset, indexWithinCurrentBlock) { + this._dataStream = dataStream; + this._headerStream = headerStream || dataStream; + this._initialized = false; + this._blockOffset = currentBlockOffset || 0; + this._objectIndex = indexWithinCurrentBlock || 0; + this._initialBlockOffset = currentBlockOffset || 0; + } + Object.defineProperty(AvroReader.prototype, "blockOffset", { + get: function () { + return this._blockOffset; + }, + enumerable: false, + configurable: true }); -} -/** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. - * - * @export - * @param {NodeJS.ReadableStream} rs The read stream. - * @param {string} file Destination file path. - * @returns {Promise} - */ -function readStreamToLocalFile(rs, file) { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - return [2 /*return*/, new Promise(function (resolve, reject) { - var ws = fs.createWriteStream(file); - rs.on("error", function (err) { - reject(err); - }); - ws.on("error", function (err) { - reject(err); - }); - ws.on("close", resolve); - rs.pipe(ws); - })]; + Object.defineProperty(AvroReader.prototype, "objectIndex", { + get: function () { + return this._objectIndex; + }, + enumerable: false, + configurable: true + }); + AvroReader.prototype.initialize = function (options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var header, _a, codec, _b, schema, _c, i; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(this._headerStream, AVRO_INIT_BYTES.length, { + abortSignal: options.abortSignal + })]; + case 1: + header = _d.sent(); + if (!arraysEqual(header, AVRO_INIT_BYTES)) { + throw new Error("Stream is not an Avro file."); + } + // File metadata is written as if defined by the following map schema: + // { "type": "map", "values": "bytes"} + _a = this; + return [4 /*yield*/, AvroParser.readMap(this._headerStream, AvroParser.readString, { + abortSignal: options.abortSignal + })]; + case 2: + // File metadata is written as if defined by the following map schema: + // { "type": "map", "values": "bytes"} + _a._metadata = _d.sent(); + codec = this._metadata[AVRO_CODEC_KEY]; + if (!(codec == undefined || codec == "null")) { + throw new Error("Codecs are not supported"); + } + // The 16-byte, randomly-generated sync marker for this file. + _b = this; + return [4 /*yield*/, AvroParser.readFixedBytes(this._headerStream, AVRO_SYNC_MARKER_SIZE, { + abortSignal: options.abortSignal + })]; + case 3: + // The 16-byte, randomly-generated sync marker for this file. + _b._syncMarker = _d.sent(); + schema = JSON.parse(this._metadata[AVRO_SCHEMA_KEY]); + this._itemType = AvroType.fromSchema(schema); + if (this._blockOffset == 0) { + this._blockOffset = this._initialBlockOffset + this._dataStream.position; + } + _c = this; + return [4 /*yield*/, AvroParser.readLong(this._dataStream, { + abortSignal: options.abortSignal + })]; + case 4: + _c._itemsRemainingInBlock = _d.sent(); + // skip block length + return [4 /*yield*/, AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal })]; + case 5: + // skip block length + _d.sent(); + this._initialized = true; + if (!(this._objectIndex && this._objectIndex > 0)) return [3 /*break*/, 9]; + i = 0; + _d.label = 6; + case 6: + if (!(i < this._objectIndex)) return [3 /*break*/, 9]; + return [4 /*yield*/, this._itemType.read(this._dataStream, { abortSignal: options.abortSignal })]; + case 7: + _d.sent(); + this._itemsRemainingInBlock--; + _d.label = 8; + case 8: + i++; + return [3 /*break*/, 6]; + case 9: return [2 /*return*/]; + } + }); }); + }; + AvroReader.prototype.hasNext = function () { + return !this._initialized || this._itemsRemainingInBlock > 0; + }; + AvroReader.prototype.parseObjects = function (options) { + if (options === void 0) { options = {}; } + return tslib.__asyncGenerator(this, arguments, function parseObjects_1() { + var result, marker, _a, err_1; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!!this._initialized) return [3 /*break*/, 2]; + return [4 /*yield*/, tslib.__await(this.initialize(options))]; + case 1: + _b.sent(); + _b.label = 2; + case 2: + if (!this.hasNext()) return [3 /*break*/, 13]; + return [4 /*yield*/, tslib.__await(this._itemType.read(this._dataStream, { + abortSignal: options.abortSignal + }))]; + case 3: + result = _b.sent(); + this._itemsRemainingInBlock--; + this._objectIndex++; + if (!(this._itemsRemainingInBlock == 0)) return [3 /*break*/, 10]; + return [4 /*yield*/, tslib.__await(AvroParser.readFixedBytes(this._dataStream, AVRO_SYNC_MARKER_SIZE, { + abortSignal: options.abortSignal + }))]; + case 4: + marker = _b.sent(); + this._blockOffset = this._initialBlockOffset + this._dataStream.position; + this._objectIndex = 0; + if (!arraysEqual(this._syncMarker, marker)) { + throw new Error("Stream is not a valid Avro file."); + } + _b.label = 5; + case 5: + _b.trys.push([5, 7, , 8]); + _a = this; + return [4 /*yield*/, tslib.__await(AvroParser.readLong(this._dataStream, { + abortSignal: options.abortSignal + }))]; + case 6: + _a._itemsRemainingInBlock = _b.sent(); + return [3 /*break*/, 8]; + case 7: + err_1 = _b.sent(); + // We hit the end of the stream. + this._itemsRemainingInBlock = 0; + return [3 /*break*/, 8]; + case 8: + if (!(this._itemsRemainingInBlock > 0)) return [3 /*break*/, 10]; + // Ignore block size + return [4 /*yield*/, tslib.__await(AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal }))]; + case 9: + // Ignore block size + _b.sent(); + _b.label = 10; + case 10: return [4 /*yield*/, tslib.__await(result)]; + case 11: return [4 /*yield*/, _b.sent()]; + case 12: + _b.sent(); + return [3 /*break*/, 2]; + case 13: return [2 /*return*/]; + } + }); + }); + }; + return AvroReader; +}()); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +var AvroReadable = /** @class */ (function () { + function AvroReadable() { + } + return AvroReadable; +}()); + +// Copyright (c) Microsoft Corporation. +var ABORT_ERROR$1 = new abortController.AbortError("Reading from the avro stream was aborted."); +var AvroReadableFromStream = /** @class */ (function (_super) { + tslib.__extends(AvroReadableFromStream, _super); + function AvroReadableFromStream(readable) { + var _this = _super.call(this) || this; + _this._readable = readable; + _this._position = 0; + return _this; + } + AvroReadableFromStream.prototype.toUint8Array = function (data) { + if (typeof data === "string") { + return Buffer.from(data); + } + return data; + }; + Object.defineProperty(AvroReadableFromStream.prototype, "position", { + get: function () { + return this._position; + }, + enumerable: false, + configurable: true }); -} + AvroReadableFromStream.prototype.read = function (size, options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var chunk; + var _this = this; + return tslib.__generator(this, function (_b) { + if ((_a = options.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) { + throw ABORT_ERROR$1; + } + if (size < 0) { + throw new Error("size parameter should be positive: " + size); + } + if (size === 0) { + return [2 /*return*/, new Uint8Array()]; + } + if (!this._readable.readable) { + throw new Error("Stream no longer readable."); + } + chunk = this._readable.read(size); + if (chunk) { + this._position += chunk.length; + // chunk.length maybe less than desired size if the stream ends. + return [2 /*return*/, this.toUint8Array(chunk)]; + } + else { + // register callback to wait for enough data to read + return [2 /*return*/, new Promise(function (resolve, reject) { + var cleanUp = function () { + _this._readable.removeListener("readable", readableCallback); + _this._readable.removeListener("error", rejectCallback); + _this._readable.removeListener("end", rejectCallback); + _this._readable.removeListener("close", rejectCallback); + if (options.abortSignal) { + options.abortSignal.removeEventListener("abort", abortHandler); + } + }; + var readableCallback = function () { + var chunk = _this._readable.read(size); + if (chunk) { + _this._position += chunk.length; + cleanUp(); + // chunk.length maybe less than desired size if the stream ends. + resolve(_this.toUint8Array(chunk)); + } + }; + var rejectCallback = function () { + cleanUp(); + reject(); + }; + var abortHandler = function () { + cleanUp(); + reject(ABORT_ERROR$1); + }; + _this._readable.on("readable", readableCallback); + _this._readable.once("error", rejectCallback); + _this._readable.once("end", rejectCallback); + _this._readable.once("close", rejectCallback); + if (options.abortSignal) { + options.abortSignal.addEventListener("abort", abortHandler); + } + })]; + } + }); + }); + }; + return AvroReadableFromStream; +}(AvroReadable)); + +// Copyright (c) Microsoft Corporation. All rights reserved. /** * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * Promisified version of fs.stat(). + * A Node.js BlobQuickQueryStream will internally parse avro data stream for blob query. + * + * @class BlobQuickQueryStream + * @extends {Readable} */ -var fsStat = util.promisify(fs.stat); +var BlobQuickQueryStream = /** @class */ (function (_super) { + tslib.__extends(BlobQuickQueryStream, _super); + /** + * Creates an instance of BlobQuickQueryStream. + * + * @param {NodeJS.ReadableStream} source The current ReadableStream returned from getter + * @param {BlobQuickQueryStreamOptions} [options={}] + * @memberof BlobQuickQueryStream + */ + function BlobQuickQueryStream(source, options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this) || this; + _this.source = source; + _this.onProgress = options.onProgress; + _this.onError = options.onError; + _this.avroReader = new AvroReader(new AvroReadableFromStream(_this.source)); + _this.avroIter = _this.avroReader.parseObjects({ abortSignal: options.abortSignal }); + return _this; + } + BlobQuickQueryStream.prototype._read = function () { + var _this = this; + this.readInternal().catch(function (err) { + _this.emit("error", err); + }); + }; + BlobQuickQueryStream.prototype.readInternal = function () { + var e_1, _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, _c, obj, schema, exit, data, bytesScanned, totalBytes, fatal, name_1, description, position, e_1_1; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 5, 6, 11]); + _b = tslib.__asyncValues(this.avroIter); + _d.label = 1; + case 1: return [4 /*yield*/, _b.next()]; + case 2: + if (!(_c = _d.sent(), !_c.done)) return [3 /*break*/, 4]; + obj = _c.value; + schema = obj.$schema; + if (typeof schema !== "string") { + throw Error("Missing schema in avro record."); + } + exit = false; + switch (schema) { + case "com.microsoft.azure.storage.queryBlobContents.resultData": + data = obj.data; + if (data instanceof Uint8Array === false) { + throw Error("Invalid data in avro result record."); + } + if (!this.push(Buffer.from(data))) { + exit = true; + } + break; + case "com.microsoft.azure.storage.queryBlobContents.progress": + bytesScanned = obj.bytesScanned; + if (typeof bytesScanned !== "number") { + throw Error("Invalid bytesScanned in avro progress record."); + } + if (this.onProgress) { + this.onProgress({ loadedBytes: bytesScanned }); + } + break; + case "com.microsoft.azure.storage.queryBlobContents.end": + if (this.onProgress) { + totalBytes = obj.totalBytes; + if (typeof totalBytes !== "number") { + throw Error("Invalid totalBytes in avro end record."); + } + this.onProgress({ loadedBytes: totalBytes }); + } + this.push(null); + break; + case "com.microsoft.azure.storage.queryBlobContents.error": + if (this.onError) { + fatal = obj.fatal; + if (typeof fatal !== "boolean") { + throw Error("Invalid fatal in avro error record."); + } + name_1 = obj.name; + if (typeof name_1 !== "string") { + throw Error("Invalid name in avro error record."); + } + description = obj.description; + if (typeof description !== "string") { + throw Error("Invalid description in avro error record."); + } + position = obj.position; + if (typeof position !== "number") { + throw Error("Invalid position in avro error record."); + } + this.onError({ + position: position, + name: name_1, + isFatal: fatal, + description: description + }); + } + break; + default: + throw Error("Unknown schema " + schema + " in avro progress record."); + } + if (exit) { + return [3 /*break*/, 4]; + } + _d.label = 3; + case 3: return [3 /*break*/, 1]; + case 4: return [3 /*break*/, 11]; + case 5: + e_1_1 = _d.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 11]; + case 6: + _d.trys.push([6, , 9, 10]); + if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 8]; + return [4 /*yield*/, _a.call(_b)]; + case 7: + _d.sent(); + _d.label = 8; + case 8: return [3 /*break*/, 10]; + case 9: + if (e_1) throw e_1.error; + return [7 /*endfinally*/]; + case 10: return [7 /*endfinally*/]; + case 11: return [2 /*return*/]; + } + }); + }); + }; + return BlobQuickQueryStream; +}(stream.Readable)); // Copyright (c) Microsoft Corporation. All rights reserved. /** - * Credential policy used to sign HTTP(S) requests before sending. This is an - * abstract class. + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * BlobQueryResponse implements BlobDownloadResponseModel interface, and in Node.js runtime it will + * parse avor data returned by blob query. * * @export - * @abstract - * @class CredentialPolicy - * @extends {BaseRequestPolicy} + * @class BlobQueryResponse + * @implements {BlobDownloadResponseModel} */ -var CredentialPolicy = /** @class */ (function (_super) { - tslib.__extends(CredentialPolicy, _super); - function CredentialPolicy() { - return _super !== null && _super.apply(this, arguments) || this; - } +var BlobQueryResponse = /** @class */ (function () { /** - * Sends out request. + * Creates an instance of BlobQueryResponse. * - * @param {WebResource} request - * @returns {Promise} - * @memberof CredentialPolicy + * @param {BlobQueryResponseModel} originalResponse + * @param {BlobQuickQueryStreamOptions} [options={}] + * @memberof BlobQueryResponse */ - CredentialPolicy.prototype.sendRequest = function (request) { - return this._nextPolicy.sendRequest(this.signRequest(request)); - }; - /** - * Child classes must implement this method with request signing. This method - * will be executed in {@link sendRequest}. - * - * @protected - * @abstract - * @param {WebResource} request - * @returns {WebResource} - * @memberof CredentialPolicy - */ - CredentialPolicy.prototype.signRequest = function (request) { - // Child classes must override this method with request signing. This method - // will be executed in sendRequest(). - return request; - }; - return CredentialPolicy; -}(coreHttp.BaseRequestPolicy)); + function BlobQueryResponse(originalResponse, options) { + if (options === void 0) { options = {}; } + this.originalResponse = originalResponse; + this.blobDownloadStream = new BlobQuickQueryStream(this.originalResponse.readableStreamBody, options); + } + Object.defineProperty(BlobQueryResponse.prototype, "acceptRanges", { + /** + * Indicates that the service supports + * requests for partial file content. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.acceptRanges; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "cacheControl", { + /** + * Returns if it was previously specified + * for the file. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.cacheControl; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentDisposition", { + /** + * Returns the value that was specified + * for the 'x-ms-content-disposition' header and specifies how to process the + * response. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentDisposition; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentEncoding", { + /** + * Returns the value that was specified + * for the Content-Encoding request header. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentEncoding; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentLanguage", { + /** + * Returns the value that was specified + * for the Content-Language request header. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentLanguage; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobSequenceNumber", { + /** + * The current sequence number for a + * page blob. This header is not returned for block blobs or append blobs. + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobSequenceNumber; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobType", { + /** + * The blob's type. Possible values include: + * 'BlockBlob', 'PageBlob', 'AppendBlob'. + * + * @readonly + * @type {(BlobType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobType; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentLength", { + /** + * The number of bytes present in the + * response body. + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentLength; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentMD5", { + /** + * If the file has an MD5 hash and the + * request is to read the full file, this response header is returned so that + * the client can check for message content integrity. If the request is to + * read a specified range and the 'x-ms-range-get-content-md5' is set to + * true, then the request returns an MD5 hash for the range, as long as the + * range size is less than or equal to 4 MB. If neither of these sets of + * conditions is true, then no value is returned for the 'Content-MD5' + * header. + * + * @readonly + * @type {(Uint8Array | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentMD5; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentRange", { + /** + * Indicates the range of bytes returned if + * the client requested a subset of the file by setting the Range request + * header. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentRange; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentType", { + /** + * The content type specified for the file. + * The default content type is 'application/octet-stream' + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentType; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyCompletedOn", { + /** + * Conclusion time of the last attempted + * Copy File operation where this file was the destination file. This value + * can specify the time of a completed, aborted, or failed copy attempt. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyId", { + /** + * String identifier for the last attempted Copy + * File operation where this file was the destination file. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyProgress", { + /** + * Contains the number of bytes copied and + * the total bytes in the source in the last attempted Copy File operation + * where this file was the destination file. Can show between 0 and + * Content-Length bytes copied. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyProgress; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copySource", { + /** + * URL up to 2KB in length that specifies the + * source file used in the last attempted Copy File operation where this file + * was the destination file. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copySource; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyStatus", { + /** + * State of the copy operation + * identified by 'x-ms-copy-id'. Possible values include: 'pending', + * 'success', 'aborted', 'failed' + * + * @readonly + * @type {(CopyStatusType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyStatus; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyStatusDescription", { + /** + * Only appears when + * x-ms-copy-status is failed or pending. Describes cause of fatal or + * non-fatal copy operation failure. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyStatusDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "leaseDuration", { + /** + * When a blob is leased, + * specifies whether the lease is of infinite or fixed duration. Possible + * values include: 'infinite', 'fixed'. + * + * @readonly + * @type {(LeaseDurationType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.leaseDuration; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "leaseState", { + /** + * Lease state of the blob. Possible + * values include: 'available', 'leased', 'expired', 'breaking', 'broken'. + * + * @readonly + * @type {(LeaseStateType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.leaseState; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "leaseStatus", { + /** + * The current lease status of the + * blob. Possible values include: 'locked', 'unlocked'. + * + * @readonly + * @type {(LeaseStatusType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.leaseStatus; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "date", { + /** + * A UTC date/time value generated by the service that + * indicates the time at which the response was initiated. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.date; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobCommittedBlockCount", { + /** + * The number of committed blocks + * present in the blob. This header is returned only for append blobs. + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobCommittedBlockCount; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "etag", { + /** + * The ETag contains a value that you can use to + * perform operations conditionally, in quotes. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.etag; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "errorCode", { + /** + * The error code. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.errorCode; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "isServerEncrypted", { + /** + * The value of this header is set to + * true if the file data and application metadata are completely encrypted + * using the specified algorithm. Otherwise, the value is set to false (when + * the file is unencrypted, or if only parts of the file/application metadata + * are encrypted). + * + * @readonly + * @type {(boolean | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.isServerEncrypted; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobContentMD5", { + /** + * If the blob has a MD5 hash, and if + * request contains range header (Range or x-ms-range), this response header + * is returned with the value of the whole blob's MD5 value. This value may + * or may not be equal to the value returned in Content-MD5 header, with the + * latter calculated from the requested range. + * + * @readonly + * @type {(Uint8Array | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobContentMD5; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "lastModified", { + /** + * Returns the date and time the file was last + * modified. Any operation that modifies the file or its properties updates + * the last modified time. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.lastModified; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "metadata", { + /** + * A name-value pair + * to associate with a file storage object. + * + * @readonly + * @type {(Metadata | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.metadata; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "requestId", { + /** + * This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.requestId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "clientRequestId", { + /** + * If a client request id header is sent in the request, this header will be present in the + * response with the same value. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.clientRequestId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "version", { + /** + * Indicates the version of the File service used + * to execute the request. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.version; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "encryptionKeySha256", { + /** + * The SHA-256 hash of the encryption key used to encrypt the blob. This value is only returned + * when the blob was encrypted with a customer-provided key. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.encryptionKeySha256; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentCrc64", { + /** + * If the request is to read a specified range and the x-ms-range-get-content-crc64 is set to + * true, then the request returns a crc64 for the range, as long as the range size is less than + * or equal to 4 MB. If both x-ms-range-get-content-crc64 & x-ms-range-get-content-md5 is + * specified in the same request, it will fail with 400(Bad Request) + * + * @type {(Uint8Array | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentCrc64; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobBody", { + /** + * The response body as a browser Blob. + * Always undefined in node.js. + * + * @readonly + * @type {(Promise | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "readableStreamBody", { + /** + * The response body as a node.js Readable stream. + * Always undefined in the browser. + * + * It will parse avor data returned by blob query. + * + * @readonly + * @type {(NodeJS.ReadableStream | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return coreHttp.isNode ? this.blobDownloadStream : undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "_response", { + /** + * The HTTP response. + * + * @type {HttpResponse} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse._response; + }, + enumerable: false, + configurable: true + }); + return BlobQueryResponse; +}()); // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -23055,12 +26538,6 @@ var StorageSharedKeyCredentialPolicy = /** @class */ (function (_super) { this.getCanonicalizedResourceString(request); var signature = this.factory.computeHMACSHA256(stringToSign); request.headers.set(HeaderConstants.AUTHORIZATION, "SharedKey " + this.factory.accountName + ":" + signature); - // Workaround for https://github.com/axios/axios/issues/2107 - // We should always keep the 'content-length' header once the issue is solved - // For a better explanation about this workaround, look here: https://github.com/Azure/azure-sdk-for-js/pull/3273 - if (typeof request.body !== "function" && !(request.body && request.onUploadProgress)) { - request.headers.remove(HeaderConstants.CONTENT_LENGTH); - } // console.log(`[URL]:${request.url}`); // console.log(`[HEADERS]:${request.headers.toString()}`); // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); @@ -23154,44 +26631,13 @@ var StorageSharedKeyCredentialPolicy = /** @class */ (function (_super) { queryKeys.sort(); for (var _i = 0, queryKeys_1 = queryKeys; _i < queryKeys_1.length; _i++) { var key = queryKeys_1[_i]; - canonicalizedResourceString += "\n" + key + ":" + decodeURIComponent(lowercaseQueries[key]); - } - } - return canonicalizedResourceString; - }; - return StorageSharedKeyCredentialPolicy; -}(CredentialPolicy)); - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -/** - * Credential is an abstract class for Azure Storage HTTP requests signing. This - * class will host an credentialPolicyCreator factory which generates CredentialPolicy. - * - * @export - * @abstract - * @class Credential - */ -var Credential = /** @class */ (function () { - function Credential() { - } - /** - * Creates a RequestPolicy object. - * - * @param {RequestPolicy} _nextPolicy - * @param {RequestPolicyOptions} _options - * @returns {RequestPolicy} - * @memberof Credential - */ - Credential.prototype.create = function ( - // tslint:disable-next-line:variable-name - _nextPolicy, - // tslint:disable-next-line:variable-name - _options) { - throw new Error("Method should be implemented in children classes."); + canonicalizedResourceString += "\n" + key + ":" + decodeURIComponent(lowercaseQueries[key]); + } + } + return canonicalizedResourceString; }; - return Credential; -}()); + return StorageSharedKeyCredentialPolicy; +}(CredentialPolicy)); // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -23243,58 +26689,365 @@ var StorageSharedKeyCredential = /** @class */ (function (_super) { return StorageSharedKeyCredential; }(Credential)); -// Copyright (c) Microsoft Corporation. All rights reserved. -/** - * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources - * or for use with Shared Access Signatures (SAS). +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. * - * @export - * @class AnonymousCredentialPolicy - * @extends {CredentialPolicy} + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. */ -var AnonymousCredentialPolicy = /** @class */ (function (_super) { - tslib.__extends(AnonymousCredentialPolicy, _super); +var packageName = "azure-storage-blob"; +var packageVersion = "12.3.0"; +var StorageClientContext = /** @class */ (function (_super) { + tslib.__extends(StorageClientContext, _super); /** - * Creates an instance of AnonymousCredentialPolicy. - * @param {RequestPolicy} nextPolicy - * @param {RequestPolicyOptions} options - * @memberof AnonymousCredentialPolicy + * Initializes a new instance of the StorageClientContext class. + * @param url The URL of the service account, container, or blob that is the targe of the desired + * operation. + * @param [options] The parameter options */ - function AnonymousCredentialPolicy(nextPolicy, options) { - return _super.call(this, nextPolicy, options) || this; + function StorageClientContext(url, options) { + var _this = this; + if (url == undefined) { + throw new Error("'url' cannot be null."); + } + if (!options) { + options = {}; + } + if (!options.userAgent) { + var defaultUserAgent = coreHttp.getDefaultUserAgentValue(); + options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent; + } + _this = _super.call(this, undefined, options) || this; + _this.version = "2020-02-10"; + _this.baseUri = "{url}"; + _this.requestContentType = "application/json; charset=utf-8"; + _this.url = url; + return _this; } - return AnonymousCredentialPolicy; -}(CredentialPolicy)); + return StorageClientContext; +}(coreHttp.ServiceClient)); + +// Copyright (c) Microsoft Corporation. All rights reserved. +(function (BlockBlobTier) { + /** + * Optimized for storing data that is accessed frequently. + */ + BlockBlobTier["Hot"] = "Hot"; + /** + * Optimized for storing data that is infrequently accessed and stored for at least 30 days. + */ + BlockBlobTier["Cool"] = "Cool"; + /** + * Optimized for storing data that is rarely accessed and stored for at least 180 days + * with flexible latency requirements (on the order of hours). + */ + BlockBlobTier["Archive"] = "Archive"; +})(exports.BlockBlobTier || (exports.BlockBlobTier = {})); +(function (PremiumPageBlobTier) { + /** + * P4 Tier. + */ + PremiumPageBlobTier["P4"] = "P4"; + /** + * P6 Tier. + */ + PremiumPageBlobTier["P6"] = "P6"; + /** + * P10 Tier. + */ + PremiumPageBlobTier["P10"] = "P10"; + /** + * P15 Tier. + */ + PremiumPageBlobTier["P15"] = "P15"; + /** + * P20 Tier. + */ + PremiumPageBlobTier["P20"] = "P20"; + /** + * P30 Tier. + */ + PremiumPageBlobTier["P30"] = "P30"; + /** + * P40 Tier. + */ + PremiumPageBlobTier["P40"] = "P40"; + /** + * P50 Tier. + */ + PremiumPageBlobTier["P50"] = "P50"; + /** + * P60 Tier. + */ + PremiumPageBlobTier["P60"] = "P60"; + /** + * P70 Tier. + */ + PremiumPageBlobTier["P70"] = "P70"; + /** + * P80 Tier. + */ + PremiumPageBlobTier["P80"] = "P80"; +})(exports.PremiumPageBlobTier || (exports.PremiumPageBlobTier = {})); +function toAccessTier(tier) { + if (tier == undefined) { + return undefined; + } + return tier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service). +} +function ensureCpkIfSpecified(cpk, isHttps) { + if (cpk && !isHttps) { + throw new RangeError("Customer-provided encryption key must be used over HTTPS."); + } + if (cpk && !cpk.encryptionAlgorithm) { + cpk.encryptionAlgorithm = EncryptionAlgorithmAES25; + } +} + +/** + * Function that converts PageRange and ClearRange to a common Range object. + * PageRange and ClearRange have start and end while Range offset and count + * this function normalizes to Range. + * @param response Model PageBlob Range response + */ +function rangeResponseFromModel(response) { + var pageRange = (response._response.parsedBody.pageRange || []).map(function (x) { return ({ + offset: x.start, + count: x.end - x.start + }); }); + var clearRange = (response._response.parsedBody.clearRange || []).map(function (x) { return ({ + offset: x.start, + count: x.end - x.start + }); }); + return tslib.__assign(tslib.__assign({}, response), { pageRange: pageRange, + clearRange: clearRange, _response: tslib.__assign(tslib.__assign({}, response._response), { parsedBody: { + pageRange: pageRange, + clearRange: clearRange + } }) }); +} // Copyright (c) Microsoft Corporation. All rights reserved. /** - * AnonymousCredential provides a credentialPolicyCreator member used to create - * AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with - * HTTP(S) requests that read public resources or for use with Shared Access - * Signatures (SAS). + * This is the poller returned by {@link BlobClient.beginCopyFromURL}. + * This can not be instantiated directly outside of this package. + * + * @ignore + */ +var BlobBeginCopyFromUrlPoller = /** @class */ (function (_super) { + tslib.__extends(BlobBeginCopyFromUrlPoller, _super); + function BlobBeginCopyFromUrlPoller(options) { + var _this = this; + var blobClient = options.blobClient, copySource = options.copySource, _a = options.intervalInMs, intervalInMs = _a === void 0 ? 15000 : _a, onProgress = options.onProgress, resumeFrom = options.resumeFrom, startCopyFromURLOptions = options.startCopyFromURLOptions; + var state; + if (resumeFrom) { + state = JSON.parse(resumeFrom).state; + } + var operation = makeBlobBeginCopyFromURLPollOperation(tslib.__assign(tslib.__assign({}, state), { blobClient: blobClient, + copySource: copySource, + startCopyFromURLOptions: startCopyFromURLOptions })); + _this = _super.call(this, operation) || this; + if (typeof onProgress === "function") { + _this.onProgress(onProgress); + } + _this.intervalInMs = intervalInMs; + return _this; + } + BlobBeginCopyFromUrlPoller.prototype.delay = function () { + return coreHttp.delay(this.intervalInMs); + }; + return BlobBeginCopyFromUrlPoller; +}(coreLro.Poller)); +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @ignore + */ +var cancel = function cancel(options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var state, copyId; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + state = this.state; + copyId = state.copyId; + if (state.isCompleted) { + return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + if (!copyId) { + state.isCancelled = true; + return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call + return [4 /*yield*/, state.blobClient.abortCopyFromURL(copyId, { + abortSignal: options.abortSignal + })]; + case 1: + // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call + _a.sent(); + state.isCancelled = true; + return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + }); + }); +}; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @ignore + */ +var update = function update(options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var state, blobClient, copySource, startCopyFromURLOptions, result, result, copyStatus, copyProgress, prevCopyProgress, err_1; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + state = this.state; + blobClient = state.blobClient, copySource = state.copySource, startCopyFromURLOptions = state.startCopyFromURLOptions; + if (!!state.isStarted) return [3 /*break*/, 2]; + state.isStarted = true; + return [4 /*yield*/, blobClient.startCopyFromURL(copySource, startCopyFromURLOptions)]; + case 1: + result = _a.sent(); + // copyId is needed to abort + state.copyId = result.copyId; + if (result.copyStatus === "success") { + state.result = result; + state.isCompleted = true; + } + return [3 /*break*/, 6]; + case 2: + if (!!state.isCompleted) return [3 /*break*/, 6]; + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4 /*yield*/, state.blobClient.getProperties({ abortSignal: options.abortSignal })]; + case 4: + result = _a.sent(); + copyStatus = result.copyStatus, copyProgress = result.copyProgress; + prevCopyProgress = state.copyProgress; + if (copyProgress) { + state.copyProgress = copyProgress; + } + if (copyStatus === "pending" && + copyProgress !== prevCopyProgress && + typeof options.fireProgress === "function") { + // trigger in setTimeout, or swallow error? + options.fireProgress(state); + } + else if (copyStatus === "success") { + state.result = result; + state.isCompleted = true; + } + else if (copyStatus === "failed") { + state.error = new Error("Blob copy failed with reason: \"" + (result.copyStatusDescription || "unknown") + "\""); + state.isCompleted = true; + } + return [3 /*break*/, 6]; + case 5: + err_1 = _a.sent(); + state.error = err_1; + state.isCompleted = true; + return [3 /*break*/, 6]; + case 6: return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + }); + }); +}; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @ignore + */ +var toString = function toString() { + return JSON.stringify({ state: this.state }, function (key, value) { + // remove blobClient from serialized state since a client can't be hydrated from this info. + if (key === "blobClient") { + return undefined; + } + return value; + }); +}; +/** + * Creates a poll operation given the provided state. + * @ignore + */ +function makeBlobBeginCopyFromURLPollOperation(state) { + return { + state: tslib.__assign({}, state), + cancel: cancel, + toString: toString, + update: update + }; +} + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +/** + * Generate a range string. For example: + * + * "bytes=255-" or "bytes=0-511" * * @export - * @class AnonymousCredential - * @extends {Credential} + * @param {Range} iRange + * @returns {string} */ -var AnonymousCredential = /** @class */ (function (_super) { - tslib.__extends(AnonymousCredential, _super); - function AnonymousCredential() { - return _super !== null && _super.apply(this, arguments) || this; +function rangeToString(iRange) { + if (iRange.offset < 0) { + throw new RangeError("Range.offset cannot be smaller than 0."); + } + if (iRange.count && iRange.count <= 0) { + throw new RangeError("Range.count must be larger than 0. Leave it undefined if you want a range from offset to the end."); } + return iRange.count + ? "bytes=" + iRange.offset + "-" + (iRange.offset + iRange.count - 1) + : "bytes=" + iRange.offset + "-"; +} + +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * A StorageClient represents a based URL class for {@link BlobServiceClient}, {@link ContainerClient} + * and etc. + * + * @export + * @class StorageClient + */ +var StorageClient = /** @class */ (function () { /** - * Creates an {@link AnonymousCredentialPolicy} object. - * - * @param {RequestPolicy} nextPolicy - * @param {RequestPolicyOptions} options - * @returns {AnonymousCredentialPolicy} - * @memberof AnonymousCredential + * Creates an instance of StorageClient. + * @param {string} url url to resource + * @param {Pipeline} pipeline request policy pipeline. + * @memberof StorageClient */ - AnonymousCredential.prototype.create = function (nextPolicy, options) { - return new AnonymousCredentialPolicy(nextPolicy, options); - }; - return AnonymousCredential; -}(Credential)); + function StorageClient(url, pipeline) { + // URL should be encoded and only once, protocol layer shouldn't encode URL again + this.url = escapeURLPath(url); + this.accountName = getAccountNameFromUrl(url); + this.pipeline = pipeline; + this.storageClientContext = new StorageClientContext(this.url, pipeline.toServiceClientOptions()); + this.isHttps = iEqual(getURLScheme(this.url) || "", "https"); + this.credential = new AnonymousCredential(); + for (var _i = 0, _a = this.pipeline.factories; _i < _a.length; _i++) { + var factory = _a[_i]; + if ((coreHttp.isNode && factory instanceof StorageSharedKeyCredential) || + factory instanceof AnonymousCredential || + coreHttp.isTokenCredential(factory)) { + this.credential = factory; + } + } + // Override protocol layer's default content-type + var storageClientContext = this.storageClientContext; + storageClientContext.requestContentType = undefined; + } + return StorageClient; +}()); // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -23467,105 +27220,195 @@ var Batch = /** @class */ (function () { return Batch; }()); -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. All rights reserved. /** - * Creates a span using the global tracer. - * @param name The name of the operation being performed. - * @param tracingOptions The options for the underlying http request. - */ -function createSpan(operationName, tracingOptions) { - if (tracingOptions === void 0) { tracingOptions = {}; } - var tracer = coreTracing.getTracer(); - var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL }); - var span = tracer.startSpan("Azure.Storage.Blob." + operationName, spanOptions); - span.setAttribute("az.namespace", "Microsoft.Storage"); - var newOptions = tracingOptions.spanOptions || {}; - if (span.isRecording()) { - newOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.Storage" }) }); - } - return { - span: span, - spanOptions: newOptions - }; -} - -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * This class generates a readable stream from the data in an array of buffers. * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ -var packageName = "azure-storage-blob"; -var packageVersion = "12.1.2"; -var StorageClientContext = /** @class */ (function (_super) { - tslib.__extends(StorageClientContext, _super); + * @export + * @class BuffersStream + */ +var BuffersStream = /** @class */ (function (_super) { + tslib.__extends(BuffersStream, _super); + /** + * Creates an instance of BuffersStream that will emit the data + * contained in the array of buffers. + * + * @param {Buffer[]} buffers Array of buffers containing the data + * @param {number} byteLength The total length of data contained in the buffers + * @memberof BuffersStream + */ + function BuffersStream(buffers, byteLength, options) { + var _this = _super.call(this, options) || this; + _this.buffers = buffers; + _this.byteLength = byteLength; + _this.byteOffsetInCurrentBuffer = 0; + _this.bufferIndex = 0; + _this.pushedBytesLength = 0; + // check byteLength is no larger than buffers[] total length + var buffersLength = 0; + for (var _i = 0, _a = _this.buffers; _i < _a.length; _i++) { + var buf = _a[_i]; + buffersLength += buf.byteLength; + } + if (buffersLength < _this.byteLength) { + throw new Error("Data size shouldn't be larger than the total length of buffers."); + } + return _this; + } /** - * Initializes a new instance of the StorageClientContext class. - * @param url The URL of the service account, container, or blob that is the targe of the desired - * operation. - * @param [options] The parameter options - */ - function StorageClientContext(url, options) { - var _this = this; - if (url == undefined) { - throw new Error("'url' cannot be null."); + * Internal _read() that will be called when the stream wants to pull more data in. + * + * @param {number} size Optional. The size of data to be read + * @memberof BuffersStream + */ + BuffersStream.prototype._read = function (size) { + if (this.pushedBytesLength >= this.byteLength) { + this.push(null); + } + if (!size) { + size = this.readableHighWaterMark; + } + var outBuffers = []; + var i = 0; + while (i < size && this.pushedBytesLength < this.byteLength) { + // The last buffer may be longer than the data it contains. + var remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength; + var remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer; + var remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers); + if (remaining > size - i) { + // chunkSize = size - i + var end = this.byteOffsetInCurrentBuffer + size - i; + outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); + this.pushedBytesLength += size - i; + this.byteOffsetInCurrentBuffer = end; + i = size; + break; + } + else { + // chunkSize = remaining + var end = this.byteOffsetInCurrentBuffer + remaining; + outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); + if (remaining === remainingCapacityInThisBuffer) { + // this.buffers[this.bufferIndex] used up, shift to next one + this.byteOffsetInCurrentBuffer = 0; + this.bufferIndex++; + } + else { + this.byteOffsetInCurrentBuffer = end; + } + this.pushedBytesLength += remaining; + i += remaining; + } } - if (!options) { - options = {}; + if (outBuffers.length > 1) { + this.push(Buffer.concat(outBuffers)); } - if (!options.userAgent) { - var defaultUserAgent = coreHttp.getDefaultUserAgentValue(); - options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent; + else if (outBuffers.length === 1) { + this.push(outBuffers[0]); } - _this = _super.call(this, undefined, options) || this; - _this.version = '2019-07-07'; - _this.baseUri = "{url}"; - _this.requestContentType = "application/json; charset=utf-8"; - _this.url = url; - return _this; - } - return StorageClientContext; -}(coreHttp.ServiceClient)); + }; + return BuffersStream; +}(stream.Readable)); // Copyright (c) Microsoft Corporation. All rights reserved. /** - * A StorageClient represents a based URL class for {@link BlobServiceClient}, {@link ContainerClient} - * and etc. + * maxBufferLength is max size of each buffer in the pooled buffers. + */ +// Can't use import as Typescript doesn't recognize "buffer". +var maxBufferLength = __webpack_require__(293).constants.MAX_LENGTH; +/** + * This class provides a buffer container which conceptually has no hard size limit. + * It accepts a capacity, an array of input buffers and the total length of input data. + * It will allocate an internal "buffer" of the capacity and fill the data in the input buffers + * into the internal "buffer" serially with respect to the total length. + * Then by calling PooledBuffer.getReadableStream(), you can get a readable stream + * assembled from all the data in the internal "buffer". * * @export - * @class StorageClient + * @class BufferScheduler */ -var StorageClient = /** @class */ (function () { +var PooledBuffer = /** @class */ (function () { + function PooledBuffer(capacity, buffers, totalLength) { + /** + * Internal buffers used to keep the data. + * Each buffer has a length of the maxBufferLength except last one. + * + * @private + * @type {Buffer[]} + * @memberof PooledBuffer + */ + this.buffers = []; + this.capacity = capacity; + this._size = 0; + // allocate + var bufferNum = Math.ceil(capacity / maxBufferLength); + for (var i = 0; i < bufferNum; i++) { + var len = i === bufferNum - 1 ? capacity % maxBufferLength : maxBufferLength; + if (len === 0) { + len = maxBufferLength; + } + this.buffers.push(Buffer.allocUnsafe(len)); + } + if (buffers) { + this.fill(buffers, totalLength); + } + } + Object.defineProperty(PooledBuffer.prototype, "size", { + /** + * The size of the data contained in the pooled buffers. + */ + get: function () { + return this._size; + }, + enumerable: false, + configurable: true + }); /** - * Creates an instance of StorageClient. - * @param {string} url url to resource - * @param {Pipeline} pipeline request policy pipeline. - * @memberof StorageClient + * Fill the internal buffers with data in the input buffers serially + * with respect to the total length and the total capacity of the internal buffers. + * Data copied will be shift out of the input buffers. + * + * @param {Buffer[]} buffers Input buffers containing the data to be filled in the pooled buffer + * @param {number} totalLength Total length of the data to be filled in. + * + * @returns {void} + * @memberof PooledBuffer */ - function StorageClient(url, pipeline) { - // URL should be encoded and only once, protocol layer shouldn't encode URL again - this.url = escapeURLPath(url); - this.accountName = getAccountNameFromUrl(url); - this.pipeline = pipeline; - this.storageClientContext = new StorageClientContext(this.url, pipeline.toServiceClientOptions()); - this.isHttps = iEqual(getURLScheme(this.url) || "", "https"); - this.credential = new AnonymousCredential(); - for (var _i = 0, _a = this.pipeline.factories; _i < _a.length; _i++) { - var factory = _a[_i]; - if ((coreHttp.isNode && factory instanceof StorageSharedKeyCredential) || - factory instanceof AnonymousCredential || - coreHttp.isTokenCredential(factory)) { - this.credential = factory; + PooledBuffer.prototype.fill = function (buffers, totalLength) { + this._size = Math.min(this.capacity, totalLength); + var i = 0, j = 0, targetOffset = 0, sourceOffset = 0, totalCopiedNum = 0; + while (totalCopiedNum < this._size) { + var source = buffers[i]; + var target = this.buffers[j]; + var copiedNum = source.copy(target, targetOffset, sourceOffset); + totalCopiedNum += copiedNum; + sourceOffset += copiedNum; + targetOffset += copiedNum; + if (sourceOffset === source.length) { + i++; + sourceOffset = 0; + } + if (targetOffset === target.length) { + j++; + targetOffset = 0; } } - // Override protocol layer's default content-type - var storageClientContext = this.storageClientContext; - storageClientContext.requestContentType = undefined; - } - return StorageClient; + // clear copied from source buffers + buffers.splice(0, i); + if (buffers.length > 0) { + buffers[0] = buffers[0].slice(sourceOffset); + } + }; + /** + * Get the readable stream assembled from all the data in the internal buffers. + * + * @returns {Readable} + * @memberof PooledBuffer + */ + PooledBuffer.prototype.getReadableStream = function () { + return new BuffersStream(this.buffers, this.size); + }; + return PooledBuffer; }()); // Copyright (c) Microsoft Corporation. All rights reserved. @@ -23680,7 +27523,7 @@ var BufferScheduler = /** @class */ (function () { * The array includes all the available buffers can be used to fill data from stream. * * @private - * @type {Buffer[]} + * @type {PooledBuffer[]} * @memberof BufferScheduler */ this.incoming = []; @@ -23688,7 +27531,7 @@ var BufferScheduler = /** @class */ (function () { * The array (queue) includes all the buffers filled from stream data. * * @private - * @type {Buffer[]} + * @type {PooledBuffer[]} * @memberof BufferScheduler */ this.outgoing = []; @@ -23746,7 +27589,8 @@ var BufferScheduler = /** @class */ (function () { } if (_this.isStreamEnd && _this.executingOutgoingHandlers === 0) { if (_this.unresolvedLength > 0 && _this.unresolvedLength < _this.bufferSize) { - _this.outgoingHandler(_this.shiftBufferFromUnresolvedDataArray(), _this.offset) + var buffer_1 = _this.shiftBufferFromUnresolvedDataArray(); + _this.outgoingHandler(function () { return buffer_1.getReadableStream(); }, buffer_1.size, _this.offset) .then(resolve) .catch(reject); } @@ -23778,32 +27622,18 @@ var BufferScheduler = /** @class */ (function () { * than blockSize when data in unresolvedDataArray is less than bufferSize. * * @private - * @returns {Buffer} + * @returns {PooledBuffer} * @memberof BufferScheduler */ - BufferScheduler.prototype.shiftBufferFromUnresolvedDataArray = function () { - if (this.unresolvedLength >= this.bufferSize) { - if (this.bufferSize === this.unresolvedDataArray[0].length) { - this.unresolvedLength -= this.bufferSize; - return this.unresolvedDataArray.shift(); - } - // Lazy concat because Buffer.concat highly drops performance - var merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); - var buffer = merged.slice(0, this.bufferSize); - merged = merged.slice(this.bufferSize); - this.unresolvedDataArray = [merged]; - this.unresolvedLength -= buffer.length; - return buffer; - } - else if (this.unresolvedLength > 0) { - var merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); - this.unresolvedDataArray = []; - this.unresolvedLength = 0; - return merged; + BufferScheduler.prototype.shiftBufferFromUnresolvedDataArray = function (buffer) { + if (!buffer) { + buffer = new PooledBuffer(this.bufferSize, this.unresolvedDataArray, this.unresolvedLength); } else { - return Buffer.allocUnsafe(0); + buffer.fill(this.unresolvedDataArray, this.unresolvedLength); } + this.unresolvedLength -= buffer.size; + return buffer; }; /** * Resolve data in unresolvedDataArray. For every buffer with size in blockSize @@ -23821,10 +27651,11 @@ var BufferScheduler = /** @class */ (function () { var buffer = void 0; if (this.incoming.length > 0) { buffer = this.incoming.shift(); + this.shiftBufferFromUnresolvedDataArray(buffer); } else { if (this.numBuffers < this.maxBuffers) { - buffer = Buffer.allocUnsafe(this.bufferSize); + buffer = this.shiftBufferFromUnresolvedDataArray(); this.numBuffers++; } else { @@ -23832,7 +27663,6 @@ var BufferScheduler = /** @class */ (function () { return false; } } - buffer.fill(this.shiftBufferFromUnresolvedDataArray()); this.outgoing.push(buffer); this.triggerOutgoingHandlers(); } @@ -23876,13 +27706,13 @@ var BufferScheduler = /** @class */ (function () { return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: - bufferLength = buffer.length; + bufferLength = buffer.size; this.executingOutgoingHandlers++; this.offset += bufferLength; _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.outgoingHandler(buffer, this.offset - bufferLength)]; + return [4 /*yield*/, this.outgoingHandler(function () { return buffer.getReadableStream(); }, bufferLength, this.offset - bufferLength)]; case 2: _a.sent(); return [3 /*break*/, 4]; @@ -23915,188 +27745,150 @@ var BufferScheduler = /** @class */ (function () { return BufferScheduler; }()); +// Copyright (c) Microsoft Corporation. /** - * Function that converts PageRange and ClearRange to a common Range object. - * PageRange and ClearRange have start and end while Range offset and count - * this function normalizes to Range. - * @param response Model PageBlob Range response + * Creates a span using the global tracer. + * @param name The name of the operation being performed. + * @param tracingOptions The options for the underlying http request. */ -function rangeResponseFromModel(response) { - var pageRange = (response._response.parsedBody.pageRange || []).map(function (x) { return ({ - offset: x.start, - count: x.end - x.start - }); }); - var clearRange = (response._response.parsedBody.clearRange || []).map(function (x) { return ({ - offset: x.start, - count: x.end - x.start - }); }); - return tslib.__assign(tslib.__assign({}, response), { pageRange: pageRange, - clearRange: clearRange, _response: tslib.__assign(tslib.__assign({}, response._response), { parsedBody: { - pageRange: pageRange, - clearRange: clearRange - } }) }); +function createSpan(operationName, tracingOptions) { + if (tracingOptions === void 0) { tracingOptions = {}; } + var tracer = coreTracing.getTracer(); + var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL }); + var span = tracer.startSpan("Azure.Storage.Blob." + operationName, spanOptions); + span.setAttribute("az.namespace", "Microsoft.Storage"); + var newOptions = tracingOptions.spanOptions || {}; + if (span.isRecording()) { + newOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.Storage" }) }); + } + return { + span: span, + spanOptions: newOptions + }; } // Copyright (c) Microsoft Corporation. All rights reserved. /** - * This is the poller returned by {@link BlobClient.beginCopyFromURL}. - * This can not be instantiated directly outside of this package. + * Reads a readable stream into buffer. Fill the buffer from offset to end. * - * @ignore - */ -var BlobBeginCopyFromUrlPoller = /** @class */ (function (_super) { - tslib.__extends(BlobBeginCopyFromUrlPoller, _super); - function BlobBeginCopyFromUrlPoller(options) { - var _this = this; - var blobClient = options.blobClient, copySource = options.copySource, _a = options.intervalInMs, intervalInMs = _a === void 0 ? 15000 : _a, onProgress = options.onProgress, resumeFrom = options.resumeFrom, startCopyFromURLOptions = options.startCopyFromURLOptions; - var state; - if (resumeFrom) { - state = JSON.parse(resumeFrom).state; - } - var operation = makeBlobBeginCopyFromURLPollOperation(tslib.__assign(tslib.__assign({}, state), { blobClient: blobClient, - copySource: copySource, - startCopyFromURLOptions: startCopyFromURLOptions })); - _this = _super.call(this, operation) || this; - if (typeof onProgress === "function") { - _this.onProgress(onProgress); - } - _this.intervalInMs = intervalInMs; - return _this; - } - BlobBeginCopyFromUrlPoller.prototype.delay = function () { - return coreHttp.delay(this.intervalInMs); - }; - return BlobBeginCopyFromUrlPoller; -}(coreLro.Poller)); -/** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @ignore + * @export + * @param {NodeJS.ReadableStream} stream A Node.js Readable stream + * @param {Buffer} buffer Buffer to be filled, length must >= offset + * @param {number} offset From which position in the buffer to be filled, inclusive + * @param {number} end To which position in the buffer to be filled, exclusive + * @param {string} [encoding] Encoding of the Readable stream + * @returns {Promise} */ -var cancel = function cancel(options) { - if (options === void 0) { options = {}; } +function streamToBuffer(stream, buffer, offset, end, encoding) { return tslib.__awaiter(this, void 0, void 0, function () { - var state, copyId; + var pos, count; return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - state = this.state; - copyId = state.copyId; - if (state.isCompleted) { - return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } - if (!copyId) { - state.isCancelled = true; - return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } - // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call - return [4 /*yield*/, state.blobClient.abortCopyFromURL(copyId, { - abortSignal: options.abortSignal - })]; - case 1: - // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call - _a.sent(); - state.isCancelled = true; - return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } + pos = 0; + count = end - offset; + return [2 /*return*/, new Promise(function (resolve, reject) { + stream.on("readable", function () { + if (pos >= count) { + resolve(); + return; + } + var chunk = stream.read(); + if (!chunk) { + return; + } + if (typeof chunk === "string") { + chunk = Buffer.from(chunk, encoding); + } + // How much data needed in this chunk + var chunkLength = pos + chunk.length > count ? count - pos : chunk.length; + buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); + pos += chunkLength; + }); + stream.on("end", function () { + if (pos < count) { + reject(new Error("Stream drains before getting enough data needed. Data read: " + pos + ", data need: " + count)); + } + resolve(); + }); + stream.on("error", reject); + })]; }); }); -}; +} /** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @ignore + * Reads a readable stream into buffer entirely. + * + * @export + * @param {NodeJS.ReadableStream} stream A Node.js Readable stream + * @param {Buffer} buffer Buffer to be filled, length must >= offset + * @param {string} [encoding] Encoding of the Readable stream + * @returns {Promise} with the count of bytes read. + * @throws {RangeError} If buffer size is not big enough. */ -var update = function update(options) { - if (options === void 0) { options = {}; } +function streamToBuffer2(stream, buffer, encoding) { return tslib.__awaiter(this, void 0, void 0, function () { - var state, blobClient, copySource, startCopyFromURLOptions, result, result, copyStatus, copyProgress, prevCopyProgress, err_1; + var pos, bufferSize; return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - state = this.state; - blobClient = state.blobClient, copySource = state.copySource, startCopyFromURLOptions = state.startCopyFromURLOptions; - if (!!state.isStarted) return [3 /*break*/, 2]; - state.isStarted = true; - return [4 /*yield*/, blobClient.startCopyFromURL(copySource, startCopyFromURLOptions)]; - case 1: - result = _a.sent(); - // copyId is needed to abort - state.copyId = result.copyId; - if (result.copyStatus === "success") { - state.result = result; - state.isCompleted = true; - } - return [3 /*break*/, 6]; - case 2: - if (!!state.isCompleted) return [3 /*break*/, 6]; - _a.label = 3; - case 3: - _a.trys.push([3, 5, , 6]); - return [4 /*yield*/, state.blobClient.getProperties({ abortSignal: options.abortSignal })]; - case 4: - result = _a.sent(); - copyStatus = result.copyStatus, copyProgress = result.copyProgress; - prevCopyProgress = state.copyProgress; - if (copyProgress) { - state.copyProgress = copyProgress; - } - if (copyStatus === "pending" && - copyProgress !== prevCopyProgress && - typeof options.fireProgress === "function") { - // trigger in setTimeout, or swallow error? - options.fireProgress(state); - } - else if (copyStatus === "success") { - state.result = result; - state.isCompleted = true; - } - else if (copyStatus === "failed") { - state.error = new Error("Blob copy failed with reason: \"" + (result.copyStatusDescription || "unknown") + "\""); - state.isCompleted = true; - } - return [3 /*break*/, 6]; - case 5: - err_1 = _a.sent(); - state.error = err_1; - state.isCompleted = true; - return [3 /*break*/, 6]; - case 6: return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } + pos = 0; + bufferSize = buffer.length; + return [2 /*return*/, new Promise(function (resolve, reject) { + stream.on("readable", function () { + var chunk = stream.read(); + if (!chunk) { + return; + } + if (typeof chunk === "string") { + chunk = Buffer.from(chunk, encoding); + } + if (pos + chunk.length > bufferSize) { + reject(new Error("Stream exceeds buffer size. Buffer size: " + bufferSize)); + return; + } + buffer.fill(chunk, pos, pos + chunk.length); + pos += chunk.length; + }); + stream.on("end", function () { + resolve(pos); + }); + stream.on("error", reject); + })]; }); }); -}; +} /** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @ignore + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. + * + * @export + * @param {NodeJS.ReadableStream} rs The read stream. + * @param {string} file Destination file path. + * @returns {Promise} */ -var toString = function toString() { - return JSON.stringify({ state: this.state }, function (key, value) { - // remove blobClient from serialized state since a client can't be hydrated from this info. - if (key === "blobClient") { - return undefined; - } - return value; +function readStreamToLocalFile(rs, file) { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, new Promise(function (resolve, reject) { + var ws = fs.createWriteStream(file); + rs.on("error", function (err) { + reject(err); + }); + ws.on("error", function (err) { + reject(err); + }); + ws.on("close", resolve); + rs.pipe(ws); + })]; + }); }); -}; +} /** - * Creates a poll operation given the provided state. - * @ignore + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Promisified version of fs.stat(). */ -function makeBlobBeginCopyFromURLPollOperation(state) { - return { - state: tslib.__assign({}, state), - cancel: cancel, - toString: toString, - update: update - }; -} +var fsStat = util.promisify(fs.stat); +var fsCreateReadStream = fs.createReadStream; -// Copyright (c) Microsoft Corporation. All rights reserved. /** * A BlobClient represents a URL to an Azure Storage blob; the blob may be a block blob, * append blob, or page blob. @@ -24174,7 +27966,7 @@ var BlobClient = /** @class */ (function (_super) { get: function () { return this._name; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobClient.prototype, "containerName", { @@ -24184,7 +27976,7 @@ var BlobClient = /** @class */ (function (_super) { get: function () { return this._containerName; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -24198,6 +27990,17 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.withSnapshot = function (snapshot) { return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline); }; + /** + * Creates a new BlobClient object pointing to a version of this blob. + * Provide "" will remove the versionId and return a Client to the base blob. + * + * @param {string} versionId The versionId. + * @returns {BlobClient} A new BlobClient object pointing to the version of this blob. + * @memberof BlobClient + */ + BlobClient.prototype.withVersion = function (versionId) { + return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.VERSIONID, versionId.length === 0 ? undefined : versionId), this.pipeline); + }; /** * Creates a AppendBlobClient object. * @@ -24237,7 +28040,7 @@ var BlobClient = /** @class */ (function (_super) { * @param {number} [offset] From which position of the blob to download, >= 0 * @param {number} [count] How much data to be downloaded, > 0. Will download to the end when undefined * @param {BlobDownloadOptions} [options] Optional options to Blob Download operation. - * @returns {Promise} + * @returns {Promise} * @memberof BlobClient * * Example usage (Node.js): @@ -24245,20 +28048,20 @@ var BlobClient = /** @class */ (function (_super) { * ```js * // Download and convert a blob to a string * const downloadBlockBlobResponse = await blobClient.download(); - * const downloaded = await streamToString(downloadBlockBlobResponse.readableStreamBody); - * console.log("Downloaded blob content:", downloaded); - * - * async function streamToString(readableStream) { - * return new Promise((resolve, reject) => { - * const chunks = []; - * readableStream.on("data", (data) => { - * chunks.push(data.toString()); - * }); - * readableStream.on("end", () => { - * resolve(chunks.join("")); - * }); - * readableStream.on("error", reject); - * }); + * const downloaded = await streamToBuffer(downloadBlockBlobResponse.readableStreamBody); + * console.log("Downloaded blob content:", downloaded.toString()); + * + * async function streamToBuffer(readableStream) { + * return new Promise((resolve, reject) => { + * const chunks = []; + * readableStream.on("data", (data) => { + * chunks.push(data instanceof Buffer ? data : Buffer.from(data)); + * }); + * readableStream.on("end", () => { + * resolve(Buffer.concat(chunks)); + * }); + * readableStream.on("error", reject); + * }); * } * ``` * @@ -24286,25 +28089,26 @@ var BlobClient = /** @class */ (function (_super) { * ``` */ BlobClient.prototype.download = function (offset, count, options) { + var _a; if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, res_1, e_1; + var _b, span, spanOptions, res_1, wrappedRes, e_1; var _this = this; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; options.conditions = options.conditions || {}; ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); - _a = createSpan("BlobClient-download", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlobClient-download", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.download({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress, range: offset === 0 && !count ? undefined : rangeToString({ offset: offset, count: count }), rangeGetContentMD5: options.rangeGetContentMD5, @@ -24314,7 +28118,8 @@ var BlobClient = /** @class */ (function (_super) { spanOptions: spanOptions })]; case 2: - res_1 = _b.sent(); + res_1 = _c.sent(); + wrappedRes = tslib.__assign(tslib.__assign({}, res_1), { _response: res_1._response, objectReplicationDestinationPolicyId: res_1.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res_1.objectReplicationRules) }); // We support retrying when download stream unexpected ends in Node.js runtime // Following code shouldn't be bundled into browser build, however some // bundlers may try to bundle following code and "FileReadResponse.ts". @@ -24330,10 +28135,11 @@ var BlobClient = /** @class */ (function (_super) { if (!res_1.etag) { throw new RangeError("File download response doesn't contain valid etag header"); } - return [2 /*return*/, new BlobDownloadResponse(res_1, function (start) { return tslib.__awaiter(_this, void 0, void 0, function () { + return [2 /*return*/, new BlobDownloadResponse(wrappedRes, function (start) { return tslib.__awaiter(_this, void 0, void 0, function () { var updatedOptions; - return tslib.__generator(this, function (_a) { - switch (_a.label) { + var _a; + return tslib.__generator(this, function (_b) { + switch (_b.label) { case 0: updatedOptions = { leaseAccessConditions: options.conditions, @@ -24341,7 +28147,8 @@ var BlobClient = /** @class */ (function (_super) { ifMatch: options.conditions.ifMatch || res_1.etag, ifModifiedSince: options.conditions.ifModifiedSince, ifNoneMatch: options.conditions.ifNoneMatch, - ifUnmodifiedSince: options.conditions.ifUnmodifiedSince + ifUnmodifiedSince: options.conditions.ifUnmodifiedSince, + ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }, range: rangeToString({ count: offset + res_1.contentLength - start, @@ -24360,7 +28167,7 @@ var BlobClient = /** @class */ (function (_super) { // updatedOptions.range // }, options: ${JSON.stringify(updatedOptions)}` // ); - return [2 /*return*/, (_a.sent()).readableStreamBody]; + return [2 /*return*/, (_b.sent()).readableStreamBody]; } }); }); }, offset, res_1.contentLength, { @@ -24369,7 +28176,7 @@ var BlobClient = /** @class */ (function (_super) { onProgress: options.onProgress })]; case 3: - e_1 = _b.sent(); + e_1 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e_1.message @@ -24384,7 +28191,7 @@ var BlobClient = /** @class */ (function (_super) { }); }; /** - * Returns true if the Azrue blob resource represented by this client exists; false otherwise. + * Returns true if the Azure blob resource represented by this client exists; false otherwise. * * NOTE: use this function with care since an existing blob might be deleted by other clients or * applications. Vice versa new blobs might be added by other clients or applications after this @@ -24409,6 +28216,7 @@ var BlobClient = /** @class */ (function (_super) { return [4 /*yield*/, this.getProperties({ abortSignal: options.abortSignal, customerProvidedKey: options.customerProvidedKey, + conditions: options.conditions, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) })]; case 2: @@ -24451,28 +28259,31 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.getProperties = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_3; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, res, e_3; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-getProperties", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlobClient-getProperties", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); options.conditions = options.conditions || {}; ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.getProperties({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: + res = _c.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) })]; case 3: - e_3 = _b.sent(); + e_3 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e_3.message @@ -24498,27 +28309,28 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.delete = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_4; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_4; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-delete", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-delete", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.deleteMethod({ abortSignal: options.abortSignal, deleteSnapshots: options.deleteSnapshots, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_4 = _b.sent(); + e_4 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e_4.message @@ -24532,6 +28344,56 @@ var BlobClient = /** @class */ (function (_super) { }); }); }; + /** + * Marks the specified blob or snapshot for deletion if it exists. The blob is later deleted + * during garbage collection. Note that in order to delete a blob, you must delete + * all of its snapshots. You can delete both at the same time with the Delete + * Blob operation. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob + * + * @param {BlobDeleteOptions} [options] Optional options to Blob Delete operation. + * @returns {Promise} + * @memberof BlobClient + */ + BlobClient.prototype.deleteIfExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, res, e_5; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("BlobClient-deleteIfExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_5 = _d.sent(); + if (((_a = e_5.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobNotFound") { + span.setStatus({ + code: api.CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a blob or snapshot only if it exists." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_5.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_5.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_5.message + }); + throw e_5; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; /** * Restores the contents and metadata of soft deleted blob and any associated * soft deleted snapshots. Undelete Blob is supported only on version 2017-07-29 @@ -24545,7 +28407,7 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.undelete = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_5; + var _a, span, spanOptions, e_6; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -24559,12 +28421,12 @@ var BlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_5 = _b.sent(); + e_6 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_5.message + message: e_6.message }); - throw e_5; + throw e_6; case 4: span.end(); return [7 /*endfinally*/]; @@ -24576,46 +28438,47 @@ var BlobClient = /** @class */ (function (_super) { /** * Sets system properties on the blob. * - * If no value provided, or no value provided for the specificed blob HTTP headers, + * If no value provided, or no value provided for the specified blob HTTP headers, * these blob HTTP headers without a value will be cleared. * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties * * @param {BlobHTTPHeaders} [blobHTTPHeaders] If no value provided, or no value provided for - * the specificed blob HTTP headers, these blob HTTP + * the specified blob HTTP headers, these blob HTTP * headers without a value will be cleared. * @param {BlobSetHTTPHeadersOptions} [options] Optional options to Blob Set HTTP Headers operation. * @returns {Promise} * @memberof BlobClient */ BlobClient.prototype.setHTTPHeaders = function (blobHTTPHeaders, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_6; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_7; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-setHTTPHeaders", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-setHTTPHeaders", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.setHTTPHeaders({ abortSignal: options.abortSignal, blobHTTPHeaders: blobHTTPHeaders, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_6 = _b.sent(); + e_7 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_6.message + message: e_7.message }); - throw e_6; + throw e_7; case 4: span.end(); return [7 /*endfinally*/]; @@ -24638,35 +28501,124 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.setMetadata = function (metadata, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_7; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_8; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-setMetadata", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-setMetadata", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.setMetadata({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_7 = _b.sent(); + e_8 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_7.message + message: e_8.message }); - throw e_7; + throw e_8; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets tags on the underlying blob. + * A blob can have up to 10 tags. Tag keys must be between 1 and 128 characters. Tag values must be between 0 and 256 characters. + * Valid tag key and value characters include lower and upper case letters, digits (0-9), + * space (' '), plus ('+'), minus ('-'), period ('.'), foward slash ('/'), colon (':'), equals ('='), and underscore ('_'). + * + * @param {Tags} tags + * @param {BlobSetTagsOptions} [options={}] + * @returns {Promise} + * @memberof BlobClient + */ + BlobClient.prototype.setTags = function (tags, options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, e_9; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = createSpan("BlobClient-setTags", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.blobContext.setTags({ + abortSignal: options.abortSignal, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions, + tags: toBlobTags(tags) + })]; + case 2: return [2 /*return*/, _c.sent()]; + case 3: + e_9 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_9.message + }); + throw e_9; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets the tags associated with the underlying blob. + * + * @param {BlobGetTagsOptions} [options={}] + * @returns {Promise} + * @memberof BlobClient + */ + BlobClient.prototype.getTags = function (options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, response, wrappedResponse, e_10; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = createSpan("BlobClient-getTags", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.blobContext.getTags({ + abortSignal: options.abortSignal, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions + })]; + case 2: + response = _c.sent(); + wrappedResponse = tslib.__assign(tslib.__assign({}, response), { _response: response._response, tags: toTags({ blobTagSet: response.blobTagSet }) || {} }); + return [2 /*return*/, wrappedResponse]; + case 3: + e_10 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_10.message + }); + throw e_10; case 4: span.end(); return [7 /*endfinally*/]; @@ -24694,35 +28646,36 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.createSnapshot = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_8; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_11; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-createSnapshot", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-createSnapshot", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.createSnapshot({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_8 = _b.sent(); + e_11 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_8.message + message: e_11.message }); - throw e_8; + throw e_11; case 4: span.end(); return [7 /*endfinally*/]; @@ -24867,7 +28820,7 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.abortCopyFromURL = function (copyId, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_9; + var _a, span, spanOptions, e_12; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -24882,12 +28835,12 @@ var BlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_9 = _b.sent(); + e_12 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_9.message + message: e_12.message }); - throw e_9; + throw e_12; case 4: span.end(); return [7 /*endfinally*/]; @@ -24907,23 +28860,24 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.syncCopyFromURL = function (copySource, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_10; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_13; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-syncCopyFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-syncCopyFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.copyFromURL(copySource, { abortSignal: options.abortSignal, metadata: options.metadata, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, @@ -24931,16 +28885,17 @@ var BlobClient = /** @class */ (function (_super) { sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince }, sourceContentMD5: options.sourceContentMD5, + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_10 = _b.sent(); + e_13 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_10.message + message: e_13.message }); - throw e_10; + throw e_13; case 4: span.end(); return [7 /*endfinally*/]; @@ -24963,30 +28918,32 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.setAccessTier = function (tier, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_11; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_14; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-setAccessTier", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlobClient-setAccessTier", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.setTier(toAccessTier(tier), { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), rehydratePriority: options.rehydratePriority, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_11 = _b.sent(); + e_14 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_11.message + message: e_14.message }); - throw e_11; + throw e_14; case 4: span.end(); return [7 /*endfinally*/]; @@ -24998,7 +28955,7 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.downloadToBuffer = function (param1, param2, param3, param4) { if (param4 === void 0) { param4 = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var buffer, offset, count, options, _a, span, spanOptions, response, transferProgress_1, batch, _loop_1, off, e_12; + var buffer, offset, count, options, _a, span, spanOptions, response, transferProgress_1, batch, _loop_1, off, e_15; var _this = this; return tslib.__generator(this, function (_b) { switch (_b.label) { @@ -25076,6 +29033,7 @@ var BlobClient = /** @class */ (function (_super) { abortSignal: options.abortSignal, conditions: options.conditions, maxRetryRequests: options.maxRetryRequestsPerBlock, + customerProvidedKey: options.customerProvidedKey, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) })]; case 1: @@ -25104,12 +29062,12 @@ var BlobClient = /** @class */ (function (_super) { _b.sent(); return [2 /*return*/, buffer]; case 5: - e_12 = _b.sent(); + e_15 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_12.message + message: e_15.message }); - throw e_12; + throw e_15; case 6: span.end(); return [7 /*endfinally*/]; @@ -25129,7 +29087,7 @@ var BlobClient = /** @class */ (function (_super) { * @param {number} [offset] From which position of the block blob to download. * @param {number} [count] How much data to be downloaded. Will download to the end when passing undefined. * @param {BlobDownloadOptions} [options] Options to Blob download options. - * @returns {Promise} The response data for blob download operation, + * @returns {Promise} The response data for blob download operation, * but with readableStreamBody set to undefined since its * content is already read and written into a local file * at the specified path. @@ -25139,7 +29097,7 @@ var BlobClient = /** @class */ (function (_super) { if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, e_13; + var _a, span, spanOptions, response, e_16; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25160,12 +29118,12 @@ var BlobClient = /** @class */ (function (_super) { response.blobDownloadStream = undefined; return [2 /*return*/, response]; case 5: - e_13 = _b.sent(); + e_16 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_13.message + message: e_16.message }); - throw e_13; + throw e_16; case 6: span.end(); return [7 /*endfinally*/]; @@ -25193,7 +29151,7 @@ var BlobClient = /** @class */ (function (_super) { containerName = pathComponents[1]; blobName = pathComponents[3]; } - else { + else if (isIpEndpointStyle(parsedUrl)) { // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername/blob // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername/blob // .getPath() -> /devstoreaccount1/containername/blob @@ -25201,6 +29159,13 @@ var BlobClient = /** @class */ (function (_super) { containerName = pathComponents[2]; blobName = pathComponents[4]; } + else { + // "https://customdomain.com/containername/blob". + // .getPath() -> /containername/blob + var pathComponents = parsedUrl.getPath().match("/([^/]*)(/(.*))?"); + containerName = pathComponents[1]; + blobName = pathComponents[3]; + } // decode the encoded blobName, containerName - to get all the special characters that might be present in them containerName = decodeURIComponent(containerName); blobName = decodeURIComponent(blobName); @@ -25235,41 +29200,45 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.startCopyFromURL = function (copySource, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_14; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_17; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-startCopyFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-startCopyFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.startCopyFromURL(copySource, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, sourceIfNoneMatch: options.sourceConditions.ifNoneMatch, - sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince + sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince, + sourceIfTags: options.sourceConditions.tagConditions }, rehydratePriority: options.rehydratePriority, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), + sealBlob: options.sealBlob, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_14 = _b.sent(); + e_17 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_14.message + message: e_17.message }); - throw e_14; + throw e_17; case 4: span.end(); return [7 /*endfinally*/]; @@ -25378,36 +29347,130 @@ var AppendBlobClient = /** @class */ (function (_super) { * ``` */ AppendBlobClient.prototype.create = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_15; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_18; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("AppendBlobClient-create", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("AppendBlobClient-create", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.appendBlobContext.create(0, { abortSignal: options.abortSignal, blobHTTPHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_15 = _b.sent(); + e_18 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_15.message + message: e_18.message }); - throw e_15; + throw e_18; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. + * If the blob with the same name already exists, the content of the existing blob will remain unchanged. + * @see https://docs.microsoft.com/rest/api/storageservices/put-blob + * + * @param {AppendBlobCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof AppendBlobClient + */ + AppendBlobClient.prototype.createIfNotExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, conditions, res, e_19; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("AppendBlobClient-createIfNotExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + conditions = { ifNoneMatch: ETagAny }; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.create(tslib.__assign(tslib.__assign({}, options), { conditions: conditions, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_19 = _d.sent(); + if (((_a = e_19.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") { + span.setStatus({ + code: api.CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_19.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_19.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_19.message + }); + throw e_19; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Seals the append blob, making it read only. + * + * @param {AppendBlobSealOptions} [options={}] + * @returns {Promise} + * @memberof AppendBlobClient + */ + AppendBlobClient.prototype.seal = function (options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, e_20; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = createSpan("AppendBlobClient-seal", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + options.conditions = options.conditions || {}; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.appendBlobContext.seal({ + abortSignal: options.abortSignal, + appendPositionAccessConditions: options.conditions, + leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions + })]; + case 2: return [2 /*return*/, _c.sent()]; + case 3: + e_20 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_20.message + }); + throw e_20; case 4: span.end(); return [7 /*endfinally*/]; @@ -25442,23 +29505,24 @@ var AppendBlobClient = /** @class */ (function (_super) { * ``` */ AppendBlobClient.prototype.appendBlock = function (body, contentLength, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_16; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_21; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("AppendBlobClient-appendBlock", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("AppendBlobClient-appendBlock", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.appendBlobContext.appendBlock(body, contentLength, { abortSignal: options.abortSignal, appendPositionAccessConditions: options.conditions, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onUploadProgress: options.onProgress, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, @@ -25466,14 +29530,14 @@ var AppendBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_16 = _b.sent(); + e_21 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_16.message + message: e_21.message }); - throw e_16; + throw e_21; case 4: span.end(); return [7 /*endfinally*/]; @@ -25499,18 +29563,19 @@ var AppendBlobClient = /** @class */ (function (_super) { * @memberof AppendBlobClient */ AppendBlobClient.prototype.appendBlockFromURL = function (sourceURL, sourceOffset, count, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_17; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_22; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("AppendBlobClient-appendBlockFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("AppendBlobClient-appendBlockFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.appendBlobContext.appendBlockFromUrl(sourceURL, 0, { abortSignal: options.abortSignal, @@ -25519,7 +29584,7 @@ var AppendBlobClient = /** @class */ (function (_super) { sourceContentCrc64: options.sourceContentCrc64, leaseAccessConditions: options.conditions, appendPositionAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, @@ -25530,14 +29595,14 @@ var AppendBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_17 = _b.sent(); + e_22 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_17.message + message: e_22.message }); - throw e_17; + throw e_22; case 4: span.end(); return [7 /*endfinally*/]; @@ -25616,6 +29681,7 @@ var BlockBlobClient = /** @class */ (function (_super) { } _this = _super.call(this, url, pipeline) || this; _this.blockBlobContext = new BlockBlob(_this.storageClientContext); + _this._blobContext = new Blob$1(_this.storageClientContext); return _this; } /** @@ -25630,6 +29696,84 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.withSnapshot = function (snapshot) { return new BlockBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline); }; + /** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Quick query for a JSON or CSV formatted blob. + * + * Example usage (Node.js): + * + * ```js + * // Query and convert a blob to a string + * const queryBlockBlobResponse = await blockBlobClient.query("select * from BlobStorage"); + * const downloaded = (await streamToBuffer(queryBlockBlobResponse.readableStreamBody)).toString(); + * console.log("Query blob content:", downloaded); + * + * async function streamToBuffer(readableStream) { + * return new Promise((resolve, reject) => { + * const chunks = []; + * readableStream.on("data", (data) => { + * chunks.push(data instanceof Buffer ? data : Buffer.from(data)); + * }); + * readableStream.on("end", () => { + * resolve(Buffer.concat(chunks)); + * }); + * readableStream.on("error", reject); + * }); + * } + * ``` + * + * @param {string} query + * @param {BlockBlobQueryOptions} [options={}] + * @returns {Promise} + * @memberof BlockBlobClient + */ + BlockBlobClient.prototype.query = function (query, options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, response, e_23; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); + _b = createSpan("BlockBlobClient-query", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this._blobContext.query({ + abortSignal: options.abortSignal, + queryRequest: { + expression: query, + inputSerialization: toQuerySerialization(options.inputTextConfiguration), + outputSerialization: toQuerySerialization(options.outputTextConfiguration) + }, + leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions + })]; + case 2: + response = _c.sent(); + return [2 /*return*/, new BlobQueryResponse(response, { + abortSignal: options.abortSignal, + onProgress: options.onProgress, + onError: options.onError + })]; + case 3: + e_23 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_23.message + }); + throw e_23; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; /** * Creates a new block blob, or updates the content of an existing block blob. * Updating an existing block blob overwrites any existing metadata on the blob. @@ -25659,38 +29803,40 @@ var BlockBlobClient = /** @class */ (function (_super) { * ``` */ BlockBlobClient.prototype.upload = function (body, contentLength, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_18; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_24; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("BlockBlobClient-upload", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlockBlobClient-upload", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blockBlobContext.upload(body, contentLength, { abortSignal: options.abortSignal, blobHTTPHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onUploadProgress: options.onProgress, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_18 = _b.sent(); + e_24 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_18.message + message: e_24.message }); - throw e_18; + throw e_24; case 4: span.end(); return [7 /*endfinally*/]; @@ -25714,7 +29860,7 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.stageBlock = function (blockId, body, contentLength, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_19; + var _a, span, spanOptions, e_25; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25735,12 +29881,12 @@ var BlockBlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_19 = _b.sent(); + e_25 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_19.message + message: e_25.message }); - throw e_19; + throw e_25; case 4: span.end(); return [7 /*endfinally*/]; @@ -25775,7 +29921,7 @@ var BlockBlobClient = /** @class */ (function (_super) { if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_20; + var _a, span, spanOptions, e_26; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25796,12 +29942,12 @@ var BlockBlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_20 = _b.sent(); + e_26 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_20.message + message: e_26.message }); - throw e_20; + throw e_26; case 4: span.end(); return [7 /*endfinally*/]; @@ -25824,37 +29970,39 @@ var BlockBlobClient = /** @class */ (function (_super) { * @memberof BlockBlobClient */ BlockBlobClient.prototype.commitBlockList = function (blocks, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_21; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_27; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("BlockBlobClient-commitBlockList", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlockBlobClient-commitBlockList", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blockBlobContext.commitBlockList({ latest: blocks }, { abortSignal: options.abortSignal, blobHTTPHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_21 = _b.sent(); + e_27 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_21.message + message: e_27.message }); - throw e_21; + throw e_27; case 4: span.end(); return [7 /*endfinally*/]; @@ -25875,23 +30023,25 @@ var BlockBlobClient = /** @class */ (function (_super) { * @memberof BlockBlobClient */ BlockBlobClient.prototype.getBlockList = function (listType, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, res, e_22; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, res, e_28; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlockBlobClient-getBlockList", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlockBlobClient-getBlockList", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blockBlobContext.getBlockList(listType, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; case 2: - res = _b.sent(); + res = _c.sent(); if (!res.committedBlocks) { res.committedBlocks = []; } @@ -25900,12 +30050,12 @@ var BlockBlobClient = /** @class */ (function (_super) { } return [2 /*return*/, res]; case 3: - e_22 = _b.sent(); + e_28 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_22.message + message: e_28.message }); - throw e_22; + throw e_28; case 4: span.end(); return [7 /*endfinally*/]; @@ -25915,6 +30065,56 @@ var BlockBlobClient = /** @class */ (function (_super) { }); }; // High level functions + /** + * Uploads a Buffer(Node.js)/Blob(browsers)/ArrayBuffer/ArrayBufferView object to a BlockBlob. + * + * When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is + * {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload. + * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} + * to commit the block list. + * + * @export + * @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView + * @param {BlockBlobParallelUploadOptions} [options] + * @returns {Promise} + * @memberof BlockBlobClient + */ + BlockBlobClient.prototype.uploadData = function (data, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a, span, spanOptions, buffer_1, browserBlob_1; + return tslib.__generator(this, function (_b) { + _a = createSpan("BlockBlobClient-uploadData", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + try { + if (true) { + if (data instanceof Buffer) { + buffer_1 = data; + } + else if (data instanceof ArrayBuffer) { + buffer_1 = Buffer.from(data); + } + else { + data = data; + buffer_1 = Buffer.from(data.buffer, data.byteOffset, data.byteLength); + } + return [2 /*return*/, this.uploadSeekableInternal(function (offset, size) { return buffer_1.slice(offset, offset + size); }, buffer_1.byteLength, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + } + else {} + } + catch (e) { + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } + finally { + span.end(); + } + return [2 /*return*/]; + }); + }); + }; /** * ONLY AVAILABLE IN BROWSERS. * @@ -25924,6 +30124,8 @@ var BlockBlobClient = /** @class */ (function (_super) { * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call * {@link commitBlockList} to commit the block list. * + * @deprecated Use {@link uploadData} instead. + * * @export * @param {Blob | ArrayBuffer | ArrayBufferView} browserData Blob, File, ArrayBuffer or ArrayBufferView * @param {BlockBlobParallelUploadOptions} [options] Options to upload browser data. @@ -25933,7 +30135,7 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.uploadBrowserData = function (browserData, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, browserBlob_1, e_23; + var _a, span, spanOptions, browserBlob_2, e_29; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25941,18 +30143,16 @@ var BlockBlobClient = /** @class */ (function (_super) { _b.label = 1; case 1: _b.trys.push([1, 3, 4, 5]); - browserBlob_1 = new Blob([browserData]); - return [4 /*yield*/, this.uploadSeekableBlob(function (offset, size) { - return browserBlob_1.slice(offset, offset + size); - }, browserBlob_1.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + browserBlob_2 = new Blob([browserData]); + return [4 /*yield*/, this.uploadSeekableInternal(function (offset, size) { return browserBlob_2.slice(offset, offset + size); }, browserBlob_2.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_23 = _b.sent(); + e_29 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_23.message + message: e_29.message }); - throw e_23; + throw e_29; case 4: span.end(); return [7 /*endfinally*/]; @@ -25962,25 +30162,25 @@ var BlockBlobClient = /** @class */ (function (_super) { }); }; /** - * ONLY AVAILABLE IN BROWSERS. * - * Uploads a browser {@link Blob} object to block blob. Requires a blobFactory as the data source, - * which need to return a {@link Blob} object with the offset and size provided. + * Uploads data to block blob. Requires a bodyFactory as the data source, + * which need to return a {@link HttpRequestBody} object with the offset and size provided. * - * When buffer length <= 256MB, this method will use 1 upload call to finish the upload. - * Otherwise, this method will call stageBlock to upload blocks, and finally call commitBlockList + * When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is + * {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload. + * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} * to commit the block list. * - * @param {(offset: number, size: number) => Blob} blobFactory + * @param {(offset: number, size: number) => HttpRequestBody} bodyFactory * @param {number} size size of the data to upload. * @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation. * @returns {Promise} Response data for the Blob Upload operation. * @memberof BlockBlobClient */ - BlockBlobClient.prototype.uploadSeekableBlob = function (blobFactory, size, options) { + BlockBlobClient.prototype.uploadSeekableInternal = function (bodyFactory, size, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, numBlocks_1, blockList_1, blockIDPrefix_1, transferProgress_2, batch, _loop_2, i, e_24; + var _a, span, spanOptions, numBlocks_1, blockList_1, blockIDPrefix_1, transferProgress_2, batch, _loop_2, i, e_30; var _this = this; return tslib.__generator(this, function (_b) { switch (_b.label) { @@ -26015,12 +30215,12 @@ var BlockBlobClient = /** @class */ (function (_super) { if (!options.conditions) { options.conditions = {}; } - _a = createSpan("BlockBlobClient-UploadSeekableBlob", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _a = createSpan("BlockBlobClient-uploadSeekableInternal", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; _b.label = 1; case 1: _b.trys.push([1, 5, 6, 7]); if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3]; - return [4 /*yield*/, this.upload(blobFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + return [4 /*yield*/, this.upload(bodyFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: numBlocks_1 = Math.floor((size - 1) / options.blockSize) + 1; @@ -26043,7 +30243,7 @@ var BlockBlobClient = /** @class */ (function (_super) { end = i === numBlocks_1 - 1 ? size : start + options.blockSize; contentLength = end - start; blockList_1.push(blockID); - return [4 /*yield*/, this.stageBlock(blockID, blobFactory(start, contentLength), contentLength, { + return [4 /*yield*/, this.stageBlock(blockID, bodyFactory(start, contentLength), contentLength, { abortSignal: options.abortSignal, conditions: options.conditions, encryptionScope: options.encryptionScope, @@ -26072,12 +30272,12 @@ var BlockBlobClient = /** @class */ (function (_super) { _b.sent(); return [2 /*return*/, this.commitBlockList(blockList_1, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 5: - e_24 = _b.sent(); + e_30 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_24.message + message: e_30.message }); - throw e_24; + throw e_30; case 6: span.end(); return [7 /*endfinally*/]; @@ -26103,7 +30303,7 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.uploadFile = function (filePath, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, size, e_25; + var _a, span, spanOptions, size, e_31; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -26114,21 +30314,23 @@ var BlockBlobClient = /** @class */ (function (_super) { return [4 /*yield*/, fsStat(filePath)]; case 2: size = (_b.sent()).size; - return [4 /*yield*/, this.uploadResetableStream(function (offset, count) { - return fs.createReadStream(filePath, { - autoClose: true, - end: count ? offset + count - 1 : Infinity, - start: offset - }); + return [4 /*yield*/, this.uploadSeekableInternal(function (offset, count) { + return function () { + return fsCreateReadStream(filePath, { + autoClose: true, + end: count ? offset + count - 1 : Infinity, + start: offset + }); + }; }, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 3: return [2 /*return*/, _b.sent()]; case 4: - e_25 = _b.sent(); + e_31 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_25.message + message: e_31.message }); - throw e_25; + throw e_31; case 5: span.end(); return [7 /*endfinally*/]; @@ -26159,7 +30361,7 @@ var BlockBlobClient = /** @class */ (function (_super) { if (maxConcurrency === void 0) { maxConcurrency = 5; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, blockNum_1, blockIDPrefix_2, transferProgress_3, blockList_2, scheduler, e_26; + var _a, span, spanOptions, blockNum_1, blockIDPrefix_2, transferProgress_3, blockList_2, scheduler, e_32; var _this = this; return tslib.__generator(this, function (_b) { switch (_b.label) { @@ -26178,7 +30380,7 @@ var BlockBlobClient = /** @class */ (function (_super) { blockIDPrefix_2 = coreHttp.generateUuid(); transferProgress_3 = 0; blockList_2 = []; - scheduler = new BufferScheduler(stream, bufferSize, maxConcurrency, function (buffer) { return tslib.__awaiter(_this, void 0, void 0, function () { + scheduler = new BufferScheduler(stream, bufferSize, maxConcurrency, function (body, length) { return tslib.__awaiter(_this, void 0, void 0, function () { var blockID; return tslib.__generator(this, function (_a) { switch (_a.label) { @@ -26186,7 +30388,7 @@ var BlockBlobClient = /** @class */ (function (_super) { blockID = generateBlockID(blockIDPrefix_2, blockNum_1); blockList_2.push(blockID); blockNum_1++; - return [4 /*yield*/, this.stageBlock(blockID, buffer, buffer.length, { + return [4 /*yield*/, this.stageBlock(blockID, body, length, { conditions: options.conditions, encryptionScope: options.encryptionScope, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) @@ -26194,7 +30396,7 @@ var BlockBlobClient = /** @class */ (function (_super) { case 1: _a.sent(); // Update progress after block is successfully uploaded to server, in case of block trying - transferProgress_3 += buffer.length; + transferProgress_3 += length; if (options.onProgress) { options.onProgress({ loadedBytes: transferProgress_3 }); } @@ -26213,12 +30415,12 @@ var BlockBlobClient = /** @class */ (function (_super) { return [4 /*yield*/, this.commitBlockList(blockList_2, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 3: return [2 /*return*/, _b.sent()]; case 4: - e_26 = _b.sent(); + e_32 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_26.message + message: e_32.message }); - throw e_26; + throw e_32; case 5: span.end(); return [7 /*endfinally*/]; @@ -26227,132 +30429,6 @@ var BlockBlobClient = /** @class */ (function (_super) { }); }); }; - /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * Accepts a Node.js Readable stream factory, and uploads in blocks to a block blob. - * The Readable stream factory must returns a Node.js Readable stream starting from the offset defined. The offset - * is the offset in the block blob to be uploaded. - * - * When buffer length <= 256MB, this method will use 1 upload call to finish the upload. - * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} - * to commit the block list. - * - * @export - * @param {(offset: number) => NodeJS.ReadableStream} streamFactory Returns a Node.js Readable stream starting - * from the offset defined - * @param {number} size Size of the block blob - * @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation. - * @returns {(Promise)} Response data for the Blob Upload operation. - * @memberof BlockBlobClient - */ - BlockBlobClient.prototype.uploadResetableStream = function (streamFactory, size, options) { - if (options === void 0) { options = {}; } - return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, numBlocks_2, blockList_3, blockIDPrefix_3, transferProgress_4, batch, _loop_3, i, e_27; - var _this = this; - return tslib.__generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!options.blockSize) { - options.blockSize = 0; - } - if (options.blockSize < 0 || options.blockSize > BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) { - throw new RangeError("blockSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES); - } - if (options.maxSingleShotSize !== 0 && !options.maxSingleShotSize) { - options.maxSingleShotSize = BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES; - } - if (options.maxSingleShotSize < 0 || - options.maxSingleShotSize > BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES) { - throw new RangeError("maxSingleShotSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES); - } - if (options.blockSize === 0) { - if (size > BLOCK_BLOB_MAX_BLOCKS * BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) { - throw new RangeError(size + " is too larger to upload to a block blob."); - } - if (size > options.maxSingleShotSize) { - options.blockSize = Math.ceil(size / BLOCK_BLOB_MAX_BLOCKS); - if (options.blockSize < DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES) { - options.blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES; - } - } - } - if (!options.blobHTTPHeaders) { - options.blobHTTPHeaders = {}; - } - if (!options.conditions) { - options.conditions = {}; - } - _a = createSpan("BlockBlobClient-uploadResetableStream", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; - case 1: - _b.trys.push([1, 6, 7, 8]); - if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3]; - return [4 /*yield*/, this.upload(function () { return streamFactory(0); }, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; - case 2: return [2 /*return*/, _b.sent()]; - case 3: - numBlocks_2 = Math.floor((size - 1) / options.blockSize) + 1; - if (numBlocks_2 > BLOCK_BLOB_MAX_BLOCKS) { - throw new RangeError("The buffer's size is too big or the BlockSize is too small;" + - ("the number of blocks must be <= " + BLOCK_BLOB_MAX_BLOCKS)); - } - blockList_3 = []; - blockIDPrefix_3 = coreHttp.generateUuid(); - transferProgress_4 = 0; - batch = new Batch(options.concurrency); - _loop_3 = function (i) { - batch.addOperation(function () { return tslib.__awaiter(_this, void 0, void 0, function () { - var blockID, start, end, contentLength; - return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - blockID = generateBlockID(blockIDPrefix_3, i); - start = options.blockSize * i; - end = i === numBlocks_2 - 1 ? size : start + options.blockSize; - contentLength = end - start; - blockList_3.push(blockID); - return [4 /*yield*/, this.stageBlock(blockID, function () { return streamFactory(start, contentLength); }, contentLength, { - abortSignal: options.abortSignal, - conditions: options.conditions, - encryptionScope: options.encryptionScope, - tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) - })]; - case 1: - _a.sent(); - // Update progress after block is successfully uploaded to server, in case of block trying - transferProgress_4 += contentLength; - if (options.onProgress) { - options.onProgress({ loadedBytes: transferProgress_4 }); - } - return [2 /*return*/]; - } - }); - }); }); - }; - for (i = 0; i < numBlocks_2; i++) { - _loop_3(i); - } - return [4 /*yield*/, batch.do()]; - case 4: - _b.sent(); - return [4 /*yield*/, this.commitBlockList(blockList_3, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; - case 5: return [2 /*return*/, _b.sent()]; - case 6: - e_27 = _b.sent(); - span.setStatus({ - code: api.CanonicalCode.UNKNOWN, - message: e_27.message - }); - throw e_27; - case 7: - span.end(); - return [7 /*endfinally*/]; - case 8: return [2 /*return*/]; - } - }); - }); - }; return BlockBlobClient; }(BlobClient)); /** @@ -26448,17 +30524,18 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.create = function (size, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_28; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_33; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-create", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-create", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.pageBlobContext.create(0, size, { abortSignal: options.abortSignal, @@ -26466,20 +30543,72 @@ var PageBlobClient = /** @class */ (function (_super) { blobSequenceNumber: options.blobSequenceNumber, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_28 = _b.sent(); + e_33 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_28.message + message: e_33.message }); - throw e_28; + throw e_33; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Creates a page blob of the specified length. Call uploadPages to upload data + * data to a page blob. If the blob with the same name already exists, the content + * of the existing blob will remain unchanged. + * @see https://docs.microsoft.com/rest/api/storageservices/put-blob + * + * @param {number} size size of the page blob. + * @param {PageBlobCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof PageBlobClient + */ + PageBlobClient.prototype.createIfNotExists = function (size, options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, conditions, res, e_34; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("PageBlobClient-createIfNotExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + conditions = { ifNoneMatch: ETagAny }; + return [4 /*yield*/, this.create(size, tslib.__assign(tslib.__assign({}, options), { conditions: conditions, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_34 = _d.sent(); + if (((_a = e_34.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") { + span.setStatus({ + code: api.CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_34.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_34.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_34.message + }); + throw e_34; case 4: span.end(); return [7 /*endfinally*/]; @@ -26500,22 +30629,23 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.uploadPages = function (body, offset, count, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_29; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_35; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-uploadPages", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-uploadPages", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.pageBlobContext.uploadPages(body, count, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onUploadProgress: options.onProgress, range: rangeToString({ offset: offset, count: count }), sequenceNumberAccessConditions: options.conditions, @@ -26525,14 +30655,14 @@ var PageBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_29 = _b.sent(); + e_35 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_29.message + message: e_35.message }); - throw e_29; + throw e_35; case 4: span.end(); return [7 /*endfinally*/]; @@ -26555,18 +30685,19 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.uploadPagesFromURL = function (sourceURL, sourceOffset, destOffset, count, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_30; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_36; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _a = createSpan("PageBlobClient-uploadPagesFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-uploadPagesFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.pageBlobContext.uploadPagesFromURL(sourceURL, rangeToString({ offset: sourceOffset, count: count }), 0, rangeToString({ offset: destOffset, count: count }), { abortSignal: options.abortSignal, @@ -26574,7 +30705,7 @@ var PageBlobClient = /** @class */ (function (_super) { sourceContentCrc64: options.sourceContentCrc64, leaseAccessConditions: options.conditions, sequenceNumberAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, @@ -26585,14 +30716,14 @@ var PageBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_30 = _b.sent(); + e_36 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_30.message + message: e_36.message }); - throw e_30; + throw e_36; case 4: span.end(); return [7 /*endfinally*/]; @@ -26612,36 +30743,37 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.clearPages = function (offset, count, options) { + var _a; if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_31; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_37; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-clearPages", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-clearPages", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.clearPages(0, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset: offset, count: count }), sequenceNumberAccessConditions: options.conditions, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_31 = _b.sent(); + e_37 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_31.message + message: e_37.message }); - throw e_31; + throw e_37; case 4: span.end(); return [7 /*endfinally*/]; @@ -26661,35 +30793,36 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.getPageRanges = function (offset, count, options) { + var _a; if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_32; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_38; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-getPageRanges", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-getPageRanges", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext .getPageRanges({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset: offset, count: count }), spanOptions: spanOptions }) .then(rangeResponseFromModel)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_32 = _b.sent(); + e_38 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_32.message + message: e_38.message }); - throw e_32; + throw e_38; case 4: span.end(); return [7 /*endfinally*/]; @@ -26704,41 +30837,42 @@ var PageBlobClient = /** @class */ (function (_super) { * * @param {number} offset Starting byte position of the page blob * @param {number} count Number of bytes to get ranges diff. - * @param {string} prevSnapshot Timestamp of snapshot to retrive the difference. + * @param {string} prevSnapshot Timestamp of snapshot to retrieve the difference. * @param {PageBlobGetPageRangesDiffOptions} [options] Options to the Page Blob Get Page Ranges Diff operation. * @returns {Promise} Response data for the Page Blob Get Page Range Diff operation. * @memberof PageBlobClient */ PageBlobClient.prototype.getPageRangesDiff = function (offset, count, prevSnapshot, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_33; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_39; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-getPageRangesDiff", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-getPageRangesDiff", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext .getPageRangesDiff({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevsnapshot: prevSnapshot, range: rangeToString({ offset: offset, count: count }), spanOptions: spanOptions }) .then(rangeResponseFromModel)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_33 = _b.sent(); + e_39 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_33.message + message: e_39.message }); - throw e_33; + throw e_39; case 4: span.end(); return [7 /*endfinally*/]; @@ -26753,41 +30887,42 @@ var PageBlobClient = /** @class */ (function (_super) { * * @param {number} offset Starting byte position of the page blob * @param {number} count Number of bytes to get ranges diff. - * @param {string} prevSnapshotUrl URL of snapshot to retrive the difference. + * @param {string} prevSnapshotUrl URL of snapshot to retrieve the difference. * @param {PageBlobGetPageRangesDiffOptions} [options] Options to the Page Blob Get Page Ranges Diff operation. * @returns {Promise} Response data for the Page Blob Get Page Range Diff operation. * @memberof PageBlobClient */ PageBlobClient.prototype.getPageRangesDiffForManagedDisks = function (offset, count, prevSnapshotUrl, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_34; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_40; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-GetPageRangesDiffForManagedDisks", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-GetPageRangesDiffForManagedDisks", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext .getPageRangesDiff({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevSnapshotUrl: prevSnapshotUrl, range: rangeToString({ offset: offset, count: count }), spanOptions: spanOptions }) .then(rangeResponseFromModel)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_34 = _b.sent(); + e_40 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_34.message + message: e_40.message }); - throw e_34; + throw e_40; case 4: span.end(); return [7 /*endfinally*/]; @@ -26806,32 +30941,33 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.resize = function (size, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_35; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_41; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-resize", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-resize", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.resize(size, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_35 = _b.sent(); + e_41 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_35.message + message: e_41.message }); - throw e_35; + throw e_41; case 4: span.end(); return [7 /*endfinally*/]; @@ -26851,32 +30987,33 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.updateSequenceNumber = function (sequenceNumberAction, sequenceNumber, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_36; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_42; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-updateSequenceNumber", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-updateSequenceNumber", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.updateSequenceNumber(sequenceNumberAction, { abortSignal: options.abortSignal, blobSequenceNumber: sequenceNumber, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_36 = _b.sent(); + e_42 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_36.message + message: e_42.message }); - throw e_36; + throw e_42; case 4: span.end(); return [7 /*endfinally*/]; @@ -26900,29 +31037,30 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.startCopyIncremental = function (copySource, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_37; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_43; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("PageBlobClient-startCopyIncremental", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-startCopyIncremental", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.copyIncremental(copySource, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_37 = _b.sent(); + e_43 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_37.message + message: e_43.message }); - throw e_37; + throw e_43; case 4: span.end(); return [7 /*endfinally*/]; @@ -26950,9 +31088,11 @@ var BlobLeaseClient = /** @class */ (function () { var clientContext = new StorageClientContext(client.url, client.pipeline.toServiceClientOptions()); this._url = client.url; if (client instanceof ContainerClient) { + this._isContainer = true; this._containerOrBlobOperation = new Container(clientContext); } else { + this._isContainer = false; this._containerOrBlobOperation = new Blob$1(clientContext); } if (!leaseId) { @@ -26971,7 +31111,7 @@ var BlobLeaseClient = /** @class */ (function () { get: function () { return this._leaseId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobLeaseClient.prototype, "url", { @@ -26985,7 +31125,7 @@ var BlobLeaseClient = /** @class */ (function () { get: function () { return this._url; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -27002,31 +31142,37 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.acquireLease = function (duration, options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_38; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, e_44; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-acquireLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-acquireLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.acquireLease({ abortSignal: options.abortSignal, duration: duration, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), proposedLeaseId: this._leaseId, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_38 = _b.sent(); + e_44 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_38.message + message: e_44.message }); - throw e_38; + throw e_44; case 4: span.end(); return [7 /*endfinally*/]; @@ -27047,32 +31193,38 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.changeLease = function (proposedLeaseId, options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, e_39; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, response, e_45; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-changeLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-changeLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.changeLease(this._leaseId, proposedLeaseId, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions })]; case 2: - response = _b.sent(); + response = _h.sent(); this._leaseId = proposedLeaseId; return [2 /*return*/, response]; case 3: - e_39 = _b.sent(); + e_45 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_39.message + message: e_45.message }); - throw e_39; + throw e_45; case 4: span.end(); return [7 /*endfinally*/]; @@ -27093,29 +31245,35 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.releaseLease = function (options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_40; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, e_46; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-releaseLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-releaseLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.releaseLease(this._leaseId, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_40 = _b.sent(); + e_46 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_40.message + message: e_46.message }); - throw e_40; + throw e_46; case 4: span.end(); return [7 /*endfinally*/]; @@ -27135,29 +31293,35 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.renewLease = function (options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_41; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, e_47; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-renewLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-renewLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.renewLease(this._leaseId, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_41 = _b.sent(); + e_47 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_41.message + message: e_47.message }); - throw e_41; + throw e_47; case 4: span.end(); return [7 /*endfinally*/]; @@ -27180,31 +31344,37 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.breakLease = function (breakPeriod, options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, operationOptions, e_42; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, operationOptions, e_48; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-breakLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-breakLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); operationOptions = { abortSignal: options.abortSignal, breakPeriod: breakPeriod, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions }; return [4 /*yield*/, this._containerOrBlobOperation.breakLease(operationOptions)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_42 = _b.sent(); + e_48 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_42.message + message: e_48.message }); - throw e_42; + throw e_48; case 4: span.end(); return [7 /*endfinally*/]; @@ -27286,7 +31456,7 @@ var ContainerClient = /** @class */ (function (_super) { get: function () { return this._containerName; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -27309,7 +31479,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.create = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_43; + var _a, span, spanOptions, e_49; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27323,12 +31493,12 @@ var ContainerClient = /** @class */ (function (_super) { // this will filter out unwanted properties from the response object into result object return [2 /*return*/, _b.sent()]; case 3: - e_43 = _b.sent(); + e_49 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_43.message + message: e_49.message }); - throw e_43; + throw e_49; case 4: span.end(); return [7 /*endfinally*/]; @@ -27338,7 +31508,55 @@ var ContainerClient = /** @class */ (function (_super) { }); }; /** - * Returns true if the Azrue container resource represented by this client exists; false otherwise. + * Creates a new container under the specified account. If the container with + * the same name already exists, it is not changed. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container + * + * @param {ContainerCreateOptions} [options] + * @returns {Promise} + * @memberof ContainerClient + */ + ContainerClient.prototype.createIfNotExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, res, e_50; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("ContainerClient-createIfNotExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.create(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_50 = _d.sent(); + if (((_a = e_50.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") { + span.setStatus({ + code: api.CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a container only if it does not already exist." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_50.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_50.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_50.message + }); + throw e_50; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns true if the Azure container resource represented by this client exists; false otherwise. * * NOTE: use this function with care since an existing container might be deleted by other clients or * applications. Vice versa new containers with the same name might be added by other clients or @@ -27351,7 +31569,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.exists = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_44; + var _a, span, spanOptions, e_51; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27367,8 +31585,8 @@ var ContainerClient = /** @class */ (function (_super) { _b.sent(); return [2 /*return*/, true]; case 3: - e_44 = _b.sent(); - if (e_44.statusCode === 404) { + e_51 = _b.sent(); + if (e_51.statusCode === 404) { span.setStatus({ code: api.CanonicalCode.NOT_FOUND, message: "Expected exception when checking container existence" @@ -27377,9 +31595,9 @@ var ContainerClient = /** @class */ (function (_super) { } span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_44.message + message: e_51.message }); - throw e_44; + throw e_51; case 4: span.end(); return [7 /*endfinally*/]; @@ -27454,7 +31672,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.getProperties = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_45; + var _a, span, spanOptions, e_52; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27468,12 +31686,12 @@ var ContainerClient = /** @class */ (function (_super) { return [4 /*yield*/, this.containerContext.getProperties(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal }, options.conditions), { spanOptions: spanOptions }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_45 = _b.sent(); + e_52 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_45.message + message: e_52.message }); - throw e_45; + throw e_52; case 4: span.end(); return [7 /*endfinally*/]; @@ -27494,18 +31712,13 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.delete = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_46; + var _a, span, spanOptions, e_53; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: if (!options.conditions) { options.conditions = {}; } - if ((options.conditions.ifMatch && options.conditions.ifMatch !== ETagNone) || - (options.conditions.ifNoneMatch && options.conditions.ifNoneMatch !== ETagNone)) { - throw new RangeError("the IfMatch and IfNoneMatch access conditions must have their default\ - values because they are ignored by the service"); - } _a = createSpan("ContainerClient-delete", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; _b.label = 1; case 1: @@ -27518,12 +31731,60 @@ var ContainerClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_46 = _b.sent(); + e_53 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_46.message + message: e_53.message }); - throw e_46; + throw e_53; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Marks the specified container for deletion if it exists. The container and any blobs + * contained within it are later deleted during garbage collection. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container + * + * @param {ContainerDeleteMethodOptions} [options] Options to Container Delete operation. + * @returns {Promise} + * @memberof ContainerClient + */ + ContainerClient.prototype.deleteIfExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, res, e_54; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("ContainerClient-deleteIfExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_54 = _d.sent(); + if (((_a = e_54.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") { + span.setStatus({ + code: api.CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a container only if it exists." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_54.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_54.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_54.message + }); + throw e_54; case 4: span.end(); return [7 /*endfinally*/]; @@ -27549,18 +31810,15 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.setMetadata = function (metadata, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_47; + var _a, span, spanOptions, e_55; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: if (!options.conditions) { options.conditions = {}; } - if (options.conditions.ifUnmodifiedSince || - (options.conditions.ifMatch && options.conditions.ifMatch !== ETagNone) || - (options.conditions.ifNoneMatch && options.conditions.ifNoneMatch !== ETagNone)) { - throw new RangeError("the IfUnmodifiedSince, IfMatch, and IfNoneMatch must have their default values\ - because they are ignored by the blob service"); + if (options.conditions.ifUnmodifiedSince) { + throw new RangeError("the IfUnmodifiedSince must have their default values because they are ignored by the blob service"); } _a = createSpan("ContainerClient-setMetadata", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; _b.label = 1; @@ -27575,12 +31833,12 @@ var ContainerClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_47 = _b.sent(); + e_55 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_47.message + message: e_55.message }); - throw e_47; + throw e_55; case 4: span.end(); return [7 /*endfinally*/]; @@ -27605,7 +31863,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.getAccessPolicy = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_48; + var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_56; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27656,12 +31914,12 @@ var ContainerClient = /** @class */ (function (_super) { } return [2 /*return*/, res]; case 3: - e_48 = _b.sent(); + e_56 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_48.message + message: e_56.message }); - throw e_48; + throw e_56; case 4: span.end(); return [7 /*endfinally*/]; @@ -27692,7 +31950,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.setAccessPolicy = function (access, containerAcl, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, acl, _i, _b, identifier, e_49; + var _a, span, spanOptions, acl, _i, _b, identifier, e_57; return tslib.__generator(this, function (_c) { switch (_c.label) { case 0: @@ -27727,12 +31985,12 @@ var ContainerClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _c.sent()]; case 3: - e_49 = _c.sent(); + e_57 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_49.message + message: e_57.message }); - throw e_49; + throw e_57; case 4: span.end(); return [7 /*endfinally*/]; @@ -27777,7 +32035,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.uploadBlockBlob = function (blobName, body, contentLength, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, blockBlobClient, response, e_50; + var _a, span, spanOptions, blockBlobClient, response, e_58; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27794,12 +32052,12 @@ var ContainerClient = /** @class */ (function (_super) { response: response }]; case 3: - e_50 = _b.sent(); + e_58 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_50.message + message: e_58.message }); - throw e_50; + throw e_58; case 4: span.end(); return [7 /*endfinally*/]; @@ -27816,14 +32074,14 @@ var ContainerClient = /** @class */ (function (_super) { * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob * * @param {string} blobName - * @param {BlobDeleteOptions} [options] Options to Blob Delete operation. + * @param {ContainerDeleteBlobOptions} [options] Options to Blob Delete operation. * @returns {Promise} Block blob deletion response data. * @memberof ContainerClient */ ContainerClient.prototype.deleteBlob = function (blobName, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, blobClient, e_51; + var _a, span, spanOptions, blobClient, e_59; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27832,15 +32090,18 @@ var ContainerClient = /** @class */ (function (_super) { case 1: _b.trys.push([1, 3, 4, 5]); blobClient = this.getBlobClient(blobName); + if (options.versionId) { + blobClient = blobClient.withVersion(options.versionId); + } return [4 /*yield*/, blobClient.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_51 = _b.sent(); + e_59 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_51.message + message: e_59.message }); - throw e_51; + throw e_59; case 4: span.end(); return [7 /*endfinally*/]; @@ -27864,7 +32125,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listBlobFlatSegment = function (marker, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_52; + var _a, span, spanOptions, response, wrappedResponse, e_60; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27873,14 +32134,20 @@ var ContainerClient = /** @class */ (function (_super) { case 1: _b.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.containerContext.listBlobFlatSegment(tslib.__assign(tslib.__assign({ marker: marker }, options), { spanOptions: spanOptions }))]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: + response = _b.sent(); + wrappedResponse = tslib.__assign(tslib.__assign({}, response), { _response: response._response, segment: tslib.__assign(tslib.__assign({}, response.segment), { blobItems: response.segment.blobItems.map(function (blobItemInteral) { + var blobItem = tslib.__assign(tslib.__assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) }); + return blobItem; + }) }) }); + return [2 /*return*/, wrappedResponse]; case 3: - e_52 = _b.sent(); + e_60 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_52.message + message: e_60.message }); - throw e_52; + throw e_60; case 4: span.end(); return [7 /*endfinally*/]; @@ -27896,7 +32163,7 @@ var ContainerClient = /** @class */ (function (_super) { * again (passing the the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs * - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {string} [marker] A string value that identifies the portion of the list to be returned with the next list operation. * @param {ContainerListBlobsSegmentOptions} [options] Options to Container List Blob Hierarchy Segment operation. * @returns {Promise} @@ -27905,7 +32172,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listBlobHierarchySegment = function (delimiter, marker, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_53; + var _a, span, spanOptions, response, wrappedResponse, e_61; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27914,14 +32181,20 @@ var ContainerClient = /** @class */ (function (_super) { case 1: _b.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.containerContext.listBlobHierarchySegment(delimiter, tslib.__assign(tslib.__assign({ marker: marker }, options), { spanOptions: spanOptions }))]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: + response = _b.sent(); + wrappedResponse = tslib.__assign(tslib.__assign({}, response), { _response: response._response, segment: tslib.__assign(tslib.__assign({}, response.segment), { blobItems: response.segment.blobItems.map(function (blobItemInteral) { + var blobItem = tslib.__assign(tslib.__assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) }); + return blobItem; + }) }) }); + return [2 /*return*/, wrappedResponse]; case 3: - e_53 = _b.sent(); + e_61 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_53.message + message: e_61.message }); - throw e_53; + throw e_61; case 4: span.end(); return [7 /*endfinally*/]; @@ -27983,8 +32256,8 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listItems = function (options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listItems_1() { - var marker, _a, _b, listBlobsFlatSegmentResponse, e_54_1; - var e_54, _c; + var marker, _a, _b, listBlobsFlatSegmentResponse, e_62_1; + var e_62, _c; return tslib.__generator(this, function (_d) { switch (_d.label) { case 0: @@ -28003,8 +32276,8 @@ var ContainerClient = /** @class */ (function (_super) { case 5: return [3 /*break*/, 1]; case 6: return [3 /*break*/, 13]; case 7: - e_54_1 = _d.sent(); - e_54 = { error: e_54_1 }; + e_62_1 = _d.sent(); + e_62 = { error: e_62_1 }; return [3 /*break*/, 13]; case 8: _d.trys.push([8, , 11, 12]); @@ -28015,7 +32288,7 @@ var ContainerClient = /** @class */ (function (_super) { _d.label = 10; case 10: return [3 /*break*/, 12]; case 11: - if (e_54) throw e_54.error; + if (e_62) throw e_62.error; return [7 /*endfinally*/]; case 12: return [7 /*endfinally*/]; case 13: return [2 /*return*/]; @@ -28111,9 +32384,15 @@ var ContainerClient = /** @class */ (function (_super) { if (options.includeSnapshots) { include.push("snapshots"); } + if (options.includeVersions) { + include.push("versions"); + } if (options.includeUncommitedBlobs) { include.push("uncommittedblobs"); } + if (options.includeTags) { + include.push("tags"); + } if (options.prefix === "") { options.prefix = undefined; } @@ -28147,7 +32426,7 @@ var ContainerClient = /** @class */ (function (_super) { * Returns an AsyncIterableIterator for ContainerListBlobHierarchySegmentResponse * * @private - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {string} [marker] A string value that identifies the portion of * the list of blobs to be returned with the next listing operation. The * operation returns the ContinuationToken value within the response body if the @@ -28158,7 +32437,8 @@ var ContainerClient = /** @class */ (function (_super) { * @param {ContainerListBlobsSegmentOptions} [options] Options to list blobs operation. * @returns {AsyncIterableIterator} * @memberof ContainerClient - */ ContainerClient.prototype.listHierarchySegments = function (delimiter, marker, options) { + */ + ContainerClient.prototype.listHierarchySegments = function (delimiter, marker, options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listHierarchySegments_1() { var listBlobsHierarchySegmentResponse; @@ -28189,7 +32469,7 @@ var ContainerClient = /** @class */ (function (_super) { * Returns an AsyncIterableIterator for {@link BlobPrefix} and {@link BlobItem} objects. * * @private - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {ContainerListBlobsSegmentOptions} [options] Options to list blobs operation. * @returns {AsyncIterableIterator<{ kind: "prefix" } & BlobPrefix | { kind: "blob" } & BlobItem>} * @memberof ContainerClient @@ -28197,8 +32477,8 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listItemsByHierarchy = function (delimiter, options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listItemsByHierarchy_1() { - var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_55_1; - var e_55, _f; + var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_63_1; + var e_63, _f; return tslib.__generator(this, function (_g) { switch (_g.label) { case 0: @@ -28241,8 +32521,8 @@ var ContainerClient = /** @class */ (function (_super) { case 12: return [3 /*break*/, 1]; case 13: return [3 /*break*/, 20]; case 14: - e_55_1 = _g.sent(); - e_55 = { error: e_55_1 }; + e_63_1 = _g.sent(); + e_63 = { error: e_63_1 }; return [3 /*break*/, 20]; case 15: _g.trys.push([15, , 18, 19]); @@ -28253,7 +32533,7 @@ var ContainerClient = /** @class */ (function (_super) { _g.label = 17; case 17: return [3 /*break*/, 19]; case 18: - if (e_55) throw e_55.error; + if (e_63) throw e_63.error; return [7 /*endfinally*/]; case 19: return [7 /*endfinally*/]; case 20: return [2 /*return*/]; @@ -28282,7 +32562,7 @@ var ContainerClient = /** @class */ (function (_super) { * Example using `iter.next()`: * * ```js - * let iter = await containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" }); + * let iter = containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" }); * let entity = await iter.next(); * while (!entity.done) { * let item = entity.value; @@ -28334,7 +32614,7 @@ var ContainerClient = /** @class */ (function (_super) { * } * ``` * - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {ContainerListBlobsOptions} [options={}] Options to list blobs operation. * @returns {(PagedAsyncIterableIterator< * { kind: "prefix" } & BlobPrefix | { kind: "blob" } & BlobItem, @@ -28346,6 +32626,9 @@ var ContainerClient = /** @class */ (function (_super) { var _a; var _this = this; if (options === void 0) { options = {}; } + if (delimiter === "") { + throw new RangeError("delimiter should contain one or more characters"); + } var include = []; if (options.includeCopy) { include.push("copy"); @@ -28359,9 +32642,15 @@ var ContainerClient = /** @class */ (function (_super) { if (options.includeSnapshots) { include.push("snapshots"); } + if (options.includeVersions) { + include.push("versions"); + } if (options.includeUncommitedBlobs) { include.push("uncommittedblobs"); } + if (options.includeTags) { + include.push("tags"); + } if (options.prefix === "") { options.prefix = undefined; } @@ -28406,15 +32695,21 @@ var ContainerClient = /** @class */ (function (_super) { var parsedUrl = coreHttp.URLBuilder.parse(this.url); if (parsedUrl.getHost().split(".")[1] === "blob") { // "https://myaccount.blob.core.windows.net/containername". + // "https://customdomain.com/containername". // .getPath() -> /containername containerName = parsedUrl.getPath().split("/")[1]; } - else { + else if (isIpEndpointStyle(parsedUrl)) { // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername // .getPath() -> /devstoreaccount1/containername containerName = parsedUrl.getPath().split("/")[2]; } + else { + // "https://customdomain.com/containername". + // .getPath() -> /containername + containerName = parsedUrl.getPath().split("/")[1]; + } // decode the encoded containerName - to get all the special characters that might be present in it containerName = decodeURIComponent(containerName); if (!containerName) { @@ -28883,7 +33178,7 @@ var InnerBatchRequest = /** @class */ (function () { this.subRequests = new Map(); } /** - * Create pipeline to assemble sub requests. The idea here is to use exising + * Create pipeline to assemble sub requests. The idea here is to use existing * credential and serialization/deserialization components, with additional policies to * filter unnecessary headers, assemble sub requests into request's body * and intercept request from going to wire. @@ -28891,7 +33186,7 @@ var InnerBatchRequest = /** @class */ (function () { */ InnerBatchRequest.prototype.createPipeline = function (credential) { var isAnonymousCreds = credential instanceof AnonymousCredential; - var policyFactoryLength = 3 + (isAnonymousCreds ? 0 : 1); // [deserilizationPolicy, BatchHeaderFilterPolicyFactory, (Optional)Credential, BatchRequestAssemblePolicyFactory] + var policyFactoryLength = 3 + (isAnonymousCreds ? 0 : 1); // [deserializationPolicy, BatchHeaderFilterPolicyFactory, (Optional)Credential, BatchRequestAssemblePolicyFactory] var factories = new Array(policyFactoryLength); factories[0] = coreHttp.deserializationPolicy(); // Default deserializationPolicy is provided by protocol layer factories[1] = new BatchHeaderFilterPolicyFactory(); // Use batch header filter policy to exclude unnecessary headers @@ -29345,6 +33640,48 @@ var BlobServiceClient = /** @class */ (function (_super) { }); }); }; + /** + * Restore a previously deleted Blob container. + * This API is only functional if Container Soft Delete is enabled for the storage account associated with the container. + * + * @param {string} deletedContainerName Name of the previously deleted container. + * @param {string} deletedContainerVersion Version of the previously deleted container, used to uniquely identify the deleted container. + * @returns {Promise} Container deletion response. + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.undeleteContainer = function (deletedContainerName, deletedContainerVersion, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a, span, spanOptions, containerClient, containerContext, containerUndeleteResponse, e_3; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = createSpan("BlobServiceClient-undeleteContainer", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b.label = 1; + case 1: + _b.trys.push([1, 3, 4, 5]); + containerClient = this.getContainerClient(options.destinationContainerName || deletedContainerName); + containerContext = new Container(containerClient["storageClientContext"]); + return [4 /*yield*/, containerContext.restore(tslib.__assign(tslib.__assign({ deletedContainerName: deletedContainerName, + deletedContainerVersion: deletedContainerVersion }, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + containerUndeleteResponse = _b.sent(); + return [2 /*return*/, { containerClient: containerClient, containerUndeleteResponse: containerUndeleteResponse }]; + case 3: + e_3 = _b.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_3.message + }); + throw e_3; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; /** * Gets the properties of a storage account’s Blob service, including properties * for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -29357,7 +33694,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getProperties = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_3; + var _a, span, spanOptions, e_4; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29371,12 +33708,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_3 = _b.sent(); + e_4 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_3.message + message: e_4.message }); - throw e_3; + throw e_4; case 4: span.end(); return [7 /*endfinally*/]; @@ -29398,7 +33735,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.setProperties = function (properties, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_4; + var _a, span, spanOptions, e_5; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29412,12 +33749,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_4 = _b.sent(); + e_5 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_4.message + message: e_5.message }); - throw e_4; + throw e_5; case 4: span.end(); return [7 /*endfinally*/]; @@ -29439,7 +33776,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getStatistics = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_5; + var _a, span, spanOptions, e_6; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29453,12 +33790,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_5 = _b.sent(); + e_6 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_5.message + message: e_6.message }); - throw e_5; + throw e_6; case 4: span.end(); return [7 /*endfinally*/]; @@ -29481,7 +33818,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getAccountInfo = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_6; + var _a, span, spanOptions, e_7; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29495,12 +33832,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_6 = _b.sent(); + e_7 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_6.message + message: e_7.message }); - throw e_6; + throw e_7; case 4: span.end(); return [7 /*endfinally*/]; @@ -29515,9 +33852,9 @@ var BlobServiceClient = /** @class */ (function (_super) { * * @param {string} [marker] A string value that identifies the portion of * the list of containers to be returned with the next listing operation. The - * operation returns the NextMarker value within the response body if the + * operation returns the continuationToken value within the response body if the * listing operation did not return all containers remaining to be listed - * with the current page. The NextMarker value can be used as the value for + * with the current page. The continuationToken value can be used as the value for * the marker parameter in a subsequent call to request the next page of list * items. The marker value is opaque to the client. * @param {ServiceListContainersSegmentOptions} [options] Options to the Service List Container Segment operation. @@ -29527,7 +33864,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.listContainersSegment = function (marker, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_7; + var _a, span, spanOptions, e_8; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29535,15 +33872,15 @@ var BlobServiceClient = /** @class */ (function (_super) { _b.label = 1; case 1: _b.trys.push([1, 3, 4, 5]); - return [4 /*yield*/, this.serviceContext.listContainersSegment(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal, marker: marker }, options), { spanOptions: spanOptions }))]; + return [4 /*yield*/, this.serviceContext.listContainersSegment(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal, marker: marker }, options), { include: typeof options.include === "string" ? [options.include] : options.include, spanOptions: spanOptions }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_7 = _b.sent(); + e_8 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_7.message + message: e_8.message }); - throw e_7; + throw e_8; case 4: span.end(); return [7 /*endfinally*/]; @@ -29552,15 +33889,282 @@ var BlobServiceClient = /** @class */ (function (_super) { }); }); }; + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags + * match a given search expression. Filter blobs searches across all containers within a + * storage account but can be scoped within the expression to a single container. + * + * @private + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {string} [marker] A string value that identifies the portion of + * the list of blobs to be returned with the next listing operation. The + * operation returns the continuationToken value within the response body if the + * listing operation did not return all blobs remaining to be listed + * with the current page. The continuationToken value can be used as the value for + * the marker parameter in a subsequent call to request the next page of list + * items. The marker value is opaque to the client. + * @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags. + * @returns {Promise} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTagsSegment = function (tagFilterSqlExpression, marker, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a, span, spanOptions, e_9; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = createSpan("BlobServiceClient-findBlobsByTagsSegment", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b.label = 1; + case 1: + _b.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.serviceContext.filterBlobs({ + abortSignal: options.abortSignal, + where: tagFilterSqlExpression, + marker: marker, + maxPageSize: options.maxPageSize, + spanOptions: spanOptions + })]; + case 2: return [2 /*return*/, _b.sent()]; + case 3: + e_9 = _b.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_9.message + }); + throw e_9; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns an AsyncIterableIterator for ServiceFindBlobsByTagsSegmentResponse. + * + * @private + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {string} [marker] A string value that identifies the portion of + * the list of blobs to be returned with the next listing operation. The + * operation returns the continuationToken value within the response body if the + * listing operation did not return all blobs remaining to be listed + * with the current page. The continuationToken value can be used as the value for + * the marker parameter in a subsequent call to request the next page of list + * items. The marker value is opaque to the client. + * @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags. + * @returns {AsyncIterableIterator} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTagsSegments = function (tagFilterSqlExpression, marker, options) { + if (options === void 0) { options = {}; } + return tslib.__asyncGenerator(this, arguments, function findBlobsByTagsSegments_1() { + var response; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(!!marker || marker === undefined)) return [3 /*break*/, 6]; + _a.label = 1; + case 1: return [4 /*yield*/, tslib.__await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options))]; + case 2: + response = _a.sent(); + response.blobs = response.blobs || []; + marker = response.continuationToken; + return [4 /*yield*/, tslib.__await(response)]; + case 3: return [4 /*yield*/, _a.sent()]; + case 4: + _a.sent(); + _a.label = 5; + case 5: + if (marker) return [3 /*break*/, 1]; + _a.label = 6; + case 6: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns an AsyncIterableIterator for blobs. + * + * @private + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to findBlobsByTagsItems. + * @returns {AsyncIterableIterator} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTagsItems = function (tagFilterSqlExpression, options) { + if (options === void 0) { options = {}; } + return tslib.__asyncGenerator(this, arguments, function findBlobsByTagsItems_1() { + var marker, _a, _b, segment, e_10_1; + var e_10, _c; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 7, 8, 13]); + _a = tslib.__asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)); + _d.label = 1; + case 1: return [4 /*yield*/, tslib.__await(_a.next())]; + case 2: + if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6]; + segment = _b.value; + return [5 /*yield**/, tslib.__values(tslib.__asyncDelegator(tslib.__asyncValues(segment.blobs)))]; + case 3: return [4 /*yield*/, tslib.__await.apply(void 0, [_d.sent()])]; + case 4: + _d.sent(); + _d.label = 5; + case 5: return [3 /*break*/, 1]; + case 6: return [3 /*break*/, 13]; + case 7: + e_10_1 = _d.sent(); + e_10 = { error: e_10_1 }; + return [3 /*break*/, 13]; + case 8: + _d.trys.push([8, , 11, 12]); + if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10]; + return [4 /*yield*/, tslib.__await(_c.call(_a))]; + case 9: + _d.sent(); + _d.label = 10; + case 10: return [3 /*break*/, 12]; + case 11: + if (e_10) throw e_10.error; + return [7 /*endfinally*/]; + case 12: return [7 /*endfinally*/]; + case 13: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns an async iterable iterator to find all blobs with specified tag + * under the specified account. + * + * .byPage() returns an async iterable iterator to list the blobs in pages. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties + * + * Example using `for await` syntax: + * + * ```js + * let i = 1; + * for await (const blob of blobServiceClient.findBlobsByTags("tagkey='tagvalue'")) { + * console.log(`Blob ${i++}: ${container.name}`); + * } + * ``` + * + * Example using `iter.next()`: + * + * ```js + * let i = 1; + * const iter = blobServiceClient.findBlobsByTags("tagkey='tagvalue'"); + * let blobItem = await iter.next(); + * while (!blobItem.done) { + * console.log(`Blob ${i++}: ${blobItem.value.name}`); + * blobItem = await iter.next(); + * } + * ``` + * + * Example using `byPage()`: + * + * ```js + * // passing optional maxPageSize in the page settings + * let i = 1; + * for await (const response of blobServiceClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) { + * if (response.blobs) { + * for (const blob of response.blobs) { + * console.log(`Blob ${i++}: ${blob.name}`); + * } + * } + * } + * ``` + * + * Example using paging with a marker: + * + * ```js + * let i = 1; + * let iterator = blobServiceClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 }); + * let response = (await iterator.next()).value; + * + * // Prints 2 blob names + * if (response.blobs) { + * for (const blob of response.blobs) { + * console.log(`Blob ${i++}: ${blob.name}`); + * } + * } + * + * // Gets next marker + * let marker = response.continuationToken; + * // Passing next marker as continuationToken + * iterator = blobServiceClient + * .findBlobsByTags("tagkey='tagvalue'") + * .byPage({ continuationToken: marker, maxPageSize: 10 }); + * response = (await iterator.next()).value; + * + * // Prints blob names + * if (response.blobs) { + * for (const blob of response.blobs) { + * console.log(`Blob ${i++}: ${blob.name}`); + * } + * } + * ``` + * + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {ServiceFindBlobByTagsOptions} [options={}] Options to find blobs by tags. + * @returns {PagedAsyncIterableIterator} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTags = function (tagFilterSqlExpression, options) { + var _a; + var _this = this; + if (options === void 0) { options = {}; } + // AsyncIterableIterator to iterate over blobs + var listSegmentOptions = tslib.__assign({}, options); + var iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions); + return _a = { + /** + * @member {Promise} [next] The next method, part of the iteration protocol + */ + next: function () { + return iter.next(); + } + }, + /** + * @member {Symbol} [asyncIterator] The connection to the async iterator, part of the iteration protocol + */ + _a[Symbol.asyncIterator] = function () { + return this; + }, + /** + * @member {Function} [byPage] Return an AsyncIterableIterator that works a page at a time + */ + _a.byPage = function (settings) { + if (settings === void 0) { settings = {}; } + return _this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, tslib.__assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions)); + }, + _a; + }; /** * Returns an AsyncIterableIterator for ServiceListContainersSegmentResponses * * @private * @param {string} [marker] A string value that identifies the portion of * the list of containers to be returned with the next listing operation. The - * operation returns the NextMarker value within the response body if the + * operation returns the continuationToken value within the response body if the * listing operation did not return all containers remaining to be listed - * with the current page. The NextMarker value can be used as the value for + * with the current page. The continuationToken value can be used as the value for * the marker parameter in a subsequent call to request the next page of list * items. The marker value is opaque to the client. * @param {ServiceListContainersSegmentOptions} [options] Options to list containers operation. @@ -29607,8 +34211,8 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.listItems = function (options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listItems_1() { - var marker, _a, _b, segment, e_8_1; - var e_8, _c; + var marker, _a, _b, segment, e_11_1; + var e_11, _c; return tslib.__generator(this, function (_d) { switch (_d.label) { case 0: @@ -29627,8 +34231,8 @@ var BlobServiceClient = /** @class */ (function (_super) { case 5: return [3 /*break*/, 1]; case 6: return [3 /*break*/, 13]; case 7: - e_8_1 = _d.sent(); - e_8 = { error: e_8_1 }; + e_11_1 = _d.sent(); + e_11 = { error: e_11_1 }; return [3 /*break*/, 13]; case 8: _d.trys.push([8, , 11, 12]); @@ -29639,7 +34243,7 @@ var BlobServiceClient = /** @class */ (function (_super) { _d.label = 10; case 10: return [3 /*break*/, 12]; case 11: - if (e_8) throw e_8.error; + if (e_11) throw e_11.error; return [7 /*endfinally*/]; case 12: return [7 /*endfinally*/]; case 13: return [2 /*return*/]; @@ -29729,8 +34333,15 @@ var BlobServiceClient = /** @class */ (function (_super) { if (options.prefix === "") { options.prefix = undefined; } + var include = []; + if (options.includeDeleted) { + include.push("deleted"); + } + if (options.includeMetadata) { + include.push("metadata"); + } // AsyncIterableIterator to iterate over containers - var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (options.includeMetadata ? { include: "metadata" } : {})); + var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (include.length > 0 ? { include: include } : {})); var iter = this.listItems(listSegmentOptions); return _a = { /** @@ -29771,7 +34382,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getUserDelegationKey = function (startsOn, expiresOn, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, userDelegationKey, res, e_9; + var _a, span, spanOptions, response, userDelegationKey, res, e_12; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29800,12 +34411,12 @@ var BlobServiceClient = /** @class */ (function (_super) { res = tslib.__assign({ _response: response._response, requestId: response.requestId, clientRequestId: response.clientRequestId, version: response.version, date: response.date, errorCode: response.errorCode }, userDelegationKey); return [2 /*return*/, res]; case 3: - e_9 = _b.sent(); + e_12 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_9.message + message: e_12.message }); - throw e_9; + throw e_12; case 4: span.end(); return [7 /*endfinally*/]; @@ -29865,6 +34476,13 @@ var AccountSASPermissions = /** @class */ (function () { * @memberof AccountSASPermissions */ this.delete = false; + /** + * Permission to delete versions granted. + * + * @type {boolean} + * @memberof AccountSASPermissions + */ + this.deleteVersion = false; /** * Permission to list blob containers, blobs, shares, directories, and files granted. * @@ -29900,6 +34518,20 @@ var AccountSASPermissions = /** @class */ (function () { * @memberof AccountSASPermissions */ this.process = false; + /** + * Specfies Tag access granted. + * + * @type {boolean} + * @memberof AccountSASPermissions + */ + this.tag = false; + /** + * Permission to filter blobs. + * + * @type {boolean} + * @memberof AccountSASPermissions + */ + this.filter = false; } /** * Parse initializes the AccountSASPermissions fields from a string. @@ -29923,6 +34555,9 @@ var AccountSASPermissions = /** @class */ (function () { case "d": accountSASPermissions.delete = true; break; + case "x": + accountSASPermissions.deleteVersion = true; + break; case "l": accountSASPermissions.list = true; break; @@ -29938,6 +34573,12 @@ var AccountSASPermissions = /** @class */ (function () { case "p": accountSASPermissions.process = true; break; + case "t": + accountSASPermissions.tag = true; + break; + case "f": + accountSASPermissions.filter = true; + break; default: throw new RangeError("Invalid permission character: " + c); } @@ -29970,6 +34611,15 @@ var AccountSASPermissions = /** @class */ (function () { if (this.delete) { permissions.push("d"); } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.filter) { + permissions.push("f"); + } + if (this.tag) { + permissions.push("t"); + } if (this.list) { permissions.push("l"); } @@ -30222,52 +34872,61 @@ function ipRangeToString(ipRange) { * @class SASQueryParameters */ var SASQueryParameters = /** @class */ (function () { - /** - * Creates an instance of SASQueryParameters. - * - * @param {string} version Representing the storage version - * @param {string} signature Representing the signature for the SAS token - * @param {string} [permissions] Representing the storage permissions - * @param {string} [services] Representing the storage services being accessed (only for Account SAS) - * @param {string} [resourceTypes] Representing the storage resource types being accessed (only for Account SAS) - * @param {SASProtocol} [protocol] Representing the allowed HTTP protocol(s) - * @param {Date} [startsOn] Representing the start time for this SAS token - * @param {Date} [expiresOn] Representing the expiry time for this SAS token - * @param {SasIPRange} [ipRange] Representing the range of valid IP addresses for this SAS token - * @param {string} [identifier] Representing the signed identifier (only for Service SAS) - * @param {string} [resource] Representing the storage container or blob (only for Service SAS) - * @param {string} [cacheControl] Representing the cache-control header (only for Blob/File Service SAS) - * @param {string} [contentDisposition] Representing the content-disposition header (only for Blob/File Service SAS) - * @param {string} [contentEncoding] Representing the content-encoding header (only for Blob/File Service SAS) - * @param {string} [contentLanguage] Representing the content-language header (only for Blob/File Service SAS) - * @param {string} [contentType] Representing the content-type header (only for Blob/File Service SAS) - * @param {userDelegationKey} [userDelegationKey] Representing the user delegation key properties - * @memberof SASQueryParameters - */ - function SASQueryParameters(version, signature, permissions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey) { + function SASQueryParameters(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId) { this.version = version; - this.services = services; - this.resourceTypes = resourceTypes; - this.expiresOn = expiresOn; - this.permissions = permissions; - this.protocol = protocol; - this.startsOn = startsOn; - this.ipRangeInner = ipRange; - this.identifier = identifier; - this.resource = resource; this.signature = signature; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.contentEncoding = contentEncoding; - this.contentLanguage = contentLanguage; - this.contentType = contentType; - if (userDelegationKey) { - this.signedOid = userDelegationKey.signedObjectId; - this.signedTenentId = userDelegationKey.signedTenantId; - this.signedStartsOn = userDelegationKey.signedStartsOn; - this.signedExpiresOn = userDelegationKey.signedExpiresOn; - this.signedService = userDelegationKey.signedService; - this.signedVersion = userDelegationKey.signedVersion; + if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") { + // SASQueryParametersOptions + this.permissions = permissionsOrOptions.permissions; + this.services = permissionsOrOptions.services; + this.resourceTypes = permissionsOrOptions.resourceTypes; + this.protocol = permissionsOrOptions.protocol; + this.startsOn = permissionsOrOptions.startsOn; + this.expiresOn = permissionsOrOptions.expiresOn; + this.ipRangeInner = permissionsOrOptions.ipRange; + this.identifier = permissionsOrOptions.identifier; + this.resource = permissionsOrOptions.resource; + this.cacheControl = permissionsOrOptions.cacheControl; + this.contentDisposition = permissionsOrOptions.contentDisposition; + this.contentEncoding = permissionsOrOptions.contentEncoding; + this.contentLanguage = permissionsOrOptions.contentLanguage; + this.contentType = permissionsOrOptions.contentType; + if (permissionsOrOptions.userDelegationKey) { + this.signedOid = permissionsOrOptions.userDelegationKey.signedObjectId; + this.signedTenantId = permissionsOrOptions.userDelegationKey.signedTenantId; + this.signedStartsOn = permissionsOrOptions.userDelegationKey.signedStartsOn; + this.signedExpiresOn = permissionsOrOptions.userDelegationKey.signedExpiresOn; + this.signedService = permissionsOrOptions.userDelegationKey.signedService; + this.signedVersion = permissionsOrOptions.userDelegationKey.signedVersion; + this.preauthorizedAgentObjectId = permissionsOrOptions.preauthorizedAgentObjectId; + this.correlationId = permissionsOrOptions.correlationId; + } + } + else { + this.services = services; + this.resourceTypes = resourceTypes; + this.expiresOn = expiresOn; + this.permissions = permissionsOrOptions; + this.protocol = protocol; + this.startsOn = startsOn; + this.ipRangeInner = ipRange; + this.identifier = identifier; + this.resource = resource; + this.cacheControl = cacheControl; + this.contentDisposition = contentDisposition; + this.contentEncoding = contentEncoding; + this.contentLanguage = contentLanguage; + this.contentType = contentType; + if (userDelegationKey) { + this.signedOid = userDelegationKey.signedObjectId; + this.signedTenantId = userDelegationKey.signedTenantId; + this.signedStartsOn = userDelegationKey.signedStartsOn; + this.signedExpiresOn = userDelegationKey.signedExpiresOn; + this.signedService = userDelegationKey.signedService; + this.signedVersion = userDelegationKey.signedVersion; + this.preauthorizedAgentObjectId = preauthorizedAgentObjectId; + this.correlationId = correlationId; + } } } Object.defineProperty(SASQueryParameters.prototype, "ipRange", { @@ -30287,7 +34946,7 @@ var SASQueryParameters = /** @class */ (function () { } return undefined; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -30319,7 +34978,9 @@ var SASQueryParameters = /** @class */ (function () { "rscd", "rsce", "rscl", - "rsct" + "rsct", + "saoid", + "scid" ]; var queries = []; for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { @@ -30353,7 +35014,7 @@ var SASQueryParameters = /** @class */ (function () { this.tryAppendQueryParameter(queries, param, this.signedOid); break; case "sktid": // Signed tenant ID - this.tryAppendQueryParameter(queries, param, this.signedTenentId); + this.tryAppendQueryParameter(queries, param, this.signedTenantId); break; case "skt": // Signed key start time this.tryAppendQueryParameter(queries, param, this.signedStartsOn ? truncatedISO8061Date(this.signedStartsOn, false) : undefined); @@ -30391,6 +35052,12 @@ var SASQueryParameters = /** @class */ (function () { case "rsct": this.tryAppendQueryParameter(queries, param, this.contentType); break; + case "saoid": + this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId); + break; + case "scid": + this.tryAppendQueryParameter(queries, param, this.correlationId); + break; } } return queries.join("&"); @@ -30436,6 +35103,21 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC var version = accountSASSignatureValues.version ? accountSASSignatureValues.version : SERVICE_VERSION; + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.tag && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.filter && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when provided 'f' permission."); + } var parsedPermissions = AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString()); var parsedServices = AccountSASServices.parse(accountSASSignatureValues.services).toString(); var parsedResourceTypes = AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString(); @@ -30508,6 +35190,34 @@ var BlobSASPermissions = /** @class */ (function () { * @memberof BlobSASPermissions */ this.delete = false; + /** + * Specifies Delete version access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.deleteVersion = false; + /** + * Specfies Tag access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.tag = false; + /** + * Specifies Move access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.move = false; + /** + * Specifies Execute access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.execute = false; } /** * Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an @@ -30538,6 +35248,18 @@ var BlobSASPermissions = /** @class */ (function () { case "d": blobSASPermissions.delete = true; break; + case "x": + blobSASPermissions.deleteVersion = true; + break; + case "t": + blobSASPermissions.tag = true; + break; + case "m": + blobSASPermissions.move = true; + break; + case "e": + blobSASPermissions.execute = true; + break; default: throw new RangeError("Invalid permission: " + char); } @@ -30568,6 +35290,18 @@ var BlobSASPermissions = /** @class */ (function () { if (this.delete) { permissions.push("d"); } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.tag) { + permissions.push("t"); + } + if (this.move) { + permissions.push("m"); + } + if (this.execute) { + permissions.push("e"); + } return permissions.join(""); }; return BlobSASPermissions; @@ -30622,6 +35356,13 @@ var ContainerSASPermissions = /** @class */ (function () { * @memberof ContainerSASPermissions */ this.delete = false; + /** + * Specifies Delete version access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.deleteVersion = false; /** * Specifies List access granted. * @@ -30629,6 +35370,27 @@ var ContainerSASPermissions = /** @class */ (function () { * @memberof ContainerSASPermissions */ this.list = false; + /** + * Specfies Tag access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.tag = false; + /** + * Specifies Move access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.move = false; + /** + * Specifies Execute access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.execute = false; } /** * Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an @@ -30662,6 +35424,18 @@ var ContainerSASPermissions = /** @class */ (function () { case "l": containerSASPermissions.list = true; break; + case "t": + containerSASPermissions.tag = true; + break; + case "x": + containerSASPermissions.deleteVersion = true; + break; + case "m": + containerSASPermissions.move = true; + break; + case "e": + containerSASPermissions.execute = true; + break; default: throw new RangeError("Invalid permission " + char); } @@ -30695,9 +35469,21 @@ var ContainerSASPermissions = /** @class */ (function () { if (this.delete) { permissions.push("d"); } + if (this.deleteVersion) { + permissions.push("x"); + } if (this.list) { permissions.push("l"); } + if (this.tag) { + permissions.push("t"); + } + if (this.move) { + permissions.push("m"); + } + if (this.execute) { + permissions.push("e"); + } return permissions.join(""); }; return ContainerSASPermissions; @@ -30753,6 +35539,7 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent if (sharedKeyCredential === undefined && userDelegationKeyCredential === undefined) { throw TypeError("Invalid sharedKeyCredential, userDelegationKey or accountName."); } + // Version 2019-12-12 adds support for the blob tags permission. // Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields. // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string if (version >= "2018-11-09") { @@ -30760,7 +35547,13 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential); } else { - return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential); + // Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId. + if (version >= "2020-02-10") { + return generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential); + } + else { + return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential); + } } } if (version >= "2015-04-05") { @@ -30791,20 +35584,18 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent * @returns {SASQueryParameters} */ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); if (!blobSASSignatureValues.identifier && - !blobSASSignatureValues.permissions && !blobSASSignatureValues.expiresOn) { + !blobSASSignatureValues.permissions && + !blobSASSignatureValues.expiresOn) { throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; var resource = "c"; - var verifiedPermissions; - if (blobSASSignatureValues.snapshotTime) { - throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'."); - } if (blobSASSignatureValues.blobName) { resource = "b"; } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + var verifiedPermissions; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); @@ -30826,7 +35617,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe blobSASSignatureValues.identifier, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", @@ -30834,7 +35625,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "" ].join("\n"); var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); } /** * ONLY AVAILABLE IN NODE.JS RUNTIME. @@ -30854,23 +35645,26 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe * @returns {SASQueryParameters} */ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); if (!blobSASSignatureValues.identifier && - !blobSASSignatureValues.permissions && !blobSASSignatureValues.expiresOn) { + !blobSASSignatureValues.permissions && + !blobSASSignatureValues.expiresOn) { throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; var resource = "c"; - var verifiedPermissions; - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); - } + var timestamp = blobSASSignatureValues.snapshotTime; if (blobSASSignatureValues.blobName) { resource = "b"; if (blobSASSignatureValues.snapshotTime) { resource = "bs"; } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + var verifiedPermissions; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); @@ -30892,9 +35686,9 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe blobSASSignatureValues.identifier, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, resource, - blobSASSignatureValues.snapshotTime, + timestamp, blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", @@ -30902,7 +35696,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "" ].join("\n"); var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); } /** * ONLY AVAILABLE IN NODE.JS RUNTIME. @@ -30911,7 +35705,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe * Creates an instance of SASQueryParameters. * * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. + * set corresponding properties directly, such as permissions, startsOn. * * WARNING: identifier will be ignored, permissions and expiresOn are required. * @@ -30920,22 +35714,102 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe * @returns {SASQueryParameters} */ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); } - var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; var resource = "c"; + var timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } + } + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. var verifiedPermissions; - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } + else { + verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } } + // Signature is generated on the un-url-encoded values. + var stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? truncatedISO8061Date(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType + ].join("\n"); + var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey); +} +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-02-10. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param {BlobSASSignatureValues} blobSASSignatureValues + * @param {UserDelegationKeyCredential} userDelegationKeyCredential + * @returns {SASQueryParameters} + */ +function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); + } + var resource = "c"; + var timestamp = blobSASSignatureValues.snapshotTime; if (blobSASSignatureValues.blobName) { resource = "b"; if (blobSASSignatureValues.snapshotTime) { resource = "bs"; } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + var verifiedPermissions; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); @@ -30964,11 +35838,14 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD : "", userDelegationKeyCredential.userDelegationKey.signedService, userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.preauthorizedAgentObjectId, + undefined, + blobSASSignatureValues.correlationId, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, resource, - blobSASSignatureValues.snapshotTime, + timestamp, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, @@ -30976,7 +35853,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD blobSASSignatureValues.contentType ].join("\n"); var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId); } function getCanonicalName(accountName, containerName, blobName) { // Container: "/blob/account/containerName" @@ -30987,6 +35864,42 @@ function getCanonicalName(accountName, containerName, blobName) { } return elements.join(""); } +function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) { + var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; + if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") { + throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'."); + } + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { + throw RangeError("Must provide 'blobName' when providing 'snapshotTime'."); + } + if (blobSASSignatureValues.versionId && version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'."); + } + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { + throw RangeError("Must provide 'blobName' when providing 'versionId'."); + } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission."); + } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.tag && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission."); + } + if (version < "2020-02-10" && + blobSASSignatureValues.permissions && + (blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) { + throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission."); + } + if (version < "2020-02-10" && + (blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) { + throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'."); + } + blobSASSignatureValues.version = version; + return blobSASSignatureValues; +} Object.defineProperty(exports, 'BaseRequestPolicy', { enumerable: true, @@ -31059,58 +35972,7 @@ exports.newPipeline = newPipeline; /***/ }), -/* 374 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpanKind = void 0; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var SpanKind; -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(SpanKind = exports.SpanKind || (exports.SpanKind = {})); -//# sourceMappingURL=span_kind.js.map - -/***/ }), +/* 374 */, /* 375 */, /* 376 */, /* 377 */, @@ -31124,10 +35986,20 @@ var SpanKind; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const assert = __webpack_require__(357); -const path = __webpack_require__(622); -const pathHelper = __webpack_require__(972); +const path = __importStar(__webpack_require__(622)); +const pathHelper = __importStar(__webpack_require__(972)); +const assert_1 = __importDefault(__webpack_require__(357)); const IS_WINDOWS = process.platform === 'win32'; /** * Helper class for parsing paths into segments @@ -31141,7 +36013,7 @@ class Path { this.segments = []; // String if (typeof itemPath === 'string') { - assert(itemPath, `Parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); // Normalize slashes and trim unnecessary trailing slash itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); // Not rooted @@ -31168,24 +36040,24 @@ class Path { // Array else { // Must not be empty - assert(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); + assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); // Each segment for (let i = 0; i < itemPath.length; i++) { let segment = itemPath[i]; // Must not be empty - assert(segment, `Parameter 'itemPath' must not contain any empty segments`); + assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`); // Normalize slashes segment = pathHelper.normalizeSeparators(itemPath[i]); // Root segment if (i === 0 && pathHelper.hasRoot(segment)) { segment = pathHelper.safeTrimTrailingSeparator(segment); - assert(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); + assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); this.segments.push(segment); } // All other segments else { // Must not contain slash - assert(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); + assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); this.segments.push(segment); } } @@ -31607,30 +36479,7 @@ exports.endpoint = endpoint; /* 388 */, /* 389 */, /* 390 */, -/* 391 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Event.js.map - -/***/ }), +/* 391 */, /* 392 */, /* 393 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -34140,34 +38989,7 @@ module.exports = __webpack_require__(141); module.exports = require("crypto"); /***/ }), -/* 418 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports._globalThis = void 0; -/** only globals that common to node and browsers are allowed */ -// eslint-disable-next-line node/no-unsupported-features/es-builtins -exports._globalThis = typeof globalThis === 'object' ? globalThis : global; -//# sourceMappingURL=globalThis.js.map - -/***/ }), +/* 418 */, /* 419 */, /* 420 */, /* 421 */, @@ -35164,48 +39986,14 @@ exports.createTar = createTar; /* 436 */, /* 437 */, /* 438 */, -/* 439 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.defaultSetter = void 0; -/** - * Default setter which sets value via direct property access - * - * @param carrier - * @param key - */ -function defaultSetter(carrier, key, value) { - carrier[key] = value; -} -exports.defaultSetter = defaultSetter; -//# sourceMappingURL=setter.js.map - -/***/ }), +/* 439 */, /* 440 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35219,35 +40007,67 @@ exports.defaultSetter = defaultSetter; * See the License for the specific language governing permissions and * limitations under the License. */ -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(2)); -__export(__webpack_require__(744)); -__export(__webpack_require__(553)); -__export(__webpack_require__(40)); -__export(__webpack_require__(43)); -__export(__webpack_require__(625)); -__export(__webpack_require__(450)); -__export(__webpack_require__(767)); -__export(__webpack_require__(151)); -__export(__webpack_require__(162)); -__export(__webpack_require__(670)); -__export(__webpack_require__(932)); -__export(__webpack_require__(975)); -var context_base_1 = __webpack_require__(459); -exports.Context = context_base_1.Context; -const context_1 = __webpack_require__(492); +exports.propagation = exports.metrics = exports.trace = exports.context = void 0; +__exportStar(__webpack_require__(276), exports); +__exportStar(__webpack_require__(158), exports); +__exportStar(__webpack_require__(2), exports); +__exportStar(__webpack_require__(33), exports); +__exportStar(__webpack_require__(744), exports); +__exportStar(__webpack_require__(553), exports); +__exportStar(__webpack_require__(278), exports); +__exportStar(__webpack_require__(40), exports); +__exportStar(__webpack_require__(318), exports); +__exportStar(__webpack_require__(551), exports); +__exportStar(__webpack_require__(659), exports); +__exportStar(__webpack_require__(702), exports); +__exportStar(__webpack_require__(43), exports); +__exportStar(__webpack_require__(625), exports); +__exportStar(__webpack_require__(450), exports); +__exportStar(__webpack_require__(107), exports); +__exportStar(__webpack_require__(189), exports); +__exportStar(__webpack_require__(906), exports); +__exportStar(__webpack_require__(727), exports); +__exportStar(__webpack_require__(165), exports); +__exportStar(__webpack_require__(851), exports); +__exportStar(__webpack_require__(95), exports); +__exportStar(__webpack_require__(767), exports); +__exportStar(__webpack_require__(151), exports); +__exportStar(__webpack_require__(162), exports); +__exportStar(__webpack_require__(781), exports); +__exportStar(__webpack_require__(340), exports); +__exportStar(__webpack_require__(607), exports); +__exportStar(__webpack_require__(670), exports); +__exportStar(__webpack_require__(586), exports); +__exportStar(__webpack_require__(220), exports); +__exportStar(__webpack_require__(932), exports); +__exportStar(__webpack_require__(839), exports); +__exportStar(__webpack_require__(975), exports); +__exportStar(__webpack_require__(70), exports); +__exportStar(__webpack_require__(694), exports); +__exportStar(__webpack_require__(695), exports); +var context_base_1 = __webpack_require__(231); +Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_base_1.Context; } }); +var context_1 = __webpack_require__(492); /** Entrypoint for context API */ exports.context = context_1.ContextAPI.getInstance(); -const trace_1 = __webpack_require__(875); +var trace_1 = __webpack_require__(875); /** Entrypoint for trace API */ exports.trace = trace_1.TraceAPI.getInstance(); -const metrics_1 = __webpack_require__(136); +var metrics_1 = __webpack_require__(136); /** Entrypoint for metrics API */ exports.metrics = metrics_1.MetricsAPI.getInstance(); -const propagation_1 = __webpack_require__(22); +var propagation_1 = __webpack_require__(21); /** Entrypoint for propagation API */ exports.propagation = propagation_1.PropagationAPI.getInstance(); exports.default = { @@ -35288,7 +40108,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setCacheState = exports.isExactKeyMatch = void 0; const core = __importStar(__webpack_require__(470)); -const constants_1 = __webpack_require__(694); +const constants_1 = __webpack_require__(196); function isExactKeyMatch(key, cacheKey) { return !!(cacheKey && cacheKey.localeCompare(key, undefined, { @@ -35324,30 +40144,7 @@ exports.isValidEvent = isValidEvent; /***/ }), /* 444 */, -/* 445 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=link_context.js.map - -/***/ }), +/* 445 */, /* 446 */, /* 447 */, /* 448 */ @@ -35539,8 +40336,8 @@ exports.Octokit = Octokit; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35555,16 +40352,20 @@ exports.Octokit = Octokit; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopMeter_1 = __webpack_require__(625); +exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0; +var NoopMeter_1 = __webpack_require__(625); /** * An implementation of the {@link MeterProvider} which returns an impotent Meter * for all calls to `getMeter` */ -class NoopMeterProvider { - getMeter(_name, _version) { - return NoopMeter_1.NOOP_METER; +var NoopMeterProvider = /** @class */ (function () { + function NoopMeterProvider() { } -} + NoopMeterProvider.prototype.getMeter = function (_name, _version) { + return NoopMeter_1.NOOP_METER; + }; + return NoopMeterProvider; +}()); exports.NoopMeterProvider = NoopMeterProvider; exports.NOOP_METER_PROVIDER = new NoopMeterProvider(); //# sourceMappingURL=NoopMeterProvider.js.map @@ -37294,30 +42095,7 @@ exports.FetchError = FetchError; /***/ }), /* 455 */, /* 456 */, -/* 457 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=TimedEvent.js.map - -/***/ }), +/* 457 */, /* 458 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -37500,35 +42278,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); /***/ }), -/* 459 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(560)); -__export(__webpack_require__(53)); -//# sourceMappingURL=index.js.map - -/***/ }), +/* 459 */, /* 460 */ /***/ (function(module) { @@ -38037,47 +42787,7 @@ exports.getState = getState; /* 481 */, /* 482 */, /* 483 */, -/* 484 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_HTTP_TEXT_PROPAGATOR = exports.NoopHttpTextPropagator = void 0; -/** - * No-op implementations of {@link HttpTextPropagator}. - */ -var NoopHttpTextPropagator = /** @class */ (function () { - function NoopHttpTextPropagator() { - } - /** Noop inject function does nothing */ - NoopHttpTextPropagator.prototype.inject = function (context, carrier, setter) { }; - /** Noop extract function does nothing and returns the input context */ - NoopHttpTextPropagator.prototype.extract = function (context, carrier, getter) { - return context; - }; - return NoopHttpTextPropagator; -}()); -exports.NoopHttpTextPropagator = NoopHttpTextPropagator; -exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); -//# sourceMappingURL=NoopHttpTextPropagator.js.map - -/***/ }), +/* 484 */, /* 485 */, /* 486 */, /* 487 */, @@ -38144,8 +42854,8 @@ exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38160,83 +42870,76 @@ exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const context_base_1 = __webpack_require__(459); +exports.ContextAPI = void 0; +var context_base_1 = __webpack_require__(231); +var global_utils_1 = __webpack_require__(976); +var NOOP_CONTEXT_MANAGER = new context_base_1.NoopContextManager(); /** * Singleton object which represents the entry point to the OpenTelemetry Context API */ -class ContextAPI { +var ContextAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._contextManager = new context_base_1.NoopContextManager(); + function ContextAPI() { } /** Get the singleton instance of the Context API */ - static getInstance() { + ContextAPI.getInstance = function () { if (!this._instance) { this._instance = new ContextAPI(); } return this._instance; - } + }; /** * Set the current context manager. Returns the initialized context manager */ - setGlobalContextManager(contextManager) { - this._contextManager = contextManager; + ContextAPI.prototype.setGlobalContextManager = function (contextManager) { + if (global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) { + // global context manager has already been set + return this._getContextManager(); + } + global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, contextManager, NOOP_CONTEXT_MANAGER); return contextManager; - } + }; /** * Get the currently active context */ - active() { - return this._contextManager.active(); - } + ContextAPI.prototype.active = function () { + return this._getContextManager().active(); + }; /** * Execute a function with an active context * * @param context context to be active during function execution * @param fn function to execute in a context */ - with(context, fn) { - return this._contextManager.with(context, fn); - } + ContextAPI.prototype.with = function (context, fn) { + return this._getContextManager().with(context, fn); + }; /** * Bind a context to a target function or event emitter * * @param target function or event emitter to bind * @param context context to bind to the event emitter or function. Defaults to the currently active context */ - bind(target, context = this.active()) { - return this._contextManager.bind(target, context); - } -} + ContextAPI.prototype.bind = function (target, context) { + if (context === void 0) { context = this.active(); } + return this._getContextManager().bind(target, context); + }; + ContextAPI.prototype._getContextManager = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NOOP_CONTEXT_MANAGER); + }; + /** Disable and remove the global context manager */ + ContextAPI.prototype.disable = function () { + this._getContextManager().disable(); + delete global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]; + }; + return ContextAPI; +}()); exports.ContextAPI = ContextAPI; //# sourceMappingURL=context.js.map /***/ }), -/* 493 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EntryTtl = void 0; -/** - * EntryTtl is an integer that represents number of hops an entry can propagate. - * - * For now, ONLY special values (0 and -1) are supported. - */ -var EntryTtl; -(function (EntryTtl) { - /** - * NO_PROPAGATION is considered to have local context and is used within the - * process it created. - */ - EntryTtl[EntryTtl["NO_PROPAGATION"] = 0] = "NO_PROPAGATION"; - /** UNLIMITED_PROPAGATION can propagate unlimited hops. */ - EntryTtl[EntryTtl["UNLIMITED_PROPAGATION"] = -1] = "UNLIMITED_PROPAGATION"; -})(EntryTtl = exports.EntryTtl || (exports.EntryTtl = {})); -//# sourceMappingURL=EntryValue.js.map - -/***/ }), +/* 493 */, /* 494 */, /* 495 */, /* 496 */, @@ -38349,21 +43052,6 @@ module.exports = {"application/1d-interleaved-parityfec":{"source":"iana"},"appl "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); @@ -38371,12 +43059,115 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi if (k2 === undefined) k2 = k; o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(__webpack_require__(418), exports); -//# sourceMappingURL=index.js.map +exports.addBinToPath = exports.run = void 0; +const core = __importStar(__webpack_require__(470)); +const io = __importStar(__webpack_require__(1)); +const installer = __importStar(__webpack_require__(634)); +const path_1 = __importDefault(__webpack_require__(622)); +const child_process_1 = __importDefault(__webpack_require__(129)); +const fs_1 = __importDefault(__webpack_require__(747)); +const url_1 = __webpack_require__(835); +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + // + // versionSpec is optional. If supplied, install / use from the tool cache + // If not supplied then problem matchers will still be setup. Useful for self-hosted. + // + let versionSpec = core.getInput('go-version'); + // stable will be true unless false is the exact input + // since getting unstable versions should be explicit + let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE'; + core.info(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`); + if (versionSpec) { + let token = core.getInput('token'); + let auth = !token || isGhes() ? undefined : `token ${token}`; + const installDir = yield installer.getGo(versionSpec, stable, auth); + core.exportVariable('GOROOT', installDir); + core.addPath(path_1.default.join(installDir, 'bin')); + core.info('Added go to the path'); + let added = yield addBinToPath(); + core.debug(`add bin ${added}`); + core.info(`Successfully setup go version ${versionSpec}`); + } + // add problem matchers + const matchersPath = path_1.default.join(__dirname, '..', 'matchers.json'); + core.info(`##[add-matcher]${matchersPath}`); + // output the version actually being used + let goPath = yield io.which('go'); + let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); + core.info(goVersion); + core.startGroup('go env'); + let goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString(); + core.info(goEnv); + core.endGroup(); + } + catch (error) { + core.setFailed(error.message); + } + }); +} +exports.run = run; +function addBinToPath() { + return __awaiter(this, void 0, void 0, function* () { + let added = false; + let g = yield io.which('go'); + core.debug(`which go :${g}:`); + if (!g) { + core.debug('go not in the path'); + return added; + } + let buf = child_process_1.default.execSync('go env GOPATH'); + if (buf) { + let gp = buf.toString().trim(); + core.debug(`go env GOPATH :${gp}:`); + if (!fs_1.default.existsSync(gp)) { + // some of the hosted images have go install but not profile dir + core.debug(`creating ${gp}`); + io.mkdirP(gp); + } + let bp = path_1.default.join(gp, 'bin'); + if (!fs_1.default.existsSync(bp)) { + core.debug(`creating ${bp}`); + io.mkdirP(bp); + } + core.addPath(bp); + added = true; + } + return added; + }); +} +exports.addBinToPath = addBinToPath; +function isGhes() { + const ghUrl = new url_1.URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); + return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; +} + /***/ }), /* 515 */ @@ -40085,15 +44876,38 @@ CombinedStream.prototype._emitError = function(err) { /* 548 */, /* 549 */, /* 550 */, -/* 551 */, +/* 551 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=BoundInstrument.js.map + +/***/ }), /* 552 */, /* 553 */ /***/ (function(__unusedmodule, exports) { "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40108,6 +44922,7 @@ CombinedStream.prototype._emitError = function(err) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultSetter = void 0; /** * Default setter which sets value via direct property access * @@ -40407,90 +45222,7 @@ exports.defaultSetter = defaultSetter; /***/ }), -/* 560 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/*! - * Copyright 2020, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Class which stores and manages current context values. All methods which - * update context such as get and delete do not modify an existing context, - * but create a new one with updated values. - */ -class Context { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - constructor(parentContext) { - this._currentContext = parentContext ? new Map(parentContext) : new Map(); - } - /** Get a key to uniquely identify a context value */ - static createKey(description) { - return Symbol(description); - } - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - getValue(key) { - return this._currentContext.get(key); - } - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - setValue(key, value) { - const context = new Context(this._currentContext); - context._currentContext.set(key, value); - return context; - } - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - deleteValue(key) { - const context = new Context(this._currentContext); - context._currentContext.delete(key); - return context; - } -} -exports.Context = Context; -/** The root context is used as the default parent context when there is no active context */ -Context.ROOT_CONTEXT = new Context(); -/** - * This is another identifier to the root context which allows developers to easily search the - * codebase for direct uses of context which need to be removed in later PRs. - * - * It's existence is temporary and it should be removed when all references are fixed. - */ -Context.TODO = Context.ROOT_CONTEXT; -//# sourceMappingURL=context.js.map - -/***/ }), +/* 560 */, /* 561 */, /* 562 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -40537,15 +45269,7 @@ exports.getPublicSuffix = getPublicSuffix; /***/ }), -/* 563 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=attributes.js.map - -/***/ }), +/* 563 */, /* 564 */, /* 565 */, /* 566 */ @@ -40597,43 +45321,7 @@ function clean(key) /* 578 */, /* 579 */, /* 580 */, -/* 581 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(__webpack_require__(47), exports); -__exportStar(__webpack_require__(966), exports); -__exportStar(__webpack_require__(267), exports); -//# sourceMappingURL=index.js.map - -/***/ }), +/* 581 */, /* 582 */ /***/ (function(module) { @@ -40811,7 +45499,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de /***/ }), /* 586 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -40831,114 +45519,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceAPI = void 0; -var NoopTracerProvider_1 = __webpack_require__(222); -var global_utils_1 = __webpack_require__(591); -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - */ -var TraceAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function TraceAPI() { - } - /** Get the singleton instance of the Trace API */ - TraceAPI.getInstance = function () { - if (!this._instance) { - this._instance = new TraceAPI(); - } - return this._instance; - }; - /** - * Set the current global tracer. Returns the initialized global tracer provider - */ - TraceAPI.prototype.setGlobalTracerProvider = function (provider) { - if (global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) { - // global tracer provider has already been set - return this.getTracerProvider(); - } - global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopTracerProvider_1.NOOP_TRACER_PROVIDER); - return this.getTracerProvider(); - }; - /** - * Returns the global tracer provider. - */ - TraceAPI.prototype.getTracerProvider = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopTracerProvider_1.NOOP_TRACER_PROVIDER); - }; - /** - * Returns a tracer from the global tracer provider. - */ - TraceAPI.prototype.getTracer = function (name, version) { - return this.getTracerProvider().getTracer(name, version); - }; - /** Remove the global tracer provider */ - TraceAPI.prototype.disable = function () { - delete global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]; - }; - return TraceAPI; -}()); -exports.TraceAPI = TraceAPI; -//# sourceMappingURL=trace.js.map +//# sourceMappingURL=span.js.map /***/ }), /* 587 */, /* 588 */, /* 589 */, /* 590 */, -/* 591 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_TRACE_API_KEY = exports.GLOBAL_PROPAGATION_API_KEY = exports.GLOBAL_METRICS_API_KEY = exports.GLOBAL_CONTEXT_MANAGER_API_KEY = void 0; -var platform_1 = __webpack_require__(165); -exports.GLOBAL_CONTEXT_MANAGER_API_KEY = Symbol.for('io.opentelemetry.js.api.context'); -exports.GLOBAL_METRICS_API_KEY = Symbol.for('io.opentelemetry.js.api.metrics'); -exports.GLOBAL_PROPAGATION_API_KEY = Symbol.for('io.opentelemetry.js.api.propagation'); -exports.GLOBAL_TRACE_API_KEY = Symbol.for('io.opentelemetry.js.api.trace'); -exports._global = platform_1._globalThis; -/** - * Make a function which accepts a version integer and returns the instance of an API if the version - * is compatible, or a fallback version (usually NOOP) if it is not. - * - * @param requiredVersion Backwards compatibility version which is required to return the instance - * @param instance Instance which should be returned if the required version is compatible - * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible - */ -function makeGetter(requiredVersion, instance, fallback) { - return function (version) { - return version === requiredVersion ? instance : fallback; - }; -} -exports.makeGetter = makeGetter; -/** - * A number which should be incremented each time a backwards incompatible - * change is made to the API. This number is used when an API package - * attempts to access the global API to ensure it is getting a compatible - * version. If the global API is not compatible with the API package - * attempting to get it, a NOOP API implementation will be returned. - */ -exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0; -//# sourceMappingURL=global-utils.js.map - -/***/ }), +/* 591 */, /* 592 */, /* 593 */, /* 594 */, @@ -40949,8 +45537,15 @@ exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const pathHelper = __webpack_require__(972); +const pathHelper = __importStar(__webpack_require__(972)); const internal_match_kind_1 = __webpack_require__(327); const IS_WINDOWS = process.platform === 'win32'; /** @@ -41032,8 +45627,15 @@ exports.partialMatch = partialMatch; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const core = __webpack_require__(470); +const core = __importStar(__webpack_require__(470)); /** * Returns a copy with defaults filled in. */ @@ -41328,7 +45930,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _rng = _interopRequireDefault(__webpack_require__(733)); +var _rng = _interopRequireDefault(__webpack_require__(944)); var _stringify = _interopRequireDefault(__webpack_require__(855)); @@ -41360,7 +45962,30 @@ var _default = v4; exports.default = _default; /***/ }), -/* 607 */, +/* 607 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=span_context.js.map + +/***/ }), /* 608 */, /* 609 */, /* 610 */, @@ -41409,23 +46034,63 @@ exports.default = _default; "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer.js.map +function getProxyUrl(reqUrl) { + let usingSsl = reqUrl.protocol === 'https:'; + let proxyUrl; + if (checkBypass(reqUrl)) { + return proxyUrl; + } + let proxyVar; + if (usingSsl) { + proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; + } + else { + proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; + } + if (proxyVar) { + proxyUrl = new URL(proxyVar); + } + return proxyUrl; +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + let upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (let upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; + /***/ }), /* 619 */, @@ -41509,8 +46174,8 @@ module.exports = require("path"); "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41524,41 +46189,74 @@ module.exports = require("path"); * See the License for the specific language governing permissions and * limitations under the License. */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + 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 extendStatics(d, b); + }; + 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 }); +exports.NOOP_BATCH_OBSERVER_METRIC = exports.NOOP_SUM_OBSERVER_METRIC = exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = exports.NOOP_VALUE_OBSERVER_METRIC = exports.NOOP_BOUND_BASE_OBSERVER = exports.NOOP_VALUE_RECORDER_METRIC = exports.NOOP_BOUND_VALUE_RECORDER = exports.NOOP_COUNTER_METRIC = exports.NOOP_BOUND_COUNTER = exports.NOOP_METER = exports.NoopBoundBaseObserver = exports.NoopBoundValueRecorder = exports.NoopBoundCounter = exports.NoopBatchObserverMetric = exports.NoopBaseObserverMetric = exports.NoopValueRecorderMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0; /** * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses * constant NoopMetrics for all of its methods. */ -class NoopMeter { - constructor() { } +var NoopMeter = /** @class */ (function () { + function NoopMeter() { + } /** - * Returns constant noop measure. + * Returns constant noop value recorder. * @param name the name of the metric. * @param [options] the metric options. */ - createMeasure(name, options) { - return exports.NOOP_MEASURE_METRIC; - } + NoopMeter.prototype.createValueRecorder = function (name, options) { + return exports.NOOP_VALUE_RECORDER_METRIC; + }; /** * Returns a constant noop counter. * @param name the name of the metric. * @param [options] the metric options. */ - createCounter(name, options) { + NoopMeter.prototype.createCounter = function (name, options) { return exports.NOOP_COUNTER_METRIC; - } + }; /** - * Returns constant noop observer. + * Returns a constant noop UpDownCounter. * @param name the name of the metric. * @param [options] the metric options. */ - createObserver(name, options) { - return exports.NOOP_OBSERVER_METRIC; - } -} + NoopMeter.prototype.createUpDownCounter = function (name, options) { + return exports.NOOP_COUNTER_METRIC; + }; + /** + * Returns constant noop value observer. + * @param name the name of the metric. + * @param [options] the metric options. + * @param [callback] the value observer callback + */ + NoopMeter.prototype.createValueObserver = function (name, options, callback) { + return exports.NOOP_VALUE_OBSERVER_METRIC; + }; + /** + * Returns constant noop batch observer. + * @param name the name of the metric. + * @param callback the batch observer callback + */ + NoopMeter.prototype.createBatchObserver = function (name, callback) { + return exports.NOOP_BATCH_OBSERVER_METRIC; + }; + return NoopMeter; +}()); exports.NoopMeter = NoopMeter; -class NoopMetric { - constructor(instrument) { +var NoopMetric = /** @class */ (function () { + function NoopMetric(instrument) { this._instrument = instrument; } /** @@ -41568,32 +46266,42 @@ class NoopMetric { * @param labels key-values pairs that are associated with a specific metric * that you want to record. */ - bind(labels) { + NoopMetric.prototype.bind = function (labels) { return this._instrument; - } + }; /** * Removes the Binding from the metric, if it is present. * @param labels key-values pairs that are associated with a specific metric. */ - unbind(labels) { + NoopMetric.prototype.unbind = function (labels) { return; - } + }; /** * Clears all timeseries from the Metric. */ - clear() { + NoopMetric.prototype.clear = function () { return; - } -} + }; + return NoopMetric; +}()); exports.NoopMetric = NoopMetric; -class NoopCounterMetric extends NoopMetric { - add(value, labels) { - this.bind(labels).add(value); +var NoopCounterMetric = /** @class */ (function (_super) { + __extends(NoopCounterMetric, _super); + function NoopCounterMetric() { + return _super !== null && _super.apply(this, arguments) || this; } -} + NoopCounterMetric.prototype.add = function (value, labels) { + this.bind(labels).add(value); + }; + return NoopCounterMetric; +}(NoopMetric)); exports.NoopCounterMetric = NoopCounterMetric; -class NoopMeasureMetric extends NoopMetric { - record(value, labels, correlationContext, spanContext) { +var NoopValueRecorderMetric = /** @class */ (function (_super) { + __extends(NoopValueRecorderMetric, _super); + function NoopValueRecorderMetric() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoopValueRecorderMetric.prototype.record = function (value, labels, correlationContext, spanContext) { if (typeof correlationContext === 'undefined') { this.bind(labels).record(value); } @@ -41603,36 +46311,67 @@ class NoopMeasureMetric extends NoopMetric { else { this.bind(labels).record(value, correlationContext, spanContext); } + }; + return NoopValueRecorderMetric; +}(NoopMetric)); +exports.NoopValueRecorderMetric = NoopValueRecorderMetric; +var NoopBaseObserverMetric = /** @class */ (function (_super) { + __extends(NoopBaseObserverMetric, _super); + function NoopBaseObserverMetric() { + return _super !== null && _super.apply(this, arguments) || this; } -} -exports.NoopMeasureMetric = NoopMeasureMetric; -class NoopObserverMetric extends NoopMetric { - setCallback(callback) { } -} -exports.NoopObserverMetric = NoopObserverMetric; -class NoopBoundCounter { - add(value) { - return; + NoopBaseObserverMetric.prototype.observation = function () { + return { + observer: this, + value: 0, + }; + }; + return NoopBaseObserverMetric; +}(NoopMetric)); +exports.NoopBaseObserverMetric = NoopBaseObserverMetric; +var NoopBatchObserverMetric = /** @class */ (function (_super) { + __extends(NoopBatchObserverMetric, _super); + function NoopBatchObserverMetric() { + return _super !== null && _super.apply(this, arguments) || this; } -} + return NoopBatchObserverMetric; +}(NoopMetric)); +exports.NoopBatchObserverMetric = NoopBatchObserverMetric; +var NoopBoundCounter = /** @class */ (function () { + function NoopBoundCounter() { + } + NoopBoundCounter.prototype.add = function (value) { + return; + }; + return NoopBoundCounter; +}()); exports.NoopBoundCounter = NoopBoundCounter; -class NoopBoundMeasure { - record(value, correlationContext, spanContext) { +var NoopBoundValueRecorder = /** @class */ (function () { + function NoopBoundValueRecorder() { + } + NoopBoundValueRecorder.prototype.record = function (value, correlationContext, spanContext) { return; + }; + return NoopBoundValueRecorder; +}()); +exports.NoopBoundValueRecorder = NoopBoundValueRecorder; +var NoopBoundBaseObserver = /** @class */ (function () { + function NoopBoundBaseObserver() { } -} -exports.NoopBoundMeasure = NoopBoundMeasure; -class NoopBoundObserver { - setCallback(callback) { } -} -exports.NoopBoundObserver = NoopBoundObserver; + NoopBoundBaseObserver.prototype.update = function (value) { }; + return NoopBoundBaseObserver; +}()); +exports.NoopBoundBaseObserver = NoopBoundBaseObserver; exports.NOOP_METER = new NoopMeter(); exports.NOOP_BOUND_COUNTER = new NoopBoundCounter(); exports.NOOP_COUNTER_METRIC = new NoopCounterMetric(exports.NOOP_BOUND_COUNTER); -exports.NOOP_BOUND_MEASURE = new NoopBoundMeasure(); -exports.NOOP_MEASURE_METRIC = new NoopMeasureMetric(exports.NOOP_BOUND_MEASURE); -exports.NOOP_BOUND_OBSERVER = new NoopBoundObserver(); -exports.NOOP_OBSERVER_METRIC = new NoopObserverMetric(exports.NOOP_BOUND_OBSERVER); +exports.NOOP_BOUND_VALUE_RECORDER = new NoopBoundValueRecorder(); +exports.NOOP_VALUE_RECORDER_METRIC = new NoopValueRecorderMetric(exports.NOOP_BOUND_VALUE_RECORDER); +exports.NOOP_BOUND_BASE_OBSERVER = new NoopBoundBaseObserver(); +exports.NOOP_VALUE_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); +exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); +exports.NOOP_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); +exports.NOOP_BATCH_OBSERVER_METRIC = new NoopBatchObserverMetric(); //# sourceMappingURL=NoopMeter.js.map /***/ }), @@ -43751,129 +48490,7 @@ exports.getArch = getArch; /***/ }), -/* 647 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - 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) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.addBinToPath = exports.run = void 0; -const core = __importStar(__webpack_require__(470)); -const io = __importStar(__webpack_require__(1)); -const installer = __importStar(__webpack_require__(634)); -const path_1 = __importDefault(__webpack_require__(622)); -const child_process_1 = __importDefault(__webpack_require__(129)); -const fs_1 = __importDefault(__webpack_require__(747)); -const url_1 = __webpack_require__(835); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - // - // versionSpec is optional. If supplied, install / use from the tool cache - // If not supplied then problem matchers will still be setup. Useful for self-hosted. - // - let versionSpec = core.getInput('go-version'); - // stable will be true unless false is the exact input - // since getting unstable versions should be explicit - let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE'; - core.info(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`); - if (versionSpec) { - let token = core.getInput('token'); - let auth = !token || isGhes() ? undefined : `token ${token}`; - const installDir = yield installer.getGo(versionSpec, stable, auth); - core.exportVariable('GOROOT', installDir); - core.addPath(path_1.default.join(installDir, 'bin')); - core.info('Added go to the path'); - let added = yield addBinToPath(); - core.debug(`add bin ${added}`); - core.info(`Successfully setup go version ${versionSpec}`); - } - // add problem matchers - const matchersPath = path_1.default.join(__dirname, '..', 'matchers.json'); - core.info(`##[add-matcher]${matchersPath}`); - // output the version actually being used - let goPath = yield io.which('go'); - let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); - core.info(goVersion); - core.startGroup('go env'); - let goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString(); - core.info(goEnv); - core.endGroup(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.run = run; -function addBinToPath() { - return __awaiter(this, void 0, void 0, function* () { - let added = false; - let g = yield io.which('go'); - core.debug(`which go :${g}:`); - if (!g) { - core.debug('go not in the path'); - return added; - } - let buf = child_process_1.default.execSync('go env GOPATH'); - if (buf) { - let gp = buf.toString().trim(); - core.debug(`go env GOPATH :${gp}:`); - if (!fs_1.default.existsSync(gp)) { - // some of the hosted images have go install but not profile dir - core.debug(`creating ${gp}`); - io.mkdirP(gp); - } - let bp = path_1.default.join(gp, 'bin'); - if (!fs_1.default.existsSync(bp)) { - core.debug(`creating ${bp}`); - io.mkdirP(bp); - } - core.addPath(bp); - added = true; - } - return added; - }); -} -exports.addBinToPath = addBinToPath; -function isGhes() { - const ghUrl = new url_1.URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); - return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; -} - - -/***/ }), +/* 647 */, /* 648 */, /* 649 */, /* 650 */, @@ -43923,7 +48540,7 @@ const core = __importStar(__webpack_require__(470)); const tc = __importStar(__webpack_require__(533)); const os_1 = __importDefault(__webpack_require__(87)); const path_1 = __importDefault(__webpack_require__(622)); -const main_1 = __webpack_require__(647); +const main_1 = __webpack_require__(514); const downloadURL = "https://github.com/golangci/golangci-lint/releases/download"; const getAssetURL = (versionConfig) => { let ext = "tar.gz"; @@ -44028,7 +48645,30 @@ exports.installGo = installGo; /***/ }), /* 658 */, -/* 659 */, +/* 659 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Meter.js.map + +/***/ }), /* 660 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -44191,8 +48831,10 @@ module.exports = require("util"); "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SpanKind = void 0; +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44206,11 +48848,6 @@ module.exports = require("util"); * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Type of span. Can be used to specify additional relationships between spans - * in addition to a parent/child relationship. - */ var SpanKind; (function (SpanKind) { /** Default value. Indicates that the span is used internally. */ @@ -44443,30 +49080,7 @@ function isUnixExecutable(stats) { //# sourceMappingURL=io-util.js.map /***/ }), -/* 673 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Plugin.js.map - -/***/ }), +/* 673 */, /* 674 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -44667,30 +49281,49 @@ exports.Deprecation = Deprecation; "use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.RefKey = exports.Events = exports.State = exports.Inputs = void 0; -var Inputs; -(function (Inputs) { - Inputs["Key"] = "key"; - Inputs["Path"] = "path"; - Inputs["RestoreKeys"] = "restore-keys"; -})(Inputs = exports.Inputs || (exports.Inputs = {})); -var State; -(function (State) { - State["CachePrimaryKey"] = "CACHE_KEY"; - State["CacheMatchedKey"] = "CACHE_RESULT"; -})(State = exports.State || (exports.State = {})); -var Events; -(function (Events) { - Events["Key"] = "GITHUB_EVENT_NAME"; - Events["Push"] = "push"; - Events["PullRequest"] = "pull_request"; -})(Events = exports.Events || (exports.Events = {})); -exports.RefKey = "GITHUB_REF"; +//# sourceMappingURL=tracer_provider.js.map +/***/ }), +/* 695 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=tracer.js.map /***/ }), -/* 695 */, /* 696 */ /***/ (function(module) { @@ -45042,7 +49675,30 @@ module.exports = isPlainObject; /***/ }), -/* 702 */, +/* 702 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=MeterProvider.js.map + +/***/ }), /* 703 */, /* 704 */, /* 705 */, @@ -45125,7 +49781,18 @@ module.exports = isPlainObject; /***/ }), /* 709 */, /* 710 */, -/* 711 */, +/* 711 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +__webpack_require__(71); + + +/***/ }), /* 712 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -45172,7 +49839,87 @@ module.exports = isPlainObject; /***/ }), /* 713 */, /* 714 */, -/* 715 */, +/* 715 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Context = void 0; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var Context = /** @class */ (function () { + /** + * Construct a new context which inherits values from an optional parent context. + * + * @param parentContext a context from which to inherit values + */ + function Context(parentContext) { + this._currentContext = parentContext ? new Map(parentContext) : new Map(); + } + /** Get a key to uniquely identify a context value */ + Context.createKey = function (description) { + return Symbol(description); + }; + /** + * Get a value from the context. + * + * @param key key which identifies a context value + */ + Context.prototype.getValue = function (key) { + return this._currentContext.get(key); + }; + /** + * Create a new context which inherits from this context and has + * the given key set to the given value. + * + * @param key context key for which to set the value + * @param value value to set for the given key + */ + Context.prototype.setValue = function (key, value) { + var context = new Context(this._currentContext); + context._currentContext.set(key, value); + return context; + }; + /** + * Return a new context which inherits from this context but does + * not contain a value for the given key. + * + * @param key context key for which to clear a value + */ + Context.prototype.deleteValue = function (key) { + var context = new Context(this._currentContext); + context._currentContext.delete(key); + return context; + }; + /** The root context is used as the default parent context when there is no active context */ + Context.ROOT_CONTEXT = new Context(); + /** + * This is another identifier to the root context which allows developers to easily search the + * codebase for direct uses of context which need to be removed in later PRs. + * + * It's existence is temporary and it should be removed when all references are fixed. + */ + Context.TODO = Context.ROOT_CONTEXT; + return Context; +}()); +exports.Context = Context; +//# sourceMappingURL=context.js.map + +/***/ }), /* 716 */, /* 717 */, /* 718 */, @@ -45222,7 +49969,7 @@ const core = __importStar(__webpack_require__(470)); const crypto = __importStar(__webpack_require__(417)); const fs = __importStar(__webpack_require__(747)); const path_1 = __importDefault(__webpack_require__(622)); -const constants_1 = __webpack_require__(694); +const constants_1 = __webpack_require__(196); const utils = __importStar(__webpack_require__(443)); function checksumFile(hashName, path) { return new Promise((resolve, reject) => { @@ -45369,16 +50116,31 @@ exports.saveCache = saveCache; /***/ }), /* 725 */, -/* 726 */ +/* 726 */, +/* 727 */ /***/ (function(__unusedmodule, exports) { "use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=trace_state.js.map +//# sourceMappingURL=Event.js.map /***/ }), -/* 727 */, /* 728 */ /***/ (function(__unusedmodule, exports) { @@ -45397,99 +50159,71 @@ exports.SearchState = SearchState; /***/ }), /* 729 */, /* 730 */, -/* 731 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MetricsAPI = void 0; -var NoopMeterProvider_1 = __webpack_require__(984); -var global_utils_1 = __webpack_require__(591); -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -var MetricsAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function MetricsAPI() { - } - /** Get the singleton instance of the Metrics API */ - MetricsAPI.getInstance = function () { - if (!this._instance) { - this._instance = new MetricsAPI(); - } - return this._instance; - }; - /** - * Set the current global meter. Returns the initialized global meter provider. - */ - MetricsAPI.prototype.setGlobalMeterProvider = function (provider) { - if (global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) { - // global meter provider has already been set - return this.getMeterProvider(); - } - global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopMeterProvider_1.NOOP_METER_PROVIDER); - return provider; - }; - /** - * Returns the global meter provider. - */ - MetricsAPI.prototype.getMeterProvider = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopMeterProvider_1.NOOP_METER_PROVIDER); - }; - /** - * Returns a meter from the global meter provider. - */ - MetricsAPI.prototype.getMeter = function (name, version) { - return this.getMeterProvider().getMeter(name, version); - }; - /** Remove the global meter provider */ - MetricsAPI.prototype.disable = function () { - delete global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]; - }; - return MetricsAPI; -}()); -exports.MetricsAPI = MetricsAPI; -//# sourceMappingURL=metrics.js.map - -/***/ }), +/* 731 */, /* 732 */, /* 733 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = rng; - -var _crypto = _interopRequireDefault(__webpack_require__(417)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const rnds8 = new Uint8Array(16); - -function rng() { - return _crypto.default.randomFillSync(rnds8); +Object.defineProperty(exports, "__esModule", { value: true }); +class BasicCredentialHandler { + constructor(username, password) { + this.username = username; + this.password = password; + } + prepareRequest(options) { + options.headers['Authorization'] = + 'Basic ' + + Buffer.from(this.username + ':' + this.password).toString('base64'); + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +exports.BasicCredentialHandler = BasicCredentialHandler; +class BearerCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + options.headers['Authorization'] = 'Bearer ' + this.token; + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +exports.BearerCredentialHandler = BearerCredentialHandler; +class PersonalAccessTokenCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + options.headers['Authorization'] = + 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } } +exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; + /***/ }), /* 734 */, @@ -45738,30 +50472,7 @@ function rng() { /***/ }), /* 739 */, /* 740 */, -/* 741 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=span_context.js.map - -/***/ }), +/* 741 */, /* 742 */, /* 743 */, /* 744 */ @@ -45769,8 +50480,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45785,17 +50496,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.NOOP_HTTP_TEXT_PROPAGATOR = exports.NoopHttpTextPropagator = void 0; /** * No-op implementations of {@link HttpTextPropagator}. */ -class NoopHttpTextPropagator { +var NoopHttpTextPropagator = /** @class */ (function () { + function NoopHttpTextPropagator() { + } /** Noop inject function does nothing */ - inject(context, carrier, setter) { } + NoopHttpTextPropagator.prototype.inject = function (context, carrier, setter) { }; /** Noop extract function does nothing and returns the input context */ - extract(context, carrier, getter) { + NoopHttpTextPropagator.prototype.extract = function (context, carrier, getter) { return context; - } -} + }; + return NoopHttpTextPropagator; +}()); exports.NoopHttpTextPropagator = NoopHttpTextPropagator; exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); //# sourceMappingURL=NoopHttpTextPropagator.js.map @@ -46298,7 +51013,41 @@ module.exports = require("zlib"); /***/ }), /* 762 */, /* 763 */, -/* 764 */, +/* 764 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(145), exports); +//# sourceMappingURL=index.js.map + +/***/ }), /* 765 */, /* 766 */ /***/ (function(module) { @@ -46321,8 +51070,8 @@ module.exports = function(dst, src) { "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46337,10 +51086,11 @@ module.exports = function(dst, src) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const trace_flags_1 = __webpack_require__(975); +exports.NOOP_SPAN = exports.NoopSpan = exports.INVALID_SPAN_ID = exports.INVALID_TRACE_ID = void 0; +var trace_flags_1 = __webpack_require__(975); exports.INVALID_TRACE_ID = '0'; exports.INVALID_SPAN_ID = '0'; -const INVALID_SPAN_CONTEXT = { +var INVALID_SPAN_CONTEXT = { traceId: exports.INVALID_TRACE_ID, spanId: exports.INVALID_SPAN_ID, traceFlags: trace_flags_1.TraceFlags.NONE, @@ -46350,41 +51100,43 @@ const INVALID_SPAN_CONTEXT = { * implementation is available. All operations are no-op including context * propagation. */ -class NoopSpan { - constructor(_spanContext = INVALID_SPAN_CONTEXT) { +var NoopSpan = /** @class */ (function () { + function NoopSpan(_spanContext) { + if (_spanContext === void 0) { _spanContext = INVALID_SPAN_CONTEXT; } this._spanContext = _spanContext; } // Returns a SpanContext. - context() { + NoopSpan.prototype.context = function () { return this._spanContext; - } + }; // By default does nothing - setAttribute(key, value) { + NoopSpan.prototype.setAttribute = function (key, value) { return this; - } + }; // By default does nothing - setAttributes(attributes) { + NoopSpan.prototype.setAttributes = function (attributes) { return this; - } + }; // By default does nothing - addEvent(name, attributes) { + NoopSpan.prototype.addEvent = function (name, attributes) { return this; - } + }; // By default does nothing - setStatus(status) { + NoopSpan.prototype.setStatus = function (status) { return this; - } + }; // By default does nothing - updateName(name) { + NoopSpan.prototype.updateName = function (name) { return this; - } + }; // By default does nothing - end(endTime) { } + NoopSpan.prototype.end = function (endTime) { }; // isRecording always returns false for noopSpan. - isRecording() { + NoopSpan.prototype.isRecording = function () { return false; - } -} + }; + return NoopSpan; +}()); exports.NoopSpan = NoopSpan; exports.NOOP_SPAN = new NoopSpan(); //# sourceMappingURL=NoopSpan.js.map @@ -47130,7 +51882,30 @@ function populateMaps (extensions, types) { /***/ }), /* 780 */, -/* 781 */, +/* 781 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Sampler.js.map + +/***/ }), /* 782 */, /* 783 */, /* 784 */, @@ -47913,94 +52688,301 @@ exports.createTokenAuth = createTokenAuth; /***/ }), /* 814 */, /* 815 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module) { -"use strict"; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __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 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, 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 }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PropagationAPI = void 0; -var getter_1 = __webpack_require__(331); -var NoopHttpTextPropagator_1 = __webpack_require__(484); -var setter_1 = __webpack_require__(439); -var context_1 = __webpack_require__(284); -var global_utils_1 = __webpack_require__(591); -var contextApi = context_1.ContextAPI.getInstance(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - */ -var PropagationAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function PropagationAPI() { - } - /** Get the singleton instance of the Propagator API */ - PropagationAPI.getInstance = function () { - if (!this._instance) { - this._instance = new PropagationAPI(); - } - return this._instance; - }; - /** - * Set the current propagator. Returns the initialized propagator - */ - PropagationAPI.prototype.setGlobalPropagator = function (propagator) { - if (global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) { - // global propagator has already been set - return this._getGlobalPropagator(); - } - global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, propagator, NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); - return propagator; - }; - /** - * Inject context into a carrier to be propagated inter-process - * - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - * @param context Context carrying tracing data to inject. Defaults to the currently active context. - */ - PropagationAPI.prototype.inject = function (carrier, setter, context) { - if (setter === void 0) { setter = setter_1.defaultSetter; } - if (context === void 0) { context = contextApi.active(); } - return this._getGlobalPropagator().inject(context, carrier, setter); - }; - /** - * Extract context from a carrier - * - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - * @param context Context which the newly created context will inherit from. Defaults to the currently active context. - */ - PropagationAPI.prototype.extract = function (carrier, getter, context) { - if (getter === void 0) { getter = getter_1.defaultGetter; } - if (context === void 0) { context = contextApi.active(); } - return this._getGlobalPropagator().extract(context, carrier, getter); - }; - /** Remove the global propagator */ - PropagationAPI.prototype.disable = function () { - delete global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]; - }; - PropagationAPI.prototype._getGlobalPropagator = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); - }; - return PropagationAPI; -}()); -exports.PropagationAPI = PropagationAPI; -//# sourceMappingURL=propagation.js.map /***/ }), /* 816 */, @@ -48048,8 +53030,25 @@ module.exports = v4; /***/ }), -/* 827 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 827 */, +/* 828 */, +/* 829 */, +/* 830 */, +/* 831 */, +/* 832 */, +/* 833 */, +/* 834 */, +/* 835 */ +/***/ (function(module) { + +module.exports = require("url"); + +/***/ }), +/* 836 */, +/* 837 */, +/* 838 */, +/* 839 */ +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -48068,95 +53067,10 @@ module.exports = v4; * See the License for the specific language governing permissions and * limitations under the License. */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.propagation = exports.metrics = exports.trace = exports.context = void 0; -__exportStar(__webpack_require__(362), exports); -__exportStar(__webpack_require__(109), exports); -__exportStar(__webpack_require__(331), exports); -__exportStar(__webpack_require__(177), exports); -__exportStar(__webpack_require__(484), exports); -__exportStar(__webpack_require__(439), exports); -__exportStar(__webpack_require__(168), exports); -__exportStar(__webpack_require__(493), exports); -__exportStar(__webpack_require__(890), exports); -__exportStar(__webpack_require__(237), exports); -__exportStar(__webpack_require__(949), exports); -__exportStar(__webpack_require__(272), exports); -__exportStar(__webpack_require__(993), exports); -__exportStar(__webpack_require__(982), exports); -__exportStar(__webpack_require__(984), exports); -__exportStar(__webpack_require__(119), exports); -__exportStar(__webpack_require__(169), exports); -__exportStar(__webpack_require__(563), exports); -__exportStar(__webpack_require__(391), exports); -__exportStar(__webpack_require__(673), exports); -__exportStar(__webpack_require__(445), exports); -__exportStar(__webpack_require__(100), exports); -__exportStar(__webpack_require__(340), exports); -__exportStar(__webpack_require__(980), exports); -__exportStar(__webpack_require__(222), exports); -__exportStar(__webpack_require__(225), exports); -__exportStar(__webpack_require__(868), exports); -__exportStar(__webpack_require__(741), exports); -__exportStar(__webpack_require__(374), exports); -__exportStar(__webpack_require__(246), exports); -__exportStar(__webpack_require__(871), exports); -__exportStar(__webpack_require__(883), exports); -__exportStar(__webpack_require__(457), exports); -__exportStar(__webpack_require__(917), exports); -__exportStar(__webpack_require__(726), exports); -__exportStar(__webpack_require__(889), exports); -__exportStar(__webpack_require__(618), exports); -var context_base_1 = __webpack_require__(581); -Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_base_1.Context; } }); -var context_1 = __webpack_require__(284); -/** Entrypoint for context API */ -exports.context = context_1.ContextAPI.getInstance(); -var trace_1 = __webpack_require__(586); -/** Entrypoint for trace API */ -exports.trace = trace_1.TraceAPI.getInstance(); -var metrics_1 = __webpack_require__(731); -/** Entrypoint for metrics API */ -exports.metrics = metrics_1.MetricsAPI.getInstance(); -var propagation_1 = __webpack_require__(815); -/** Entrypoint for propagation API */ -exports.propagation = propagation_1.PropagationAPI.getInstance(); -exports.default = { - trace: exports.trace, - metrics: exports.metrics, - context: exports.context, - propagation: exports.propagation, -}; -//# sourceMappingURL=index.js.map - -/***/ }), -/* 828 */, -/* 829 */, -/* 830 */, -/* 831 */, -/* 832 */, -/* 833 */, -/* 834 */, -/* 835 */ -/***/ (function(module) { - -module.exports = require("url"); +//# sourceMappingURL=TimedEvent.js.map /***/ }), -/* 836 */, -/* 837 */, -/* 838 */, -/* 839 */, /* 840 */, /* 841 */, /* 842 */ @@ -49381,7 +54295,30 @@ exports.restEndpointMethods = restEndpointMethods; /* 848 */, /* 849 */, /* 850 */, -/* 851 */, +/* 851 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=link_context.js.map + +/***/ }), /* 852 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -51610,92 +56547,23 @@ function removeHook (state, name, method) { } var index = state.registry[name] - .map(function (registered) { return registered.orig }) - .indexOf(method) - - if (index === -1) { - return - } - - state.registry[name].splice(index, 1) -} - - -/***/ }), -/* 867 */, -/* 868 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SamplingDecision = void 0; -/** - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - */ -var SamplingDecision; -(function (SamplingDecision) { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; -})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); -//# sourceMappingURL=SamplingResult.js.map + .map(function (registered) { return registered.orig }) + .indexOf(method) -/***/ }), -/* 869 */, -/* 870 */, -/* 871 */ -/***/ (function(__unusedmodule, exports) { + if (index === -1) { + return + } -"use strict"; + state.registry[name].splice(index, 1) +} -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=SpanOptions.js.map /***/ }), +/* 867 */, +/* 868 */, +/* 869 */, +/* 870 */, +/* 871 */, /* 872 */, /* 873 */, /* 874 */, @@ -51704,8 +56572,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51720,42 +56588,53 @@ Object.defineProperty(exports, "__esModule", { value: true }); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopTracerProvider_1 = __webpack_require__(162); +exports.TraceAPI = void 0; +var NoopTracerProvider_1 = __webpack_require__(162); +var global_utils_1 = __webpack_require__(976); /** * Singleton object which represents the entry point to the OpenTelemetry Tracing API */ -class TraceAPI { +var TraceAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._tracerProvider = NoopTracerProvider_1.NOOP_TRACER_PROVIDER; + function TraceAPI() { } /** Get the singleton instance of the Trace API */ - static getInstance() { + TraceAPI.getInstance = function () { if (!this._instance) { this._instance = new TraceAPI(); } return this._instance; - } + }; /** * Set the current global tracer. Returns the initialized global tracer provider */ - setGlobalTracerProvider(provider) { - this._tracerProvider = provider; - return provider; - } + TraceAPI.prototype.setGlobalTracerProvider = function (provider) { + if (global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) { + // global tracer provider has already been set + return this.getTracerProvider(); + } + global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopTracerProvider_1.NOOP_TRACER_PROVIDER); + return this.getTracerProvider(); + }; /** * Returns the global tracer provider. */ - getTracerProvider() { - return this._tracerProvider; - } + TraceAPI.prototype.getTracerProvider = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopTracerProvider_1.NOOP_TRACER_PROVIDER); + }; /** * Returns a tracer from the global tracer provider. */ - getTracer(name, version) { + TraceAPI.prototype.getTracer = function (name, version) { return this.getTracerProvider().getTracer(name, version); - } -} + }; + /** Remove the global tracer provider */ + TraceAPI.prototype.disable = function () { + delete global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]; + }; + return TraceAPI; +}()); exports.TraceAPI = TraceAPI; //# sourceMappingURL=trace.js.map @@ -51767,153 +56646,7 @@ exports.TraceAPI = TraceAPI; /* 880 */, /* 881 */, /* 882 */, -/* 883 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CanonicalCode = void 0; -/** - * An enumeration of canonical status codes. - */ -var CanonicalCode; -(function (CanonicalCode) { - /** - * Not an error; returned on success - */ - CanonicalCode[CanonicalCode["OK"] = 0] = "OK"; - /** - * The operation was cancelled (typically by the caller). - */ - CanonicalCode[CanonicalCode["CANCELLED"] = 1] = "CANCELLED"; - /** - * Unknown error. An example of where this error may be returned is - * if a status value received from another address space belongs to - * an error-space that is not known in this address space. Also - * errors raised by APIs that do not return enough error information - * may be converted to this error. - */ - CanonicalCode[CanonicalCode["UNKNOWN"] = 2] = "UNKNOWN"; - /** - * Client specified an invalid argument. Note that this differs - * from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments - * that are problematic regardless of the state of the system - * (e.g., a malformed file name). - */ - CanonicalCode[CanonicalCode["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT"; - /** - * Deadline expired before operation could complete. For operations - * that change the state of the system, this error may be returned - * even if the operation has completed successfully. For example, a - * successful response from a server could have been delayed long - * enough for the deadline to expire. - */ - CanonicalCode[CanonicalCode["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED"; - /** - * Some requested entity (e.g., file or directory) was not found. - */ - CanonicalCode[CanonicalCode["NOT_FOUND"] = 5] = "NOT_FOUND"; - /** - * Some entity that we attempted to create (e.g., file or directory) - * already exists. - */ - CanonicalCode[CanonicalCode["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS"; - /** - * The caller does not have permission to execute the specified - * operation. PERMISSION_DENIED must not be used for rejections - * caused by exhausting some resource (use RESOURCE_EXHAUSTED - * instead for those errors). PERMISSION_DENIED must not be - * used if the caller can not be identified (use UNAUTHENTICATED - * instead for those errors). - */ - CanonicalCode[CanonicalCode["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED"; - /** - * Some resource has been exhausted, perhaps a per-user quota, or - * perhaps the entire file system is out of space. - */ - CanonicalCode[CanonicalCode["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED"; - /** - * Operation was rejected because the system is not in a state - * required for the operation's execution. For example, directory - * to be deleted may be non-empty, an rmdir operation is applied to - * a non-directory, etc. - * - * A litmus test that may help a service implementor in deciding - * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - * - * - Use UNAVAILABLE if the client can retry just the failing call. - * - Use ABORTED if the client should retry at a higher-level - * (e.g., restarting a read-modify-write sequence). - * - Use FAILED_PRECONDITION if the client should not retry until - * the system state has been explicitly fixed. E.g., if an "rmdir" - * fails because the directory is non-empty, FAILED_PRECONDITION - * should be returned since the client should not retry unless - * they have first fixed up the directory by deleting files from it. - * - Use FAILED_PRECONDITION if the client performs conditional - * REST Get/Update/Delete on a resource and the resource on the - * server does not match the condition. E.g., conflicting - * read-modify-write on the same resource. - */ - CanonicalCode[CanonicalCode["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION"; - /** - * The operation was aborted, typically due to a concurrency issue - * like sequencer check failures, transaction aborts, etc. - * - * See litmus test above for deciding between FAILED_PRECONDITION, - * ABORTED, and UNAVAILABLE. - */ - CanonicalCode[CanonicalCode["ABORTED"] = 10] = "ABORTED"; - /** - * Operation was attempted past the valid range. E.g., seeking or - * reading past end of file. - * - * Unlike INVALID_ARGUMENT, this error indicates a problem that may - * be fixed if the system state changes. For example, a 32-bit file - * system will generate INVALID_ARGUMENT if asked to read at an - * offset that is not in the range [0,2^32-1], but it will generate - * OUT_OF_RANGE if asked to read from an offset past the current - * file size. - * - * There is a fair bit of overlap between FAILED_PRECONDITION and - * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific - * error) when it applies so that callers who are iterating through - * a space can easily look for an OUT_OF_RANGE error to detect when - * they are done. - */ - CanonicalCode[CanonicalCode["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE"; - /** - * Operation is not implemented or not supported/enabled in this service. - */ - CanonicalCode[CanonicalCode["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED"; - /** - * Internal errors. Means some invariants expected by underlying - * system has been broken. If you see one of these errors, - * something is very broken. - */ - CanonicalCode[CanonicalCode["INTERNAL"] = 13] = "INTERNAL"; - /** - * The service is currently unavailable. This is a most likely a - * transient condition and may be corrected by retrying with - * a backoff. - * - * See litmus test above for deciding between FAILED_PRECONDITION, - * ABORTED, and UNAVAILABLE. - */ - CanonicalCode[CanonicalCode["UNAVAILABLE"] = 14] = "UNAVAILABLE"; - /** - * Unrecoverable data loss or corruption. - */ - CanonicalCode[CanonicalCode["DATA_LOSS"] = 15] = "DATA_LOSS"; - /** - * The request does not have valid authentication credentials for the - * operation. - */ - CanonicalCode[CanonicalCode["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED"; -})(CanonicalCode = exports.CanonicalCode || (exports.CanonicalCode = {})); -//# sourceMappingURL=status.js.map - -/***/ }), +/* 883 */, /* 884 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -52416,794 +57149,566 @@ var CanonicalCode; /***/ }), /* 886 */, -/* 887 */, -/* 888 */, -/* 889 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer_provider.js.map - -/***/ }), -/* 890 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=BatchObserverResult.js.map - -/***/ }), -/* 891 */, -/* 892 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -var iterate = __webpack_require__(157) - , initState = __webpack_require__(903) - , terminator = __webpack_require__(939) - ; - -// Public API -module.exports = serialOrdered; -// sorting helpers -module.exports.ascending = ascending; -module.exports.descending = descending; - -/** - * Runs iterator over provided sorted array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} sortMethod - custom sort function - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serialOrdered(list, iterator, sortMethod, callback) -{ - var state = initState(list, sortMethod); - - iterate(list, iterator, state, function iteratorHandler(error, result) - { - if (error) - { - callback(error, result); - return; - } - - state.index++; - - // are we there yet? - if (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, iteratorHandler); - return; - } - - // done here - callback(null, state.results); - }); - - return terminator.bind(state, callback); -} - -/* - * -- Sort methods - */ - -/** - * sort helper to sort array elements in ascending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function ascending(a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} - -/** - * sort helper to sort array elements in descending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function descending(a, b) -{ - return -1 * ascending(a, b); -} - - -/***/ }), -/* 893 */, -/* 894 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, '__esModule', { value: true }); - -var api = __webpack_require__(827); -var tslib = __webpack_require__(865); - -// Copyright (c) Microsoft Corporation. -/** - * A no-op implementation of Span that can safely be used without side-effects. - */ -var NoOpSpan = /** @class */ (function () { - function NoOpSpan() { - } - /** - * Returns the SpanContext associated with this Span. - */ - NoOpSpan.prototype.context = function () { - return { - spanId: "", - traceId: "", - traceFlags: api.TraceFlags.NONE - }; - }; - /** - * Marks the end of Span execution. - * @param _endTime The time to use as the Span's end time. Defaults to - * the current time. - */ - NoOpSpan.prototype.end = function (_endTime) { - /* Noop */ - }; - /** - * Sets an attribute on the Span - * @param _key the attribute key - * @param _value the attribute value - */ - NoOpSpan.prototype.setAttribute = function (_key, _value) { - return this; - }; - /** - * Sets attributes on the Span - * @param _attributes the attributes to add - */ - NoOpSpan.prototype.setAttributes = function (_attributes) { - return this; - }; - /** - * Adds an event to the Span - * @param _name The name of the event - * @param _attributes The associated attributes to add for this event - */ - NoOpSpan.prototype.addEvent = function (_name, _attributes) { - return this; - }; - /** - * Sets a status on the span. Overrides the default of CanonicalCode.OK. - * @param _status The status to set. - */ - NoOpSpan.prototype.setStatus = function (_status) { - return this; - }; - /** - * Updates the name of the Span - * @param _name the new Span name - */ - NoOpSpan.prototype.updateName = function (_name) { - return this; - }; - /** - * Returns whether this span will be recorded - */ - NoOpSpan.prototype.isRecording = function () { - return false; - }; - return NoOpSpan; -}()); - -// Copyright (c) Microsoft Corporation. -/** - * A no-op implementation of Tracer that can be used when tracing - * is disabled. - */ -var NoOpTracer = /** @class */ (function () { - function NoOpTracer() { - } - /** - * Starts a new Span. - * @param _name The name of the span. - * @param _options The SpanOptions used during Span creation. - */ - NoOpTracer.prototype.startSpan = function (_name, _options) { - return new NoOpSpan(); - }; - /** - * Returns the current Span from the current context, if available. - */ - NoOpTracer.prototype.getCurrentSpan = function () { - return new NoOpSpan(); - }; - /** - * Executes the given function within the context provided by a Span. - * @param _span The span that provides the context. - * @param fn The function to be executed. - */ - NoOpTracer.prototype.withSpan = function (_span, fn) { - return fn(); - }; - /** - * Bind a Span as the target's scope - * @param target An object to bind the scope. - * @param _span A specific Span to use. Otherwise, use the current one. - */ - NoOpTracer.prototype.bind = function (target, _span) { - return target; - }; - return NoOpTracer; -}()); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -function getGlobalObject() { - return global; -} - -// Copyright (c) Microsoft Corporation. -// V1 = OpenTelemetry 0.1 -// V2 = OpenTelemetry 0.2 -// V3 = OpenTelemetry 0.6.1 -var GLOBAL_TRACER_VERSION = 3; -// preview5 shipped with @azure/core-tracing.tracerCache -// and didn't have smart detection for collisions -var GLOBAL_TRACER_SYMBOL = Symbol.for("@azure/core-tracing.tracerCache2"); -var cache; -function loadTracerCache() { - var globalObj = getGlobalObject(); - var existingCache = globalObj[GLOBAL_TRACER_SYMBOL]; - var setGlobalCache = true; - if (existingCache) { - if (existingCache.version === GLOBAL_TRACER_VERSION) { - cache = existingCache; - } - else { - setGlobalCache = false; - if (existingCache.tracer) { - throw new Error("Two incompatible versions of @azure/core-tracing have been loaded.\n This library is " + GLOBAL_TRACER_VERSION + ", existing is " + existingCache.version + "."); - } - } - } - if (!cache) { - cache = { - tracer: undefined, - version: GLOBAL_TRACER_VERSION - }; - } - if (setGlobalCache) { - globalObj[GLOBAL_TRACER_SYMBOL] = cache; - } -} -function getCache() { - if (!cache) { - loadTracerCache(); - } - return cache; -} +/* 887 */, +/* 888 */, +/* 889 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { -// Copyright (c) Microsoft Corporation. -var defaultTracer; -function getDefaultTracer() { - if (!defaultTracer) { - defaultTracer = new NoOpTracer(); - } - return defaultTracer; -} -/** - * Sets the global tracer, enabling tracing for the Azure SDK. - * @param tracer An OpenTelemetry Tracer instance. - */ -function setTracer(tracer) { - var cache = getCache(); - cache.tracer = tracer; -} -/** - * Retrieves the active tracer, or returns a - * no-op implementation if one is not set. +"use strict"; +/*! + * Copyright (c) Microsoft and contributors. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Azure Core LRO SDK for JavaScript - 1.0.2 */ -function getTracer() { - var cache = getCache(); - if (!cache.tracer) { - return getDefaultTracer(); - } - return cache.tracer; -} + + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = __webpack_require__(422); // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. /** - * @ignore - * @internal + * When a poller is manually stopped through the `stopPolling` method, + * the poller will be rejected with an instance of the PollerStoppedError. */ -var OpenCensusTraceStateWrapper = /** @class */ (function () { - function OpenCensusTraceStateWrapper(state) { - this._state = state; +var PollerStoppedError = /** @class */ (function (_super) { + tslib.__extends(PollerStoppedError, _super); + function PollerStoppedError(message) { + var _this = _super.call(this, message) || this; + _this.name = "PollerStoppedError"; + Object.setPrototypeOf(_this, PollerStoppedError.prototype); + return _this; } - OpenCensusTraceStateWrapper.prototype.get = function (_key) { - throw new Error("Method not implemented."); - }; - OpenCensusTraceStateWrapper.prototype.set = function (_key, _value) { - throw new Error("Method not implemented."); - }; - OpenCensusTraceStateWrapper.prototype.unset = function (_key) { - throw new Error("Method not implemented"); - }; - OpenCensusTraceStateWrapper.prototype.serialize = function () { - return this._state || ""; - }; - return OpenCensusTraceStateWrapper; -}()); - -// Copyright (c) Microsoft Corporation. -function isWrappedSpan(span) { - return !!span && span.getWrappedSpan !== undefined; -} -function isTracer(tracerOrSpan) { - return tracerOrSpan.getWrappedTracer !== undefined; -} + return PollerStoppedError; +}(Error)); /** - * An implementation of OpenTelemetry Span that wraps an OpenCensus Span. + * When a poller is cancelled through the `cancelOperation` method, + * the poller will be rejected with an instance of the PollerCancelledError. */ -var OpenCensusSpanWrapper = /** @class */ (function () { - function OpenCensusSpanWrapper(tracerOrSpan, name, options) { - if (name === void 0) { name = ""; } - if (options === void 0) { options = {}; } - if (isTracer(tracerOrSpan)) { - var parent = isWrappedSpan(options.parent) ? options.parent.getWrappedSpan() : undefined; - this._span = tracerOrSpan.getWrappedTracer().startChildSpan({ - name: name, - childOf: parent - }); - this._span.start(); - if (options.links) { - for (var _i = 0, _a = options.links; _i < _a.length; _i++) { - var link = _a[_i]; - // Since there is no way to set the link relationship, leave it as Unspecified. - this._span.addLink(link.context.traceId, link.context.spanId, 0 /* LinkType.UNSPECIFIED */, link.attributes); - } - } - } - else { - this._span = tracerOrSpan; - } +var PollerCancelledError = /** @class */ (function (_super) { + tslib.__extends(PollerCancelledError, _super); + function PollerCancelledError(message) { + var _this = _super.call(this, message) || this; + _this.name = "PollerCancelledError"; + Object.setPrototypeOf(_this, PollerCancelledError.prototype); + return _this; } - /** - * The underlying OpenCensus Span - */ - OpenCensusSpanWrapper.prototype.getWrappedSpan = function () { - return this._span; - }; - /** - * Marks the end of Span execution. - * @param endTime The time to use as the Span's end time. Defaults to - * the current time. - */ - OpenCensusSpanWrapper.prototype.end = function (_endTime) { - this._span.end(); - }; - /** - * Returns the SpanContext associated with this Span. - */ - OpenCensusSpanWrapper.prototype.context = function () { - var openCensusSpanContext = this._span.spanContext; - return { - spanId: openCensusSpanContext.spanId, - traceId: openCensusSpanContext.traceId, - traceFlags: openCensusSpanContext.options, - traceState: new OpenCensusTraceStateWrapper(openCensusSpanContext.traceState) - }; - }; - /** - * Sets an attribute on the Span - * @param key the attribute key - * @param value the attribute value - */ - OpenCensusSpanWrapper.prototype.setAttribute = function (key, value) { - this._span.addAttribute(key, value); - return this; - }; - /** - * Sets attributes on the Span - * @param attributes the attributes to add - */ - OpenCensusSpanWrapper.prototype.setAttributes = function (attributes) { - this._span.attributes = attributes; - return this; - }; - /** - * Adds an event to the Span - * @param name The name of the event - * @param attributes The associated attributes to add for this event - */ - OpenCensusSpanWrapper.prototype.addEvent = function (_name, _attributes) { - throw new Error("Method not implemented."); - }; - /** - * Sets a status on the span. Overrides the default of CanonicalCode.OK. - * @param status The status to set. - */ - OpenCensusSpanWrapper.prototype.setStatus = function (status) { - this._span.setStatus(status.code, status.message); - return this; - }; - /** - * Updates the name of the Span - * @param name the new Span name - */ - OpenCensusSpanWrapper.prototype.updateName = function (name) { - this._span.name = name; - return this; - }; - /** - * Returns whether this span will be recorded - */ - OpenCensusSpanWrapper.prototype.isRecording = function () { - // NoRecordSpans have an empty traceId - return !!this._span.traceId; - }; - return OpenCensusSpanWrapper; -}()); - -// Copyright (c) Microsoft Corporation. + return PollerCancelledError; +}(Error)); /** - * An implementation of OpenTelemetry Tracer that wraps an OpenCensus Tracer. + * A class that represents the definition of a program that polls through consecutive requests + * until it reaches a state of completion. + * + * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. + * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. + * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. + * + * ```ts + * const poller = new MyPoller(); + * + * // Polling just once: + * await poller.poll(); + * + * // We can try to cancel the request here, by calling: + * // + * // await poller.cancelOperation(); + * // + * + * // Getting the final result: + * const result = await poller.pollUntilDone(); + * ``` + * + * The Poller is defined by two types, a type representing the state of the poller, which + * must include a basic set of properties from `PollOperationState`, + * and a return type defined by `TResult`, which can be anything. + * + * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having + * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. + * + * ```ts + * class Client { + * public async makePoller: PollerLike { + * const poller = new MyPoller({}); + * // It might be preferred to return the poller after the first request is made, + * // so that some information can be obtained right away. + * await poller.poll(); + * return poller; + * } + * } + * + * const poller: PollerLike = myClient.makePoller(); + * ``` + * + * A poller can be created through its constructor, then it can be polled until it's completed. + * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. + * At any point in time, the intermediate forms of the result type can be requested without delay. + * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. + * + * ```ts + * const poller = myClient.makePoller(); + * const state: MyOperationState = poller.getOperationState(); + * + * // The intermediate result can be obtained at any time. + * const result: MyResult | undefined = poller.getResult(); + * + * // The final result can only be obtained after the poller finishes. + * const result: MyResult = await poller.pollUntilDone(); + * ``` + * */ -var OpenCensusTracerWrapper = /** @class */ (function () { +var Poller = /** @class */ (function () { /** - * Create a new wrapper around a given OpenCensus Tracer. - * @param tracer The OpenCensus Tracer to wrap. + * A poller needs to be initialized by passing in at least the basic properties of the PollOperation. + * + * When writing an implementation of a Poller, this implementation needs to deal with the initialization + * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's + * operation has already been defined, at least its basic properties. The code below shows how to approach + * the definition of the constructor of a new custom poller. + * + * ```ts + * export class MyPoller extends Poller { + * constructor({ + * // Anything you might need outside of the basics + * }) { + * let state: MyOperationState = { + * privateProperty: private, + * publicProperty: public, + * }; + * + * const operation = { + * state, + * update, + * cancel, + * toString + * } + * + * // Sending the operation to the parent's constructor. + * super(operation); + * + * // You can assign more local properties here. + * } + * } + * ``` + * + * Inside of this constructor, a new promise is created. This will be used to + * tell the user when the poller finishes (see `pollUntilDone()`). The promise's + * resolve and reject methods are also used internally to control when to resolve + * or reject anyone waiting for the poller to finish. + * + * The constructor of a custom implementation of a poller is where any serialized version of + * a previous poller's operation should be deserialized into the operation sent to the + * base constructor. For example: + * + * ```ts + * export class MyPoller extends Poller { + * constructor( + * baseOperation: string | undefined + * ) { + * let state: MyOperationState = {}; + * if (baseOperation) { + * state = { + * ...JSON.parse(baseOperation).state, + * ...state + * }; + * } + * const operation = { + * state, + * // ... + * } + * super(operation); + * } + * } + * ``` + * + * @param operation Must contain the basic properties of PollOperation. */ - function OpenCensusTracerWrapper(tracer) { - this._tracer = tracer; + function Poller(operation) { + var _this = this; + this.stopped = true; + this.pollProgressCallbacks = []; + this.operation = operation; + this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. + // The above warning would get thrown if `poller.poll` is called, it returns an error, + // and pullUntilDone did not have a .catch or await try/catch on it's return value. + this.promise.catch(function () { }); } /** - * The wrapped OpenCensus Tracer - */ - OpenCensusTracerWrapper.prototype.getWrappedTracer = function () { - return this._tracer; - }; - /** - * Starts a new Span. - * @param name The name of the span. - * @param options The SpanOptions used during Span creation. - */ - OpenCensusTracerWrapper.prototype.startSpan = function (name, options) { - return new OpenCensusSpanWrapper(this, name, options); - }; - /** - * Returns the current Span from the current context, if available. - */ - OpenCensusTracerWrapper.prototype.getCurrentSpan = function () { - return undefined; - }; - /** - * Executes the given function within the context provided by a Span. - * @param _span The span that provides the context. - * @param _fn The function to be executed. + * @internal + * @ignore + * Starts a loop that will break only if the poller is done + * or if the poller is stopped. */ - OpenCensusTracerWrapper.prototype.withSpan = function (_span, _fn) { - throw new Error("Method not implemented."); + Poller.prototype.startPolling = function () { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (this.stopped) { + this.stopped = false; + } + _a.label = 1; + case 1: + if (!(!this.isStopped() && !this.isDone())) return [3 /*break*/, 4]; + return [4 /*yield*/, this.poll()]; + case 2: + _a.sent(); + return [4 /*yield*/, this.delay()]; + case 3: + _a.sent(); + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + }); }; /** - * Bind a Span as the target's scope - * @param target An object to bind the scope. - * @param _span A specific Span to use. Otherwise, use the current one. + * @internal + * @ignore + * pollOnce does one polling, by calling to the update method of the underlying + * poll operation to make any relevant change effective. + * + * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. + * + * @param options Optional properties passed to the operation's update method. */ - OpenCensusTracerWrapper.prototype.bind = function (_target, _span) { - throw new Error("Method not implemented."); + Poller.prototype.pollOnce = function (options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var state, _a, e_1; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + state = this.operation.state; + _b.label = 1; + case 1: + _b.trys.push([1, 4, , 5]); + if (!!this.isDone()) return [3 /*break*/, 3]; + _a = this; + return [4 /*yield*/, this.operation.update({ + abortSignal: options.abortSignal, + fireProgress: this.fireProgress.bind(this) + })]; + case 2: + _a.operation = _b.sent(); + if (this.isDone() && this.resolve) { + this.resolve(state.result); + } + _b.label = 3; + case 3: return [3 /*break*/, 5]; + case 4: + e_1 = _b.sent(); + state.error = e_1; + if (this.reject) { + this.reject(e_1); + } + throw e_1; + case 5: return [2 /*return*/]; + } + }); + }); }; - return OpenCensusTracerWrapper; -}()); - -// Copyright (c) Microsoft Corporation. -/** - * A mock span useful for testing. - */ -var TestSpan = /** @class */ (function (_super) { - tslib.__extends(TestSpan, _super); - /** - * Starts a new Span. - * @param parentTracer The tracer that created this Span - * @param name The name of the span. - * @param context The SpanContext this span belongs to - * @param kind The SpanKind of this Span - * @param parentSpanId The identifier of the parent Span - * @param startTime The startTime of the event (defaults to now) - */ - function TestSpan(parentTracer, name, context, kind, parentSpanId, startTime) { - if (startTime === void 0) { startTime = Date.now(); } - var _this = _super.call(this) || this; - _this._tracer = parentTracer; - _this.name = name; - _this.kind = kind; - _this.startTime = startTime; - _this.parentSpanId = parentSpanId; - _this.status = { - code: api.CanonicalCode.OK - }; - _this.endCalled = false; - _this._context = context; - _this.attributes = {}; - return _this; - } /** - * Returns the Tracer that created this Span + * @internal + * @ignore + * fireProgress calls the functions passed in via onProgress the method of the poller. + * + * It loops over all of the callbacks received from onProgress, and executes them, sending them + * the current operation state. + * + * @param state The current operation state. */ - TestSpan.prototype.tracer = function () { - return this._tracer; + Poller.prototype.fireProgress = function (state) { + for (var _i = 0, _a = this.pollProgressCallbacks; _i < _a.length; _i++) { + var callback = _a[_i]; + callback(state); + } }; /** - * Returns the SpanContext associated with this Span. + * @internal + * @ignore + * Invokes the underlying operation's cancel method, and rejects the + * pollUntilDone promise. */ - TestSpan.prototype.context = function () { - return this._context; + Poller.prototype.cancelOnce = function (options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = this; + return [4 /*yield*/, this.operation.cancel(options)]; + case 1: + _a.operation = _b.sent(); + if (this.reject) { + this.reject(new PollerCancelledError("Poller cancelled")); + } + return [2 /*return*/]; + } + }); + }); }; /** - * Marks the end of Span execution. - * @param _endTime The time to use as the Span's end time. Defaults to - * the current time. + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + * + * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. + * + * @param options Optional properties passed to the operation's update method. */ - TestSpan.prototype.end = function (_endTime) { - this.endCalled = true; + Poller.prototype.poll = function (options) { + var _this = this; + if (options === void 0) { options = {}; } + if (!this.pollOncePromise) { + this.pollOncePromise = this.pollOnce(options); + var clearPollOncePromise = function () { + _this.pollOncePromise = undefined; + }; + this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise); + } + return this.pollOncePromise; }; /** - * Sets a status on the span. Overrides the default of CanonicalCode.OK. - * @param status The status to set. + * Returns a promise that will resolve once the underlying operation is completed. */ - TestSpan.prototype.setStatus = function (status) { - this.status = status; - return this; + Poller.prototype.pollUntilDone = function () { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + if (this.stopped) { + this.startPolling().catch(this.reject); + } + return [2 /*return*/, this.promise]; + }); + }); }; /** - * Returns whether this span will be recorded + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. */ - TestSpan.prototype.isRecording = function () { - return true; + Poller.prototype.onProgress = function (callback) { + var _this = this; + this.pollProgressCallbacks.push(callback); + return function () { + _this.pollProgressCallbacks = _this.pollProgressCallbacks.filter(function (c) { return c !== callback; }); + }; }; /** - * Sets an attribute on the Span - * @param key the attribute key - * @param value the attribute value + * Returns true if the poller has finished polling. */ - TestSpan.prototype.setAttribute = function (key, value) { - this.attributes[key] = value; - return this; + Poller.prototype.isDone = function () { + var state = this.operation.state; + return Boolean(state.isCompleted || state.isCancelled || state.error); }; /** - * Sets attributes on the Span - * @param attributes the attributes to add + * Stops the poller from continuing to poll. */ - TestSpan.prototype.setAttributes = function (attributes) { - for (var _i = 0, _a = Object.keys(attributes); _i < _a.length; _i++) { - var key = _a[_i]; - this.attributes[key] = attributes[key]; + Poller.prototype.stopPolling = function () { + if (!this.stopped) { + this.stopped = true; + if (this.reject) { + this.reject(new PollerStoppedError("This poller is already stopped")); + } } - return this; - }; - return TestSpan; -}(NoOpSpan)); - -// Copyright (c) Microsoft Corporation. -/** - * A mock tracer useful for testing - */ -var TestTracer = /** @class */ (function (_super) { - tslib.__extends(TestTracer, _super); - function TestTracer() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.traceIdCounter = 0; - _this.spanIdCounter = 0; - _this.rootSpans = []; - _this.knownSpans = []; - return _this; - } - TestTracer.prototype.getNextTraceId = function () { - this.traceIdCounter++; - return String(this.traceIdCounter); - }; - TestTracer.prototype.getNextSpanId = function () { - this.spanIdCounter++; - return String(this.spanIdCounter); }; /** - * Returns all Spans that were created without a parent + * Returns true if the poller is stopped. */ - TestTracer.prototype.getRootSpans = function () { - return this.rootSpans; + Poller.prototype.isStopped = function () { + return this.stopped; }; /** - * Returns all Spans this Tracer knows about + * Attempts to cancel the underlying operation. + * + * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. + * + * If it's called again before it finishes, it will throw an error. + * + * @param options Optional properties passed to the operation's update method. */ - TestTracer.prototype.getKnownSpans = function () { - return this.knownSpans; + Poller.prototype.cancelOperation = function (options) { + if (options === void 0) { options = {}; } + if (!this.stopped) { + this.stopped = true; + } + if (!this.cancelPromise) { + this.cancelPromise = this.cancelOnce(options); + } + else if (options.abortSignal) { + throw new Error("A cancel request is currently pending"); + } + return this.cancelPromise; }; /** - * Returns all Spans where end() has not been called + * Returns the state of the operation. + * + * Even though TState will be the same type inside any of the methods of any extension of the Poller class, + * implementations of the pollers can customize what's shared with the public by writing their own + * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller + * and a public type representing a safe to share subset of the properties of the internal state. + * Their definition of getOperationState can then return their public type. + * + * Example: + * + * ```ts + * // Let's say we have our poller's operation state defined as: + * interface MyOperationState extends PollOperationState { + * privateProperty?: string; + * publicProperty?: string; + * } + * + * // To allow us to have a true separation of public and private state, we have to define another interface: + * interface PublicState extends PollOperationState { + * publicProperty?: string; + * } + * + * // Then, we define our Poller as follows: + * export class MyPoller extends Poller { + * // ... More content is needed here ... + * + * public getOperationState(): PublicState { + * const state: PublicState = this.operation.state; + * return { + * // Properties from PollOperationState + * isStarted: state.isStarted, + * isCompleted: state.isCompleted, + * isCancelled: state.isCancelled, + * error: state.error, + * result: state.result, + * + * // The only other property needed by PublicState. + * publicProperty: state.publicProperty + * } + * } + * } + * ``` + * + * You can see this in the tests of this repository, go to the file: + * `../test/utils/testPoller.ts` + * and look for the getOperationState implementation. */ - TestTracer.prototype.getActiveSpans = function () { - return this.knownSpans.filter(function (span) { - return !span.endCalled; - }); + Poller.prototype.getOperationState = function () { + return this.operation.state; }; /** - * Return all Spans for a particular trace, grouped by their - * parent Span in a tree-like structure - * @param traceId The traceId to return the graph for + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. */ - TestTracer.prototype.getSpanGraph = function (traceId) { - var traceSpans = this.knownSpans.filter(function (span) { - return span.context().traceId === traceId; - }); - var roots = []; - var nodeMap = new Map(); - for (var _i = 0, traceSpans_1 = traceSpans; _i < traceSpans_1.length; _i++) { - var span = traceSpans_1[_i]; - var spanId = span.context().spanId; - var node = { - name: span.name, - children: [] - }; - nodeMap.set(spanId, node); - if (span.parentSpanId) { - var parent = nodeMap.get(span.parentSpanId); - if (!parent) { - throw new Error("Span with name " + node.name + " has an unknown parentSpan with id " + span.parentSpanId); - } - parent.children.push(node); - } - else { - roots.push(node); - } - } - return { - roots: roots - }; + Poller.prototype.getResult = function () { + var state = this.operation.state; + return state.result; }; /** - * Starts a new Span. - * @param name The name of the span. - * @param options The SpanOptions used during Span creation. + * Returns a serialized version of the poller's operation + * by invoking the operation's toString method. */ - TestTracer.prototype.startSpan = function (name, options) { - if (options === void 0) { options = {}; } - var parentContext = this._getParentContext(options); - var traceId; - var isRootSpan = false; - if (parentContext && parentContext.traceId) { - traceId = parentContext.traceId; - } - else { - traceId = this.getNextTraceId(); - isRootSpan = true; - } - var context = { - traceId: traceId, - spanId: this.getNextSpanId(), - traceFlags: api.TraceFlags.NONE - }; - var span = new TestSpan(this, name, context, options.kind || api.SpanKind.INTERNAL, parentContext ? parentContext.spanId : undefined, options.startTime); - this.knownSpans.push(span); - if (isRootSpan) { - this.rootSpans.push(span); - } - return span; - }; - TestTracer.prototype._getParentContext = function (options) { - var parent = options.parent; - var result; - if (parent) { - if ("traceId" in parent) { - result = parent; - } - else { - result = parent.context(); - } - } - return result; + Poller.prototype.toString = function () { + return this.operation.toString(); }; - return TestTracer; -}(NoOpTracer)); + return Poller; +}()); + +exports.Poller = Poller; +exports.PollerCancelledError = PollerCancelledError; +exports.PollerStoppedError = PollerStoppedError; +//# sourceMappingURL=index.js.map + + +/***/ }), +/* 890 */, +/* 891 */, +/* 892 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +var iterate = __webpack_require__(157) + , initState = __webpack_require__(903) + , terminator = __webpack_require__(939) + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -var VERSION = "00"; /** - * Generates a `SpanContext` given a `traceparent` header value. - * @param traceParent Serialized span context data as a `traceparent` header value. - * @returns The `SpanContext` generated from the `traceparent` value. + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator */ -function extractSpanContextFromTraceParentHeader(traceParentHeader) { - var parts = traceParentHeader.split("-"); - if (parts.length !== 4) { - return; +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; } - var version = parts[0], traceId = parts[1], spanId = parts[2], traceOptions = parts[3]; - if (version !== VERSION) { - return; + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; } - var traceFlags = parseInt(traceOptions, 16); - var spanContext = { - spanId: spanId, - traceId: traceId, - traceFlags: traceFlags - }; - return spanContext; + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); } + +/* + * -- Sort methods + */ + /** - * Generates a `traceparent` value given a span context. - * @param spanContext Contains context for a specific span. - * @returns The `spanContext` represented as a `traceparent` value. + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result */ -function getTraceParentHeader(spanContext) { - var missingFields = []; - if (!spanContext.traceId) { - missingFields.push("traceId"); - } - if (!spanContext.spanId) { - missingFields.push("spanId"); - } - if (missingFields.length) { - return; - } - var flags = spanContext.traceFlags || 0 /* NONE */; - var hexFlags = flags.toString(16); - var traceFlags = hexFlags.length === 1 ? "0" + hexFlags : hexFlags; - // https://www.w3.org/TR/trace-context/#traceparent-header-field-values - return VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-" + traceFlags; +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; } -exports.NoOpSpan = NoOpSpan; -exports.NoOpTracer = NoOpTracer; -exports.OpenCensusSpanWrapper = OpenCensusSpanWrapper; -exports.OpenCensusTracerWrapper = OpenCensusTracerWrapper; -exports.TestSpan = TestSpan; -exports.TestTracer = TestTracer; -exports.extractSpanContextFromTraceParentHeader = extractSpanContextFromTraceParentHeader; -exports.getTraceParentHeader = getTraceParentHeader; -exports.getTracer = getTracer; -exports.setTracer = setTracer; -//# sourceMappingURL=index.js.map +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} /***/ }), +/* 893 */, +/* 894 */, /* 895 */, /* 896 */ /***/ (function(module) { @@ -53350,7 +57855,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const http_client_1 = __webpack_require__(539); +const http_client_1 = __webpack_require__(22); +const constants_1 = __webpack_require__(931); function isSuccessStatusCode(statusCode) { if (!statusCode) { return false; @@ -53377,47 +57883,74 @@ function isRetryableStatusCode(statusCode) { return retryableStatusCodes.includes(statusCode); } exports.isRetryableStatusCode = isRetryableStatusCode; -function retry(name, method, getStatusCode, maxAttempts = 2) { +function sleep(milliseconds) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(resolve => setTimeout(resolve, milliseconds)); + }); +} +function retry(name, method, getStatusCode, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay, onError = undefined) { return __awaiter(this, void 0, void 0, function* () { - let response = undefined; - let statusCode = undefined; - let isRetryable = false; let errorMessage = ''; let attempt = 1; while (attempt <= maxAttempts) { + let response = undefined; + let statusCode = undefined; + let isRetryable = false; try { response = yield method(); + } + catch (error) { + if (onError) { + response = onError(error); + } + isRetryable = true; + errorMessage = error.message; + } + if (response) { statusCode = getStatusCode(response); if (!isServerErrorStatusCode(statusCode)) { return response; } + } + if (statusCode) { isRetryable = isRetryableStatusCode(statusCode); errorMessage = `Cache service responded with ${statusCode}`; } - catch (error) { - isRetryable = true; - errorMessage = error.message; - } core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); if (!isRetryable) { core.debug(`${name} - Error is not retryable`); break; } + yield sleep(delay); attempt++; } throw Error(`${name} failed: ${errorMessage}`); }); } exports.retry = retry; -function retryTypedResponse(name, method, maxAttempts = 2) { +function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { return __awaiter(this, void 0, void 0, function* () { - return yield retry(name, method, (response) => response.statusCode, maxAttempts); + return yield retry(name, method, (response) => response.statusCode, maxAttempts, delay, + // If the error object contains the statusCode property, extract it and return + // an ITypedResponse so it can be processed by the retry logic. + (error) => { + if (error instanceof http_client_1.HttpClientError) { + return { + statusCode: error.statusCode, + result: null, + headers: {} + }; + } + else { + return undefined; + } + }); }); } exports.retryTypedResponse = retryTypedResponse; -function retryHttpClientResponse(name, method, maxAttempts = 2) { +function retryHttpClientResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { return __awaiter(this, void 0, void 0, function* () { - return yield retry(name, method, (response) => response.message.statusCode, maxAttempts); + return yield retry(name, method, (response) => response.message.statusCode, maxAttempts, delay); }); } exports.retryHttpClientResponse = retryHttpClientResponse; @@ -53472,7 +58005,15 @@ function state(list, sortMethod) /***/ }), /* 904 */, /* 905 */, -/* 906 */, +/* 906 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=attributes.js.map + +/***/ }), /* 907 */, /* 908 */, /* 909 */ @@ -53486,20 +58027,11 @@ run_1.postRun(); /***/ }), -/* 910 */, -/* 911 */, -/* 912 */, -/* 913 */, -/* 914 */, -/* 915 */, -/* 916 */, -/* 917 */ -/***/ (function(__unusedmodule, exports) { +/* 910 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceFlags = void 0; /* * Copyright The OpenTelemetry Authors * @@ -53515,16 +58047,28 @@ exports.TraceFlags = void 0; * See the License for the specific language governing permissions and * limitations under the License. */ -var TraceFlags; -(function (TraceFlags) { - /** Represents no flag set. */ - TraceFlags[TraceFlags["NONE"] = 0] = "NONE"; - /** Bit to represent whether trace is sampled in trace flags. */ - TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED"; -})(TraceFlags = exports.TraceFlags || (exports.TraceFlags = {})); -//# sourceMappingURL=trace_flags.js.map +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(764), exports); +//# sourceMappingURL=index.js.map /***/ }), +/* 911 */, +/* 912 */, +/* 913 */, +/* 914 */, +/* 915 */, +/* 916 */, +/* 917 */, /* 918 */, /* 919 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -53576,17 +58120,27 @@ var TraceFlags; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const assert = __webpack_require__(357); -const os = __webpack_require__(87); -const path = __webpack_require__(622); -const pathHelper = __webpack_require__(972); +const os = __importStar(__webpack_require__(87)); +const path = __importStar(__webpack_require__(622)); +const pathHelper = __importStar(__webpack_require__(972)); +const assert_1 = __importDefault(__webpack_require__(357)); const minimatch_1 = __webpack_require__(93); const internal_match_kind_1 = __webpack_require__(327); const internal_path_1 = __webpack_require__(383); const IS_WINDOWS = process.platform === 'win32'; class Pattern { - constructor(patternOrNegate, segments) { + constructor(patternOrNegate, segments, homedir) { /** * Indicates whether matches should be excluded from the result set */ @@ -53600,9 +58154,9 @@ class Pattern { else { // Convert to pattern segments = segments || []; - assert(segments.length, `Parameter 'segments' must not empty`); + assert_1.default(segments.length, `Parameter 'segments' must not empty`); const root = Pattern.getLiteral(segments[0]); - assert(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); + assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); pattern = new internal_path_1.Path(segments).toString().trim(); if (patternOrNegate) { pattern = `!${pattern}`; @@ -53614,7 +58168,7 @@ class Pattern { pattern = pattern.substr(1).trim(); } // Normalize slashes and ensures absolute root - pattern = Pattern.fixupPattern(pattern); + pattern = Pattern.fixupPattern(pattern, homedir); // Segments this.segments = new internal_path_1.Path(pattern).segments; // Trailing slash indicates the pattern should only match directories, not regular files @@ -53651,11 +58205,11 @@ class Pattern { // Normalize slashes itemPath = pathHelper.normalizeSeparators(itemPath); // Append a trailing slash. Otherwise Minimatch will not match the directory immediately - // preceeding the globstar. For example, given the pattern `/foo/**`, Minimatch returns + // preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns // false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk. if (!itemPath.endsWith(path.sep)) { // Note, this is safe because the constructor ensures the pattern has an absolute root. - // For example, formats like C: and C:foo on Windows are resolved to an aboslute root. + // For example, formats like C: and C:foo on Windows are resolved to an absolute root. itemPath = `${itemPath}${path.sep}`; } } @@ -53693,15 +58247,15 @@ class Pattern { /** * Normalizes slashes and ensures absolute root */ - static fixupPattern(pattern) { + static fixupPattern(pattern, homedir) { // Empty - assert(pattern, 'pattern cannot be empty'); + assert_1.default(pattern, 'pattern cannot be empty'); // Must not contain `.` segment, unless first segment // Must not contain `..` segment const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); - assert(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); + assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r - assert(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); + assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); // Normalize slashes pattern = pathHelper.normalizeSeparators(pattern); // Replace leading `.` segment @@ -53710,9 +58264,9 @@ class Pattern { } // Replace leading `~` segment else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { - const homedir = os.homedir(); - assert(homedir, 'Unable to determine HOME directory'); - assert(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); + homedir = homedir || os.homedir(); + assert_1.default(homedir, 'Unable to determine HOME directory'); + assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); pattern = Pattern.globEscape(homedir) + pattern.substr(1); } // Replace relative drive root, e.g. pattern is C: or C:foo @@ -53808,7 +58362,53 @@ exports.Pattern = Pattern; //# sourceMappingURL=internal-pattern.js.map /***/ }), -/* 924 */, +/* 924 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NoopContextManager = void 0; +var context_1 = __webpack_require__(715); +var NoopContextManager = /** @class */ (function () { + function NoopContextManager() { + } + NoopContextManager.prototype.active = function () { + return context_1.Context.ROOT_CONTEXT; + }; + NoopContextManager.prototype.with = function (context, fn) { + return fn(); + }; + NoopContextManager.prototype.bind = function (target, context) { + return target; + }; + NoopContextManager.prototype.enable = function () { + return this; + }; + NoopContextManager.prototype.disable = function () { + return this; + }; + return NoopContextManager; +}()); +exports.NoopContextManager = NoopContextManager; +//# sourceMappingURL=NoopContextManager.js.map + +/***/ }), /* 925 */, /* 926 */, /* 927 */, @@ -54133,6 +58733,10 @@ var CompressionMethod; CompressionMethod["ZstdWithoutLong"] = "zstd-without-long"; CompressionMethod["Zstd"] = "zstd"; })(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {})); +// The default number of retry attempts. +exports.DefaultRetryAttempts = 2; +// The default delay in milliseconds between retry attempts. +exports.DefaultRetryDelay = 5000; // Socket timeout in milliseconds during download. If no traffic is received // over the socket during this period, the socket is destroyed and the download // is aborted. @@ -54145,22 +58749,8 @@ exports.SocketTimeout = 5000; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.CanonicalCode = void 0; /** * An enumeration of canonical status codes. */ @@ -54346,35 +58936,41 @@ function terminator(callback) /* 941 */, /* 942 */, /* 943 */, -/* 944 */, -/* 945 */, -/* 946 */, -/* 947 */, -/* 948 */, -/* 949 */ -/***/ (function(__unusedmodule, exports) { +/* 944 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Meter.js.map + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = rng; + +var _crypto = _interopRequireDefault(__webpack_require__(417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} /***/ }), +/* 945 */, +/* 946 */, +/* 947 */, +/* 948 */, +/* 949 */, /* 950 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -54491,87 +59087,7 @@ exports.checkBypass = checkBypass; /* 963 */, /* 964 */, /* 965 */, -/* 966 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Context = void 0; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var Context = /** @class */ (function () { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - function Context(parentContext) { - this._currentContext = parentContext ? new Map(parentContext) : new Map(); - } - /** Get a key to uniquely identify a context value */ - Context.createKey = function (description) { - return Symbol(description); - }; - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - Context.prototype.getValue = function (key) { - return this._currentContext.get(key); - }; - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - Context.prototype.setValue = function (key, value) { - var context = new Context(this._currentContext); - context._currentContext.set(key, value); - return context; - }; - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - Context.prototype.deleteValue = function (key) { - var context = new Context(this._currentContext); - context._currentContext.delete(key); - return context; - }; - /** The root context is used as the default parent context when there is no active context */ - Context.ROOT_CONTEXT = new Context(); - /** - * This is another identifier to the root context which allows developers to easily search the - * codebase for direct uses of context which need to be removed in later PRs. - * - * It's existence is temporary and it should be removed when all references are fixed. - */ - Context.TODO = Context.ROOT_CONTEXT; - return Context; -}()); -exports.Context = Context; -//# sourceMappingURL=context.js.map - -/***/ }), +/* 966 */, /* 967 */, /* 968 */, /* 969 */, @@ -54582,9 +59098,19 @@ exports.Context = Context; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const assert = __webpack_require__(357); -const path = __webpack_require__(622); +const path = __importStar(__webpack_require__(622)); +const assert_1 = __importDefault(__webpack_require__(357)); const IS_WINDOWS = process.platform === 'win32'; /** * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. @@ -54624,8 +59150,8 @@ exports.dirname = dirname; * or `C:` are expanded based on the current working directory. */ function ensureAbsoluteRoot(root, itemPath) { - assert(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); - assert(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); + assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); + assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); // Already rooted if (hasAbsoluteRoot(itemPath)) { return itemPath; @@ -54635,7 +59161,7 @@ function ensureAbsoluteRoot(root, itemPath) { // Check for itemPath like C: or C:foo if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { let cwd = process.cwd(); - assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); + assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); // Drive letter matches cwd? Expand to cwd if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { // Drive only, e.g. C: @@ -54660,11 +59186,11 @@ function ensureAbsoluteRoot(root, itemPath) { // Check for itemPath like \ or \foo else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { const cwd = process.cwd(); - assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); + assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); return `${cwd[0]}:\\${itemPath.substr(1)}`; } } - assert(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); + assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); // Otherwise ensure root ends with a separator if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { // Intentionally empty @@ -54681,7 +59207,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot; * `\\hello\share` and `C:\hello` (and using alternate separator). */ function hasAbsoluteRoot(itemPath) { - assert(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); // Normalize separators itemPath = normalizeSeparators(itemPath); // Windows @@ -54698,7 +59224,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot; * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). */ function hasRoot(itemPath) { - assert(itemPath, `isRooted parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`); // Normalize separators itemPath = normalizeSeparators(itemPath); // Windows @@ -54765,8 +59291,10 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TraceFlags = void 0; +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54780,12 +59308,6 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * An enumeration that represents global trace flags. These flags are - * propagated to all child {@link Span}. These determine features such as - * whether a Span should be traced. It is implemented as a bitmask. - */ var TraceFlags; (function (TraceFlags) { /** Represents no flag set. */ @@ -54796,7 +59318,59 @@ var TraceFlags; //# sourceMappingURL=trace_flags.js.map /***/ }), -/* 976 */, +/* 976 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_TRACE_API_KEY = exports.GLOBAL_PROPAGATION_API_KEY = exports.GLOBAL_METRICS_API_KEY = exports.GLOBAL_CONTEXT_MANAGER_API_KEY = void 0; +var platform_1 = __webpack_require__(910); +exports.GLOBAL_CONTEXT_MANAGER_API_KEY = Symbol.for('io.opentelemetry.js.api.context'); +exports.GLOBAL_METRICS_API_KEY = Symbol.for('io.opentelemetry.js.api.metrics'); +exports.GLOBAL_PROPAGATION_API_KEY = Symbol.for('io.opentelemetry.js.api.propagation'); +exports.GLOBAL_TRACE_API_KEY = Symbol.for('io.opentelemetry.js.api.trace'); +exports._global = platform_1._globalThis; +/** + * Make a function which accepts a version integer and returns the instance of an API if the version + * is compatible, or a fallback version (usually NOOP) if it is not. + * + * @param requiredVersion Backwards compatibility version which is required to return the instance + * @param instance Instance which should be returned if the required version is compatible + * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible + */ +function makeGetter(requiredVersion, instance, fallback) { + return function (version) { + return version === requiredVersion ? instance : fallback; + }; +} +exports.makeGetter = makeGetter; +/** + * A number which should be incremented each time a backwards incompatible + * change is made to the API. This number is used when an API package + * attempts to access the global API to ensure it is getting a compatible + * version. If the global API is not compatible with the API package + * attempting to get it, a NOOP API implementation will be returned. + */ +exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0; +//# sourceMappingURL=global-utils.js.map + +/***/ }), /* 977 */, /* 978 */, /* 979 */ @@ -54875,303 +59449,11 @@ exports.RetryHelper = RetryHelper; //# sourceMappingURL=retry-helper.js.map /***/ }), -/* 980 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_TRACER = exports.NoopTracer = void 0; -var NoopSpan_1 = __webpack_require__(340); -/** - * No-op implementations of {@link Tracer}. - */ -var NoopTracer = /** @class */ (function () { - function NoopTracer() { - } - NoopTracer.prototype.getCurrentSpan = function () { - return NoopSpan_1.NOOP_SPAN; - }; - // startSpan starts a noop span. - NoopTracer.prototype.startSpan = function (name, options) { - return NoopSpan_1.NOOP_SPAN; - }; - NoopTracer.prototype.withSpan = function (span, fn) { - return fn(); - }; - NoopTracer.prototype.bind = function (target, span) { - return target; - }; - return NoopTracer; -}()); -exports.NoopTracer = NoopTracer; -exports.NOOP_TRACER = new NoopTracer(); -//# sourceMappingURL=NoopTracer.js.map - -/***/ }), +/* 980 */, /* 981 */, -/* 982 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - 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 extendStatics(d, b); - }; - 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 }); -exports.NOOP_BATCH_OBSERVER_METRIC = exports.NOOP_SUM_OBSERVER_METRIC = exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = exports.NOOP_VALUE_OBSERVER_METRIC = exports.NOOP_BOUND_BASE_OBSERVER = exports.NOOP_VALUE_RECORDER_METRIC = exports.NOOP_BOUND_VALUE_RECORDER = exports.NOOP_COUNTER_METRIC = exports.NOOP_BOUND_COUNTER = exports.NOOP_METER = exports.NoopBoundBaseObserver = exports.NoopBoundValueRecorder = exports.NoopBoundCounter = exports.NoopBatchObserverMetric = exports.NoopBaseObserverMetric = exports.NoopValueRecorderMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0; -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -var NoopMeter = /** @class */ (function () { - function NoopMeter() { - } - /** - * Returns constant noop value recorder. - * @param name the name of the metric. - * @param [options] the metric options. - */ - NoopMeter.prototype.createValueRecorder = function (name, options) { - return exports.NOOP_VALUE_RECORDER_METRIC; - }; - /** - * Returns a constant noop counter. - * @param name the name of the metric. - * @param [options] the metric options. - */ - NoopMeter.prototype.createCounter = function (name, options) { - return exports.NOOP_COUNTER_METRIC; - }; - /** - * Returns a constant noop UpDownCounter. - * @param name the name of the metric. - * @param [options] the metric options. - */ - NoopMeter.prototype.createUpDownCounter = function (name, options) { - return exports.NOOP_COUNTER_METRIC; - }; - /** - * Returns constant noop value observer. - * @param name the name of the metric. - * @param [options] the metric options. - * @param [callback] the value observer callback - */ - NoopMeter.prototype.createValueObserver = function (name, options, callback) { - return exports.NOOP_VALUE_OBSERVER_METRIC; - }; - /** - * Returns constant noop batch observer. - * @param name the name of the metric. - * @param callback the batch observer callback - */ - NoopMeter.prototype.createBatchObserver = function (name, callback) { - return exports.NOOP_BATCH_OBSERVER_METRIC; - }; - return NoopMeter; -}()); -exports.NoopMeter = NoopMeter; -var NoopMetric = /** @class */ (function () { - function NoopMetric(instrument) { - this._instrument = instrument; - } - /** - * Returns a Bound Instrument associated with specified Labels. - * It is recommended to keep a reference to the Bound Instrument instead of - * always calling this method for every operations. - * @param labels key-values pairs that are associated with a specific metric - * that you want to record. - */ - NoopMetric.prototype.bind = function (labels) { - return this._instrument; - }; - /** - * Removes the Binding from the metric, if it is present. - * @param labels key-values pairs that are associated with a specific metric. - */ - NoopMetric.prototype.unbind = function (labels) { - return; - }; - /** - * Clears all timeseries from the Metric. - */ - NoopMetric.prototype.clear = function () { - return; - }; - return NoopMetric; -}()); -exports.NoopMetric = NoopMetric; -var NoopCounterMetric = /** @class */ (function (_super) { - __extends(NoopCounterMetric, _super); - function NoopCounterMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - NoopCounterMetric.prototype.add = function (value, labels) { - this.bind(labels).add(value); - }; - return NoopCounterMetric; -}(NoopMetric)); -exports.NoopCounterMetric = NoopCounterMetric; -var NoopValueRecorderMetric = /** @class */ (function (_super) { - __extends(NoopValueRecorderMetric, _super); - function NoopValueRecorderMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - NoopValueRecorderMetric.prototype.record = function (value, labels, correlationContext, spanContext) { - if (typeof correlationContext === 'undefined') { - this.bind(labels).record(value); - } - else if (typeof spanContext === 'undefined') { - this.bind(labels).record(value, correlationContext); - } - else { - this.bind(labels).record(value, correlationContext, spanContext); - } - }; - return NoopValueRecorderMetric; -}(NoopMetric)); -exports.NoopValueRecorderMetric = NoopValueRecorderMetric; -var NoopBaseObserverMetric = /** @class */ (function (_super) { - __extends(NoopBaseObserverMetric, _super); - function NoopBaseObserverMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - NoopBaseObserverMetric.prototype.observation = function () { - return { - observer: this, - value: 0, - }; - }; - return NoopBaseObserverMetric; -}(NoopMetric)); -exports.NoopBaseObserverMetric = NoopBaseObserverMetric; -var NoopBatchObserverMetric = /** @class */ (function (_super) { - __extends(NoopBatchObserverMetric, _super); - function NoopBatchObserverMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - return NoopBatchObserverMetric; -}(NoopMetric)); -exports.NoopBatchObserverMetric = NoopBatchObserverMetric; -var NoopBoundCounter = /** @class */ (function () { - function NoopBoundCounter() { - } - NoopBoundCounter.prototype.add = function (value) { - return; - }; - return NoopBoundCounter; -}()); -exports.NoopBoundCounter = NoopBoundCounter; -var NoopBoundValueRecorder = /** @class */ (function () { - function NoopBoundValueRecorder() { - } - NoopBoundValueRecorder.prototype.record = function (value, correlationContext, spanContext) { - return; - }; - return NoopBoundValueRecorder; -}()); -exports.NoopBoundValueRecorder = NoopBoundValueRecorder; -var NoopBoundBaseObserver = /** @class */ (function () { - function NoopBoundBaseObserver() { - } - NoopBoundBaseObserver.prototype.update = function (value) { }; - return NoopBoundBaseObserver; -}()); -exports.NoopBoundBaseObserver = NoopBoundBaseObserver; -exports.NOOP_METER = new NoopMeter(); -exports.NOOP_BOUND_COUNTER = new NoopBoundCounter(); -exports.NOOP_COUNTER_METRIC = new NoopCounterMetric(exports.NOOP_BOUND_COUNTER); -exports.NOOP_BOUND_VALUE_RECORDER = new NoopBoundValueRecorder(); -exports.NOOP_VALUE_RECORDER_METRIC = new NoopValueRecorderMetric(exports.NOOP_BOUND_VALUE_RECORDER); -exports.NOOP_BOUND_BASE_OBSERVER = new NoopBoundBaseObserver(); -exports.NOOP_VALUE_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); -exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); -exports.NOOP_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); -exports.NOOP_BATCH_OBSERVER_METRIC = new NoopBatchObserverMetric(); -//# sourceMappingURL=NoopMeter.js.map - -/***/ }), +/* 982 */, /* 983 */, -/* 984 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0; -var NoopMeter_1 = __webpack_require__(982); -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -var NoopMeterProvider = /** @class */ (function () { - function NoopMeterProvider() { - } - NoopMeterProvider.prototype.getMeter = function (_name, _version) { - return NoopMeter_1.NOOP_METER; - }; - return NoopMeterProvider; -}()); -exports.NoopMeterProvider = NoopMeterProvider; -exports.NOOP_METER_PROVIDER = new NoopMeterProvider(); -//# sourceMappingURL=NoopMeterProvider.js.map - -/***/ }), +/* 984 */, /* 985 */, /* 986 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -55273,37 +59555,7 @@ exports.exec = exec; /***/ }), -/* 993 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueType = void 0; -/** The Type of value. It describes how the data is reported. */ -var ValueType; -(function (ValueType) { - ValueType[ValueType["INT"] = 0] = "INT"; - ValueType[ValueType["DOUBLE"] = 1] = "DOUBLE"; -})(ValueType = exports.ValueType || (exports.ValueType = {})); -//# sourceMappingURL=Metric.js.map - -/***/ }), +/* 993 */, /* 994 */, /* 995 */, /* 996 */, @@ -55319,8 +59571,8 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var uuid = __webpack_require__(585); var tslib = __webpack_require__(865); +var uuid = __webpack_require__(585); var tough = __webpack_require__(393); var http = __webpack_require__(605); var https = __webpack_require__(211); @@ -55328,14 +59580,15 @@ var node_fetch = _interopDefault(__webpack_require__(454)); var abortController = __webpack_require__(106); var FormData = _interopDefault(__webpack_require__(790)); var util = __webpack_require__(669); +var url = __webpack_require__(835); var stream = __webpack_require__(794); var tunnel = __webpack_require__(413); var coreAuth = __webpack_require__(229); var logger$1 = __webpack_require__(928); var xml2js = __webpack_require__(992); var os = __webpack_require__(87); -var coreTracing = __webpack_require__(894); -var api = __webpack_require__(827); +var coreTracing = __webpack_require__(263); +var api = __webpack_require__(440); // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. @@ -55511,7 +59764,7 @@ var Constants = { * @const * @type {string} */ - coreHttpVersion: "1.1.6", + coreHttpVersion: "1.2.1", /** * Specifies HTTP. * @@ -55540,6 +59793,20 @@ var Constants = { * @type {string} */ HTTPS_PROXY: "HTTPS_PROXY", + /** + * Specifies NO Proxy. + * + * @const + * @type {string} + */ + NO_PROXY: "NO_PROXY", + /** + * Specifies ALL Proxy. + * + * @const + * @type {string} + */ + ALL_PROXY: "ALL_PROXY", HttpConstants: { /** * Http Verbs @@ -55591,6 +59858,17 @@ var Constants = { } }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +/** + * Default key used to access the XML attributes. + */ +var XML_ATTRKEY = "$"; +/** + * Default key used to access the XML value content. + */ +var XML_CHARKEY = "_"; + // Copyright (c) Microsoft Corporation. var 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; /** @@ -55730,12 +60008,17 @@ function promiseToServiceCallback(promise) { }); }; } -function prepareXMLRootList(obj, elementName) { - var _a; +function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) { + var _a, _b, _c; if (!Array.isArray(obj)) { obj = [obj]; } - return _a = {}, _a[elementName] = obj, _a; + if (!xmlNamespaceKey || !xmlNamespace) { + return _a = {}, _a[elementName] = obj, _a; + } + var result = (_b = {}, _b[elementName] = obj, _b); + result[XML_ATTRKEY] = (_c = {}, _c[xmlNamespaceKey] = xmlNamespace, _c); + return result; } /** * Applies the properties on the prototype of sourceCtors to the prototype of targetCtor @@ -55777,6 +60060,15 @@ function replaceAll(value, searchValue, replaceValue) { function isPrimitiveType(value) { return (typeof value !== "object" && typeof value !== "function") || value === null; } +function getEnvironmentValue(name) { + if (process.env[name]) { + return process.env[name]; + } + else if (process.env[name.toLowerCase()]) { + return process.env[name.toLowerCase()]; + } + return undefined; +} // Copyright (c) Microsoft Corporation. var Serializer = /** @class */ (function () { @@ -55839,9 +60131,18 @@ var Serializer = /** @class */ (function () { * * @param {string} objectName Name of the serialized object * + * @param {options} options additional options to deserialization + * * @returns {object|string|Array|number|boolean|Date|stream} A valid serialized Javascript object */ - Serializer.prototype.serialize = function (mapper, object, objectName) { + Serializer.prototype.serialize = function (mapper, object, objectName, options) { + var _a, _b, _c; + if (options === void 0) { options = {}; } + var updatedOptions = { + rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "", + includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false, + xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY + }; var payload = {}; var mapperType = mapper.type.name; if (!objectName) { @@ -55898,13 +60199,13 @@ var Serializer = /** @class */ (function () { payload = serializeBase64UrlType(objectName, object); } else if (mapperType.match(/^Sequence$/i) !== null) { - payload = serializeSequenceType(this, mapper, object, objectName); + payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions); } else if (mapperType.match(/^Dictionary$/i) !== null) { - payload = serializeDictionaryType(this, mapper, object, objectName); + payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions); } else if (mapperType.match(/^Composite$/i) !== null) { - payload = serializeCompositeType(this, mapper, object, objectName); + payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions); } } return payload; @@ -55918,9 +60219,18 @@ var Serializer = /** @class */ (function () { * * @param {string} objectName Name of the deserialized object * + * @param options Controls behavior of XML parser and builder. + * * @returns {object|string|Array|number|boolean|Date|stream} A valid deserialized Javascript object */ - Serializer.prototype.deserialize = function (mapper, responseBody, objectName) { + Serializer.prototype.deserialize = function (mapper, responseBody, objectName, options) { + var _a, _b, _c; + if (options === void 0) { options = {}; } + var updatedOptions = { + rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "", + includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false, + xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY + }; if (responseBody == undefined) { if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) { // Edge case for empty XML non-wrapped lists. xml2js can't distinguish @@ -55940,17 +60250,18 @@ var Serializer = /** @class */ (function () { objectName = mapper.serializedName; } if (mapperType.match(/^Composite$/i) !== null) { - payload = deserializeCompositeType(this, mapper, responseBody, objectName); + payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions); } else { if (this.isXML) { + var xmlCharKey = updatedOptions.xmlCharKey; /** * If the mapper specifies this as a non-composite type value but the responseBody contains - * both header ("$") and body ("_") properties, then just reduce the responseBody value to - * the body ("_") property. + * 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["$"] != undefined && responseBody["_"] != undefined) { - responseBody = responseBody["_"]; + if (responseBody[XML_ATTRKEY] != undefined && responseBody[xmlCharKey] != undefined) { + responseBody = responseBody[xmlCharKey]; } } if (mapperType.match(/^Number$/i) !== null) { @@ -55986,10 +60297,10 @@ var Serializer = /** @class */ (function () { payload = base64UrlToByteArray(responseBody); } else if (mapperType.match(/^Sequence$/i) !== null) { - payload = deserializeSequenceType(this, mapper, responseBody, objectName); + payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions); } else if (mapperType.match(/^Dictionary$/i) !== null) { - payload = deserializeDictionaryType(this, mapper, responseBody, objectName); + payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions); } } if (mapper.isConstant) { @@ -56094,7 +60405,7 @@ function serializeBasicTypes(typeName, objectName, value) { objectType !== "function" && !(value instanceof ArrayBuffer) && !ArrayBuffer.isView(value) && - !(typeof Blob === "function" && value instanceof Blob)) { + !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) { throw new Error(objectName + " must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream."); } } @@ -56178,7 +60489,8 @@ function serializeDateTypes(typeName, value, objectName) { } return value; } -function serializeSequenceType(serializer, mapper, object, objectName) { +function serializeSequenceType(serializer, mapper, object, objectName, isXml, options) { + var _a, _b; if (!Array.isArray(object)) { throw new Error(objectName + " must be of type Array."); } @@ -56189,11 +60501,29 @@ function serializeSequenceType(serializer, mapper, object, objectName) { } var tempArray = []; for (var i = 0; i < object.length; i++) { - tempArray[i] = serializer.serialize(elementType, object[i], objectName); + var serializedValue = serializer.serialize(elementType, object[i], objectName, options); + if (isXml && elementType.xmlNamespace) { + var xmlnsKey = elementType.xmlNamespacePrefix + ? "xmlns:" + elementType.xmlNamespacePrefix + : "xmlns"; + if (elementType.type.name === "Composite") { + tempArray[i] = tslib.__assign({}, serializedValue); + tempArray[i][XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = elementType.xmlNamespace, _a); + } + else { + tempArray[i] = {}; + tempArray[i][options.xmlCharKey] = serializedValue; + tempArray[i][XML_ATTRKEY] = (_b = {}, _b[xmlnsKey] = elementType.xmlNamespace, _b); + } + } + else { + tempArray[i] = serializedValue; + } } return tempArray; } -function serializeDictionaryType(serializer, mapper, object, objectName) { +function serializeDictionaryType(serializer, mapper, object, objectName, isXml, options) { + var _a; if (typeof object !== "object") { throw new Error(objectName + " must be of type object."); } @@ -56203,12 +60533,48 @@ function serializeDictionaryType(serializer, mapper, object, objectName) { ("mapper and it must of type \"object\" in " + objectName + ".")); } var tempDictionary = {}; - for (var _i = 0, _a = Object.keys(object); _i < _a.length; _i++) { - var key = _a[_i]; - tempDictionary[key] = serializer.serialize(valueType, object[key], objectName + "." + key); + for (var _i = 0, _b = Object.keys(object); _i < _b.length; _i++) { + var key = _b[_i]; + var 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) { + var xmlnsKey = mapper.xmlNamespacePrefix ? "xmlns:" + mapper.xmlNamespacePrefix : "xmlns"; + var result = tempDictionary; + result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a); + 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) { + var additionalProperties = mapper.type.additionalProperties; + if (!additionalProperties && mapper.type.className) { + var 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) { + var 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 @@ -56217,32 +60583,28 @@ function serializeDictionaryType(serializer, mapper, object, objectName) { function resolveModelProperties(serializer, mapper, objectName) { var modelProps = mapper.type.modelProperties; if (!modelProps) { - var 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) + "\"."); - } - var modelMapper = serializer.modelMappers[className]; + var modelMapper = resolveReferencedMapper(serializer, mapper, objectName); if (!modelMapper) { - throw new Error("mapper() cannot be null or undefined for model \"" + className + "\"."); + throw new Error("mapper() cannot be null or undefined for model \"" + mapper.type.className + "\"."); } - modelProps = modelMapper.type.modelProperties; + 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 \"" + className + "\" for object \"" + objectName + "\".")); + ("mapper \"" + JSON.stringify(modelMapper) + "\" of type \"" + mapper.type.className + "\" for object \"" + objectName + "\".")); } } return modelProps; } -function serializeCompositeType(serializer, mapper, object, objectName) { - var _a; +function serializeCompositeType(serializer, mapper, object, objectName, isXml, options) { + var _a, _b; if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) { mapper = getPolymorphicMapper(serializer, mapper, object, "clientName"); } if (object != undefined) { var payload = {}; var modelProps = resolveModelProperties(serializer, mapper, objectName); - for (var _i = 0, _b = Object.keys(modelProps); _i < _b.length; _i++) { - var key = _b[_i]; + for (var _i = 0, _c = Object.keys(modelProps); _i < _c.length; _i++) { + var key = _c[_i]; var propertyMapper = modelProps[key]; if (propertyMapper.readOnly) { continue; @@ -56260,8 +60622,8 @@ function serializeCompositeType(serializer, mapper, object, objectName) { else { var paths = splitSerializeName(propertyMapper.serializedName); propName = paths.pop(); - for (var _c = 0, paths_1 = paths; _c < paths_1.length; _c++) { - var pathName = paths_1[_c]; + for (var _d = 0, paths_1 = paths; _d < paths_1.length; _d++) { + var pathName = paths_1[_d]; var childObject = parentObject[pathName]; if (childObject == undefined && (object[key] != undefined || propertyMapper.defaultValue !== undefined)) { @@ -56271,6 +60633,12 @@ function serializeCompositeType(serializer, mapper, object, objectName) { } } if (parentObject != undefined) { + if (isXml && mapper.xmlNamespace) { + var xmlnsKey = mapper.xmlNamespacePrefix + ? "xmlns:" + mapper.xmlNamespacePrefix + : "xmlns"; + parentObject[XML_ATTRKEY] = tslib.__assign(tslib.__assign({}, parentObject[XML_ATTRKEY]), (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a)); + } var propertyObjectName = propertyMapper.serializedName !== "" ? objectName + "." + propertyMapper.serializedName : objectName; @@ -56281,31 +60649,32 @@ function serializeCompositeType(serializer, mapper, object, objectName) { toSerialize == undefined) { toSerialize = mapper.serializedName; } - var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName); + var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName, options); if (serializedValue !== undefined && propName != undefined) { - if (propertyMapper.xmlIsAttribute) { - // $ is the key attributes are kept under in xml2js. + var 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.$ = parentObject.$ || {}; - parentObject.$[propName] = serializedValue; + parentObject[XML_ATTRKEY] = parentObject[XML_ATTRKEY] || {}; + parentObject[XML_ATTRKEY][propName] = serializedValue; } - else if (propertyMapper.xmlIsWrapped) { - parentObject[propName] = (_a = {}, _a[propertyMapper.xmlElementName] = serializedValue, _a); + else if (isXml && propertyMapper.xmlIsWrapped) { + parentObject[propName] = (_b = {}, _b[propertyMapper.xmlElementName] = value, _b); } else { - parentObject[propName] = serializedValue; + parentObject[propName] = value; } } } } - var additionalPropertiesMapper = mapper.type.additionalProperties; + var additionalPropertiesMapper = resolveAdditionalProperties(serializer, mapper, objectName); if (additionalPropertiesMapper) { var propNames = Object.keys(modelProps); var _loop_1 = function (clientPropName) { var isAdditionalProperty = propNames.every(function (pn) { return pn !== clientPropName; }); if (isAdditionalProperty) { - payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]'); + payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]', options); } }; for (var clientPropName in object) { @@ -56316,18 +60685,43 @@ function serializeCompositeType(serializer, mapper, object, objectName) { } return object; } -function isSpecialXmlProperty(propertyName) { - return ["$", "_"].includes(propertyName); +function getXmlObjectValue(propertyMapper, serializedValue, isXml, options) { + var _a; + if (!isXml || !propertyMapper.xmlNamespace) { + return serializedValue; + } + var xmlnsKey = propertyMapper.xmlNamespacePrefix + ? "xmlns:" + propertyMapper.xmlNamespacePrefix + : "xmlns"; + var xmlNamespace = (_a = {}, _a[xmlnsKey] = propertyMapper.xmlNamespace, _a); + if (["Composite"].includes(propertyMapper.type.name)) { + if (serializedValue[XML_ATTRKEY]) { + return serializedValue; + } + else { + var result_1 = tslib.__assign({}, serializedValue); + result_1[XML_ATTRKEY] = xmlNamespace; + return result_1; + } + } + var result = {}; + result[options.xmlCharKey] = serializedValue; + result[XML_ATTRKEY] = xmlNamespace; + return result; +} +function isSpecialXmlProperty(propertyName, options) { + return [XML_ATTRKEY, options.xmlCharKey].includes(propertyName); } -function deserializeCompositeType(serializer, mapper, responseBody, objectName) { +function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) { + var _a; if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) { mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName"); } var modelProps = resolveModelProperties(serializer, mapper, objectName); var instance = {}; var handledPropertyNames = []; - for (var _i = 0, _a = Object.keys(modelProps); _i < _a.length; _i++) { - var key = _a[_i]; + for (var _i = 0, _b = Object.keys(modelProps); _i < _b.length; _i++) { + var key = _b[_i]; var propertyMapper = modelProps[key]; var paths = splitSerializeName(modelProps[key].serializedName); handledPropertyNames.push(paths[0]); @@ -56339,31 +60733,44 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) var headerCollectionPrefix = propertyMapper.headerCollectionPrefix; if (headerCollectionPrefix) { var dictionary = {}; - for (var _b = 0, _c = Object.keys(responseBody); _b < _c.length; _b++) { - var headerKey = _c[_b]; + for (var _c = 0, _d = Object.keys(responseBody); _c < _d.length; _c++) { + var headerKey = _d[_c]; if (headerKey.startsWith(headerCollectionPrefix)) { - dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName); + 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.$) { - instance[key] = serializer.deserialize(propertyMapper, responseBody.$[xmlName], propertyObjectName); + if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) { + instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options); } else { var propertyName = xmlElementName || xmlName || serializedName; - var unwrappedProperty = responseBody[propertyName]; if (propertyMapper.xmlIsWrapped) { - unwrappedProperty = responseBody[xmlName]; - unwrappedProperty = unwrappedProperty && unwrappedProperty[xmlElementName]; - var isEmptyWrappedList = unwrappedProperty === undefined; - if (isEmptyWrappedList) { - unwrappedProperty = []; - } + /* a list of wrapped by + For the xml example below + + ... + ... + + the responseBody has + { + Cors: { + CorsRule: [{...}, {...}] + } + } + xmlName is "Cors" and xmlElementName is"CorsRule". + */ + var wrapped = responseBody[xmlName]; + var elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : []; + instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options); + } + else { + var property = responseBody[propertyName]; + instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options); } - instance[key] = serializer.deserialize(propertyMapper, unwrappedProperty, propertyObjectName); } } else { @@ -56371,8 +60778,8 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) var propertyInstance = void 0; var res = responseBody; // traversing the object step by step. - for (var _d = 0, paths_2 = paths; _d < paths_2.length; _d++) { - var item = paths_2[_d]; + for (var _e = 0, paths_2 = paths; _e < paths_2.length; _e++) { + var item = paths_2[_e]; if (!res) break; res = res[item]; @@ -56397,10 +60804,10 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) // paging if (Array.isArray(responseBody[key]) && modelProps[key].serializedName === "") { propertyInstance = responseBody[key]; - instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName); + instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options); } else if (propertyInstance !== undefined || propertyMapper.defaultValue !== undefined) { - serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName); + serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options); instance[key] = serializedValue; } } @@ -56418,23 +60825,23 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) }; for (var responsePropName in responseBody) { if (isAdditionalProperty(responsePropName)) { - instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]'); + instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]', options); } } } else if (responseBody) { - for (var _e = 0, _f = Object.keys(responseBody); _e < _f.length; _e++) { - var key = _f[_e]; + for (var _f = 0, _g = Object.keys(responseBody); _f < _g.length; _f++) { + var key = _g[_f]; if (instance[key] === undefined && !handledPropertyNames.includes(key) && - !isSpecialXmlProperty(key)) { + !isSpecialXmlProperty(key, options)) { instance[key] = responseBody[key]; } } } return instance; } -function deserializeDictionaryType(serializer, mapper, responseBody, objectName) { +function deserializeDictionaryType(serializer, mapper, responseBody, objectName, options) { var value = mapper.type.value; if (!value || typeof value !== "object") { throw new Error("\"value\" metadata for a Dictionary must be defined in the " + @@ -56444,13 +60851,13 @@ function deserializeDictionaryType(serializer, mapper, responseBody, objectName) var tempDictionary = {}; for (var _i = 0, _a = Object.keys(responseBody); _i < _a.length; _i++) { var key = _a[_i]; - tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName); + tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName, options); } return tempDictionary; } return responseBody; } -function deserializeSequenceType(serializer, mapper, responseBody, objectName) { +function deserializeSequenceType(serializer, mapper, responseBody, objectName, options) { var element = mapper.type.element; if (!element || typeof element !== "object") { throw new Error("element\" metadata for an Array must be defined in the " + @@ -56463,7 +60870,7 @@ function deserializeSequenceType(serializer, mapper, responseBody, objectName) { } var tempArray = []; for (var i = 0; i < responseBody.length; i++) { - tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]"); + tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]", options); } return tempArray; } @@ -56764,7 +61171,7 @@ var WebResource = /** @class */ (function () { if (!this.headers.get("Content-Type")) { this.headers.set("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 + // set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicitly this.body = options.body; if (options.body !== undefined && options.body !== null) { // body as a stream special case. set the body as-is and check for some special request headers specific to sending a stream. @@ -56917,11 +61324,6 @@ var URLQuery = /** @class */ (function () { break; case "ParameterValue": switch (currentCharacter) { - case "=": - parameterName = ""; - parameterValue = ""; - currentState = "Invalid"; - break; case "&": result.set(parameterName, parameterValue); parameterName = ""; @@ -56933,11 +61335,6 @@ var URLQuery = /** @class */ (function () { break; } break; - case "Invalid": - if (currentCharacter === "&") { - currentState = "ParameterName"; - } - break; default: throw new Error("Unrecognized URLQuery parse state: " + currentState); } @@ -57633,8 +62030,9 @@ var FetchHttpClient = /** @class */ (function () { if (typeof value === "function") { value = value(); } - // eslint-disable-next-line no-prototype-builtins - if (value && value.hasOwnProperty("value") && value.hasOwnProperty("options")) { + if (value && + Object.prototype.hasOwnProperty.call(value, "value") && + Object.prototype.hasOwnProperty.call(value, "options")) { requestForm_1.append(key, value.value, value.options); } else { @@ -57685,7 +62083,7 @@ var FetchHttpClient = /** @class */ (function () { return [4 /*yield*/, this.prepareRequest(httpRequest)]; case 1: platformSpecificRequestInit = _d.sent(); - requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal }, platformSpecificRequestInit); + requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal, redirect: "manual" }, platformSpecificRequestInit); _d.label = 2; case 2: _d.trys.push([2, 8, 9, 10]); @@ -58165,13 +62563,12 @@ var xml2jsDefaultOptionsV2 = { trim: false, normalize: false, normalizeTags: false, - attrkey: "$", - charkey: "_", + attrkey: XML_ATTRKEY, explicitArray: true, ignoreAttrs: false, mergeAttrs: false, explicitRoot: true, - validator: null, + validator: undefined, xmlns: false, explicitChildren: false, preserveChildrenOrder: false, @@ -58180,17 +62577,17 @@ var xml2jsDefaultOptionsV2 = { includeWhiteChars: false, async: false, strict: true, - attrNameProcessors: null, - attrValueProcessors: null, - tagNameProcessors: null, - valueProcessors: null, + attrNameProcessors: undefined, + attrValueProcessors: undefined, + tagNameProcessors: undefined, + valueProcessors: undefined, rootName: "root", xmldec: { version: "1.0", encoding: "UTF-8", standalone: true }, - doctype: null, + doctype: undefined, renderOpts: { pretty: true, indent: " ", @@ -58217,7 +62614,10 @@ xml2jsBuilderSettings.renderOpts = { * `rootName` indicates the name of the root element in the resulting XML */ function stringifyXML(obj, opts) { - xml2jsBuilderSettings.rootName = (opts || {}).rootName; + var _a; + if (opts === void 0) { opts = {}; } + xml2jsBuilderSettings.rootName = opts.rootName; + xml2jsBuilderSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY; var builder = new xml2js.Builder(xml2jsBuilderSettings); return builder.buildObject(obj); } @@ -58228,7 +62628,10 @@ function stringifyXML(obj, opts) { * `includeRoot` indicates whether the root element is to be included or not in the output */ function parseXML(str, opts) { - xml2jsParserSettings.explicitRoot = !!(opts && opts.includeRoot); + var _a; + if (opts === void 0) { opts = {}; } + xml2jsParserSettings.explicitRoot = !!opts.includeRoot; + xml2jsParserSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY; var xmlParser = new xml2js.Parser(xml2jsParserSettings); return new Promise(function (resolve, reject) { if (!str) { @@ -58252,10 +62655,10 @@ function parseXML(str, opts) { * Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they * pass through the HTTP pipeline. */ -function deserializationPolicy(deserializationContentTypes) { +function deserializationPolicy(deserializationContentTypes, parsingOptions) { return { create: function (nextPolicy, options) { - return new DeserializationPolicy(nextPolicy, deserializationContentTypes, options); + return new DeserializationPolicy(nextPolicy, options, deserializationContentTypes, parsingOptions); } }; } @@ -58273,22 +62676,25 @@ var DefaultDeserializationOptions = { */ var DeserializationPolicy = /** @class */ (function (_super) { tslib.__extends(DeserializationPolicy, _super); - function DeserializationPolicy(nextPolicy, deserializationContentTypes, options) { - var _this = _super.call(this, nextPolicy, options) || this; + function DeserializationPolicy(nextPolicy, requestPolicyOptions, deserializationContentTypes, parsingOptions) { + if (parsingOptions === void 0) { parsingOptions = {}; } + var _a; + var _this = _super.call(this, nextPolicy, requestPolicyOptions) || this; _this.jsonContentTypes = (deserializationContentTypes && deserializationContentTypes.json) || defaultJsonContentTypes; _this.xmlContentTypes = (deserializationContentTypes && deserializationContentTypes.xml) || defaultXmlContentTypes; + _this.xmlCharKey = (_a = parsingOptions.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY; return _this; } DeserializationPolicy.prototype.sendRequest = function (request) { return tslib.__awaiter(this, void 0, void 0, function () { var _this = this; return tslib.__generator(this, function (_a) { - return [2 /*return*/, this._nextPolicy - .sendRequest(request) - .then(function (response) { - return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response); + return [2 /*return*/, this._nextPolicy.sendRequest(request).then(function (response) { + return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response, { + xmlCharKey: _this.xmlCharKey + }); })]; }); }); @@ -58324,8 +62730,15 @@ function shouldDeserializeResponse(parsedResponse) { } return result; } -function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { - return parse(jsonContentTypes, xmlContentTypes, response).then(function (parsedResponse) { +function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, options) { + var _a, _b, _c; + if (options === void 0) { options = {}; } + var updatedOptions = { + rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "", + includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false, + xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY + }; + return parse(jsonContentTypes, xmlContentTypes, response, updatedOptions).then(function (parsedResponse) { if (!shouldDeserializeResponse(parsedResponse)) { return parsedResponse; } @@ -58334,54 +62747,13 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { return parsedResponse; } var responseSpec = getOperationResponse(parsedResponse); - var expectedStatusCodes = Object.keys(operationSpec.responses); - var hasNoExpectedStatusCodes = expectedStatusCodes.length === 0 || - (expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"); - var isExpectedStatusCode = hasNoExpectedStatusCodes - ? 200 <= parsedResponse.status && parsedResponse.status < 300 - : !!responseSpec; - // There is no operation response spec for current status code. - // So, treat it as an error case and use the default response spec to deserialize the response. - if (!isExpectedStatusCode) { - var defaultResponseSpec = operationSpec.responses.default; - if (!defaultResponseSpec) { - return parsedResponse; - } - var defaultBodyMapper = defaultResponseSpec.bodyMapper; - var defaultHeadersMapper = defaultResponseSpec.headersMapper; - var initialErrorMessage = isStreamOperation(operationSpec) - ? "Unexpected status code: " + parsedResponse.status - : parsedResponse.bodyAsText; - var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, parsedResponse); - try { - // If error response has a body, try to extract error code & message from it - // Then try to deserialize it using default body mapper - if (parsedResponse.parsedBody) { - var parsedBody = parsedResponse.parsedBody; - var internalError = parsedBody.error || parsedBody; - error.code = internalError.code; - if (internalError.message) { - error.message = internalError.message; - } - if (defaultBodyMapper) { - var valueToDeserialize = parsedBody; - if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) { - valueToDeserialize = - typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : []; - } - error.response.parsedBody = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody"); - } - } - // 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.rawHeaders(), "operationRes.parsedHeaders"); - } - } - catch (defaultError) { - error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response."; - } + var _a = handleErrorResponse(parsedResponse, operationSpec, responseSpec), error = _a.error, shouldReturnResponse = _a.shouldReturnResponse; + 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) { @@ -58394,7 +62766,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { : []; } try { - parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody"); + parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options); } catch (error) { var restError = new RestError("Error " + error + " occurred in deserializing the responseBody - " + parsedResponse.bodyAsText, undefined, parsedResponse.status, parsedResponse.request, parsedResponse); @@ -58406,13 +62778,78 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { parsedResponse.parsedBody = response.status >= 200 && response.status < 300; } if (responseSpec.headersMapper) { - parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders"); + parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options); } } return parsedResponse; }); } -function parse(jsonContentTypes, xmlContentTypes, operationResponse) { +function isOperationSpecEmpty(operationSpec) { + var expectedStatusCodes = Object.keys(operationSpec.responses); + return (expectedStatusCodes.length === 0 || + (expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default")); +} +function handleErrorResponse(parsedResponse, operationSpec, responseSpec) { + var isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300; + var isExpectedStatusCode = isOperationSpecEmpty(operationSpec) + ? isSuccessByStatus + : !!responseSpec; + if (isExpectedStatusCode) { + if (responseSpec) { + if (!responseSpec.isError) { + return { error: null, shouldReturnResponse: false }; + } + } + else { + return { error: null, shouldReturnResponse: false }; + } + } + var errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default; + var initialErrorMessage = isStreamOperation(operationSpec) + ? "Unexpected status code: " + parsedResponse.status + : parsedResponse.bodyAsText; + var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, 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; + } + var defaultBodyMapper = errorResponseSpec.bodyMapper; + var 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) { + var parsedBody = parsedResponse.parsedBody; + var parsedError = void 0; + if (defaultBodyMapper) { + var valueToDeserialize = parsedBody; + if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) { + valueToDeserialize = + typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : []; + } + parsedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody"); + } + var internalError = parsedBody.error || parsedError || parsedBody; + error.code = internalError.code; + if (internalError.message) { + error.message = internalError.message; + } + if (defaultBodyMapper) { + error.response.parsedBody = parsedError; + } + } + // 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.rawHeaders(), "operationRes.parsedHeaders"); + } + } + catch (defaultError) { + error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response."; + } + return { error: error, shouldReturnResponse: false }; +} +function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts) { var errorHandler = function (err) { var msg = "Error \"" + err + "\" occurred while parsing the response body - " + operationResponse.bodyAsText + "."; var errCode = err.code || RestError.PARSE_ERROR; @@ -58433,7 +62870,7 @@ function parse(jsonContentTypes, xmlContentTypes, operationResponse) { }).catch(errorHandler); } else if (contentComponents.some(function (component) { return xmlContentTypes.indexOf(component) !== -1; })) { - return parseXML(text_1) + return parseXML(text_1, opts) .then(function (body) { operationResponse.parsedBody = body; return operationResponse; @@ -58703,6 +63140,10 @@ var UserAgentPolicy = /** @class */ (function (_super) { }(BaseRequestPolicy)); // Copyright (c) Microsoft Corporation. +/** + * Methods that are allowed to follow redirects 301 and 302 + */ +var allowedRedirect = ["GET", "HEAD"]; var DefaultRedirectOptions = { handleRedirects: true, maxRetries: 20 @@ -58735,7 +63176,11 @@ function handleRedirect(policy, response, currentRetries) { var request = response.request, status = response.status; var locationHeader = response.headers.get("location"); if (locationHeader && - (status === 300 || status === 307 || (status === 303 && request.method === "POST")) && + (status === 300 || + (status === 301 && allowedRedirect.includes(request.method)) || + (status === 302 && allowedRedirect.includes(request.method)) || + (status === 303 && request.method === "POST") || + status === 307) && (!policy.maxRetries || currentRetries < policy.maxRetries)) { var builder = URLBuilder.parse(request.url); builder.setPath(locationHeader); @@ -58744,6 +63189,7 @@ function handleRedirect(policy, response, currentRetries) { // redirected GET request if the redirect url is present in the location header if (status === 303) { request.method = "GET"; + delete request.body; } return policy._nextPolicy .sendRequest(request) @@ -58946,6 +63392,71 @@ var ExpiringAccessTokenCache = /** @class */ (function () { }()); // Copyright (c) Microsoft Corporation. +/** + * Helps the core-http token authentication policies with requesting a new token if we're not currently waiting for a new token. + */ +var AccessTokenRefresher = /** @class */ (function () { + function AccessTokenRefresher(credential, scopes, requiredMillisecondsBeforeNewRefresh) { + if (requiredMillisecondsBeforeNewRefresh === void 0) { requiredMillisecondsBeforeNewRefresh = 30000; } + this.credential = credential; + this.scopes = scopes; + this.requiredMillisecondsBeforeNewRefresh = requiredMillisecondsBeforeNewRefresh; + this.lastCalled = 0; + } + /** + * Returns true if the required milliseconds(defaulted to 30000) have been passed signifying + * that we are ready for a new refresh. + * + * @returns {boolean} + */ + AccessTokenRefresher.prototype.isReady = function () { + // We're only ready for a new refresh if the required milliseconds have passed. + return (!this.lastCalled || Date.now() - this.lastCalled > this.requiredMillisecondsBeforeNewRefresh); + }; + /** + * Stores the time in which it is called, + * then requests a new token, + * then sets this.promise to undefined, + * then returns the token. + * @param options getToken options + */ + AccessTokenRefresher.prototype.getToken = function (options) { + return tslib.__awaiter(this, void 0, void 0, function () { + var token; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + this.lastCalled = Date.now(); + return [4 /*yield*/, this.credential.getToken(this.scopes, options)]; + case 1: + token = _a.sent(); + this.promise = undefined; + return [2 /*return*/, token || undefined]; + } + }); + }); + }; + /** + * Requests a new token if we're not currently waiting for a new token. + * Returns null if the required time between each call hasn't been reached. + * @param options getToken options + */ + AccessTokenRefresher.prototype.refresh = function (options) { + if (!this.promise) { + this.promise = this.getToken(options); + } + return this.promise; + }; + return AccessTokenRefresher; +}()); + +// Copyright (c) Microsoft Corporation. +/** + * The automated token refresh will only start to happen at the + * expiration date minus the value of timeBetweenRefreshAttemptsInMs, + * which is by default 30 seconds. + */ +var timeBetweenRefreshAttemptsInMs = 30000; /** * Creates a new BearerTokenAuthenticationPolicy factory. * @@ -58954,9 +63465,10 @@ var ExpiringAccessTokenCache = /** @class */ (function () { */ function bearerTokenAuthenticationPolicy(credential, scopes) { var tokenCache = new ExpiringAccessTokenCache(); + var tokenRefresher = new AccessTokenRefresher(credential, scopes, timeBetweenRefreshAttemptsInMs); return { create: function (nextPolicy, options) { - return new BearerTokenAuthenticationPolicy(nextPolicy, options, credential, scopes, tokenCache); + return new BearerTokenAuthenticationPolicy(nextPolicy, options, tokenCache, tokenRefresher); } }; } @@ -58978,11 +63490,10 @@ var BearerTokenAuthenticationPolicy = /** @class */ (function (_super) { * @param scopes The scopes for which the bearer token applies. * @param tokenCache The cache for the most recent AccessToken returned from the TokenCredential. */ - function BearerTokenAuthenticationPolicy(nextPolicy, options, credential, scopes, tokenCache) { + function BearerTokenAuthenticationPolicy(nextPolicy, options, tokenCache, tokenRefresher) { var _this = _super.call(this, nextPolicy, options) || this; - _this.credential = credential; - _this.scopes = scopes; _this.tokenCache = tokenCache; + _this.tokenRefresher = tokenRefresher; return _this; } /** @@ -59011,6 +63522,26 @@ var BearerTokenAuthenticationPolicy = /** @class */ (function (_super) { }); }); }; + /** + * Attempts a token update if any other time related conditionals have been reached based on the tokenRefresher class. + */ + BearerTokenAuthenticationPolicy.prototype.updateTokenIfNeeded = function (options) { + return tslib.__awaiter(this, void 0, void 0, function () { + var accessToken; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.tokenRefresher.isReady()) return [3 /*break*/, 2]; + return [4 /*yield*/, this.tokenRefresher.refresh(options)]; + case 1: + accessToken = _a.sent(); + this.tokenCache.setCachedToken(accessToken); + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }; BearerTokenAuthenticationPolicy.prototype.getToken = function (options) { return tslib.__awaiter(this, void 0, void 0, function () { var accessToken; @@ -59019,12 +63550,20 @@ var BearerTokenAuthenticationPolicy = /** @class */ (function (_super) { case 0: accessToken = this.tokenCache.getCachedToken(); if (!(accessToken === undefined)) return [3 /*break*/, 2]; - return [4 /*yield*/, this.credential.getToken(this.scopes, options)]; + return [4 /*yield*/, this.tokenRefresher.refresh(options)]; case 1: - accessToken = (_a.sent()) || undefined; + // Waiting for the next refresh only if the cache is unable to retrieve the access token, + // which means that it has expired, or it has never been set. + accessToken = _a.sent(); this.tokenCache.setCachedToken(accessToken); - _a.label = 2; - case 2: return [2 /*return*/, accessToken ? accessToken.token : undefined]; + return [3 /*break*/, 3]; + case 2: + // If we still have a cached access token, + // And any other time related conditionals have been reached based on the tokenRefresher class, + // then attempt to refresh without waiting. + this.updateTokenIfNeeded(options); + _a.label = 3; + case 3: return [2 /*return*/, accessToken ? accessToken.token : undefined]; } }); }); @@ -59125,23 +63664,57 @@ function retry$1(policy, request, operationResponse, err, retryData) { })(exports.QueryCollectionFormat || (exports.QueryCollectionFormat = {})); // Copyright (c) Microsoft Corporation. +var noProxyList = []; +var isNoProxyInitalized = false; +var byPassedList = new Map(); function loadEnvironmentProxyValue() { if (!process) { return undefined; } - if (process.env[Constants.HTTPS_PROXY]) { - return process.env[Constants.HTTPS_PROXY]; - } - else if (process.env[Constants.HTTPS_PROXY.toLowerCase()]) { - return process.env[Constants.HTTPS_PROXY.toLowerCase()]; + var httpsProxy = getEnvironmentValue(Constants.HTTPS_PROXY); + var allProxy = getEnvironmentValue(Constants.ALL_PROXY); + var httpProxy = getEnvironmentValue(Constants.HTTP_PROXY); + return httpsProxy || allProxy || httpProxy; +} +// Check whether the given `uri` matches the noProxyList. If it matches, any request sent to that same `uri` won't set the proxy settings. +function isBypassed(uri) { + if (byPassedList.has(uri)) { + return byPassedList.get(uri); + } + loadNoProxy(); + var isBypassed = false; + var host = URLBuilder.parse(uri).getHost(); + for (var _i = 0, noProxyList_1 = noProxyList; _i < noProxyList_1.length; _i++) { + var proxyString = noProxyList_1[_i]; + if (proxyString[0] === ".") { + if (uri.endsWith(proxyString)) { + isBypassed = true; + } + else { + if (host === proxyString.slice(1) && host.length === proxyString.length - 1) { + isBypassed = true; + } + } + } + else { + if (host === proxyString) { + isBypassed = true; + } + } } - else if (process.env[Constants.HTTP_PROXY]) { - return process.env[Constants.HTTP_PROXY]; + byPassedList.set(uri, isBypassed); + return isBypassed; +} +function loadNoProxy() { + if (isNoProxyInitalized) { + return; } - else if (process.env[Constants.HTTP_PROXY.toLowerCase()]) { - return process.env[Constants.HTTP_PROXY.toLowerCase()]; + var noProxy = getEnvironmentValue(Constants.NO_PROXY); + if (noProxy) { + var list = noProxy.split(","); + noProxyList = list.map(function (item) { return item.trim(); }).filter(function (item) { return item.length; }); } - return undefined; + isNoProxyInitalized = true; } function getDefaultProxySettings(proxyUrl) { if (!proxyUrl) { @@ -59197,7 +63770,7 @@ var ProxyPolicy = /** @class */ (function (_super) { return _this; } ProxyPolicy.prototype.sendRequest = function (request) { - if (!request.proxySettings) { + if (!request.proxySettings && !isBypassed(request.url)) { request.proxySettings = this.proxySettings; } return this._nextPolicy.sendRequest(request); @@ -59472,6 +64045,51 @@ var DisableResponseDecompressionPolicy = /** @class */ (function (_super) { return DisableResponseDecompressionPolicy; }(BaseRequestPolicy)); +// Copyright (c) Microsoft Corporation. +function ndJsonPolicy() { + return { + create: function (nextPolicy, options) { + return new NdJsonPolicy(nextPolicy, options); + } + }; +} +/** + * NdJsonPolicy that formats a JSON array as newline-delimited JSON + */ +var NdJsonPolicy = /** @class */ (function (_super) { + tslib.__extends(NdJsonPolicy, _super); + /** + * Creates an instance of KeepAlivePolicy. + * + * @param nextPolicy + * @param options + */ + function NdJsonPolicy(nextPolicy, options) { + return _super.call(this, nextPolicy, options) || this; + } + /** + * Sends a request. + * + * @param request + */ + NdJsonPolicy.prototype.sendRequest = function (request) { + return tslib.__awaiter(this, void 0, void 0, function () { + var body; + return tslib.__generator(this, function (_a) { + // There currently isn't a good way to bypass the serializer + if (typeof request.body === "string" && request.body.startsWith("[")) { + body = JSON.parse(request.body); + if (Array.isArray(body)) { + request.body = body.map(function (item) { return JSON.stringify(item) + "\n"; }).join(""); + } + } + return [2 /*return*/, this._nextPolicy.sendRequest(request)]; + }); + }); + }; + return NdJsonPolicy; +}(BaseRequestPolicy)); + // Copyright (c) Microsoft Corporation. /** * @class @@ -59513,10 +64131,15 @@ var ServiceClient = /** @class */ (function () { var bearerTokenPolicyFactory = undefined; // eslint-disable-next-line @typescript-eslint/no-this-alias var serviceClient = _this; + var serviceClientOptions = options; return { create: function (nextPolicy, options) { + var credentialScopes = getCredentialScopes(serviceClientOptions, serviceClient.baseUri); + if (!credentialScopes) { + throw new Error("When using credential, the ServiceClient must contain a baseUri or a credentialScopes in ServiceClientOptions. Unable to create a bearerTokenAuthenticationPolicy"); + } if (bearerTokenPolicyFactory === undefined || bearerTokenPolicyFactory === null) { - bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, (serviceClient.baseUri || "") + "/.default"); + bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, credentialScopes); } return bearerTokenPolicyFactory.create(nextPolicy, options); } @@ -59580,19 +64203,21 @@ var ServiceClient = /** @class */ (function () { * @param {ServiceCallback} callback The callback to call when the response is received. */ ServiceClient.prototype.sendOperationRequest = function (operationArguments, operationSpec, callback) { + var _a; return tslib.__awaiter(this, void 0, void 0, function () { - var httpRequest, result, baseUri, requestUrl, _i, _a, urlParameter, urlParameterValue, _b, _c, queryParameter, queryParameterValue, index, item, index, contentType, _d, _e, headerParameter, headerValue, headerCollectionPrefix, _f, _g, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb; - return tslib.__generator(this, function (_h) { - switch (_h.label) { + var serializerOptions, httpRequest, result, baseUri, requestUrl, _i, _b, urlParameter, urlParameterValue, _c, _d, queryParameter, queryParameterValue, index, item, index, contentType, _e, _f, headerParameter, headerValue, headerCollectionPrefix, _g, _h, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb; + return tslib.__generator(this, function (_j) { + switch (_j.label) { case 0: if (typeof operationArguments.options === "function") { callback = operationArguments.options; operationArguments.options = undefined; } + serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions; httpRequest = new WebResource(); - _h.label = 1; + _j.label = 1; case 1: - _h.trys.push([1, 6, , 7]); + _j.trys.push([1, 6, , 7]); baseUri = operationSpec.baseUrl || this.baseUri; if (!baseUri) { throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use."); @@ -59604,10 +64229,10 @@ var ServiceClient = /** @class */ (function () { requestUrl.appendPath(operationSpec.path); } if (operationSpec.urlParameters && operationSpec.urlParameters.length > 0) { - for (_i = 0, _a = operationSpec.urlParameters; _i < _a.length; _i++) { - urlParameter = _a[_i]; + for (_i = 0, _b = operationSpec.urlParameters; _i < _b.length; _i++) { + urlParameter = _b[_i]; urlParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, urlParameter, operationSpec.serializer); - urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter)); + urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter), serializerOptions); if (!urlParameter.skipEncoding) { urlParameterValue = encodeURIComponent(urlParameterValue); } @@ -59615,16 +64240,17 @@ var ServiceClient = /** @class */ (function () { } } if (operationSpec.queryParameters && operationSpec.queryParameters.length > 0) { - for (_b = 0, _c = operationSpec.queryParameters; _b < _c.length; _b++) { - queryParameter = _c[_b]; + for (_c = 0, _d = operationSpec.queryParameters; _c < _d.length; _c++) { + queryParameter = _d[_c]; queryParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, queryParameter, operationSpec.serializer); if (queryParameterValue !== undefined && queryParameterValue !== null) { - queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter)); + queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter), serializerOptions); if (queryParameter.collectionFormat !== undefined && queryParameter.collectionFormat !== null) { if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Multi) { if (queryParameterValue.length === 0) { - queryParameterValue = ""; + // The collection is empty, no need to try serializing the current queryParam + continue; } else { for (index in queryParameterValue) { @@ -59669,16 +64295,16 @@ var ServiceClient = /** @class */ (function () { httpRequest.headers.set("Content-Type", contentType); } if (operationSpec.headerParameters) { - for (_d = 0, _e = operationSpec.headerParameters; _d < _e.length; _d++) { - headerParameter = _e[_d]; + for (_e = 0, _f = operationSpec.headerParameters; _e < _f.length; _e++) { + headerParameter = _f[_e]; headerValue = getOperationArgumentValueFromParameter(this, operationArguments, headerParameter, operationSpec.serializer); if (headerValue !== undefined && headerValue !== null) { - headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter)); + headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter), serializerOptions); headerCollectionPrefix = headerParameter.mapper .headerCollectionPrefix; if (headerCollectionPrefix) { - for (_f = 0, _g = Object.keys(headerValue); _f < _g.length; _f++) { - key = _g[_f]; + for (_g = 0, _h = Object.keys(headerValue); _g < _h.length; _g++) { + key = _h[_g]; httpRequest.headers.set(headerCollectionPrefix + key, headerValue[key]); } } @@ -59722,15 +64348,15 @@ var ServiceClient = /** @class */ (function () { } rawResponse = void 0; sendRequestError = void 0; - _h.label = 2; + _j.label = 2; case 2: - _h.trys.push([2, 4, , 5]); + _j.trys.push([2, 4, , 5]); return [4 /*yield*/, this.sendRequest(httpRequest)]; case 3: - rawResponse = _h.sent(); + rawResponse = _j.sent(); return [3 /*break*/, 5]; case 4: - error_1 = _h.sent(); + error_1 = _j.sent(); sendRequestError = error_1; return [3 /*break*/, 5]; case 5: @@ -59746,7 +64372,7 @@ var ServiceClient = /** @class */ (function () { } return [3 /*break*/, 7]; case 6: - error_2 = _h.sent(); + error_2 = _j.sent(); result = Promise.reject(error_2); return [3 /*break*/, 7]; case 7: @@ -59765,29 +64391,42 @@ var ServiceClient = /** @class */ (function () { return ServiceClient; }()); function serializeRequestBody(serviceClient, httpRequest, operationArguments, operationSpec) { - var _a; + var _a, _b, _c, _d, _e, _f; + var serializerOptions = (_b = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions) !== null && _b !== void 0 ? _b : {}; + var updatedOptions = { + rootName: (_c = serializerOptions.rootName) !== null && _c !== void 0 ? _c : "", + includeRoot: (_d = serializerOptions.includeRoot) !== null && _d !== void 0 ? _d : false, + xmlCharKey: (_e = serializerOptions.xmlCharKey) !== null && _e !== void 0 ? _e : XML_CHARKEY + }; + var xmlCharKey = serializerOptions.xmlCharKey; if (operationSpec.requestBody && operationSpec.requestBody.mapper) { httpRequest.body = getOperationArgumentValueFromParameter(serviceClient, operationArguments, operationSpec.requestBody, operationSpec.serializer); var bodyMapper = operationSpec.requestBody.mapper; - var required = bodyMapper.required, xmlName = bodyMapper.xmlName, xmlElementName = bodyMapper.xmlElementName, serializedName = bodyMapper.serializedName; + var required = bodyMapper.required, xmlName = bodyMapper.xmlName, xmlElementName = bodyMapper.xmlElementName, serializedName = bodyMapper.serializedName, xmlNamespace = bodyMapper.xmlNamespace, xmlNamespacePrefix = bodyMapper.xmlNamespacePrefix; var typeName = bodyMapper.type.name; try { if ((httpRequest.body !== undefined && httpRequest.body !== null) || required) { var requestBodyParameterPathString = getPathStringFromParameter(operationSpec.requestBody); - httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString); + httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString, updatedOptions); var isStream = typeName === MapperType.Stream; if (operationSpec.isXML) { + var xmlnsKey = xmlNamespacePrefix ? "xmlns:" + xmlNamespacePrefix : "xmlns"; + var value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, httpRequest.body, updatedOptions); if (typeName === MapperType.Sequence) { - httpRequest.body = stringifyXML(prepareXMLRootList(httpRequest.body, xmlElementName || xmlName || serializedName), { rootName: xmlName || serializedName }); + httpRequest.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { + rootName: xmlName || serializedName, + xmlCharKey: xmlCharKey + }); } else if (!isStream) { - httpRequest.body = stringifyXML(httpRequest.body, { - rootName: xmlName || serializedName + httpRequest.body = stringifyXML(value, { + rootName: xmlName || serializedName, + xmlCharKey: xmlCharKey }); } } else if (typeName === MapperType.String && - (((_a = operationSpec.contentType) === null || _a === void 0 ? void 0 : _a.match("text/plain")) || operationSpec.mediaType === "text")) { + (((_f = operationSpec.contentType) === null || _f === void 0 ? void 0 : _f.match("text/plain")) || operationSpec.mediaType === "text")) { // the String serializer has validated that request body is a string // so just send the string. return; @@ -59803,16 +64442,31 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op } else if (operationSpec.formDataParameters && operationSpec.formDataParameters.length > 0) { httpRequest.formData = {}; - for (var _i = 0, _b = operationSpec.formDataParameters; _i < _b.length; _i++) { - var formDataParameter = _b[_i]; + for (var _i = 0, _g = operationSpec.formDataParameters; _i < _g.length; _i++) { + var formDataParameter = _g[_i]; var formDataParameterValue = getOperationArgumentValueFromParameter(serviceClient, operationArguments, formDataParameter, operationSpec.serializer); if (formDataParameterValue !== undefined && formDataParameterValue !== null) { var formDataParameterPropertyName = formDataParameter.mapper.serializedName || getPathStringFromParameter(formDataParameter); - httpRequest.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter)); + httpRequest.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) { + var _a; + // 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)) { + var result = {}; + result[options.xmlCharKey] = serializedValue; + result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = xmlNamespace, _a); + return result; + } + return serializedValue; +} function getValueOrFunctionResult(value, defaultValueCreator) { var result; if (typeof value === "string") { @@ -59855,6 +64509,9 @@ function createDefaultRequestPolicyFactories(authPolicyFactory, options) { } function createPipelineFromOptions(pipelineOptions, authPolicyFactory) { var requestPolicyFactories = []; + if (pipelineOptions.sendStreamingJson) { + requestPolicyFactories.push(ndJsonPolicy()); + } var userAgentValue = undefined; if (pipelineOptions.userAgentOptions && pipelineOptions.userAgentOptions.userAgentPrefix) { var userAgentInfo = []; @@ -59895,10 +64552,12 @@ function getOperationArgumentValueFromParameter(serviceClient, operationArgument return getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameter.parameterPath, parameter.mapper, serializer); } function getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameterPath, parameterMapper, serializer) { + var _a; var value; if (typeof parameterPath === "string") { parameterPath = [parameterPath]; } + var serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions; if (Array.isArray(parameterPath)) { if (parameterPath.length > 0) { if (parameterMapper.isConstant) { @@ -59919,7 +64578,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu } // Serialize just for validation purposes. var parameterPathString = getPathStringFromParameterPath(parameterPath, parameterMapper); - serializer.serialize(parameterMapper, value, parameterPathString); + serializer.serialize(parameterMapper, value, parameterPathString, serializerOptions); } } else { @@ -59932,7 +64591,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu var propertyValue = getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, propertyPath, propertyMapper, serializer); // Serialize just for validation purposes. var propertyPathString = getPathStringFromParameterPath(propertyPath, propertyMapper); - serializer.serialize(propertyMapper, propertyValue, propertyPathString); + serializer.serialize(propertyMapper, propertyValue, propertyPathString, serializerOptions); if (propertyValue !== undefined && propertyValue !== null) { if (!value) { value = {}; @@ -60006,6 +64665,46 @@ function flattenResponse(_response, responseSpec) { } return addOperationResponse(tslib.__assign(tslib.__assign({}, parsedHeaders), _response.parsedBody)); } +function getCredentialScopes(options, baseUri) { + if (options === null || options === void 0 ? void 0 : options.credentialScopes) { + var scopes = options.credentialScopes; + return Array.isArray(scopes) + ? scopes.map(function (scope) { return new url.URL(scope).toString(); }) + : new url.URL(scopes).toString(); + } + if (baseUri) { + return baseUri + "/.default"; + } + return undefined; +} + +// Copyright (c) Microsoft Corporation. +/** + * Creates a function called createSpan to create spans using the global tracer. + * @ignore + * @param spanConfig The name of the operation being performed. + * @param tracingOptions The options for the underlying http request. + */ +function createSpanFunction(_a) { + var packagePrefix = _a.packagePrefix, namespace = _a.namespace; + return function (operationName, operationOptions) { + var tracer = coreTracing.getTracer(); + var tracingOptions = operationOptions.tracingOptions || {}; + var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL }); + var span = tracer.startSpan(packagePrefix + "." + operationName, spanOptions); + span.setAttribute("az.namespace", namespace); + var newSpanOptions = tracingOptions.spanOptions || {}; + if (span.isRecording()) { + newSpanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": namespace }) }); + } + var newTracingOptions = tslib.__assign(tslib.__assign({}, tracingOptions), { spanOptions: newSpanOptions }); + var newOperationOptions = tslib.__assign(tslib.__assign({}, operationOptions), { tracingOptions: newTracingOptions }); + return { + span: span, + updatedOptions: newOperationOptions + }; + }; +} // Copyright (c) Microsoft Corporation. var HeaderConstants = Constants.HeaderConstants; @@ -60133,16 +64832,14 @@ Object.defineProperty(exports, 'isTokenCredential', { return coreAuth.isTokenCredential; } }); +exports.AccessTokenRefresher = AccessTokenRefresher; exports.ApiKeyCredentials = ApiKeyCredentials; exports.BaseRequestPolicy = BaseRequestPolicy; exports.BasicAuthenticationCredentials = BasicAuthenticationCredentials; -exports.BearerTokenAuthenticationPolicy = BearerTokenAuthenticationPolicy; exports.Constants = Constants; exports.DefaultHttpClient = NodeFetchHttpClient; -exports.DisableResponseDecompressionPolicy = DisableResponseDecompressionPolicy; exports.ExpiringAccessTokenCache = ExpiringAccessTokenCache; exports.HttpHeaders = HttpHeaders; -exports.KeepAlivePolicy = KeepAlivePolicy; exports.MapperType = MapperType; exports.RequestPolicyOptions = RequestPolicyOptions; exports.RestError = RestError; @@ -60152,9 +64849,12 @@ exports.TopicCredentials = TopicCredentials; exports.URLBuilder = URLBuilder; exports.URLQuery = URLQuery; exports.WebResource = WebResource; +exports.XML_ATTRKEY = XML_ATTRKEY; +exports.XML_CHARKEY = XML_CHARKEY; exports.applyMixins = applyMixins; exports.bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy; exports.createPipelineFromOptions = createPipelineFromOptions; +exports.createSpanFunction = createSpanFunction; exports.delay = delay; exports.deserializationPolicy = deserializationPolicy; exports.deserializeResponseBody = deserializeResponseBody; diff --git a/dist/run/index.js b/dist/run/index.js index 1846984d8d..60664238cf 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -350,8 +350,8 @@ function copyFile(srcFile, destFile, force) { "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -366,6 +366,7 @@ function copyFile(srcFile, destFile, force) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultGetter = void 0; /** * Default getter which just does a simple property access. Returns * undefined if the key is not set. @@ -1482,7 +1483,9 @@ function resolvePaths(patterns) { try { for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { const file = _d.value; - const relativeFile = path.relative(workspace, file); + const relativeFile = path + .relative(workspace, file) + .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); core.debug(`Matched: ${relativeFile}`); // Paths are made relative so the tar entries are all relative to the root of the workspace. paths.push(`${relativeFile}`); @@ -1647,14 +1650,13 @@ module.exports = eval("require")("encoding"); /***/ }), /* 20 */, -/* 21 */, -/* 22 */ +/* 21 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1669,33 +1671,38 @@ module.exports = eval("require")("encoding"); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const getter_1 = __webpack_require__(2); -const NoopHttpTextPropagator_1 = __webpack_require__(744); -const setter_1 = __webpack_require__(553); -const context_1 = __webpack_require__(492); -const contextApi = context_1.ContextAPI.getInstance(); +exports.PropagationAPI = void 0; +var getter_1 = __webpack_require__(2); +var NoopHttpTextPropagator_1 = __webpack_require__(744); +var setter_1 = __webpack_require__(553); +var context_1 = __webpack_require__(492); +var global_utils_1 = __webpack_require__(976); +var contextApi = context_1.ContextAPI.getInstance(); /** * Singleton object which represents the entry point to the OpenTelemetry Propagation API */ -class PropagationAPI { +var PropagationAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._propagator = NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR; + function PropagationAPI() { } /** Get the singleton instance of the Propagator API */ - static getInstance() { + PropagationAPI.getInstance = function () { if (!this._instance) { this._instance = new PropagationAPI(); } return this._instance; - } + }; /** * Set the current propagator. Returns the initialized propagator */ - setGlobalPropagator(propagator) { - this._propagator = propagator; + PropagationAPI.prototype.setGlobalPropagator = function (propagator) { + if (global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) { + // global propagator has already been set + return this._getGlobalPropagator(); + } + global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, propagator, NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); return propagator; - } + }; /** * Inject context into a carrier to be propagated inter-process * @@ -1703,9 +1710,11 @@ class PropagationAPI { * @param setter Function used to set values on the carrier * @param context Context carrying tracing data to inject. Defaults to the currently active context. */ - inject(carrier, setter = setter_1.defaultSetter, context = contextApi.active()) { - return this._propagator.inject(context, carrier, setter); - } + PropagationAPI.prototype.inject = function (carrier, setter, context) { + if (setter === void 0) { setter = setter_1.defaultSetter; } + if (context === void 0) { context = contextApi.active(); } + return this._getGlobalPropagator().inject(context, carrier, setter); + }; /** * Extract context from a carrier * @@ -1713,163 +1722,709 @@ class PropagationAPI { * @param getter Function used to extract keys from a carrier * @param context Context which the newly created context will inherit from. Defaults to the currently active context. */ - extract(carrier, getter = getter_1.defaultGetter, context = contextApi.active()) { - return this._propagator.extract(context, carrier, getter); - } -} + PropagationAPI.prototype.extract = function (carrier, getter, context) { + if (getter === void 0) { getter = getter_1.defaultGetter; } + if (context === void 0) { context = contextApi.active(); } + return this._getGlobalPropagator().extract(context, carrier, getter); + }; + /** Remove the global propagator */ + PropagationAPI.prototype.disable = function () { + delete global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]; + }; + PropagationAPI.prototype._getGlobalPropagator = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); + }; + return PropagationAPI; +}()); exports.PropagationAPI = PropagationAPI; //# sourceMappingURL=propagation.js.map /***/ }), -/* 23 */, -/* 24 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _default = '00000000-0000-0000-0000-000000000000'; -exports.default = _default; - -/***/ }), -/* 25 */, -/* 26 */, -/* 27 */, -/* 28 */, -/* 29 */, -/* 30 */, -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { +/* 22 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - 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) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", { value: true }); -const semver = __importStar(__webpack_require__(864)); -const core_1 = __webpack_require__(470); -// needs to be require for core node modules to be mocked -/* eslint @typescript-eslint/no-require-imports: 0 */ -const os = __webpack_require__(87); -const cp = __webpack_require__(129); -const fs = __webpack_require__(747); -function _findMatch(versionSpec, stable, candidates, archFilter) { - return __awaiter(this, void 0, void 0, function* () { - const platFilter = os.platform(); - let result; - let match; - let file; - for (const candidate of candidates) { - const version = candidate.version; - core_1.debug(`check ${version} satisfies ${versionSpec}`); - if (semver.satisfies(version, versionSpec) && - (!stable || candidate.stable === stable)) { - file = candidate.files.find(item => { - core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); - let chk = item.arch === archFilter && item.platform === platFilter; - if (chk && item.platform_version) { - const osVersion = module.exports._getOsVersion(); - if (osVersion === item.platform_version) { - chk = true; - } - else { - chk = semver.satisfies(osVersion, item.platform_version); - } +const http = __webpack_require__(605); +const https = __webpack_require__(211); +const pm = __webpack_require__(618); +let tunnel; +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + let proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return new Promise(async (resolve, reject) => { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + let parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + } + get(requestUrl, additionalHeaders) { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + } + del(requestUrl, additionalHeaders) { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + } + post(requestUrl, data, additionalHeaders) { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + } + patch(requestUrl, data, additionalHeaders) { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + } + put(requestUrl, data, additionalHeaders) { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + } + head(requestUrl, additionalHeaders) { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return this.request(verb, requestUrl, stream, additionalHeaders); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + async getJson(requestUrl, additionalHeaders = {}) { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + let res = await this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async postJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async putJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async patchJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + async request(verb, requestUrl, data, headers) { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + let parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + while (numTries < maxTries) { + response = await this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (let i = 0; i < this.handlers.length; i++) { + if (this.handlers[i].canHandleAuthentication(response)) { + authenticationHandler = this.handlers[i]; + break; } - return chk; - }); - if (file) { - core_1.debug(`matched ${candidate.version}`); - match = candidate; + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't break; } + let parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol == 'https:' && + parsedUrl.protocol != parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + await response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (let header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = await this.requestRaw(info, data); + redirectsRemaining--; + } + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + await response.readBody(); + await this._performExponentialBackoff(numTries); } } - if (match && file) { - // clone since we're mutating the file list to be only the file that matches - result = Object.assign({}, match); - result.files = [file]; + return response; + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); } - return result; - }); -} -exports._findMatch = _findMatch; -function _getOsVersion() { - // TODO: add windows and other linux, arm variants - // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python) - const plat = os.platform(); - let version = ''; - if (plat === 'darwin') { - version = cp.execSync('sw_vers -productVersion').toString(); + this._disposed = true; } - else if (plat === 'linux') { - // lsb_release process not in some containers, readfile - // Run cat /etc/lsb-release - // DISTRIB_ID=Ubuntu - // DISTRIB_RELEASE=18.04 - // DISTRIB_CODENAME=bionic - // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" - const lsbContents = module.exports._readLinuxVersionFile(); - if (lsbContents) { - const lines = lsbContents.split('\n'); - for (const line of lines) { - const parts = line.split('='); - if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') { - version = parts[1].trim(); - break; + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return new Promise((resolve, reject) => { + let callbackForResult = function (err, res) { + if (err) { + reject(err); } + resolve(res); + }; + this.requestRawWithCallback(info, data, callbackForResult); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + let socket; + if (typeof data === 'string') { + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + let handleResult = (err, res) => { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + }; + let req = info.httpModule.request(info.options, (msg) => { + let res = new HttpClientResponse(msg); + handleResult(null, res); + }); + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); } + handleResult(new Error('Request timeout: ' + info.options.path), null); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err, null); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); } } - return version; -} -exports._getOsVersion = _getOsVersion; -function _readLinuxVersionFile() { - const lsbFile = '/etc/lsb-release'; - let contents = ''; - if (fs.existsSync(lsbFile)) { - contents = fs.readFileSync(lsbFile).toString(); + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + let parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); } - return contents; -} -exports._readLinuxVersionFile = _readLinuxVersionFile; -//# sourceMappingURL=manifest.js.map - -/***/ }), -/* 32 */, -/* 33 */, -/* 34 */, -/* 35 */, -/* 36 */, -/* 37 */, -/* 38 */, -/* 39 */, -/* 40 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/*! - * Copyright 2019, OpenTelemetry Authors - * + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + this.handlers.forEach(handler => { + handler.prepareRequest(info.options); + }); + } + return info; + } + _mergeHeaders(headers) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + let proxyUrl = pm.getProxyUrl(parsedUrl); + let useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (!!agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (!!this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + if (useProxy) { + // If using proxy, need tunnel + if (!tunnel) { + tunnel = __webpack_require__(413); + } + const agentOptions = { + maxSockets: maxSockets, + keepAlive: this._keepAlive, + proxy: { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`, + host: proxyUrl.hostname, + port: proxyUrl.port + } + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + } + static dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + let a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + async _processResponse(res, options) { + return new Promise(async (resolve, reject) => { + const statusCode = res.message.statusCode; + const response = { + statusCode: statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode == HttpCodes.NotFound) { + resolve(response); + } + let obj; + let contents; + // get the result from the body + try { + contents = await res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = 'Failed request: (' + statusCode + ')'; + } + let err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + }); + } +} +exports.HttpClient = HttpClient; + + +/***/ }), +/* 23 */, +/* 24 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports.default = _default; + +/***/ }), +/* 25 */, +/* 26 */, +/* 27 */, +/* 28 */, +/* 29 */, +/* 30 */, +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const semver = __importStar(__webpack_require__(864)); +const core_1 = __webpack_require__(470); +// needs to be require for core node modules to be mocked +/* eslint @typescript-eslint/no-require-imports: 0 */ +const os = __webpack_require__(87); +const cp = __webpack_require__(129); +const fs = __webpack_require__(747); +function _findMatch(versionSpec, stable, candidates, archFilter) { + return __awaiter(this, void 0, void 0, function* () { + const platFilter = os.platform(); + let result; + let match; + let file; + for (const candidate of candidates) { + const version = candidate.version; + core_1.debug(`check ${version} satisfies ${versionSpec}`); + if (semver.satisfies(version, versionSpec) && + (!stable || candidate.stable === stable)) { + file = candidate.files.find(item => { + core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); + let chk = item.arch === archFilter && item.platform === platFilter; + if (chk && item.platform_version) { + const osVersion = module.exports._getOsVersion(); + if (osVersion === item.platform_version) { + chk = true; + } + else { + chk = semver.satisfies(osVersion, item.platform_version); + } + } + return chk; + }); + if (file) { + core_1.debug(`matched ${candidate.version}`); + match = candidate; + break; + } + } + } + if (match && file) { + // clone since we're mutating the file list to be only the file that matches + result = Object.assign({}, match); + result.files = [file]; + } + return result; + }); +} +exports._findMatch = _findMatch; +function _getOsVersion() { + // TODO: add windows and other linux, arm variants + // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python) + const plat = os.platform(); + let version = ''; + if (plat === 'darwin') { + version = cp.execSync('sw_vers -productVersion').toString(); + } + else if (plat === 'linux') { + // lsb_release process not in some containers, readfile + // Run cat /etc/lsb-release + // DISTRIB_ID=Ubuntu + // DISTRIB_RELEASE=18.04 + // DISTRIB_CODENAME=bionic + // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" + const lsbContents = module.exports._readLinuxVersionFile(); + if (lsbContents) { + const lines = lsbContents.split('\n'); + for (const line of lines) { + const parts = line.split('='); + if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') { + version = parts[1].trim(); + break; + } + } + } + } + return version; +} +exports._getOsVersion = _getOsVersion; +function _readLinuxVersionFile() { + const lsbFile = '/etc/lsb-release'; + let contents = ''; + if (fs.existsSync(lsbFile)) { + contents = fs.readFileSync(lsbFile).toString(); + } + return contents; +} +exports._readLinuxVersionFile = _readLinuxVersionFile; +//# sourceMappingURL=manifest.js.map + +/***/ }), +/* 32 */, +/* 33 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -1883,6 +2438,22 @@ exports._readLinuxVersionFile = _readLinuxVersionFile; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=HttpTextPropagator.js.map + +/***/ }), +/* 34 */, +/* 35 */, +/* 36 */, +/* 37 */, +/* 38 */, +/* 39 */, +/* 40 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EntryTtl = void 0; /** * EntryTtl is an integer that represents number of hops an entry can propagate. * @@ -1908,8 +2479,8 @@ var EntryTtl; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1924,6 +2495,7 @@ var EntryTtl; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueType = void 0; /** The Type of value. It describes how the data is reported. */ var ValueType; (function (ValueType) { @@ -1936,30 +2508,7 @@ var ValueType; /* 44 */, /* 45 */, /* 46 */, -/* 47 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map - -/***/ }), +/* 47 */, /* 48 */, /* 49 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -2068,12 +2617,13 @@ const parseVersion = (s) => { patch: match[3] === undefined ? null : parseInt(match[3]), }; }; -exports.stringifyVersion = (v) => { +const stringifyVersion = (v) => { if (v == null) { return "latest"; } return `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}`; }; +exports.stringifyVersion = stringifyVersion; const minVersion = { major: 1, minor: 28, @@ -2157,49 +2707,7 @@ exports.findLintVersion = findLintVersion; /***/ }), -/* 53 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -const context_1 = __webpack_require__(560); -class NoopContextManager { - active() { - return context_1.Context.ROOT_CONTEXT; - } - with(context, fn) { - return fn(); - } - bind(target, context) { - return target; - } - enable() { - return this; - } - disable() { - return this; - } -} -exports.NoopContextManager = NoopContextManager; -//# sourceMappingURL=NoopContextManager.js.map - -/***/ }), +/* 53 */, /* 54 */, /* 55 */, /* 56 */, @@ -2233,7 +2741,15 @@ exports.NoopContextManager = NoopContextManager; /* 67 */, /* 68 */, /* 69 */, -/* 70 */, +/* 70 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=trace_state.js.map + +/***/ }), /* 71 */ /***/ (function() { @@ -3458,12 +3974,7 @@ function regExpEscape (s) { /***/ }), /* 94 */, -/* 95 */, -/* 96 */, -/* 97 */, -/* 98 */, -/* 99 */, -/* 100 */ +/* 95 */ /***/ (function(__unusedmodule, exports) { "use strict"; @@ -3487,6 +3998,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=link.js.map /***/ }), +/* 96 */, +/* 97 */, +/* 98 */, +/* 99 */, +/* 100 */, /* 101 */, /* 102 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -3855,490 +4371,33 @@ exports.AbortSignal = AbortSignal; /***/ }), -/* 107 */, -/* 108 */, -/* 109 */ +/* 107 */ /***/ (function(__unusedmodule, exports) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Time.js.map - -/***/ }), -/* 110 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; -/*! - * Copyright (c) Microsoft and contributors. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Azure Core LRO SDK for JavaScript - 1.0.2 - */ - - -Object.defineProperty(exports, '__esModule', { value: true }); - -var tslib = __webpack_require__(422); - -// Copyright (c) Microsoft Corporation. -/** - * When a poller is manually stopped through the `stopPolling` method, - * the poller will be rejected with an instance of the PollerStoppedError. - */ -var PollerStoppedError = /** @class */ (function (_super) { - tslib.__extends(PollerStoppedError, _super); - function PollerStoppedError(message) { - var _this = _super.call(this, message) || this; - _this.name = "PollerStoppedError"; - Object.setPrototypeOf(_this, PollerStoppedError.prototype); - return _this; - } - return PollerStoppedError; -}(Error)); -/** - * When a poller is cancelled through the `cancelOperation` method, - * the poller will be rejected with an instance of the PollerCancelledError. - */ -var PollerCancelledError = /** @class */ (function (_super) { - tslib.__extends(PollerCancelledError, _super); - function PollerCancelledError(message) { - var _this = _super.call(this, message) || this; - _this.name = "PollerCancelledError"; - Object.setPrototypeOf(_this, PollerCancelledError.prototype); - return _this; - } - return PollerCancelledError; -}(Error)); -/** - * A class that represents the definition of a program that polls through consecutive requests - * until it reaches a state of completion. - * - * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. - * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. - * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. - * - * ```ts - * const poller = new MyPoller(); - * - * // Polling just once: - * await poller.poll(); - * - * // We can try to cancel the request here, by calling: - * // - * // await poller.cancelOperation(); - * // - * - * // Getting the final result: - * const result = await poller.pollUntilDone(); - * ``` - * - * The Poller is defined by two types, a type representing the state of the poller, which - * must include a basic set of properties from `PollOperationState`, - * and a return type defined by `TResult`, which can be anything. - * - * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having - * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. - * - * ```ts - * class Client { - * public async makePoller: PollerLike { - * const poller = new MyPoller({}); - * // It might be preferred to return the poller after the first request is made, - * // so that some information can be obtained right away. - * await poller.poll(); - * return poller; - * } - * } - * - * const poller: PollerLike = myClient.makePoller(); - * ``` - * - * A poller can be created through its constructor, then it can be polled until it's completed. - * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. - * At any point in time, the intermediate forms of the result type can be requested without delay. - * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. - * - * ```ts - * const poller = myClient.makePoller(); - * const state: MyOperationState = poller.getOperationState(); +/* + * Copyright The OpenTelemetry Authors * - * // The intermediate result can be obtained at any time. - * const result: MyResult | undefined = poller.getResult(); + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * // The final result can only be obtained after the poller finishes. - * const result: MyResult = await poller.pollUntilDone(); - * ``` + * https://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ -var Poller = /** @class */ (function () { - /** - * A poller needs to be initialized by passing in at least the basic properties of the PollOperation. - * - * When writing an implementation of a Poller, this implementation needs to deal with the initialization - * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's - * operation has already been defined, at least its basic properties. The code below shows how to approach - * the definition of the constructor of a new custom poller. - * - * ```ts - * export class MyPoller extends Poller { - * constructor({ - * // Anything you might need outside of the basics - * }) { - * let state: MyOperationState = { - * privateProperty: private, - * publicProperty: public, - * }; - * - * const operation = { - * state, - * update, - * cancel, - * toString - * } - * - * // Sending the operation to the parent's constructor. - * super(operation); - * - * // You can assign more local properties here. - * } - * } - * ``` - * - * Inside of this constructor, a new promise is created. This will be used to - * tell the user when the poller finishes (see `pollUntilDone()`). The promise's - * resolve and reject methods are also used internally to control when to resolve - * or reject anyone waiting for the poller to finish. - * - * The constructor of a custom implementation of a poller is where any serialized version of - * a previous poller's operation should be deserialized into the operation sent to the - * base constructor. For example: - * - * ```ts - * export class MyPoller extends Poller { - * constructor( - * baseOperation: string | undefined - * ) { - * let state: MyOperationState = {}; - * if (baseOperation) { - * state = { - * ...JSON.parse(baseOperation).state, - * ...state - * }; - * } - * const operation = { - * state, - * // ... - * } - * super(operation); - * } - * } - * ``` - * - * @param operation Must contain the basic properties of PollOperation. - */ - function Poller(operation) { - var _this = this; - this.stopped = true; - this.pollProgressCallbacks = []; - this.operation = operation; - this.promise = new Promise(function (resolve, reject) { - _this.resolve = resolve; - _this.reject = reject; - }); - // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. - // The above warning would get thrown if `poller.poll` is called, it returns an error, - // and pullUntilDone did not have a .catch or await try/catch on it's return value. - this.promise.catch(function () { }); - } - /** - * @internal - * @ignore - * Starts a loop that will break only if the poller is done - * or if the poller is stopped. - */ - Poller.prototype.startPolling = function () { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - if (this.stopped) { - this.stopped = false; - } - _a.label = 1; - case 1: - if (!(!this.isStopped() && !this.isDone())) return [3 /*break*/, 4]; - return [4 /*yield*/, this.poll()]; - case 2: - _a.sent(); - return [4 /*yield*/, this.delay()]; - case 3: - _a.sent(); - return [3 /*break*/, 1]; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * @internal - * @ignore - * pollOnce does one polling, by calling to the update method of the underlying - * poll operation to make any relevant change effective. - * - * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. - * - * @param options Optional properties passed to the operation's update method. - */ - Poller.prototype.pollOnce = function (options) { - if (options === void 0) { options = {}; } - return tslib.__awaiter(this, void 0, void 0, function () { - var state, _a, e_1; - return tslib.__generator(this, function (_b) { - switch (_b.label) { - case 0: - state = this.operation.state; - _b.label = 1; - case 1: - _b.trys.push([1, 4, , 5]); - if (!!this.isDone()) return [3 /*break*/, 3]; - _a = this; - return [4 /*yield*/, this.operation.update({ - abortSignal: options.abortSignal, - fireProgress: this.fireProgress.bind(this) - })]; - case 2: - _a.operation = _b.sent(); - if (this.isDone() && this.resolve) { - this.resolve(state.result); - } - _b.label = 3; - case 3: return [3 /*break*/, 5]; - case 4: - e_1 = _b.sent(); - state.error = e_1; - if (this.reject) { - this.reject(e_1); - } - throw e_1; - case 5: return [2 /*return*/]; - } - }); - }); - }; - /** - * @internal - * @ignore - * fireProgress calls the functions passed in via onProgress the method of the poller. - * - * It loops over all of the callbacks received from onProgress, and executes them, sending them - * the current operation state. - * - * @param state The current operation state. - */ - Poller.prototype.fireProgress = function (state) { - for (var _i = 0, _a = this.pollProgressCallbacks; _i < _a.length; _i++) { - var callback = _a[_i]; - callback(state); - } - }; - /** - * @internal - * @ignore - * Invokes the underlying operation's cancel method, and rejects the - * pollUntilDone promise. - */ - Poller.prototype.cancelOnce = function (options) { - if (options === void 0) { options = {}; } - return tslib.__awaiter(this, void 0, void 0, function () { - var _a; - return tslib.__generator(this, function (_b) { - switch (_b.label) { - case 0: - _a = this; - return [4 /*yield*/, this.operation.cancel(options)]; - case 1: - _a.operation = _b.sent(); - if (this.reject) { - this.reject(new PollerCancelledError("Poller cancelled")); - } - return [2 /*return*/]; - } - }); - }); - }; - /** - * Returns a promise that will resolve once a single polling request finishes. - * It does this by calling the update method of the Poller's operation. - * - * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. - * - * @param options Optional properties passed to the operation's update method. - */ - Poller.prototype.poll = function (options) { - var _this = this; - if (options === void 0) { options = {}; } - if (!this.pollOncePromise) { - this.pollOncePromise = this.pollOnce(options); - var clearPollOncePromise = function () { - _this.pollOncePromise = undefined; - }; - this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise); - } - return this.pollOncePromise; - }; - /** - * Returns a promise that will resolve once the underlying operation is completed. - */ - Poller.prototype.pollUntilDone = function () { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - if (this.stopped) { - this.startPolling().catch(this.reject); - } - return [2 /*return*/, this.promise]; - }); - }); - }; - /** - * Invokes the provided callback after each polling is completed, - * sending the current state of the poller's operation. - * - * It returns a method that can be used to stop receiving updates on the given callback function. - */ - Poller.prototype.onProgress = function (callback) { - var _this = this; - this.pollProgressCallbacks.push(callback); - return function () { - _this.pollProgressCallbacks = _this.pollProgressCallbacks.filter(function (c) { return c !== callback; }); - }; - }; - /** - * Returns true if the poller has finished polling. - */ - Poller.prototype.isDone = function () { - var state = this.operation.state; - return Boolean(state.isCompleted || state.isCancelled || state.error); - }; - /** - * Stops the poller from continuing to poll. - */ - Poller.prototype.stopPolling = function () { - if (!this.stopped) { - this.stopped = true; - if (this.reject) { - this.reject(new PollerStoppedError("This poller is already stopped")); - } - } - }; - /** - * Returns true if the poller is stopped. - */ - Poller.prototype.isStopped = function () { - return this.stopped; - }; - /** - * Attempts to cancel the underlying operation. - * - * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. - * - * If it's called again before it finishes, it will throw an error. - * - * @param options Optional properties passed to the operation's update method. - */ - Poller.prototype.cancelOperation = function (options) { - if (options === void 0) { options = {}; } - if (!this.stopped) { - this.stopped = true; - } - if (!this.cancelPromise) { - this.cancelPromise = this.cancelOnce(options); - } - else if (options.abortSignal) { - throw new Error("A cancel request is currently pending"); - } - return this.cancelPromise; - }; - /** - * Returns the state of the operation. - * - * Even though TState will be the same type inside any of the methods of any extension of the Poller class, - * implementations of the pollers can customize what's shared with the public by writing their own - * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller - * and a public type representing a safe to share subset of the properties of the internal state. - * Their definition of getOperationState can then return their public type. - * - * Example: - * - * ```ts - * // Let's say we have our poller's operation state defined as: - * interface MyOperationState extends PollOperationState { - * privateProperty?: string; - * publicProperty?: string; - * } - * - * // To allow us to have a true separation of public and private state, we have to define another interface: - * interface PublicState extends PollOperationState { - * publicProperty?: string; - * } - * - * // Then, we define our Poller as follows: - * export class MyPoller extends Poller { - * // ... More content is needed here ... - * - * public getOperationState(): PublicState { - * const state: PublicState = this.operation.state; - * return { - * // Properties from PollOperationState - * isStarted: state.isStarted, - * isCompleted: state.isCompleted, - * isCancelled: state.isCancelled, - * error: state.error, - * result: state.result, - * - * // The only other property needed by PublicState. - * publicProperty: state.publicProperty - * } - * } - * } - * ``` - * - * You can see this in the tests of this repository, go to the file: - * `../test/utils/testPoller.ts` - * and look for the getOperationState implementation. - */ - Poller.prototype.getOperationState = function () { - return this.operation.state; - }; - /** - * Returns the result value of the operation, - * regardless of the state of the poller. - * It can return undefined or an incomplete form of the final TResult value - * depending on the implementation. - */ - Poller.prototype.getResult = function () { - var state = this.operation.state; - return state.result; - }; - /** - * Returns a serialized version of the poller's operation - * by invoking the operation's toString method. - */ - Poller.prototype.toString = function () { - return this.operation.toString(); - }; - return Poller; -}()); - -exports.Poller = Poller; -exports.PollerCancelledError = PollerCancelledError; -exports.PollerStoppedError = PollerStoppedError; -//# sourceMappingURL=index.js.map - +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Observation.js.map /***/ }), +/* 108 */, +/* 109 */, +/* 110 */, /* 111 */, /* 112 */, /* 113 */, @@ -4365,8 +4424,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const http_client_1 = __webpack_require__(539); -const auth_1 = __webpack_require__(226); +const http_client_1 = __webpack_require__(22); +const auth_1 = __webpack_require__(733); const crypto = __importStar(__webpack_require__(417)); const fs = __importStar(__webpack_require__(747)); const url_1 = __webpack_require__(835); @@ -4490,9 +4549,12 @@ function uploadChunk(httpClient, resourceUrl, openStream, start, end) { 'Content-Type': 'application/octet-stream', 'Content-Range': getContentRange(start, end) }; - yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { + const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () { return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders); })); + if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) { + throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`); + } }); } function uploadFile(httpClient, cacheId, archivePath, options) { @@ -4872,39 +4934,16 @@ exports.realpath = function realpath(p, cache, cb) { /***/ }), /* 118 */, -/* 119 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Observation.js.map - -/***/ }), -/* 120 */, -/* 121 */, -/* 122 */, -/* 123 */, -/* 124 */, -/* 125 */, -/* 126 */, -/* 127 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 119 */, +/* 120 */, +/* 121 */, +/* 122 */, +/* 123 */, +/* 124 */, +/* 125 */, +/* 126 */, +/* 127 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -4980,8 +5019,8 @@ run_1.run(); "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -4996,42 +5035,53 @@ run_1.run(); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopMeterProvider_1 = __webpack_require__(450); +exports.MetricsAPI = void 0; +var NoopMeterProvider_1 = __webpack_require__(450); +var global_utils_1 = __webpack_require__(976); /** * Singleton object which represents the entry point to the OpenTelemetry Metrics API */ -class MetricsAPI { +var MetricsAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._meterProvider = NoopMeterProvider_1.NOOP_METER_PROVIDER; + function MetricsAPI() { } /** Get the singleton instance of the Metrics API */ - static getInstance() { + MetricsAPI.getInstance = function () { if (!this._instance) { this._instance = new MetricsAPI(); } return this._instance; - } + }; /** * Set the current global meter. Returns the initialized global meter provider. */ - setGlobalMeterProvider(provider) { - this._meterProvider = provider; + MetricsAPI.prototype.setGlobalMeterProvider = function (provider) { + if (global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) { + // global meter provider has already been set + return this.getMeterProvider(); + } + global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopMeterProvider_1.NOOP_METER_PROVIDER); return provider; - } + }; /** * Returns the global meter provider. */ - getMeterProvider() { - return this._meterProvider; - } + MetricsAPI.prototype.getMeterProvider = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopMeterProvider_1.NOOP_METER_PROVIDER); + }; /** * Returns a meter from the global meter provider. */ - getMeter(name, version) { + MetricsAPI.prototype.getMeter = function (name, version) { return this.getMeterProvider().getMeter(name, version); - } -} + }; + /** Remove the global meter provider */ + MetricsAPI.prototype.disable = function () { + delete global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]; + }; + return MetricsAPI; +}()); exports.MetricsAPI = MetricsAPI; //# sourceMappingURL=metrics.js.map @@ -5326,8 +5376,332 @@ exports.debug = debug; // for test /***/ }), /* 142 */, /* 143 */, -/* 144 */, -/* 145 */, +/* 144 */ +/***/ (function(module) { + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __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 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, 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 }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); + + +/***/ }), +/* 145 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports._globalThis = void 0; +/** only globals that common to node and browsers are allowed */ +// eslint-disable-next-line node/no-unsupported-features/es-builtins +exports._globalThis = typeof globalThis === 'object' ? globalThis : global; +//# sourceMappingURL=globalThis.js.map + +/***/ }), /* 146 */, /* 147 */ /***/ (function(__unusedmodule, exports) { @@ -6154,8 +6528,8 @@ module.exports.setGracefulCleanup = setGracefulCleanup; "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -6170,25 +6544,29 @@ module.exports.setGracefulCleanup = setGracefulCleanup; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopSpan_1 = __webpack_require__(767); +exports.NOOP_TRACER = exports.NoopTracer = void 0; +var NoopSpan_1 = __webpack_require__(767); /** * No-op implementations of {@link Tracer}. */ -class NoopTracer { - getCurrentSpan() { - return NoopSpan_1.NOOP_SPAN; +var NoopTracer = /** @class */ (function () { + function NoopTracer() { } + NoopTracer.prototype.getCurrentSpan = function () { + return NoopSpan_1.NOOP_SPAN; + }; // startSpan starts a noop span. - startSpan(name, options) { + NoopTracer.prototype.startSpan = function (name, options) { return NoopSpan_1.NOOP_SPAN; - } - withSpan(span, fn) { + }; + NoopTracer.prototype.withSpan = function (span, fn) { return fn(); - } - bind(target, span) { + }; + NoopTracer.prototype.bind = function (target, span) { return target; - } -} + }; + return NoopTracer; +}()); exports.NoopTracer = NoopTracer; exports.NOOP_TRACER = new NoopTracer(); //# sourceMappingURL=NoopTracer.js.map @@ -6392,7 +6770,15 @@ function runJob(iterator, key, item, callback) /***/ }), -/* 158 */, +/* 158 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Time.js.map + +/***/ }), /* 159 */, /* 160 */, /* 161 */, @@ -6401,8 +6787,8 @@ function runJob(iterator, key, item, callback) "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -6417,16 +6803,22 @@ function runJob(iterator, key, item, callback) * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopTracer_1 = __webpack_require__(151); +exports.NOOP_TRACER_PROVIDER = exports.NoopTracerProvider = void 0; +var NoopTracer_1 = __webpack_require__(151); /** - * An implementation of the {@link TracerProvider} which returns an impotent Tracer - * for all calls to `getTracer` + * An implementation of the {@link TracerProvider} which returns an impotent + * Tracer for all calls to `getTracer`. + * + * All operations are no-op. */ -class NoopTracerProvider { - getTracer(_name, _version) { - return NoopTracer_1.NOOP_TRACER; +var NoopTracerProvider = /** @class */ (function () { + function NoopTracerProvider() { } -} + NoopTracerProvider.prototype.getTracer = function (_name, _version) { + return NoopTracer_1.NOOP_TRACER; + }; + return NoopTracerProvider; +}()); exports.NoopTracerProvider = NoopTracerProvider; exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); //# sourceMappingURL=NoopTracerProvider.js.map @@ -6435,7 +6827,7 @@ exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); /* 163 */, /* 164 */, /* 165 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -6454,71 +6846,14 @@ exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); * See the License for the specific language governing permissions and * limitations under the License. */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(__webpack_require__(514), exports); -//# sourceMappingURL=index.js.map +//# sourceMappingURL=Plugin.js.map /***/ }), /* 166 */, /* 167 */, -/* 168 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=CorrelationContext.js.map - -/***/ }), -/* 169 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=ObserverResult.js.map - -/***/ }), +/* 168 */, +/* 169 */, /* 170 */, /* 171 */, /* 172 */, @@ -6533,7 +6868,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _rng = _interopRequireDefault(__webpack_require__(733)); +var _rng = _interopRequireDefault(__webpack_require__(944)); var _stringify = _interopRequireDefault(__webpack_require__(855)); @@ -6638,30 +6973,7 @@ exports.default = _default; /* 174 */, /* 175 */, /* 176 */, -/* 177 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=HttpTextPropagator.js.map - -/***/ }), +/* 177 */, /* 178 */, /* 179 */, /* 180 */ @@ -6899,14 +7211,64 @@ exports.postRun = postRun; /* 186 */, /* 187 */, /* 188 */, -/* 189 */, +/* 189 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=ObserverResult.js.map + +/***/ }), /* 190 */, /* 191 */, /* 192 */, /* 193 */, /* 194 */, /* 195 */, -/* 196 */, +/* 196 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RefKey = exports.Events = exports.State = exports.Inputs = void 0; +var Inputs; +(function (Inputs) { + Inputs["Key"] = "key"; + Inputs["Path"] = "path"; + Inputs["RestoreKeys"] = "restore-keys"; +})(Inputs = exports.Inputs || (exports.Inputs = {})); +var State; +(function (State) { + State["CachePrimaryKey"] = "CACHE_KEY"; + State["CacheMatchedKey"] = "CACHE_RESULT"; +})(State = exports.State || (exports.State = {})); +var Events; +(function (Events) { + Events["Key"] = "GITHUB_EVENT_NAME"; + Events["Push"] = "push"; + Events["PullRequest"] = "pull_request"; +})(Events = exports.Events || (exports.Events = {})); +exports.RefKey = "GITHUB_REF"; + + +/***/ }), /* 197 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -7007,10 +7369,8 @@ module.exports = require("punycode"); /* 217 */, /* 218 */, /* 219 */, -/* 220 */, -/* 221 */, -/* 222 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 220 */ +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -7030,118 +7390,15 @@ module.exports = require("punycode"); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_TRACER_PROVIDER = exports.NoopTracerProvider = void 0; -var NoopTracer_1 = __webpack_require__(980); -/** - * An implementation of the {@link TracerProvider} which returns an impotent - * Tracer for all calls to `getTracer`. - * - * All operations are no-op. - */ -var NoopTracerProvider = /** @class */ (function () { - function NoopTracerProvider() { - } - NoopTracerProvider.prototype.getTracer = function (_name, _version) { - return NoopTracer_1.NOOP_TRACER; - }; - return NoopTracerProvider; -}()); -exports.NoopTracerProvider = NoopTracerProvider; -exports.NOOP_TRACER_PROVIDER = new NoopTracerProvider(); -//# sourceMappingURL=NoopTracerProvider.js.map +//# sourceMappingURL=SpanOptions.js.map /***/ }), +/* 221 */, +/* 222 */, /* 223 */, /* 224 */, -/* 225 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Sampler.js.map - -/***/ }), -/* 226 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -class BasicCredentialHandler { - constructor(username, password) { - this.username = username; - this.password = password; - } - prepareRequest(options) { - options.headers['Authorization'] = - 'Basic ' + - Buffer.from(this.username + ':' + this.password).toString('base64'); - } - // This handler cannot handle 401 - canHandleAuthentication(response) { - return false; - } - handleAuthentication(httpClient, requestInfo, objs) { - return null; - } -} -exports.BasicCredentialHandler = BasicCredentialHandler; -class BearerCredentialHandler { - constructor(token) { - this.token = token; - } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - options.headers['Authorization'] = 'Bearer ' + this.token; - } - // This handler cannot handle 401 - canHandleAuthentication(response) { - return false; - } - handleAuthentication(httpClient, requestInfo, objs) { - return null; - } -} -exports.BearerCredentialHandler = BearerCredentialHandler; -class PersonalAccessTokenCredentialHandler { - constructor(token) { - this.token = token; - } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - options.headers['Authorization'] = - 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); - } - // This handler cannot handle 401 - canHandleAuthentication(response) { - return false; - } - handleAuthentication(httpClient, requestInfo, objs) { - return null; - } -} -exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; - - -/***/ }), +/* 225 */, +/* 226 */, /* 227 */, /* 228 */, /* 229 */ @@ -7220,14 +7477,8 @@ exports.isTokenCredential = isTokenCredential; /***/ }), /* 230 */, -/* 231 */, -/* 232 */, -/* 233 */, -/* 234 */, -/* 235 */, -/* 236 */, -/* 237 */ -/***/ (function(__unusedmodule, exports) { +/* 231 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -7246,10 +7497,29 @@ exports.isTokenCredential = isTokenCredential; * See the License for the specific language governing permissions and * limitations under the License. */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=BoundInstrument.js.map +__exportStar(__webpack_require__(328), exports); +__exportStar(__webpack_require__(715), exports); +__exportStar(__webpack_require__(924), exports); +//# sourceMappingURL=index.js.map /***/ }), +/* 232 */, +/* 233 */, +/* 234 */, +/* 235 */, +/* 236 */, +/* 237 */, /* 238 */ /***/ (function(__unusedmodule, exports) { @@ -7350,16 +7620,7 @@ function _default(name, version, hashfunc) { } /***/ }), -/* 242 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -__webpack_require__(71); - - -/***/ }), +/* 242 */, /* 243 */, /* 244 */, /* 245 */ @@ -7854,30 +8115,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 246 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=span.js.map - -/***/ }), +/* 246 */, /* 247 */, /* 248 */, /* 249 */, @@ -7905,7 +8143,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const http_client_1 = __webpack_require__(539); +const http_client_1 = __webpack_require__(22); const storage_blob_1 = __webpack_require__(373); const buffer = __importStar(__webpack_require__(293)); const fs = __importStar(__webpack_require__(747)); @@ -8983,9 +9221,9 @@ exports.Context = Context; Object.defineProperty(exports, '__esModule', { value: true }); var api = __webpack_require__(440); -var tslib = __webpack_require__(422); +var tslib = __webpack_require__(144); -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. /** * A no-op implementation of Span that can safely be used without side-effects. */ @@ -9056,7 +9294,7 @@ var NoOpSpan = /** @class */ (function () { return NoOpSpan; }()); -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. /** * A no-op implementation of Tracer that can be used when tracing * is disabled. @@ -9097,13 +9335,13 @@ var NoOpTracer = /** @class */ (function () { return NoOpTracer; }()); -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. function getGlobalObject() { return global; } -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // V1 = OpenTelemetry 0.1 // V2 = OpenTelemetry 0.2 // V3 = OpenTelemetry 0.6.1 @@ -9144,7 +9382,7 @@ function getCache() { return cache; } -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. var defaultTracer; function getDefaultTracer() { if (!defaultTracer) { @@ -9172,8 +9410,8 @@ function getTracer() { return cache.tracer; } -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. /** * @ignore * @internal @@ -9197,6 +9435,7 @@ var OpenCensusTraceStateWrapper = /** @class */ (function () { return OpenCensusTraceStateWrapper; }()); +// Copyright (c) Microsoft Corporation. function isWrappedSpan(span) { return !!span && span.getWrappedSpan !== undefined; } @@ -9306,6 +9545,7 @@ var OpenCensusSpanWrapper = /** @class */ (function () { return OpenCensusSpanWrapper; }()); +// Copyright (c) Microsoft Corporation. /** * An implementation of OpenTelemetry Tracer that wraps an OpenCensus Tracer. */ @@ -9356,6 +9596,7 @@ var OpenCensusTracerWrapper = /** @class */ (function () { return OpenCensusTracerWrapper; }()); +// Copyright (c) Microsoft Corporation. /** * A mock span useful for testing. */ @@ -9443,6 +9684,7 @@ var TestSpan = /** @class */ (function (_super) { return TestSpan; }(NoOpSpan)); +// Copyright (c) Microsoft Corporation. /** * A mock tracer useful for testing */ @@ -9563,8 +9805,8 @@ var TestTracer = /** @class */ (function (_super) { return TestTracer; }(NoOpTracer)); -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. var VERSION = "00"; /** * Generates a `SpanContext` given a `traceparent` header value. @@ -9661,8 +9903,17 @@ exports.setTracer = setTracer; /***/ }), /* 266 */, -/* 267 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 267 */, +/* 268 */, +/* 269 */, +/* 270 */, +/* 271 */, +/* 272 */, +/* 273 */, +/* 274 */, +/* 275 */, +/* 276 */ +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -9682,37 +9933,11 @@ exports.setTracer = setTracer; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.NoopContextManager = void 0; -var context_1 = __webpack_require__(966); -var NoopContextManager = /** @class */ (function () { - function NoopContextManager() { - } - NoopContextManager.prototype.active = function () { - return context_1.Context.ROOT_CONTEXT; - }; - NoopContextManager.prototype.with = function (context, fn) { - return fn(); - }; - NoopContextManager.prototype.bind = function (target, context) { - return target; - }; - NoopContextManager.prototype.enable = function () { - return this; - }; - NoopContextManager.prototype.disable = function () { - return this; - }; - return NoopContextManager; -}()); -exports.NoopContextManager = NoopContextManager; -//# sourceMappingURL=NoopContextManager.js.map +//# sourceMappingURL=Logger.js.map /***/ }), -/* 268 */, -/* 269 */, -/* 270 */, -/* 271 */, -/* 272 */ +/* 277 */, +/* 278 */ /***/ (function(__unusedmodule, exports) { "use strict"; @@ -9733,15 +9958,9 @@ exports.NoopContextManager = NoopContextManager; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=MeterProvider.js.map +//# sourceMappingURL=CorrelationContext.js.map /***/ }), -/* 273 */, -/* 274 */, -/* 275 */, -/* 276 */, -/* 277 */, -/* 278 */, /* 279 */, /* 280 */ /***/ (function(module) { @@ -9810,96 +10029,7 @@ exports.create = create; /***/ }), /* 282 */, /* 283 */, -/* 284 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ContextAPI = void 0; -var context_base_1 = __webpack_require__(581); -var global_utils_1 = __webpack_require__(591); -var NOOP_CONTEXT_MANAGER = new context_base_1.NoopContextManager(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Context API - */ -var ContextAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function ContextAPI() { - } - /** Get the singleton instance of the Context API */ - ContextAPI.getInstance = function () { - if (!this._instance) { - this._instance = new ContextAPI(); - } - return this._instance; - }; - /** - * Set the current context manager. Returns the initialized context manager - */ - ContextAPI.prototype.setGlobalContextManager = function (contextManager) { - if (global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) { - // global context manager has already been set - return this._getContextManager(); - } - global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, contextManager, NOOP_CONTEXT_MANAGER); - return contextManager; - }; - /** - * Get the currently active context - */ - ContextAPI.prototype.active = function () { - return this._getContextManager().active(); - }; - /** - * Execute a function with an active context - * - * @param context context to be active during function execution - * @param fn function to execute in a context - */ - ContextAPI.prototype.with = function (context, fn) { - return this._getContextManager().with(context, fn); - }; - /** - * Bind a context to a target function or event emitter - * - * @param target function or event emitter to bind - * @param context context to bind to the event emitter or function. Defaults to the currently active context - */ - ContextAPI.prototype.bind = function (target, context) { - if (context === void 0) { context = this.active(); } - return this._getContextManager().bind(target, context); - }; - ContextAPI.prototype._getContextManager = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NOOP_CONTEXT_MANAGER); - }; - /** Disable and remove the global context manager */ - ContextAPI.prototype.disable = function () { - this._getContextManager().disable(); - delete global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]; - }; - return ContextAPI; -}()); -exports.ContextAPI = ContextAPI; -//# sourceMappingURL=context.js.map - -/***/ }), +/* 284 */, /* 285 */, /* 286 */, /* 287 */, @@ -9950,12 +10080,19 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const core = __webpack_require__(470); -const fs = __webpack_require__(747); -const globOptionsHelper = __webpack_require__(601); -const path = __webpack_require__(622); -const patternHelper = __webpack_require__(597); +const core = __importStar(__webpack_require__(470)); +const fs = __importStar(__webpack_require__(747)); +const globOptionsHelper = __importStar(__webpack_require__(601)); +const path = __importStar(__webpack_require__(622)); +const patternHelper = __importStar(__webpack_require__(597)); const internal_match_kind_1 = __webpack_require__(327); const internal_pattern_1 = __webpack_require__(923); const internal_search_state_1 = __webpack_require__(728); @@ -10699,7 +10836,30 @@ if (typeof Object.create === 'function') { /***/ }), /* 316 */, /* 317 */, -/* 318 */, +/* 318 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=BatchObserverResult.js.map + +/***/ }), /* 319 */, /* 320 */, /* 321 */, @@ -10731,10 +10891,7 @@ var MatchKind; //# sourceMappingURL=internal-match-kind.js.map /***/ }), -/* 328 */, -/* 329 */, -/* 330 */, -/* 331 */ +/* 328 */ /***/ (function(__unusedmodule, exports) { "use strict"; @@ -10755,21 +10912,12 @@ var MatchKind; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.defaultGetter = void 0; -/** - * Default getter which just does a simple property access. Returns - * undefined if the key is not set. - * - * @param carrier - * @param key - */ -function defaultGetter(carrier, key) { - return carrier[key]; -} -exports.defaultGetter = defaultGetter; -//# sourceMappingURL=getter.js.map +//# sourceMappingURL=types.js.map /***/ }), +/* 329 */, +/* 330 */, +/* 331 */, /* 332 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -11068,7 +11216,7 @@ exports.Store = Store; /***/ }), /* 339 */, /* 340 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -11088,60 +11236,30 @@ exports.Store = Store; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_SPAN = exports.NoopSpan = exports.INVALID_SPAN_ID = exports.INVALID_TRACE_ID = void 0; -var trace_flags_1 = __webpack_require__(917); -exports.INVALID_TRACE_ID = '0'; -exports.INVALID_SPAN_ID = '0'; -var INVALID_SPAN_CONTEXT = { - traceId: exports.INVALID_TRACE_ID, - spanId: exports.INVALID_SPAN_ID, - traceFlags: trace_flags_1.TraceFlags.NONE, -}; +exports.SamplingDecision = void 0; /** - * The NoopSpan is the default {@link Span} that is used when no Span - * implementation is available. All operations are no-op including context - * propagation. + * A sampling decision that determines how a {@link Span} will be recorded + * and collected. */ -var NoopSpan = /** @class */ (function () { - function NoopSpan(_spanContext) { - if (_spanContext === void 0) { _spanContext = INVALID_SPAN_CONTEXT; } - this._spanContext = _spanContext; - } - // Returns a SpanContext. - NoopSpan.prototype.context = function () { - return this._spanContext; - }; - // By default does nothing - NoopSpan.prototype.setAttribute = function (key, value) { - return this; - }; - // By default does nothing - NoopSpan.prototype.setAttributes = function (attributes) { - return this; - }; - // By default does nothing - NoopSpan.prototype.addEvent = function (name, attributes) { - return this; - }; - // By default does nothing - NoopSpan.prototype.setStatus = function (status) { - return this; - }; - // By default does nothing - NoopSpan.prototype.updateName = function (name) { - return this; - }; - // By default does nothing - NoopSpan.prototype.end = function (endTime) { }; - // isRecording always returns false for noopSpan. - NoopSpan.prototype.isRecording = function () { - return false; - }; - return NoopSpan; -}()); -exports.NoopSpan = NoopSpan; -exports.NOOP_SPAN = new NoopSpan(); -//# sourceMappingURL=NoopSpan.js.map +var SamplingDecision; +(function (SamplingDecision) { + /** + * `Span.isRecording() === false`, span will not be recorded and all events + * and attributes will be dropped. + */ + SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; + /** + * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} + * MUST NOT be set. + */ + SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; + /** + * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} + * MUST be set. + */ + SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; +})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); +//# sourceMappingURL=SamplingResult.js.map /***/ }), /* 341 */, @@ -11321,30 +11439,7 @@ module.exports = require("assert"); /* 359 */, /* 360 */, /* 361 */, -/* 362 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Logger.js.map - -/***/ }), +/* 362 */, /* 363 */, /* 364 */, /* 365 */, @@ -11364,19 +11459,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, '__esModule', { value: true }); var coreHttp = __webpack_require__(999); -var tslib = __webpack_require__(422); +var tslib = __webpack_require__(815); var api = __webpack_require__(440); var logger$1 = __webpack_require__(928); var abortController = __webpack_require__(106); var os = __webpack_require__(87); var stream = __webpack_require__(794); -var fs = __webpack_require__(747); -var util = __webpack_require__(669); +__webpack_require__(711); var crypto = __webpack_require__(417); +var coreLro = __webpack_require__(889); var events = __webpack_require__(614); var coreTracing = __webpack_require__(263); -var coreLro = __webpack_require__(110); -__webpack_require__(242); +var fs = __webpack_require__(747); +var util = __webpack_require__(669); /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -11487,6 +11582,13 @@ var StorageError = { type: { name: "String" } + }, + code: { + xmlName: "Code", + serializedName: "Code", + type: { + name: "String" + } } } } @@ -11520,7 +11622,7 @@ var DataLakeStorageError = { name: "Composite", className: "DataLakeStorageError", modelProperties: { - error: { + dataLakeStorageErrorDetails: { xmlName: "error", serializedName: "error", type: { @@ -11561,12 +11663,12 @@ var AccessPolicy = { } } }; -var BlobProperties = { +var BlobPropertiesInternal = { xmlName: "Properties", - serializedName: "BlobProperties", + serializedName: "BlobPropertiesInternal", type: { name: "Composite", - className: "BlobProperties", + className: "BlobPropertiesInternal", modelProperties: { createdOn: { xmlName: "Creation-Time", @@ -11819,83 +11921,90 @@ var BlobProperties = { type: { name: "DateTimeRfc1123" } - } - } - } -}; -var BlobItem = { - xmlName: "Blob", - serializedName: "BlobItem", - type: { - name: "Composite", - className: "BlobItem", - modelProperties: { - name: { - xmlName: "Name", - required: true, - serializedName: "Name", + }, + tagCount: { + xmlName: "TagCount", + serializedName: "TagCount", type: { - name: "String" + name: "Number" } }, - deleted: { - xmlName: "Deleted", - required: true, - serializedName: "Deleted", + expiresOn: { + xmlName: "Expiry-Time", + serializedName: "Expiry-Time", + type: { + name: "DateTimeRfc1123" + } + }, + isSealed: { + xmlName: "Sealed", + serializedName: "Sealed", type: { name: "Boolean" } }, - snapshot: { - xmlName: "Snapshot", - required: true, - serializedName: "Snapshot", + rehydratePriority: { + xmlName: "RehydratePriority", + serializedName: "RehydratePriority", type: { name: "String" } }, - properties: { - xmlName: "Properties", + lastAccessedOn: { + xmlName: "LastAccessTime", + serializedName: "LastAccessTime", + type: { + name: "DateTimeRfc1123" + } + } + } + } +}; +var BlobTag = { + xmlName: "Tag", + serializedName: "BlobTag", + type: { + name: "Composite", + className: "BlobTag", + modelProperties: { + key: { + xmlName: "Key", required: true, - serializedName: "Properties", + serializedName: "Key", type: { - name: "Composite", - className: "BlobProperties" + name: "String" } }, - metadata: { - xmlName: "Metadata", - serializedName: "Metadata", + value: { + xmlName: "Value", + required: true, + serializedName: "Value", type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } + name: "String" } } } } }; -var BlobFlatListSegment = { - xmlName: "Blobs", - serializedName: "BlobFlatListSegment", +var BlobTags = { + xmlName: "Tags", + serializedName: "BlobTags", type: { name: "Composite", - className: "BlobFlatListSegment", + className: "BlobTags", modelProperties: { - blobItems: { - xmlName: "BlobItems", - xmlElementName: "Blob", + blobTagSet: { + xmlIsWrapped: true, + xmlName: "TagSet", + xmlElementName: "Tag", required: true, - serializedName: "BlobItems", + serializedName: "BlobTagSet", type: { name: "Sequence", element: { type: { name: "Composite", - className: "BlobItem" + className: "BlobTag" } } } @@ -11903,109 +12012,102 @@ var BlobFlatListSegment = { } } }; -var ListBlobsFlatSegmentResponse = { - xmlName: "EnumerationResults", - serializedName: "ListBlobsFlatSegmentResponse", +var BlobItemInternal = { + xmlName: "Blob", + serializedName: "BlobItemInternal", type: { name: "Composite", - className: "ListBlobsFlatSegmentResponse", + className: "BlobItemInternal", modelProperties: { - serviceEndpoint: { - xmlIsAttribute: true, - xmlName: "ServiceEndpoint", + name: { + xmlName: "Name", required: true, - serializedName: "ServiceEndpoint", + serializedName: "Name", type: { name: "String" } }, - containerName: { - xmlIsAttribute: true, - xmlName: "ContainerName", + deleted: { + xmlName: "Deleted", required: true, - serializedName: "ContainerName", + serializedName: "Deleted", type: { - name: "String" + name: "Boolean" } }, - prefix: { - xmlName: "Prefix", - serializedName: "Prefix", + snapshot: { + xmlName: "Snapshot", + required: true, + serializedName: "Snapshot", type: { name: "String" } }, - marker: { - xmlName: "Marker", - serializedName: "Marker", + versionId: { + xmlName: "VersionId", + serializedName: "VersionId", type: { name: "String" } }, - maxPageSize: { - xmlName: "MaxResults", - serializedName: "MaxResults", + isCurrentVersion: { + xmlName: "IsCurrentVersion", + serializedName: "IsCurrentVersion", type: { - name: "Number" + name: "Boolean" } }, - segment: { - xmlName: "Blobs", + properties: { + xmlName: "Properties", required: true, - serializedName: "Segment", + serializedName: "Properties", type: { name: "Composite", - className: "BlobFlatListSegment" + className: "BlobPropertiesInternal" } }, - continuationToken: { - xmlName: "NextMarker", - serializedName: "NextMarker", + metadata: { + xmlName: "Metadata", + serializedName: "Metadata", type: { - name: "String" + name: "Dictionary", + value: { + type: { + name: "String" + } + } } - } - } - } -}; -var BlobPrefix = { - serializedName: "BlobPrefix", - type: { - name: "Composite", - className: "BlobPrefix", - modelProperties: { - name: { - xmlName: "Name", - required: true, - serializedName: "Name", + }, + blobTags: { + xmlName: "Tags", + serializedName: "BlobTags", type: { - name: "String" + name: "Composite", + className: "BlobTags" + } + }, + objectReplicationMetadata: { + xmlName: "OrMetadata", + serializedName: "ObjectReplicationMetadata", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } } } } } }; -var BlobHierarchyListSegment = { +var BlobFlatListSegment = { xmlName: "Blobs", - serializedName: "BlobHierarchyListSegment", + serializedName: "BlobFlatListSegment", type: { name: "Composite", - className: "BlobHierarchyListSegment", + className: "BlobFlatListSegment", modelProperties: { - blobPrefixes: { - xmlName: "BlobPrefixes", - xmlElementName: "BlobPrefix", - serializedName: "BlobPrefixes", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BlobPrefix" - } - } - } - }, blobItems: { xmlName: "BlobItems", xmlElementName: "Blob", @@ -12016,7 +12118,7 @@ var BlobHierarchyListSegment = { element: { type: { name: "Composite", - className: "BlobItem" + className: "BlobItemInternal" } } } @@ -12024,12 +12126,133 @@ var BlobHierarchyListSegment = { } } }; -var ListBlobsHierarchySegmentResponse = { +var ListBlobsFlatSegmentResponse = { xmlName: "EnumerationResults", - serializedName: "ListBlobsHierarchySegmentResponse", + serializedName: "ListBlobsFlatSegmentResponse", type: { name: "Composite", - className: "ListBlobsHierarchySegmentResponse", + className: "ListBlobsFlatSegmentResponse", + modelProperties: { + serviceEndpoint: { + xmlIsAttribute: true, + xmlName: "ServiceEndpoint", + required: true, + serializedName: "ServiceEndpoint", + type: { + name: "String" + } + }, + containerName: { + xmlIsAttribute: true, + xmlName: "ContainerName", + required: true, + serializedName: "ContainerName", + type: { + name: "String" + } + }, + prefix: { + xmlName: "Prefix", + serializedName: "Prefix", + type: { + name: "String" + } + }, + marker: { + xmlName: "Marker", + serializedName: "Marker", + type: { + name: "String" + } + }, + maxPageSize: { + xmlName: "MaxResults", + serializedName: "MaxResults", + type: { + name: "Number" + } + }, + segment: { + xmlName: "Blobs", + required: true, + serializedName: "Segment", + type: { + name: "Composite", + className: "BlobFlatListSegment" + } + }, + continuationToken: { + xmlName: "NextMarker", + serializedName: "NextMarker", + type: { + name: "String" + } + } + } + } +}; +var BlobPrefix = { + serializedName: "BlobPrefix", + type: { + name: "Composite", + className: "BlobPrefix", + modelProperties: { + name: { + xmlName: "Name", + required: true, + serializedName: "Name", + type: { + name: "String" + } + } + } + } +}; +var BlobHierarchyListSegment = { + xmlName: "Blobs", + serializedName: "BlobHierarchyListSegment", + type: { + name: "Composite", + className: "BlobHierarchyListSegment", + modelProperties: { + blobPrefixes: { + xmlName: "BlobPrefixes", + xmlElementName: "BlobPrefix", + serializedName: "BlobPrefixes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BlobPrefix" + } + } + } + }, + blobItems: { + xmlName: "BlobItems", + xmlElementName: "Blob", + required: true, + serializedName: "BlobItems", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BlobItemInternal" + } + } + } + } + } + } +}; +var ListBlobsHierarchySegmentResponse = { + xmlName: "EnumerationResults", + serializedName: "ListBlobsHierarchySegmentResponse", + type: { + name: "Composite", + className: "ListBlobsHierarchySegmentResponse", modelProperties: { serviceEndpoint: { xmlIsAttribute: true, @@ -12301,6 +12524,20 @@ var ContainerProperties = { type: { name: "Boolean" } + }, + deletedOn: { + xmlName: "DeletedTime", + serializedName: "DeletedTime", + type: { + name: "DateTimeRfc1123" + } + }, + remainingRetentionDays: { + xmlName: "RemainingRetentionDays", + serializedName: "RemainingRetentionDays", + type: { + name: "Number" + } } } } @@ -12320,6 +12557,20 @@ var ContainerItem = { name: "String" } }, + deleted: { + xmlName: "Deleted", + serializedName: "Deleted", + type: { + name: "Boolean" + } + }, + version: { + xmlName: "Version", + serializedName: "Version", + type: { + name: "String" + } + }, properties: { xmlName: "Properties", required: true, @@ -12344,6 +12595,136 @@ var ContainerItem = { } } }; +var DelimitedTextConfiguration = { + serializedName: "DelimitedTextConfiguration", + type: { + name: "Composite", + className: "DelimitedTextConfiguration", + modelProperties: { + columnSeparator: { + xmlName: "ColumnSeparator", + required: true, + serializedName: "ColumnSeparator", + type: { + name: "String" + } + }, + fieldQuote: { + xmlName: "FieldQuote", + required: true, + serializedName: "FieldQuote", + type: { + name: "String" + } + }, + recordSeparator: { + xmlName: "RecordSeparator", + required: true, + serializedName: "RecordSeparator", + type: { + name: "String" + } + }, + escapeChar: { + xmlName: "EscapeChar", + required: true, + serializedName: "EscapeChar", + type: { + name: "String" + } + }, + headersPresent: { + xmlName: "HasHeaders", + required: true, + serializedName: "HeadersPresent", + type: { + name: "Boolean" + } + } + } + } +}; +var JsonTextConfiguration = { + serializedName: "JsonTextConfiguration", + type: { + name: "Composite", + className: "JsonTextConfiguration", + modelProperties: { + recordSeparator: { + xmlName: "RecordSeparator", + required: true, + serializedName: "RecordSeparator", + type: { + name: "String" + } + } + } + } +}; +var ArrowField = { + xmlName: "Field", + serializedName: "ArrowField", + type: { + name: "Composite", + className: "ArrowField", + modelProperties: { + type: { + xmlName: "Type", + required: true, + serializedName: "Type", + type: { + name: "String" + } + }, + name: { + xmlName: "Name", + serializedName: "Name", + type: { + name: "String" + } + }, + precision: { + xmlName: "Precision", + serializedName: "Precision", + type: { + name: "Number" + } + }, + scale: { + xmlName: "Scale", + serializedName: "Scale", + type: { + name: "Number" + } + } + } + } +}; +var ArrowConfiguration = { + serializedName: "ArrowConfiguration", + type: { + name: "Composite", + className: "ArrowConfiguration", + modelProperties: { + schema: { + xmlIsWrapped: true, + xmlName: "Schema", + xmlElementName: "Field", + required: true, + serializedName: "Schema", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ArrowField" + } + } + } + } + } + } +}; var ListContainersSegmentResponse = { xmlName: "EnumerationResults", serializedName: "ListContainersSegmentResponse", @@ -12459,6 +12840,90 @@ var CorsRule = { } } }; +var FilterBlobItem = { + xmlName: "Blob", + serializedName: "FilterBlobItem", + type: { + name: "Composite", + className: "FilterBlobItem", + modelProperties: { + name: { + xmlName: "Name", + required: true, + serializedName: "Name", + type: { + name: "String" + } + }, + containerName: { + xmlName: "ContainerName", + required: true, + serializedName: "ContainerName", + type: { + name: "String" + } + }, + tagValue: { + xmlName: "TagValue", + required: true, + serializedName: "TagValue", + type: { + name: "String" + } + } + } + } +}; +var FilterBlobSegment = { + xmlName: "EnumerationResults", + serializedName: "FilterBlobSegment", + type: { + name: "Composite", + className: "FilterBlobSegment", + modelProperties: { + serviceEndpoint: { + xmlIsAttribute: true, + xmlName: "ServiceEndpoint", + required: true, + serializedName: "ServiceEndpoint", + type: { + name: "String" + } + }, + where: { + xmlName: "Where", + required: true, + serializedName: "Where", + type: { + name: "String" + } + }, + blobs: { + xmlIsWrapped: true, + xmlName: "Blobs", + xmlElementName: "Blob", + required: true, + serializedName: "Blobs", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FilterBlobItem" + } + } + } + }, + continuationToken: { + xmlName: "NextMarker", + serializedName: "NextMarker", + type: { + name: "String" + } + } + } + } +}; var GeoReplication = { serializedName: "GeoReplication", type: { @@ -12687,6 +13152,112 @@ var PageList = { } } }; +var QueryFormat = { + serializedName: "QueryFormat", + type: { + name: "Composite", + className: "QueryFormat", + modelProperties: { + type: { + xmlName: "Type", + serializedName: "Type", + type: { + name: "Enum", + allowedValues: [ + "delimited", + "json", + "arrow" + ] + } + }, + delimitedTextConfiguration: { + xmlName: "DelimitedTextConfiguration", + serializedName: "DelimitedTextConfiguration", + type: { + name: "Composite", + className: "DelimitedTextConfiguration" + } + }, + jsonTextConfiguration: { + xmlName: "JsonTextConfiguration", + serializedName: "JsonTextConfiguration", + type: { + name: "Composite", + className: "JsonTextConfiguration" + } + }, + arrowConfiguration: { + xmlName: "ArrowConfiguration", + serializedName: "ArrowConfiguration", + type: { + name: "Composite", + className: "ArrowConfiguration" + } + } + } + } +}; +var QuerySerialization = { + serializedName: "QuerySerialization", + type: { + name: "Composite", + className: "QuerySerialization", + modelProperties: { + format: { + xmlName: "Format", + required: true, + serializedName: "Format", + type: { + name: "Composite", + className: "QueryFormat" + } + } + } + } +}; +var QueryRequest = { + serializedName: "QueryRequest", + type: { + name: "Composite", + className: "QueryRequest", + modelProperties: { + queryType: { + xmlName: "QueryType", + required: true, + isConstant: true, + serializedName: "QueryType", + defaultValue: 'SQL', + type: { + name: "String" + } + }, + expression: { + xmlName: "Expression", + required: true, + serializedName: "Expression", + type: { + name: "String" + } + }, + inputSerialization: { + xmlName: "InputSerialization", + serializedName: "InputSerialization", + type: { + name: "Composite", + className: "QuerySerialization" + } + }, + outputSerialization: { + xmlName: "OutputSerialization", + serializedName: "OutputSerialization", + type: { + name: "Composite", + className: "QuerySerialization" + } + } + } + } +}; var SignedIdentifier = { serializedName: "SignedIdentifier", type: { @@ -12740,6 +13311,13 @@ var StaticWebsite = { type: { name: "String" } + }, + defaultIndexDocumentPath: { + xmlName: "DefaultIndexDocumentPath", + serializedName: "DefaultIndexDocumentPath", + type: { + name: "String" + } } } } @@ -13061,7 +13639,9 @@ var ServiceGetAccountInfoHeaders = { allowedValues: [ "Storage", "BlobStorage", - "StorageV2" + "StorageV2", + "FileStorage", + "BlockBlobStorage" ] } }, @@ -13113,6 +13693,45 @@ var ServiceSubmitBatchHeaders = { } } }; +var ServiceFilterBlobsHeaders = { + serializedName: "service-filterblobs-headers", + type: { + name: "Composite", + className: "ServiceFilterBlobsHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; var ContainerCreateHeaders = { serializedName: "container-create-headers", type: { @@ -13488,6 +14107,45 @@ var ContainerSetAccessPolicyHeaders = { } } }; +var ContainerRestoreHeaders = { + serializedName: "container-restore-headers", + type: { + name: "Composite", + className: "ContainerRestoreHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; var ContainerAcquireLeaseHeaders = { serializedName: "container-acquirelease-headers", type: { @@ -13907,7 +14565,9 @@ var ContainerGetAccountInfoHeaders = { allowedValues: [ "Storage", "BlobStorage", - "StorageV2" + "StorageV2", + "FileStorage", + "BlockBlobStorage" ] } }, @@ -13944,6 +14604,24 @@ var BlobDownloadHeaders = { }, headerCollectionPrefix: "x-ms-meta-" }, + objectReplicationPolicyId: { + serializedName: "x-ms-or-policy-id", + type: { + name: "String" + } + }, + objectReplicationRules: { + serializedName: "x-ms-or", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + }, + headerCollectionPrefix: "x-ms-or-" + }, contentLength: { serializedName: "content-length", type: { @@ -14108,6 +14786,12 @@ var BlobDownloadHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, acceptRanges: { serializedName: "accept-ranges", type: { @@ -14150,6 +14834,24 @@ var BlobDownloadHeaders = { name: "ByteArray" } }, + tagCount: { + serializedName: "x-ms-tag-count", + type: { + name: "Number" + } + }, + isSealed: { + serializedName: "x-ms-blob-sealed", + type: { + name: "Boolean" + } + }, + lastAccessed: { + serializedName: "x-ms-last-access-time", + type: { + name: "DateTimeRfc1123" + } + }, contentCrc64: { serializedName: "x-ms-content-crc64", type: { @@ -14195,6 +14897,24 @@ var BlobGetPropertiesHeaders = { }, headerCollectionPrefix: "x-ms-meta-" }, + objectReplicationPolicyId: { + serializedName: "x-ms-or-policy-id", + type: { + name: "String" + } + }, + objectReplicationRules: { + serializedName: "x-ms-or", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + }, + headerCollectionPrefix: "x-ms-or-" + }, blobType: { serializedName: "x-ms-blob-type", type: { @@ -14425,6 +15145,48 @@ var BlobGetPropertiesHeaders = { name: "DateTimeRfc1123" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, + isCurrentVersion: { + serializedName: "x-ms-is-current-version", + type: { + name: "Boolean" + } + }, + tagCount: { + serializedName: "x-ms-tag-count", + type: { + name: "Number" + } + }, + expiresOn: { + serializedName: "x-ms-expiry-time", + type: { + name: "DateTimeRfc1123" + } + }, + isSealed: { + serializedName: "x-ms-blob-sealed", + type: { + name: "Boolean" + } + }, + rehydratePriority: { + serializedName: "x-ms-rehydrate-priority", + type: { + name: "String" + } + }, + lastAccessed: { + serializedName: "x-ms-last-access-time", + type: { + name: "DateTimeRfc1123" + } + }, errorCode: { serializedName: "x-ms-error-code", type: { @@ -14680,6 +15442,12 @@ var PageBlobCreateHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -14755,6 +15523,12 @@ var AppendBlobCreateHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -14830,6 +15604,12 @@ var BlockBlobUploadHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -14902,6 +15682,57 @@ var BlobUndeleteHeaders = { } } }; +var BlobSetExpiryHeaders = { + serializedName: "blob-setexpiry-headers", + type: { + name: "Composite", + className: "BlobSetExpiryHeaders", + modelProperties: { + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + lastModified: { + serializedName: "last-modified", + type: { + name: "DateTimeRfc1123" + } + }, + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; var BlobSetHTTPHeadersHeaders = { serializedName: "blob-sethttpheaders-headers", type: { @@ -14995,6 +15826,12 @@ var BlobSetMetadataHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15349,6 +16186,12 @@ var BlobCreateSnapshotHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15406,6 +16249,12 @@ var BlobStartCopyFromURLHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15475,6 +16324,12 @@ var BlobCopyFromURLHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -15639,7 +16494,9 @@ var BlobGetAccountInfoHeaders = { allowedValues: [ "Storage", "BlobStorage", - "StorageV2" + "StorageV2", + "FileStorage", + "BlockBlobStorage" ] } }, @@ -15838,6 +16695,12 @@ var BlockBlobCommitBlockListHeaders = { name: "String" } }, + versionId: { + serializedName: "x-ms-version-id", + type: { + name: "String" + } + }, date: { serializedName: "date", type: { @@ -16648,6 +17511,386 @@ var AppendBlobAppendBlockFromUrlHeaders = { } } }; +var AppendBlobSealHeaders = { + serializedName: "appendblob-seal-headers", + type: { + name: "Composite", + className: "AppendBlobSealHeaders", + modelProperties: { + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + lastModified: { + serializedName: "last-modified", + type: { + name: "DateTimeRfc1123" + } + }, + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + isSealed: { + serializedName: "x-ms-blob-sealed", + type: { + name: "Boolean" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; +var BlobQueryHeaders = { + serializedName: "blob-query-headers", + type: { + name: "Composite", + className: "BlobQueryHeaders", + modelProperties: { + lastModified: { + serializedName: "last-modified", + type: { + name: "DateTimeRfc1123" + } + }, + metadata: { + serializedName: "x-ms-meta", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + }, + headerCollectionPrefix: "x-ms-meta-" + }, + contentLength: { + serializedName: "content-length", + type: { + name: "Number" + } + }, + contentType: { + serializedName: "content-type", + type: { + name: "String" + } + }, + contentRange: { + serializedName: "content-range", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + contentMD5: { + serializedName: "content-md5", + type: { + name: "ByteArray" + } + }, + contentEncoding: { + serializedName: "content-encoding", + type: { + name: "String" + } + }, + cacheControl: { + serializedName: "cache-control", + type: { + name: "String" + } + }, + contentDisposition: { + serializedName: "content-disposition", + type: { + name: "String" + } + }, + contentLanguage: { + serializedName: "content-language", + type: { + name: "String" + } + }, + blobSequenceNumber: { + serializedName: "x-ms-blob-sequence-number", + type: { + name: "Number" + } + }, + blobType: { + serializedName: "x-ms-blob-type", + type: { + name: "Enum", + allowedValues: [ + "BlockBlob", + "PageBlob", + "AppendBlob" + ] + } + }, + copyCompletionTime: { + serializedName: "x-ms-copy-completion-time", + type: { + name: "DateTimeRfc1123" + } + }, + copyStatusDescription: { + serializedName: "x-ms-copy-status-description", + type: { + name: "String" + } + }, + copyId: { + serializedName: "x-ms-copy-id", + type: { + name: "String" + } + }, + copyProgress: { + serializedName: "x-ms-copy-progress", + type: { + name: "String" + } + }, + copySource: { + serializedName: "x-ms-copy-source", + type: { + name: "String" + } + }, + copyStatus: { + serializedName: "x-ms-copy-status", + type: { + name: "Enum", + allowedValues: [ + "pending", + "success", + "aborted", + "failed" + ] + } + }, + leaseDuration: { + serializedName: "x-ms-lease-duration", + type: { + name: "Enum", + allowedValues: [ + "infinite", + "fixed" + ] + } + }, + leaseState: { + serializedName: "x-ms-lease-state", + type: { + name: "Enum", + allowedValues: [ + "available", + "leased", + "expired", + "breaking", + "broken" + ] + } + }, + leaseStatus: { + serializedName: "x-ms-lease-status", + type: { + name: "Enum", + allowedValues: [ + "locked", + "unlocked" + ] + } + }, + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + acceptRanges: { + serializedName: "accept-ranges", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + blobCommittedBlockCount: { + serializedName: "x-ms-blob-committed-block-count", + type: { + name: "Number" + } + }, + isServerEncrypted: { + serializedName: "x-ms-server-encrypted", + type: { + name: "Boolean" + } + }, + encryptionKeySha256: { + serializedName: "x-ms-encryption-key-sha256", + type: { + name: "String" + } + }, + encryptionScope: { + serializedName: "x-ms-encryption-scope", + type: { + name: "String" + } + }, + blobContentMD5: { + serializedName: "x-ms-blob-content-md5", + type: { + name: "ByteArray" + } + }, + contentCrc64: { + serializedName: "x-ms-content-crc64", + type: { + name: "ByteArray" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; +var BlobGetTagsHeaders = { + serializedName: "blob-gettags-headers", + type: { + name: "Composite", + className: "BlobGetTagsHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; +var BlobSetTagsHeaders = { + serializedName: "blob-settags-headers", + type: { + name: "Composite", + className: "BlobSetTagsHeaders", + modelProperties: { + clientRequestId: { + serializedName: "x-ms-client-request-id", + type: { + name: "String" + } + }, + requestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + version: { + serializedName: "x-ms-version", + type: { + name: "String" + } + }, + date: { + serializedName: "date", + type: { + name: "DateTimeRfc1123" + } + }, + errorCode: { + serializedName: "x-ms-error-code", + type: { + name: "String" + } + } + } + } +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -16664,12 +17907,15 @@ var Mappers = /*#__PURE__*/Object.freeze({ ContainerItem: ContainerItem, ContainerProperties: ContainerProperties, CorsRule: CorsRule, + FilterBlobItem: FilterBlobItem, + FilterBlobSegment: FilterBlobSegment, GeoReplication: GeoReplication, KeyInfo: KeyInfo, ListContainersSegmentResponse: ListContainersSegmentResponse, Logging: Logging, Metrics: Metrics, RetentionPolicy: RetentionPolicy, + ServiceFilterBlobsHeaders: ServiceFilterBlobsHeaders, ServiceGetAccountInfoHeaders: ServiceGetAccountInfoHeaders, ServiceGetPropertiesHeaders: ServiceGetPropertiesHeaders, ServiceGetStatisticsHeaders: ServiceGetStatisticsHeaders, @@ -16901,6 +18147,18 @@ var blobSequenceNumber = { } } }; +var blobTagsString = { + parameterPath: [ + "options", + "blobTagsString" + ], + mapper: { + serializedName: "x-ms-tags", + type: { + name: "String" + } + } +}; var blobType0 = { parameterPath: "blobType", mapper: { @@ -17002,7 +18260,7 @@ var comp10 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'copy', + defaultValue: 'expiry', type: { name: "String" } @@ -17014,7 +18272,7 @@ var comp11 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'tier', + defaultValue: 'snapshot', type: { name: "String" } @@ -17026,7 +18284,7 @@ var comp12 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'page', + defaultValue: 'copy', type: { name: "String" } @@ -17038,7 +18296,7 @@ var comp13 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'pagelist', + defaultValue: 'tier', type: { name: "String" } @@ -17050,7 +18308,7 @@ var comp14 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'incrementalcopy', + defaultValue: 'query', type: { name: "String" } @@ -17062,7 +18320,7 @@ var comp15 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'appendblock', + defaultValue: 'tags', type: { name: "String" } @@ -17074,7 +18332,7 @@ var comp16 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'block', + defaultValue: 'page', type: { name: "String" } @@ -17086,7 +18344,31 @@ var comp17 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'blocklist', + defaultValue: 'pagelist', + type: { + name: "String" + } + } +}; +var comp18 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'incrementalcopy', + type: { + name: "String" + } + } +}; +var comp19 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'appendblock', type: { name: "String" } @@ -17104,6 +18386,42 @@ var comp2 = { } } }; +var comp20 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'seal', + type: { + name: "String" + } + } +}; +var comp21 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'block', + type: { + name: "String" + } + } +}; +var comp22 = { + parameterPath: "comp", + mapper: { + required: true, + isConstant: true, + serializedName: "comp", + defaultValue: 'blocklist', + type: { + name: "String" + } + } +}; var comp3 = { parameterPath: "comp", mapper: { @@ -17134,7 +18452,7 @@ var comp5 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'metadata', + defaultValue: 'blobs', type: { name: "String" } @@ -17146,7 +18464,7 @@ var comp6 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'acl', + defaultValue: 'metadata', type: { name: "String" } @@ -17158,7 +18476,7 @@ var comp7 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'lease', + defaultValue: 'acl', type: { name: "String" } @@ -17182,7 +18500,7 @@ var comp9 = { required: true, isConstant: true, serializedName: "comp", - defaultValue: 'snapshot', + defaultValue: 'lease', type: { name: "String" } @@ -17295,6 +18613,30 @@ var defaultEncryptionScope = { } } }; +var deletedContainerName = { + parameterPath: [ + "options", + "deletedContainerName" + ], + mapper: { + serializedName: "x-ms-deleted-container-name", + type: { + name: "String" + } + } +}; +var deletedContainerVersion = { + parameterPath: [ + "options", + "deletedContainerVersion" + ], + mapper: { + serializedName: "x-ms-deleted-container-version", + type: { + name: "String" + } + } +}; var deleteSnapshots = { parameterPath: [ "options", @@ -17399,6 +18741,28 @@ var encryptionScope = { } } }; +var expiresOn = { + parameterPath: [ + "options", + "expiresOn" + ], + mapper: { + serializedName: "x-ms-expiry-time", + type: { + name: "String" + } + } +}; +var expiryOptions = { + parameterPath: "expiryOptions", + mapper: { + required: true, + serializedName: "x-ms-expiry-option", + type: { + name: "String" + } + } +}; var group = { parameterPath: [ "options", @@ -17489,6 +18853,19 @@ var ifSequenceNumberLessThanOrEqualTo = { } } }; +var ifTags = { + parameterPath: [ + "options", + "modifiedAccessConditions", + "ifTags" + ], + mapper: { + serializedName: "x-ms-if-tags", + type: { + name: "String" + } + } +}; var ifUnmodifiedSince = { parameterPath: [ "options", @@ -17510,12 +18887,19 @@ var include0 = { mapper: { serializedName: "include", type: { - name: "Enum", - allowedValues: [ - "metadata" - ] + name: "Sequence", + element: { + type: { + name: "Enum", + allowedValues: [ + "metadata", + "deleted" + ] + } + } } - } + }, + collectionFormat: coreHttp.QueryCollectionFormat.Csv }; var include1 = { parameterPath: [ @@ -17534,7 +18918,9 @@ var include1 = { "deleted", "metadata", "snapshots", - "uncommittedblobs" + "uncommittedblobs", + "versions", + "tags" ] } } @@ -17924,6 +19310,18 @@ var restype2 = { } } }; +var sealBlob = { + parameterPath: [ + "options", + "sealBlob" + ], + mapper: { + serializedName: "x-ms-seal-blob", + type: { + name: "Boolean" + } + } +}; var sequenceNumberAction = { parameterPath: "sequenceNumberAction", mapper: { @@ -18014,6 +19412,19 @@ var sourceIfNoneMatch = { } } }; +var sourceIfTags = { + parameterPath: [ + "options", + "sourceModifiedAccessConditions", + "sourceIfTags" + ], + mapper: { + serializedName: "x-ms-source-if-tags", + type: { + name: "String" + } + } +}; var sourceIfUnmodifiedSince = { parameterPath: [ "options", @@ -18162,7 +19573,31 @@ var version = { required: true, isConstant: true, serializedName: "x-ms-version", - defaultValue: '2019-07-07', + defaultValue: '2020-02-10', + type: { + name: "String" + } + } +}; +var versionId = { + parameterPath: [ + "options", + "versionId" + ], + mapper: { + serializedName: "versionid", + type: { + name: "String" + } + } +}; +var where = { + parameterPath: [ + "options", + "where" + ], + mapper: { + serializedName: "where", type: { name: "String" } @@ -18239,6 +19674,11 @@ var Service = /** @class */ (function () { options: options }, submitBatchOperationSpec, callback); }; + Service.prototype.filterBlobs = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, filterBlobsOperationSpec, callback); + }; return Service; }()); // Operation Specifications @@ -18458,6 +19898,35 @@ var submitBatchOperationSpec = { isXML: true, serializer: serializer }; +var filterBlobsOperationSpec = { + httpMethod: "GET", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + where, + marker0, + maxPageSize, + comp5 + ], + headerParameters: [ + version, + requestId + ], + responses: { + 200: { + bodyMapper: FilterBlobSegment, + headersMapper: ServiceFilterBlobsHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: ServiceFilterBlobsHeaders + } + }, + isXML: true, + serializer: serializer +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -18472,9 +19941,11 @@ var Mappers$1 = /*#__PURE__*/Object.freeze({ AccessPolicy: AccessPolicy, BlobFlatListSegment: BlobFlatListSegment, BlobHierarchyListSegment: BlobHierarchyListSegment, - BlobItem: BlobItem, + BlobItemInternal: BlobItemInternal, BlobPrefix: BlobPrefix, - BlobProperties: BlobProperties, + BlobPropertiesInternal: BlobPropertiesInternal, + BlobTag: BlobTag, + BlobTags: BlobTags, ContainerAcquireLeaseHeaders: ContainerAcquireLeaseHeaders, ContainerBreakLeaseHeaders: ContainerBreakLeaseHeaders, ContainerChangeLeaseHeaders: ContainerChangeLeaseHeaders, @@ -18487,6 +19958,7 @@ var Mappers$1 = /*#__PURE__*/Object.freeze({ ContainerListBlobHierarchySegmentHeaders: ContainerListBlobHierarchySegmentHeaders, ContainerReleaseLeaseHeaders: ContainerReleaseLeaseHeaders, ContainerRenewLeaseHeaders: ContainerRenewLeaseHeaders, + ContainerRestoreHeaders: ContainerRestoreHeaders, ContainerSetAccessPolicyHeaders: ContainerSetAccessPolicyHeaders, ContainerSetMetadataHeaders: ContainerSetMetadataHeaders, ListBlobsFlatSegmentResponse: ListBlobsFlatSegmentResponse, @@ -18543,6 +20015,11 @@ var Container = /** @class */ (function () { options: options }, setAccessPolicyOperationSpec, callback); }; + Container.prototype.restore = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, restoreOperationSpec, callback); + }; Container.prototype.acquireLease = function (options, callback) { return this.client.sendOperationRequest({ options: options @@ -18687,7 +20164,7 @@ var setMetadataOperationSpec = { queryParameters: [ timeoutInSeconds, restype2, - comp5 + comp6 ], headerParameters: [ metadata, @@ -18717,7 +20194,7 @@ var getAccessPolicyOperationSpec = { queryParameters: [ timeoutInSeconds, restype2, - comp6 + comp7 ], headerParameters: [ version, @@ -18758,7 +20235,7 @@ var setAccessPolicyOperationSpec = { queryParameters: [ timeoutInSeconds, restype2, - comp6 + comp7 ], headerParameters: [ access, @@ -18801,6 +20278,35 @@ var setAccessPolicyOperationSpec = { isXML: true, serializer: serializer$1 }; +var restoreOperationSpec = { + httpMethod: "PUT", + path: "{containerName}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + restype2, + comp8 + ], + headerParameters: [ + version, + requestId, + deletedContainerName, + deletedContainerVersion + ], + responses: { + 201: { + headersMapper: ContainerRestoreHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: ContainerRestoreHeaders + } + }, + isXML: true, + serializer: serializer$1 +}; var acquireLeaseOperationSpec = { httpMethod: "PUT", path: "{containerName}", @@ -18809,7 +20315,7 @@ var acquireLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18841,7 +20347,7 @@ var releaseLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18872,7 +20378,7 @@ var renewLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18903,7 +20409,7 @@ var breakLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -18934,7 +20440,7 @@ var changeLeaseOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp7, + comp9, restype2 ], headerParameters: [ @@ -19059,6 +20565,8 @@ var getAccountInfoOperationSpec$1 = { var Mappers$2 = /*#__PURE__*/Object.freeze({ __proto__: null, + ArrowConfiguration: ArrowConfiguration, + ArrowField: ArrowField, BlobAbortCopyFromURLHeaders: BlobAbortCopyFromURLHeaders, BlobAcquireLeaseHeaders: BlobAcquireLeaseHeaders, BlobBreakLeaseHeaders: BlobBreakLeaseHeaders, @@ -19070,17 +20578,28 @@ var Mappers$2 = /*#__PURE__*/Object.freeze({ BlobGetAccessControlHeaders: BlobGetAccessControlHeaders, BlobGetAccountInfoHeaders: BlobGetAccountInfoHeaders, BlobGetPropertiesHeaders: BlobGetPropertiesHeaders, + BlobGetTagsHeaders: BlobGetTagsHeaders, + BlobQueryHeaders: BlobQueryHeaders, BlobReleaseLeaseHeaders: BlobReleaseLeaseHeaders, BlobRenameHeaders: BlobRenameHeaders, BlobRenewLeaseHeaders: BlobRenewLeaseHeaders, BlobSetAccessControlHeaders: BlobSetAccessControlHeaders, + BlobSetExpiryHeaders: BlobSetExpiryHeaders, BlobSetHTTPHeadersHeaders: BlobSetHTTPHeadersHeaders, BlobSetMetadataHeaders: BlobSetMetadataHeaders, + BlobSetTagsHeaders: BlobSetTagsHeaders, BlobSetTierHeaders: BlobSetTierHeaders, BlobStartCopyFromURLHeaders: BlobStartCopyFromURLHeaders, + BlobTag: BlobTag, + BlobTags: BlobTags, BlobUndeleteHeaders: BlobUndeleteHeaders, DataLakeStorageError: DataLakeStorageError, DataLakeStorageErrorError: DataLakeStorageErrorError, + DelimitedTextConfiguration: DelimitedTextConfiguration, + JsonTextConfiguration: JsonTextConfiguration, + QueryFormat: QueryFormat, + QueryRequest: QueryRequest, + QuerySerialization: QuerySerialization, StorageError: StorageError }); @@ -19138,6 +20657,12 @@ var Blob$1 = /** @class */ (function () { options: options }, undeleteOperationSpec, callback); }; + Blob.prototype.setExpiry = function (expiryOptions, options, callback) { + return this.client.sendOperationRequest({ + expiryOptions: expiryOptions, + options: options + }, setExpiryOperationSpec, callback); + }; Blob.prototype.setHTTPHeaders = function (options, callback) { return this.client.sendOperationRequest({ options: options @@ -19211,6 +20736,21 @@ var Blob$1 = /** @class */ (function () { options: options }, getAccountInfoOperationSpec$2, callback); }; + Blob.prototype.query = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, queryOperationSpec, callback); + }; + Blob.prototype.getTags = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, getTagsOperationSpec, callback); + }; + Blob.prototype.setTags = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, setTagsOperationSpec, callback); + }; return Blob; }()); // Operation Specifications @@ -19223,6 +20763,7 @@ var downloadOperationSpec = { ], queryParameters: [ snapshot, + versionId, timeoutInSeconds ], headerParameters: [ @@ -19238,7 +20779,8 @@ var downloadOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19275,6 +20817,7 @@ var getPropertiesOperationSpec$2 = { ], queryParameters: [ snapshot, + versionId, timeoutInSeconds ], headerParameters: [ @@ -19287,7 +20830,8 @@ var getPropertiesOperationSpec$2 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19309,6 +20853,7 @@ var deleteMethodOperationSpec$1 = { ], queryParameters: [ snapshot, + versionId, timeoutInSeconds ], headerParameters: [ @@ -19319,7 +20864,8 @@ var deleteMethodOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 202: { @@ -19471,6 +21017,34 @@ var undeleteOperationSpec = { isXML: true, serializer: serializer$2 }; +var setExpiryOperationSpec = { + httpMethod: "PUT", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + comp10 + ], + headerParameters: [ + version, + requestId, + expiryOptions, + expiresOn + ], + responses: { + 200: { + headersMapper: BlobSetExpiryHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobSetExpiryHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; var setHTTPHeadersOperationSpec = { httpMethod: "PUT", path: "{containerName}/{blob}", @@ -19494,7 +21068,8 @@ var setHTTPHeadersOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19516,7 +21091,7 @@ var setMetadataOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp5 + comp6 ], headerParameters: [ metadata, @@ -19530,7 +21105,8 @@ var setMetadataOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19552,7 +21128,7 @@ var acquireLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ duration, @@ -19563,7 +21139,8 @@ var acquireLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -19585,7 +21162,7 @@ var releaseLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ leaseId1, @@ -19595,7 +21172,8 @@ var releaseLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19617,7 +21195,7 @@ var renewLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ leaseId1, @@ -19627,7 +21205,8 @@ var renewLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19649,7 +21228,7 @@ var changeLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ leaseId1, @@ -19660,7 +21239,8 @@ var changeLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -19682,7 +21262,7 @@ var breakLeaseOperationSpec$1 = { ], queryParameters: [ timeoutInSeconds, - comp7 + comp9 ], headerParameters: [ breakPeriod, @@ -19692,7 +21272,8 @@ var breakLeaseOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 202: { @@ -19714,7 +21295,7 @@ var createSnapshotOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp9 + comp11 ], headerParameters: [ metadata, @@ -19728,6 +21309,7 @@ var createSnapshotOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, leaseId0 ], responses: { @@ -19758,14 +21340,18 @@ var startCopyFromURLOperationSpec = { copySource, version, requestId, + blobTagsString, + sealBlob, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, + sourceIfTags, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, leaseId0 ], responses: { @@ -19796,6 +21382,7 @@ var copyFromURLOperationSpec = { version, requestId, sourceContentMD5, + blobTagsString, xMsRequiresSync, sourceIfModifiedSince, sourceIfUnmodifiedSince, @@ -19805,6 +21392,7 @@ var copyFromURLOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, leaseId0 ], responses: { @@ -19828,7 +21416,7 @@ var abortCopyFromURLOperationSpec = { queryParameters: [ copyId, timeoutInSeconds, - comp10 + comp12 ], headerParameters: [ version, @@ -19855,15 +21443,18 @@ var setTierOperationSpec = { url ], queryParameters: [ + snapshot, + versionId, timeoutInSeconds, - comp11 + comp13 ], headerParameters: [ tier1, rehydratePriority, version, requestId, - leaseId0 + leaseId0, + ifTags ], responses: { 200: { @@ -19905,6 +21496,133 @@ var getAccountInfoOperationSpec$2 = { isXML: true, serializer: serializer$2 }; +var queryOperationSpec = { + httpMethod: "POST", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + snapshot, + timeoutInSeconds, + comp14 + ], + headerParameters: [ + version, + requestId, + leaseId0, + encryptionKey, + encryptionKeySha256, + encryptionAlgorithm, + ifModifiedSince, + ifUnmodifiedSince, + ifMatch, + ifNoneMatch, + ifTags + ], + requestBody: { + parameterPath: [ + "options", + "queryRequest" + ], + mapper: QueryRequest + }, + contentType: "application/xml; charset=utf-8", + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Stream" + } + }, + headersMapper: BlobQueryHeaders + }, + 206: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Stream" + } + }, + headersMapper: BlobQueryHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobQueryHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; +var getTagsOperationSpec = { + httpMethod: "GET", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + snapshot, + versionId, + comp15 + ], + headerParameters: [ + version, + requestId, + ifTags + ], + responses: { + 200: { + bodyMapper: BlobTags, + headersMapper: BlobGetTagsHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobGetTagsHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; +var setTagsOperationSpec = { + httpMethod: "PUT", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + versionId, + comp15 + ], + headerParameters: [ + version, + transactionalContentMD5, + transactionalContentCrc64, + requestId, + ifTags + ], + requestBody: { + parameterPath: [ + "options", + "tags" + ], + mapper: BlobTags + }, + contentType: "application/xml; charset=utf-8", + responses: { + 204: { + headersMapper: BlobSetTagsHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: BlobSetTagsHeaders + } + }, + isXML: true, + serializer: serializer$2 +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -20028,6 +21746,7 @@ var createOperationSpec$1 = { blobSequenceNumber, version, requestId, + blobTagsString, blobType0, blobContentType, blobContentEncoding, @@ -20042,7 +21761,8 @@ var createOperationSpec$1 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -20064,7 +21784,7 @@ var uploadPagesOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp12 + comp16 ], headerParameters: [ contentLength, @@ -20085,7 +21805,8 @@ var uploadPagesOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "body", @@ -20118,7 +21839,7 @@ var clearPagesOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp12 + comp16 ], headerParameters: [ contentLength, @@ -20137,7 +21858,8 @@ var clearPagesOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -20159,7 +21881,7 @@ var uploadPagesFromURLOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp12 + comp16 ], headerParameters: [ sourceUrl, @@ -20183,6 +21905,7 @@ var uploadPagesFromURLOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, @@ -20209,7 +21932,7 @@ var getPageRangesOperationSpec = { queryParameters: [ snapshot, timeoutInSeconds, - comp13 + comp17 ], headerParameters: [ range0, @@ -20219,7 +21942,8 @@ var getPageRangesOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20244,7 +21968,7 @@ var getPageRangesDiffOperationSpec = { snapshot, timeoutInSeconds, prevsnapshot, - comp13 + comp17 ], headerParameters: [ prevSnapshotUrl, @@ -20255,7 +21979,8 @@ var getPageRangesDiffOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20292,7 +22017,8 @@ var resizeOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20325,7 +22051,8 @@ var updateSequenceNumberOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 200: { @@ -20347,7 +22074,7 @@ var copyIncrementalOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp14 + comp18 ], headerParameters: [ copySource, @@ -20356,7 +22083,8 @@ var copyIncrementalOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 202: { @@ -20384,6 +22112,7 @@ var Mappers$4 = /*#__PURE__*/Object.freeze({ AppendBlobAppendBlockFromUrlHeaders: AppendBlobAppendBlockFromUrlHeaders, AppendBlobAppendBlockHeaders: AppendBlobAppendBlockHeaders, AppendBlobCreateHeaders: AppendBlobCreateHeaders, + AppendBlobSealHeaders: AppendBlobSealHeaders, StorageError: StorageError }); @@ -20425,6 +22154,11 @@ var AppendBlob = /** @class */ (function () { options: options }, appendBlockFromUrlOperationSpec, callback); }; + AppendBlob.prototype.seal = function (options, callback) { + return this.client.sendOperationRequest({ + options: options + }, sealOperationSpec, callback); + }; return AppendBlob; }()); // Operation Specifications @@ -20444,6 +22178,7 @@ var createOperationSpec$2 = { encryptionScope, version, requestId, + blobTagsString, blobType1, blobContentType, blobContentEncoding, @@ -20458,7 +22193,8 @@ var createOperationSpec$2 = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], responses: { 201: { @@ -20480,7 +22216,7 @@ var appendBlockOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp15 + comp19 ], headerParameters: [ contentLength, @@ -20498,7 +22234,8 @@ var appendBlockOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "body", @@ -20531,7 +22268,7 @@ var appendBlockFromUrlOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp15 + comp19 ], headerParameters: [ sourceUrl, @@ -20553,6 +22290,7 @@ var appendBlockFromUrlOperationSpec = { ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, @@ -20570,6 +22308,38 @@ var appendBlockFromUrlOperationSpec = { isXML: true, serializer: serializer$4 }; +var sealOperationSpec = { + httpMethod: "PUT", + path: "{containerName}/{blob}", + urlParameters: [ + url + ], + queryParameters: [ + timeoutInSeconds, + comp20 + ], + headerParameters: [ + version, + requestId, + leaseId0, + ifModifiedSince, + ifUnmodifiedSince, + ifMatch, + ifNoneMatch, + appendPosition + ], + responses: { + 200: { + headersMapper: AppendBlobSealHeaders + }, + default: { + bodyMapper: StorageError, + headersMapper: AppendBlobSealHeaders + } + }, + isXML: true, + serializer: serializer$4 +}; /* * Copyright (c) Microsoft Corporation. All rights reserved. @@ -20666,6 +22436,7 @@ var uploadOperationSpec = { tier0, version, requestId, + blobTagsString, blobType2, blobContentType, blobContentEncoding, @@ -20680,7 +22451,8 @@ var uploadOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "body", @@ -20714,7 +22486,7 @@ var stageBlockOperationSpec = { queryParameters: [ blockId, timeoutInSeconds, - comp16 + comp21 ], headerParameters: [ contentLength, @@ -20760,7 +22532,7 @@ var stageBlockFromURLOperationSpec = { queryParameters: [ blockId, timeoutInSeconds, - comp16 + comp21 ], headerParameters: [ contentLength, @@ -20800,7 +22572,7 @@ var commitBlockListOperationSpec = { ], queryParameters: [ timeoutInSeconds, - comp17 + comp22 ], headerParameters: [ transactionalContentMD5, @@ -20810,6 +22582,7 @@ var commitBlockListOperationSpec = { tier0, version, requestId, + blobTagsString, blobCacheControl, blobContentType, blobContentEncoding, @@ -20823,7 +22596,8 @@ var commitBlockListOperationSpec = { ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch + ifNoneMatch, + ifTags ], requestBody: { parameterPath: "blocks", @@ -20852,12 +22626,13 @@ var getBlockListOperationSpec = { snapshot, listType, timeoutInSeconds, - comp17 + comp22 ], headerParameters: [ version, requestId, - leaseId0 + leaseId0, + ifTags ], responses: { 200: { @@ -20881,10 +22656,10 @@ var logger = logger$1.createClientLogger("storage-blob"); // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -var SDK_VERSION = "12.1.2"; -var SERVICE_VERSION = "2019-07-07"; +var SDK_VERSION = "12.3.0"; +var SERVICE_VERSION = "2020-02-10"; var BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB -var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 100 * 1024 * 1024; // 100MB +var BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB var BLOCK_BLOB_MAX_BLOCKS = 50000; var DEFAULT_BLOCK_BUFFER_SIZE_BYTES = 8 * 1024 * 1024; // 8MB var DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES = 4 * 1024 * 1024; // 4MB @@ -20898,6 +22673,7 @@ var URLConstants = { FORCE_BROWSER_NO_CACHE: "_", SIGNATURE: "sig", SNAPSHOT: "snapshot", + VERSIONID: "versionid", TIMEOUT: "timeout" } }; @@ -20934,6 +22710,7 @@ var HeaderConstants = { X_MS_VERSION: "x-ms-version" }; var ETagNone = ""; +var ETagAny = "*"; var SIZE_1_MB = 1 * 1024 * 1024; var BATCH_MAX_REQUEST = 256; var BATCH_MAX_PAYLOAD_IN_BYTES = 4 * SIZE_1_MB; @@ -21033,7 +22810,9 @@ var StorageBlobLoggingAllowedHeaderNames = [ "x-ms-source-if-none-match", "x-ms-source-if-unmodified-since", "x-ms-tag-count", - "x-ms-encryption-key-sha256" + "x-ms-encryption-key-sha256", + "x-ms-if-tags", + "x-ms-source-if-tags" ]; var StorageBlobLoggingAllowedQueryParameters = [ "comp", @@ -21077,7 +22856,7 @@ var StorageBlobLoggingAllowedQueryParameters = [ * * ## URL encode and escape strategy for JS SDKs * - * When customers pass a URL string into XxxClient classes constrcutor, the URL string may already be URL encoded or not. + * When customers pass a URL string into XxxClient classes constructor, the URL string may already be URL encoded or not. * But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL * string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors. * @@ -21107,7 +22886,7 @@ var StorageBlobLoggingAllowedQueryParameters = [ * * This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string * is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL. - * If customer needs to create a blob with "%" in it's blob name, use "%25" insead of "%". Just like above 3rd sample. + * If customer needs to create a blob with "%" in it's blob name, use "%25" instead of "%". Just like above 3rd sample. * And following URL strings are invalid: * - "http://account.blob.core.windows.net/con/b%" * - "http://account.blob.core.windows.net/con/b%2" @@ -21227,14 +23006,11 @@ function extractConnectionStringParts(connectionString) { else if (!accountSas) { throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String"); } - else if (!accountName) { - throw new Error("Invalid AccountName in the provided SAS Connection String"); - } return { kind: "SASConnString", url: blobEndpoint, accountName: accountName, accountSas: accountSas }; } } /** - * Internal escape method implmented Strategy Two mentioned in escapeURL() description. + * Internal escape method implemented Strategy Two mentioned in escapeURL() description. * * @param {string} text * @returns {string} @@ -21453,6 +23229,8 @@ function delay(timeInMs, aborter, abortError) { */ function padStart(currentString, targetLength, padString) { if (padString === void 0) { padString = " "; } + // TS doesn't know this code needs to run downlevel sometimes. + // @ts-expect-error if (String.prototype.padStart) { return currentString.padStart(targetLength, padString); } @@ -21492,14 +23270,15 @@ function getAccountNameFromUrl(url) { // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; accountName = parsedUrl.getHost().split(".")[0]; } - else { + else if (isIpEndpointStyle(parsedUrl)) { // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/ // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/ // .getPath() -> /devstoreaccount1/ accountName = parsedUrl.getPath().split("/")[1]; } - if (!accountName) { - throw new Error("Provided accountName is invalid."); + else { + // Custom domain case: "https://customdomain.com/containername/blob". + accountName = ""; } return accountName; } @@ -21507,6 +23286,163 @@ function getAccountNameFromUrl(url) { throw new Error("Unable to extract accountName with provided information."); } } +function isIpEndpointStyle(parsedUrl) { + if (parsedUrl.getHost() == undefined) { + return false; + } + var host = parsedUrl.getHost() + (parsedUrl.getPort() == undefined ? "" : ":" + parsedUrl.getPort()); + // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. + // Case 2: localhost(:port), use broad regex to match port part. + // Case 3: Ipv4, use broad regex which just check if host contains Ipv4. + // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html. + return /^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host); +} +/** + * Convert Tags to encoded string. + * + * @export + * @param {Tags} tags + * @returns {string | undefined} + */ +function toBlobTagsString(tags) { + if (tags === undefined) { + return undefined; + } + var tagPairs = []; + for (var key in tags) { + if (tags.hasOwnProperty(key)) { + var value = tags[key]; + tagPairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(value)); + } + } + return tagPairs.join("&"); +} +/** + * Convert Tags type to BlobTags. + * + * @export + * @param {Tags} [tags] + * @returns {(BlobTags | undefined)} + */ +function toBlobTags(tags) { + if (tags === undefined) { + return undefined; + } + var res = { + blobTagSet: [] + }; + for (var key in tags) { + if (tags.hasOwnProperty(key)) { + var value = tags[key]; + res.blobTagSet.push({ + key: key, + value: value + }); + } + } + return res; +} +/** + * Covert BlobTags to Tags type. + * + * @export + * @param {BlobTags} [tags] + * @returns {(Tags | undefined)} + */ +function toTags(tags) { + if (tags === undefined) { + return undefined; + } + var res = {}; + for (var _i = 0, _a = tags.blobTagSet; _i < _a.length; _i++) { + var blobTag = _a[_i]; + res[blobTag.key] = blobTag.value; + } + return res; +} +/** + * Convert BlobQueryTextConfiguration to QuerySerialization type. + * + * @export + * @param {(BlobQueryJsonTextConfiguration | BlobQueryCsvTextConfiguration | BlobQueryArrowConfiguration)} [textConfiguration] + * @returns {(QuerySerialization | undefined)} + */ +function toQuerySerialization(textConfiguration) { + if (textConfiguration === undefined) { + return undefined; + } + switch (textConfiguration.kind) { + case "csv": + return { + format: { + type: "delimited", + delimitedTextConfiguration: { + columnSeparator: textConfiguration.columnSeparator || ",", + fieldQuote: textConfiguration.fieldQuote || "", + recordSeparator: textConfiguration.recordSeparator, + escapeChar: textConfiguration.escapeCharacter || "", + headersPresent: textConfiguration.hasHeaders || false + } + } + }; + case "json": + return { + format: { + type: "json", + jsonTextConfiguration: { + recordSeparator: textConfiguration.recordSeparator + } + } + }; + case "arrow": + return { + format: { + type: "arrow", + arrowConfiguration: { + schema: textConfiguration.schema + } + } + }; + default: + throw Error("Invalid BlobQueryTextConfiguration."); + } +} +function parseObjectReplicationRecord(objectReplicationRecord) { + if (!objectReplicationRecord) { + return undefined; + } + if ("policy-id" in objectReplicationRecord) { + // If the dictionary contains a key with policy id, we are not required to do any parsing since + // the policy id should already be stored in the ObjectReplicationDestinationPolicyId. + return undefined; + } + var orProperties = []; + var _loop_1 = function (key) { + var ids = key.split("_"); + var policyPrefix = "or-"; + if (ids[0].startsWith(policyPrefix)) { + ids[0] = ids[0].substring(policyPrefix.length); + } + var rule = { + ruleId: ids[1], + replicationStatus: objectReplicationRecord[key] + }; + var policyIndex = orProperties.findIndex(function (policy) { return policy.policyId === ids[0]; }); + if (policyIndex > -1) { + orProperties[policyIndex].rules.push(rule); + } + else { + orProperties.push({ + policyId: ids[0], + rules: [rule] + }); + } + }; + for (var key in objectReplicationRecord) { + _loop_1(key); + } + return orProperties; +} // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -21844,6 +23780,133 @@ var StorageRetryPolicyFactory = /** @class */ (function () { return StorageRetryPolicyFactory; }()); +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * Credential policy used to sign HTTP(S) requests before sending. This is an + * abstract class. + * + * @export + * @abstract + * @class CredentialPolicy + * @extends {BaseRequestPolicy} + */ +var CredentialPolicy = /** @class */ (function (_super) { + tslib.__extends(CredentialPolicy, _super); + function CredentialPolicy() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Sends out request. + * + * @param {WebResource} request + * @returns {Promise} + * @memberof CredentialPolicy + */ + CredentialPolicy.prototype.sendRequest = function (request) { + return this._nextPolicy.sendRequest(this.signRequest(request)); + }; + /** + * Child classes must implement this method with request signing. This method + * will be executed in {@link sendRequest}. + * + * @protected + * @abstract + * @param {WebResource} request + * @returns {WebResource} + * @memberof CredentialPolicy + */ + CredentialPolicy.prototype.signRequest = function (request) { + // Child classes must override this method with request signing. This method + // will be executed in sendRequest(). + return request; + }; + return CredentialPolicy; +}(coreHttp.BaseRequestPolicy)); + +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources + * or for use with Shared Access Signatures (SAS). + * + * @export + * @class AnonymousCredentialPolicy + * @extends {CredentialPolicy} + */ +var AnonymousCredentialPolicy = /** @class */ (function (_super) { + tslib.__extends(AnonymousCredentialPolicy, _super); + /** + * Creates an instance of AnonymousCredentialPolicy. + * @param {RequestPolicy} nextPolicy + * @param {RequestPolicyOptions} options + * @memberof AnonymousCredentialPolicy + */ + function AnonymousCredentialPolicy(nextPolicy, options) { + return _super.call(this, nextPolicy, options) || this; + } + return AnonymousCredentialPolicy; +}(CredentialPolicy)); + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +/** + * Credential is an abstract class for Azure Storage HTTP requests signing. This + * class will host an credentialPolicyCreator factory which generates CredentialPolicy. + * + * @export + * @abstract + * @class Credential + */ +var Credential = /** @class */ (function () { + function Credential() { + } + /** + * Creates a RequestPolicy object. + * + * @param {RequestPolicy} _nextPolicy + * @param {RequestPolicyOptions} _options + * @returns {RequestPolicy} + * @memberof Credential + */ + Credential.prototype.create = function ( + // tslint:disable-next-line:variable-name + _nextPolicy, + // tslint:disable-next-line:variable-name + _options) { + throw new Error("Method should be implemented in children classes."); + }; + return Credential; +}()); + +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * AnonymousCredential provides a credentialPolicyCreator member used to create + * AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with + * HTTP(S) requests that read public resources or for use with Shared Access + * Signatures (SAS). + * + * @export + * @class AnonymousCredential + * @extends {Credential} + */ +var AnonymousCredential = /** @class */ (function (_super) { + tslib.__extends(AnonymousCredential, _super); + function AnonymousCredential() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Creates an {@link AnonymousCredentialPolicy} object. + * + * @param {RequestPolicy} nextPolicy + * @param {RequestPolicyOptions} options + * @returns {AnonymousCredentialPolicy} + * @memberof AnonymousCredential + */ + AnonymousCredential.prototype.create = function (nextPolicy, options) { + return new AnonymousCredentialPolicy(nextPolicy, options); + }; + return AnonymousCredential; +}(Credential)); + // Copyright (c) Microsoft Corporation. All rights reserved. /** * TelemetryPolicy is a policy used to tag user-agent header for every requests. @@ -21908,6 +23971,8 @@ var TelemetryPolicyFactory = /** @class */ (function () { var userAgentInfo = []; { if (telemetry) { + // FIXME: replace() only replaces the first space. And we have no idea why we need to replace spaces in the first place. + // But fixing this would be a breaking change. Logged an issue here: https://github.com/Azure/azure-sdk-for-js/issues/10793 var telemetryString = (telemetry.userAgentPrefix || "").replace(" ", ""); if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) { userAgentInfo.push(telemetryString); @@ -21997,10 +24062,13 @@ var Pipeline = /** @class */ (function () { * @returns {Pipeline} A new Pipeline object. */ function newPipeline(credential, pipelineOptions) { + if (pipelineOptions === void 0) { pipelineOptions = {}; } + if (credential === undefined) { + credential = new AnonymousCredential(); + } // Order is important. Closer to the API at the top & closer to the network at the bottom. // The credential's policy factory must appear close to the wire so it can sign any // changes made by other factories (like UniqueRequestIDPolicyFactory) - if (pipelineOptions === void 0) { pipelineOptions = {}; } var telemetryPolicy = new TelemetryPolicyFactory(pipelineOptions.userAgentOptions); var factories = [ coreHttp.tracingPolicy({ userAgent: telemetryPolicy.telemetryString }), @@ -22017,7 +24085,7 @@ function newPipeline(credential, pipelineOptions) { }) ]; { - // policies only avaiable in Node.js runtime, not in browsers + // policies only available in Node.js runtime, not in browsers factories.push(coreHttp.proxyPolicy(pipelineOptions.proxyOptions)); factories.push(coreHttp.disableResponseDecompressionPolicy()); } @@ -22155,7 +24223,7 @@ var RetriableReadableStream = /** @class */ (function (_super) { /** * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * BlobDownloadResponse implements BlobDownloadResponseModel interface, and in Node.js runtime it will + * BlobDownloadResponse implements BlobDownloadResponseParsed interface, and in Node.js runtime it will * automatically retry when internal read stream unexpected ends. (This kind of unexpected ends cannot * trigger retries defined in pipeline retry policy.) * @@ -22164,13 +24232,13 @@ var RetriableReadableStream = /** @class */ (function (_super) { * * @export * @class BlobDownloadResponse - * @implements {BlobDownloadResponseModel} + * @implements {BlobDownloadResponseParsed} */ var BlobDownloadResponse = /** @class */ (function () { /** * Creates an instance of BlobDownloadResponse. * - * @param {BlobDownloadResponseModel} originalResponse + * @param {BlobDownloadResponseParsed} originalResponse * @param {ReadableStreamGetter} getter * @param {number} offset * @param {number} count @@ -22194,7 +24262,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.acceptRanges; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "cacheControl", { @@ -22209,7 +24277,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.cacheControl; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentDisposition", { @@ -22225,7 +24293,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentDisposition; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentEncoding", { @@ -22240,7 +24308,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentEncoding; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentLanguage", { @@ -22255,7 +24323,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentLanguage; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobSequenceNumber", { @@ -22270,7 +24338,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobSequenceNumber; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobType", { @@ -22285,7 +24353,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobType; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentLength", { @@ -22300,7 +24368,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentLength; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentMD5", { @@ -22321,7 +24389,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentMD5; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentRange", { @@ -22337,7 +24405,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentRange; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentType", { @@ -22352,7 +24420,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentType; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyCompletedOn", { @@ -22368,7 +24436,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyCompletedOn; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyId", { @@ -22383,7 +24451,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyProgress", { @@ -22400,7 +24468,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyProgress; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copySource", { @@ -22416,7 +24484,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copySource; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyStatus", { @@ -22432,7 +24500,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyStatus; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "copyStatusDescription", { @@ -22448,7 +24516,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.copyStatusDescription; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "leaseDuration", { @@ -22464,7 +24532,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.leaseDuration; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "leaseState", { @@ -22479,7 +24547,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.leaseState; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "leaseStatus", { @@ -22494,7 +24562,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.leaseStatus; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "date", { @@ -22509,7 +24577,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.date; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobCommittedBlockCount", { @@ -22524,7 +24592,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobCommittedBlockCount; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "etag", { @@ -22539,7 +24607,21 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.etag; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "tagCount", { + /** + * The number of tags associated with the blob + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.tagCount; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "errorCode", { @@ -22553,7 +24635,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.errorCode; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "isServerEncrypted", { @@ -22571,7 +24653,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.isServerEncrypted; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "blobContentMD5", { @@ -22589,7 +24671,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobContentMD5; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "lastModified", { @@ -22605,7 +24687,22 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.lastModified; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "lastAccessed", { + /** + * Returns the UTC date and time generated by the service that indicates the time at which the blob was + * last read or written to. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.lastAccessed; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "metadata", { @@ -22620,7 +24717,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.metadata; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "requestId", { @@ -22635,7 +24732,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.requestId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "clientRequestId", { @@ -22650,12 +24747,12 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.clientRequestId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "version", { /** - * Indicates the version of the File service used + * Indicates the version of the Blob service used * to execute the request. * * @readonly @@ -22665,7 +24762,21 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.version; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "versionId", { + /** + * Indicates the versionId of the downloaded blob version. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.versionId; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "encryptionKeySha256", { @@ -22680,7 +24791,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.encryptionKeySha256; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentCrc64", { @@ -22696,7 +24807,49 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.contentCrc64; }, - enumerable: true, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "objectReplicationDestinationPolicyId", { + /** + * Object Replication Policy Id of the destination blob. + * + * @readonly + * @type {(string| undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.objectReplicationDestinationPolicyId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "objectReplicationSourceProperties", { + /** + * Parsed Object Replication Policy Id, Rule Id(s) and status of the source blob. + * + * @readonly + * @type {(ObjectReplicationPolicy[] | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.objectReplicationSourceProperties; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobDownloadResponse.prototype, "isSealed", { + /** + * If this blob has been sealed. + * + * @readonly + * @type {(boolean | undefined)} + * @memberof BlobDownloadResponse + */ + get: function () { + return this.originalResponse.isSealed; + }, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "contentAsBlob", { @@ -22711,7 +24864,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse.blobBody; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "readableStreamBody", { @@ -22728,7 +24881,7 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return coreHttp.isNode ? this.blobDownloadStream : undefined; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobDownloadResponse.prototype, "_response", { @@ -22741,275 +24894,1605 @@ var BlobDownloadResponse = /** @class */ (function () { get: function () { return this.originalResponse._response; }, - enumerable: true, + enumerable: false, configurable: true }); return BlobDownloadResponse; }()); -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -/** - * Generate a range string. For example: - * - * "bytes=255-" or "bytes=0-511" - * - * @export - * @param {Range} iRange - * @returns {string} - */ -function rangeToString(iRange) { - if (iRange.offset < 0) { - throw new RangeError("Range.offset cannot be smaller than 0."); - } - if (iRange.count && iRange.count <= 0) { - throw new RangeError("Range.count must be larger than 0. Leave it undefined if you want a range from offset to the end."); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +var AVRO_SYNC_MARKER_SIZE = 16; +var AVRO_INIT_BYTES = new Uint8Array([79, 98, 106, 1]); +var AVRO_CODEC_KEY = "avro.codec"; +var AVRO_SCHEMA_KEY = "avro.schema"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +function arraysEqual(a, b) { + if (a === b) + return true; + if (a == null || b == null) + return false; + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; } - return iRange.count - ? "bytes=" + iRange.offset + "-" + (iRange.offset + iRange.count - 1) - : "bytes=" + iRange.offset + "-"; + return true; } -// Copyright (c) Microsoft Corporation. All rights reserved. -(function (BlockBlobTier) { - /** - * Optmized for storing data that is accessed frequently. - */ - BlockBlobTier["Hot"] = "Hot"; - /** - * Optimized for storing data that is infrequently accessed and stored for at least 30 days. - */ - BlockBlobTier["Cool"] = "Cool"; - /** - * Optimized for storing data that is rarely accessed and stored for at least 180 days - * with flexible latency requirements (on the order of hours). - */ - BlockBlobTier["Archive"] = "Archive"; -})(exports.BlockBlobTier || (exports.BlockBlobTier = {})); -(function (PremiumPageBlobTier) { - /** - * P4 Tier. - */ - PremiumPageBlobTier["P4"] = "P4"; - /** - * P6 Tier. - */ - PremiumPageBlobTier["P6"] = "P6"; - /** - * P10 Tier. - */ - PremiumPageBlobTier["P10"] = "P10"; - /** - * P15 Tier. - */ - PremiumPageBlobTier["P15"] = "P15"; - /** - * P20 Tier. - */ - PremiumPageBlobTier["P20"] = "P20"; - /** - * P30 Tier. - */ - PremiumPageBlobTier["P30"] = "P30"; - /** - * P40 Tier. - */ - PremiumPageBlobTier["P40"] = "P40"; - /** - * P50 Tier. - */ - PremiumPageBlobTier["P50"] = "P50"; - /** - * P60 Tier. - */ - PremiumPageBlobTier["P60"] = "P60"; +// Copyright (c) Microsoft Corporation. +var AvroParser = /** @class */ (function () { + function AvroParser() { + } /** - * P70 Tier. + * Reads a fixed number of bytes from the stream. + * + * @static + * @param {AvroReadable} [stream] + * @param {number} [length] + * @param {AvroParserReadOptions} [options={}] + * @returns {Promise} + * @memberof AvroParser */ - PremiumPageBlobTier["P70"] = "P70"; + AvroParser.readFixedBytes = function (stream, length, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var bytes; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, stream.read(length, { abortSignal: options.abortSignal })]; + case 1: + bytes = _a.sent(); + if (bytes.length != length) { + throw new Error("Hit stream end."); + } + return [2 /*return*/, bytes]; + } + }); + }); + }; /** - * P80 Tier. + * Reads a single byte from the stream. + * + * @static + * @param {AvroReadable} [stream] + * @param {AvroParserReadOptions} [options={}] + * @returns {Promise} + * @memberof AvroParser */ - PremiumPageBlobTier["P80"] = "P80"; -})(exports.PremiumPageBlobTier || (exports.PremiumPageBlobTier = {})); -function toAccessTier(tier) { - if (tier == undefined) { - return undefined; - } - return tier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service). -} -function ensureCpkIfSpecified(cpk, isHttps) { - if (cpk && !isHttps) { - throw new RangeError("Customer-provided encryption key must be used over HTTPS."); - } - if (cpk && !cpk.encryptionAlgorithm) { - cpk.encryptionAlgorithm = EncryptionAlgorithmAES25; - } -} - -// Copyright (c) Microsoft Corporation. All rights reserved. -/** - * Reads a readable stream into buffer. Fill the buffer from offset to end. - * - * @export - * @param {NodeJS.ReadableStream} stream A Node.js Readable stream - * @param {Buffer} buffer Buffer to be filled, length must >= offset - * @param {number} offset From which position in the buffer to be filled, inclusive - * @param {number} end To which position in the buffer to be filled, exclusive - * @param {string} [encoding] Encoding of the Readable stream - * @returns {Promise} - */ -function streamToBuffer(stream, buffer, offset, end, encoding) { - return tslib.__awaiter(this, void 0, void 0, function () { - var pos, count; - return tslib.__generator(this, function (_a) { - pos = 0; - count = end - offset; - return [2 /*return*/, new Promise(function (resolve, reject) { - stream.on("readable", function () { - if (pos >= count) { - resolve(); - return; - } - var chunk = stream.read(); - if (!chunk) { - return; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); - } - // How much data needed in this chunk - var chunkLength = pos + chunk.length > count ? count - pos : chunk.length; - buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); - pos += chunkLength; - }); - stream.on("end", function () { - if (pos < count) { - reject(new Error("Stream drains before getting enough data needed. Data read: " + pos + ", data need: " + count)); + AvroParser.readByte = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var buf; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(stream, 1, options)]; + case 1: + buf = _a.sent(); + return [2 /*return*/, buf[0]]; + } + }); + }); + }; + // int and long are stored in variable-length zig-zag coding. + // variable-length: https://lucene.apache.org/core/3_5_0/fileformats.html#VInt + // zig-zag: https://developers.google.com/protocol-buffers/docs/encoding?csw=1#types + AvroParser.readZigZagLong = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var zigZagEncoded, significanceInBit, byte, haveMoreByte, significanceInFloat, res; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + zigZagEncoded = 0; + significanceInBit = 0; + _a.label = 1; + case 1: return [4 /*yield*/, AvroParser.readByte(stream, options)]; + case 2: + byte = _a.sent(); + haveMoreByte = byte & 0x80; + zigZagEncoded |= (byte & 0x7f) << significanceInBit; + significanceInBit += 7; + _a.label = 3; + case 3: + if (haveMoreByte && significanceInBit < 28) return [3 /*break*/, 1]; + _a.label = 4; + case 4: + if (!haveMoreByte) return [3 /*break*/, 9]; + // Switch to float arithmetic + zigZagEncoded = zigZagEncoded; + significanceInFloat = 268435456; // 2 ** 28. + _a.label = 5; + case 5: return [4 /*yield*/, AvroParser.readByte(stream, options)]; + case 6: + byte = _a.sent(); + zigZagEncoded += (byte & 0x7f) * significanceInFloat; + significanceInFloat *= 128; // 2 ** 7 + _a.label = 7; + case 7: + if (byte & 0x80) return [3 /*break*/, 5]; + _a.label = 8; + case 8: + res = (zigZagEncoded % 2 ? -(zigZagEncoded + 1) : zigZagEncoded) / 2; + if (res < Number.MIN_SAFE_INTEGER || res > Number.MAX_SAFE_INTEGER) { + throw new Error("Integer overflow."); } - resolve(); - }); - stream.on("error", reject); - })]; + return [2 /*return*/, res]; + case 9: return [2 /*return*/, (zigZagEncoded >> 1) ^ -(zigZagEncoded & 1)]; + } + }); }); - }); -} -/** - * Reads a readable stream into buffer entirely. - * - * @export - * @param {NodeJS.ReadableStream} stream A Node.js Readable stream - * @param {Buffer} buffer Buffer to be filled, length must >= offset - * @param {string} [encoding] Encoding of the Readable stream - * @returns {Promise} with the count of bytes read. - * @throws {RangeError} If buffer size is not big enough. - */ -function streamToBuffer2(stream, buffer, encoding) { - return tslib.__awaiter(this, void 0, void 0, function () { - var pos, bufferSize; - return tslib.__generator(this, function (_a) { - pos = 0; - bufferSize = buffer.length; - return [2 /*return*/, new Promise(function (resolve, reject) { - stream.on("readable", function () { - var chunk = stream.read(); - if (!chunk) { - return; + }; + AvroParser.readLong = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, AvroParser.readZigZagLong(stream, options)]; + }); + }); + }; + AvroParser.readInt = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, AvroParser.readZigZagLong(stream, options)]; + }); + }); + }; + AvroParser.readNull = function () { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, null]; + }); + }); + }; + AvroParser.readBoolean = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var b; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readByte(stream, options)]; + case 1: + b = _a.sent(); + if (b == 1) { + return [2 /*return*/, true]; } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); + else if (b == 0) { + return [2 /*return*/, false]; } - if (pos + chunk.length > bufferSize) { - reject(new Error("Stream exceeds buffer size. Buffer size: " + bufferSize)); - return; + else { + throw new Error("Byte was not a boolean."); } - buffer.fill(chunk, pos, pos + chunk.length); - pos += chunk.length; - }); - stream.on("end", function () { - resolve(pos); - }); - stream.on("error", reject); - })]; + } + }); + }); + }; + AvroParser.readFloat = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var u8arr, view; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(stream, 4, options)]; + case 1: + u8arr = _a.sent(); + view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); + return [2 /*return*/, view.getFloat32(0, true)]; // littleEndian = true + } + }); + }); + }; + AvroParser.readDouble = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var u8arr, view; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(stream, 8, options)]; + case 1: + u8arr = _a.sent(); + view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); + return [2 /*return*/, view.getFloat64(0, true)]; // littleEndian = true + } + }); + }); + }; + AvroParser.readBytes = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var size; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 1: + size = _a.sent(); + if (size < 0) { + throw new Error("Bytes size was negative."); + } + return [4 /*yield*/, stream.read(size, { abortSignal: options.abortSignal })]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + AvroParser.readString = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var u8arr, utf8decoder; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readBytes(stream, options)]; + case 1: + u8arr = _a.sent(); + // polyfill TextDecoder to be backward compatible with older + // nodejs that doesn't expose TextDecoder as a global variable + if (typeof TextDecoder === "undefined" && "function" !== "undefined") { + global.TextDecoder = __webpack_require__(669).TextDecoder; + } + utf8decoder = new TextDecoder(); + return [2 /*return*/, utf8decoder.decode(u8arr)]; + } + }); + }); + }; + AvroParser.readMapPair = function (stream, readItemMethod, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var key, value; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readString(stream, options)]; + case 1: + key = _a.sent(); + return [4 /*yield*/, readItemMethod(stream, options)]; + case 2: + value = _a.sent(); + return [2 /*return*/, { key: key, value: value }]; + } + }); + }); + }; + AvroParser.readMap = function (stream, readItemMethod, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var readPairMethod, pairs, dict, _i, pairs_1, pair; + var _this = this; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + readPairMethod = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(_this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readMapPair(stream, readItemMethod, options)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + return [4 /*yield*/, AvroParser.readArray(stream, readPairMethod, options)]; + case 1: + pairs = _a.sent(); + dict = {}; + for (_i = 0, pairs_1 = pairs; _i < pairs_1.length; _i++) { + pair = pairs_1[_i]; + dict[pair.key] = pair.value; + } + return [2 /*return*/, dict]; + } + }); + }); + }; + AvroParser.readArray = function (stream, readItemMethod, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var items, count, item; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + items = []; + return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 1: + count = _a.sent(); + _a.label = 2; + case 2: + if (!(count != 0)) return [3 /*break*/, 8]; + if (!(count < 0)) return [3 /*break*/, 4]; + // Ignore block sizes + return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 3: + // Ignore block sizes + _a.sent(); + count = -count; + _a.label = 4; + case 4: + if (!count--) return [3 /*break*/, 6]; + return [4 /*yield*/, readItemMethod(stream, options)]; + case 5: + item = _a.sent(); + items.push(item); + return [3 /*break*/, 4]; + case 6: return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 7: + count = _a.sent(); + return [3 /*break*/, 2]; + case 8: return [2 /*return*/, items]; + } + }); + }); + }; + return AvroParser; +}()); +var AvroComplex; +(function (AvroComplex) { + AvroComplex["RECORD"] = "record"; + AvroComplex["ENUM"] = "enum"; + AvroComplex["ARRAY"] = "array"; + AvroComplex["MAP"] = "map"; + AvroComplex["UNION"] = "union"; + AvroComplex["FIXED"] = "fixed"; +})(AvroComplex || (AvroComplex = {})); +var AvroType = /** @class */ (function () { + function AvroType() { + } + /** + * Determines the AvroType from the Avro Schema. + */ + AvroType.fromSchema = function (schema) { + if (typeof schema == "string") { + return AvroType.fromStringSchema(schema); + } + else if (Array.isArray(schema)) { + return AvroType.fromArraySchema(schema); + } + else { + return AvroType.fromObjectSchema(schema); + } + }; + AvroType.fromStringSchema = function (schema) { + switch (schema) { + case AvroPrimitive.NULL: + case AvroPrimitive.BOOLEAN: + case AvroPrimitive.INT: + case AvroPrimitive.LONG: + case AvroPrimitive.FLOAT: + case AvroPrimitive.DOUBLE: + case AvroPrimitive.BYTES: + case AvroPrimitive.STRING: + return new AvroPrimitiveType(schema); + default: + throw new Error("Unexpected Avro type " + schema); + } + }; + AvroType.fromArraySchema = function (schema) { + return new AvroUnionType(schema.map(AvroType.fromSchema)); + }; + AvroType.fromObjectSchema = function (schema) { + var type = schema.type; + // Primitives can be defined as strings or objects + try { + return AvroType.fromStringSchema(type); + } + catch (err) { } + switch (type) { + case AvroComplex.RECORD: + if (schema.aliases) { + throw new Error("aliases currently is not supported, schema: " + schema); + } + if (!schema.name) { + throw new Error("Required attribute 'name' doesn't exist on schema: " + schema); + } + var fields = {}; + if (!schema.fields) { + throw new Error("Required attribute 'fields' doesn't exist on schema: " + schema); + } + for (var _i = 0, _a = schema.fields; _i < _a.length; _i++) { + var field = _a[_i]; + fields[field.name] = AvroType.fromSchema(field.type); + } + return new AvroRecordType(fields, schema.name); + case AvroComplex.ENUM: + if (schema.aliases) { + throw new Error("aliases currently is not supported, schema: " + schema); + } + if (!schema.symbols) { + throw new Error("Required attribute 'symbols' doesn't exist on schema: " + schema); + } + return new AvroEnumType(schema.symbols); + case AvroComplex.MAP: + if (!schema.values) { + throw new Error("Required attribute 'values' doesn't exist on schema: " + schema); + } + return new AvroMapType(AvroType.fromSchema(schema.values)); + case AvroComplex.ARRAY: // Unused today + case AvroComplex.FIXED: // Unused today + default: + throw new Error("Unexpected Avro type " + type + " in " + schema); + } + }; + return AvroType; +}()); +var AvroPrimitive; +(function (AvroPrimitive) { + AvroPrimitive["NULL"] = "null"; + AvroPrimitive["BOOLEAN"] = "boolean"; + AvroPrimitive["INT"] = "int"; + AvroPrimitive["LONG"] = "long"; + AvroPrimitive["FLOAT"] = "float"; + AvroPrimitive["DOUBLE"] = "double"; + AvroPrimitive["BYTES"] = "bytes"; + AvroPrimitive["STRING"] = "string"; +})(AvroPrimitive || (AvroPrimitive = {})); +var AvroPrimitiveType = /** @class */ (function (_super) { + tslib.__extends(AvroPrimitiveType, _super); + function AvroPrimitiveType(primitive) { + var _this = _super.call(this) || this; + _this._primitive = primitive; + return _this; + } + AvroPrimitiveType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = this._primitive; + switch (_a) { + case AvroPrimitive.NULL: return [3 /*break*/, 1]; + case AvroPrimitive.BOOLEAN: return [3 /*break*/, 3]; + case AvroPrimitive.INT: return [3 /*break*/, 5]; + case AvroPrimitive.LONG: return [3 /*break*/, 7]; + case AvroPrimitive.FLOAT: return [3 /*break*/, 9]; + case AvroPrimitive.DOUBLE: return [3 /*break*/, 11]; + case AvroPrimitive.BYTES: return [3 /*break*/, 13]; + case AvroPrimitive.STRING: return [3 /*break*/, 15]; + } + return [3 /*break*/, 17]; + case 1: return [4 /*yield*/, AvroParser.readNull()]; + case 2: return [2 /*return*/, _b.sent()]; + case 3: return [4 /*yield*/, AvroParser.readBoolean(stream, options)]; + case 4: return [2 /*return*/, _b.sent()]; + case 5: return [4 /*yield*/, AvroParser.readInt(stream, options)]; + case 6: return [2 /*return*/, _b.sent()]; + case 7: return [4 /*yield*/, AvroParser.readLong(stream, options)]; + case 8: return [2 /*return*/, _b.sent()]; + case 9: return [4 /*yield*/, AvroParser.readFloat(stream, options)]; + case 10: return [2 /*return*/, _b.sent()]; + case 11: return [4 /*yield*/, AvroParser.readDouble(stream, options)]; + case 12: return [2 /*return*/, _b.sent()]; + case 13: return [4 /*yield*/, AvroParser.readBytes(stream, options)]; + case 14: return [2 /*return*/, _b.sent()]; + case 15: return [4 /*yield*/, AvroParser.readString(stream, options)]; + case 16: return [2 /*return*/, _b.sent()]; + case 17: throw new Error("Unknown Avro Primitive"); + } + }); + }); + }; + return AvroPrimitiveType; +}(AvroType)); +var AvroEnumType = /** @class */ (function (_super) { + tslib.__extends(AvroEnumType, _super); + function AvroEnumType(symbols) { + var _this = _super.call(this) || this; + _this._symbols = symbols; + return _this; + } + AvroEnumType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var value; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readInt(stream, options)]; + case 1: + value = _a.sent(); + return [2 /*return*/, this._symbols[value]]; + } + }); }); + }; + return AvroEnumType; +}(AvroType)); +var AvroUnionType = /** @class */ (function (_super) { + tslib.__extends(AvroUnionType, _super); + function AvroUnionType(types) { + var _this = _super.call(this) || this; + _this._types = types; + return _this; + } + AvroUnionType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var typeIndex; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, AvroParser.readInt(stream, options)]; + case 1: + typeIndex = _a.sent(); + return [4 /*yield*/, this._types[typeIndex].read(stream, options)]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + return AvroUnionType; +}(AvroType)); +var AvroMapType = /** @class */ (function (_super) { + tslib.__extends(AvroMapType, _super); + function AvroMapType(itemType) { + var _this = _super.call(this) || this; + _this._itemType = itemType; + return _this; + } + AvroMapType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var readItemMethod; + var _this = this; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + readItemMethod = function (s, options) { return tslib.__awaiter(_this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this._itemType.read(s, options)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); }; + return [4 /*yield*/, AvroParser.readMap(stream, readItemMethod, options)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + return AvroMapType; +}(AvroType)); +var AvroRecordType = /** @class */ (function (_super) { + tslib.__extends(AvroRecordType, _super); + function AvroRecordType(fields, name) { + var _this = _super.call(this) || this; + _this._fields = fields; + _this._name = name; + return _this; + } + AvroRecordType.prototype.read = function (stream, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var record, _a, _b, _i, key, _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + record = {}; + record["$schema"] = this._name; + _a = []; + for (_b in this._fields) + _a.push(_b); + _i = 0; + _e.label = 1; + case 1: + if (!(_i < _a.length)) return [3 /*break*/, 4]; + key = _a[_i]; + if (!this._fields.hasOwnProperty(key)) return [3 /*break*/, 3]; + _c = record; + _d = key; + return [4 /*yield*/, this._fields[key].read(stream, options)]; + case 2: + _c[_d] = _e.sent(); + _e.label = 3; + case 3: + _i++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/, record]; + } + }); + }); + }; + return AvroRecordType; +}(AvroType)); + +// Copyright (c) Microsoft Corporation. +var AvroReader = /** @class */ (function () { + function AvroReader(dataStream, headerStream, currentBlockOffset, indexWithinCurrentBlock) { + this._dataStream = dataStream; + this._headerStream = headerStream || dataStream; + this._initialized = false; + this._blockOffset = currentBlockOffset || 0; + this._objectIndex = indexWithinCurrentBlock || 0; + this._initialBlockOffset = currentBlockOffset || 0; + } + Object.defineProperty(AvroReader.prototype, "blockOffset", { + get: function () { + return this._blockOffset; + }, + enumerable: false, + configurable: true }); -} -/** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. - * - * @export - * @param {NodeJS.ReadableStream} rs The read stream. - * @param {string} file Destination file path. - * @returns {Promise} - */ -function readStreamToLocalFile(rs, file) { - return tslib.__awaiter(this, void 0, void 0, function () { - return tslib.__generator(this, function (_a) { - return [2 /*return*/, new Promise(function (resolve, reject) { - var ws = fs.createWriteStream(file); - rs.on("error", function (err) { - reject(err); - }); - ws.on("error", function (err) { - reject(err); - }); - ws.on("close", resolve); - rs.pipe(ws); - })]; + Object.defineProperty(AvroReader.prototype, "objectIndex", { + get: function () { + return this._objectIndex; + }, + enumerable: false, + configurable: true + }); + AvroReader.prototype.initialize = function (options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var header, _a, codec, _b, schema, _c, i; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: return [4 /*yield*/, AvroParser.readFixedBytes(this._headerStream, AVRO_INIT_BYTES.length, { + abortSignal: options.abortSignal + })]; + case 1: + header = _d.sent(); + if (!arraysEqual(header, AVRO_INIT_BYTES)) { + throw new Error("Stream is not an Avro file."); + } + // File metadata is written as if defined by the following map schema: + // { "type": "map", "values": "bytes"} + _a = this; + return [4 /*yield*/, AvroParser.readMap(this._headerStream, AvroParser.readString, { + abortSignal: options.abortSignal + })]; + case 2: + // File metadata is written as if defined by the following map schema: + // { "type": "map", "values": "bytes"} + _a._metadata = _d.sent(); + codec = this._metadata[AVRO_CODEC_KEY]; + if (!(codec == undefined || codec == "null")) { + throw new Error("Codecs are not supported"); + } + // The 16-byte, randomly-generated sync marker for this file. + _b = this; + return [4 /*yield*/, AvroParser.readFixedBytes(this._headerStream, AVRO_SYNC_MARKER_SIZE, { + abortSignal: options.abortSignal + })]; + case 3: + // The 16-byte, randomly-generated sync marker for this file. + _b._syncMarker = _d.sent(); + schema = JSON.parse(this._metadata[AVRO_SCHEMA_KEY]); + this._itemType = AvroType.fromSchema(schema); + if (this._blockOffset == 0) { + this._blockOffset = this._initialBlockOffset + this._dataStream.position; + } + _c = this; + return [4 /*yield*/, AvroParser.readLong(this._dataStream, { + abortSignal: options.abortSignal + })]; + case 4: + _c._itemsRemainingInBlock = _d.sent(); + // skip block length + return [4 /*yield*/, AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal })]; + case 5: + // skip block length + _d.sent(); + this._initialized = true; + if (!(this._objectIndex && this._objectIndex > 0)) return [3 /*break*/, 9]; + i = 0; + _d.label = 6; + case 6: + if (!(i < this._objectIndex)) return [3 /*break*/, 9]; + return [4 /*yield*/, this._itemType.read(this._dataStream, { abortSignal: options.abortSignal })]; + case 7: + _d.sent(); + this._itemsRemainingInBlock--; + _d.label = 8; + case 8: + i++; + return [3 /*break*/, 6]; + case 9: return [2 /*return*/]; + } + }); }); + }; + AvroReader.prototype.hasNext = function () { + return !this._initialized || this._itemsRemainingInBlock > 0; + }; + AvroReader.prototype.parseObjects = function (options) { + if (options === void 0) { options = {}; } + return tslib.__asyncGenerator(this, arguments, function parseObjects_1() { + var result, marker, _a, err_1; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!!this._initialized) return [3 /*break*/, 2]; + return [4 /*yield*/, tslib.__await(this.initialize(options))]; + case 1: + _b.sent(); + _b.label = 2; + case 2: + if (!this.hasNext()) return [3 /*break*/, 13]; + return [4 /*yield*/, tslib.__await(this._itemType.read(this._dataStream, { + abortSignal: options.abortSignal + }))]; + case 3: + result = _b.sent(); + this._itemsRemainingInBlock--; + this._objectIndex++; + if (!(this._itemsRemainingInBlock == 0)) return [3 /*break*/, 10]; + return [4 /*yield*/, tslib.__await(AvroParser.readFixedBytes(this._dataStream, AVRO_SYNC_MARKER_SIZE, { + abortSignal: options.abortSignal + }))]; + case 4: + marker = _b.sent(); + this._blockOffset = this._initialBlockOffset + this._dataStream.position; + this._objectIndex = 0; + if (!arraysEqual(this._syncMarker, marker)) { + throw new Error("Stream is not a valid Avro file."); + } + _b.label = 5; + case 5: + _b.trys.push([5, 7, , 8]); + _a = this; + return [4 /*yield*/, tslib.__await(AvroParser.readLong(this._dataStream, { + abortSignal: options.abortSignal + }))]; + case 6: + _a._itemsRemainingInBlock = _b.sent(); + return [3 /*break*/, 8]; + case 7: + err_1 = _b.sent(); + // We hit the end of the stream. + this._itemsRemainingInBlock = 0; + return [3 /*break*/, 8]; + case 8: + if (!(this._itemsRemainingInBlock > 0)) return [3 /*break*/, 10]; + // Ignore block size + return [4 /*yield*/, tslib.__await(AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal }))]; + case 9: + // Ignore block size + _b.sent(); + _b.label = 10; + case 10: return [4 /*yield*/, tslib.__await(result)]; + case 11: return [4 /*yield*/, _b.sent()]; + case 12: + _b.sent(); + return [3 /*break*/, 2]; + case 13: return [2 /*return*/]; + } + }); + }); + }; + return AvroReader; +}()); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +var AvroReadable = /** @class */ (function () { + function AvroReadable() { + } + return AvroReadable; +}()); + +// Copyright (c) Microsoft Corporation. +var ABORT_ERROR$1 = new abortController.AbortError("Reading from the avro stream was aborted."); +var AvroReadableFromStream = /** @class */ (function (_super) { + tslib.__extends(AvroReadableFromStream, _super); + function AvroReadableFromStream(readable) { + var _this = _super.call(this) || this; + _this._readable = readable; + _this._position = 0; + return _this; + } + AvroReadableFromStream.prototype.toUint8Array = function (data) { + if (typeof data === "string") { + return Buffer.from(data); + } + return data; + }; + Object.defineProperty(AvroReadableFromStream.prototype, "position", { + get: function () { + return this._position; + }, + enumerable: false, + configurable: true }); -} + AvroReadableFromStream.prototype.read = function (size, options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var chunk; + var _this = this; + return tslib.__generator(this, function (_b) { + if ((_a = options.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) { + throw ABORT_ERROR$1; + } + if (size < 0) { + throw new Error("size parameter should be positive: " + size); + } + if (size === 0) { + return [2 /*return*/, new Uint8Array()]; + } + if (!this._readable.readable) { + throw new Error("Stream no longer readable."); + } + chunk = this._readable.read(size); + if (chunk) { + this._position += chunk.length; + // chunk.length maybe less than desired size if the stream ends. + return [2 /*return*/, this.toUint8Array(chunk)]; + } + else { + // register callback to wait for enough data to read + return [2 /*return*/, new Promise(function (resolve, reject) { + var cleanUp = function () { + _this._readable.removeListener("readable", readableCallback); + _this._readable.removeListener("error", rejectCallback); + _this._readable.removeListener("end", rejectCallback); + _this._readable.removeListener("close", rejectCallback); + if (options.abortSignal) { + options.abortSignal.removeEventListener("abort", abortHandler); + } + }; + var readableCallback = function () { + var chunk = _this._readable.read(size); + if (chunk) { + _this._position += chunk.length; + cleanUp(); + // chunk.length maybe less than desired size if the stream ends. + resolve(_this.toUint8Array(chunk)); + } + }; + var rejectCallback = function () { + cleanUp(); + reject(); + }; + var abortHandler = function () { + cleanUp(); + reject(ABORT_ERROR$1); + }; + _this._readable.on("readable", readableCallback); + _this._readable.once("error", rejectCallback); + _this._readable.once("end", rejectCallback); + _this._readable.once("close", rejectCallback); + if (options.abortSignal) { + options.abortSignal.addEventListener("abort", abortHandler); + } + })]; + } + }); + }); + }; + return AvroReadableFromStream; +}(AvroReadable)); + +// Copyright (c) Microsoft Corporation. All rights reserved. /** * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * Promisified version of fs.stat(). + * A Node.js BlobQuickQueryStream will internally parse avro data stream for blob query. + * + * @class BlobQuickQueryStream + * @extends {Readable} */ -var fsStat = util.promisify(fs.stat); +var BlobQuickQueryStream = /** @class */ (function (_super) { + tslib.__extends(BlobQuickQueryStream, _super); + /** + * Creates an instance of BlobQuickQueryStream. + * + * @param {NodeJS.ReadableStream} source The current ReadableStream returned from getter + * @param {BlobQuickQueryStreamOptions} [options={}] + * @memberof BlobQuickQueryStream + */ + function BlobQuickQueryStream(source, options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this) || this; + _this.source = source; + _this.onProgress = options.onProgress; + _this.onError = options.onError; + _this.avroReader = new AvroReader(new AvroReadableFromStream(_this.source)); + _this.avroIter = _this.avroReader.parseObjects({ abortSignal: options.abortSignal }); + return _this; + } + BlobQuickQueryStream.prototype._read = function () { + var _this = this; + this.readInternal().catch(function (err) { + _this.emit("error", err); + }); + }; + BlobQuickQueryStream.prototype.readInternal = function () { + var e_1, _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, _c, obj, schema, exit, data, bytesScanned, totalBytes, fatal, name_1, description, position, e_1_1; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 5, 6, 11]); + _b = tslib.__asyncValues(this.avroIter); + _d.label = 1; + case 1: return [4 /*yield*/, _b.next()]; + case 2: + if (!(_c = _d.sent(), !_c.done)) return [3 /*break*/, 4]; + obj = _c.value; + schema = obj.$schema; + if (typeof schema !== "string") { + throw Error("Missing schema in avro record."); + } + exit = false; + switch (schema) { + case "com.microsoft.azure.storage.queryBlobContents.resultData": + data = obj.data; + if (data instanceof Uint8Array === false) { + throw Error("Invalid data in avro result record."); + } + if (!this.push(Buffer.from(data))) { + exit = true; + } + break; + case "com.microsoft.azure.storage.queryBlobContents.progress": + bytesScanned = obj.bytesScanned; + if (typeof bytesScanned !== "number") { + throw Error("Invalid bytesScanned in avro progress record."); + } + if (this.onProgress) { + this.onProgress({ loadedBytes: bytesScanned }); + } + break; + case "com.microsoft.azure.storage.queryBlobContents.end": + if (this.onProgress) { + totalBytes = obj.totalBytes; + if (typeof totalBytes !== "number") { + throw Error("Invalid totalBytes in avro end record."); + } + this.onProgress({ loadedBytes: totalBytes }); + } + this.push(null); + break; + case "com.microsoft.azure.storage.queryBlobContents.error": + if (this.onError) { + fatal = obj.fatal; + if (typeof fatal !== "boolean") { + throw Error("Invalid fatal in avro error record."); + } + name_1 = obj.name; + if (typeof name_1 !== "string") { + throw Error("Invalid name in avro error record."); + } + description = obj.description; + if (typeof description !== "string") { + throw Error("Invalid description in avro error record."); + } + position = obj.position; + if (typeof position !== "number") { + throw Error("Invalid position in avro error record."); + } + this.onError({ + position: position, + name: name_1, + isFatal: fatal, + description: description + }); + } + break; + default: + throw Error("Unknown schema " + schema + " in avro progress record."); + } + if (exit) { + return [3 /*break*/, 4]; + } + _d.label = 3; + case 3: return [3 /*break*/, 1]; + case 4: return [3 /*break*/, 11]; + case 5: + e_1_1 = _d.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 11]; + case 6: + _d.trys.push([6, , 9, 10]); + if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 8]; + return [4 /*yield*/, _a.call(_b)]; + case 7: + _d.sent(); + _d.label = 8; + case 8: return [3 /*break*/, 10]; + case 9: + if (e_1) throw e_1.error; + return [7 /*endfinally*/]; + case 10: return [7 /*endfinally*/]; + case 11: return [2 /*return*/]; + } + }); + }); + }; + return BlobQuickQueryStream; +}(stream.Readable)); // Copyright (c) Microsoft Corporation. All rights reserved. /** - * Credential policy used to sign HTTP(S) requests before sending. This is an - * abstract class. + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * BlobQueryResponse implements BlobDownloadResponseModel interface, and in Node.js runtime it will + * parse avor data returned by blob query. * * @export - * @abstract - * @class CredentialPolicy - * @extends {BaseRequestPolicy} + * @class BlobQueryResponse + * @implements {BlobDownloadResponseModel} */ -var CredentialPolicy = /** @class */ (function (_super) { - tslib.__extends(CredentialPolicy, _super); - function CredentialPolicy() { - return _super !== null && _super.apply(this, arguments) || this; - } +var BlobQueryResponse = /** @class */ (function () { /** - * Sends out request. + * Creates an instance of BlobQueryResponse. * - * @param {WebResource} request - * @returns {Promise} - * @memberof CredentialPolicy + * @param {BlobQueryResponseModel} originalResponse + * @param {BlobQuickQueryStreamOptions} [options={}] + * @memberof BlobQueryResponse */ - CredentialPolicy.prototype.sendRequest = function (request) { - return this._nextPolicy.sendRequest(this.signRequest(request)); - }; - /** - * Child classes must implement this method with request signing. This method - * will be executed in {@link sendRequest}. - * - * @protected - * @abstract - * @param {WebResource} request - * @returns {WebResource} - * @memberof CredentialPolicy - */ - CredentialPolicy.prototype.signRequest = function (request) { - // Child classes must override this method with request signing. This method - // will be executed in sendRequest(). - return request; - }; - return CredentialPolicy; -}(coreHttp.BaseRequestPolicy)); + function BlobQueryResponse(originalResponse, options) { + if (options === void 0) { options = {}; } + this.originalResponse = originalResponse; + this.blobDownloadStream = new BlobQuickQueryStream(this.originalResponse.readableStreamBody, options); + } + Object.defineProperty(BlobQueryResponse.prototype, "acceptRanges", { + /** + * Indicates that the service supports + * requests for partial file content. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.acceptRanges; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "cacheControl", { + /** + * Returns if it was previously specified + * for the file. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.cacheControl; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentDisposition", { + /** + * Returns the value that was specified + * for the 'x-ms-content-disposition' header and specifies how to process the + * response. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentDisposition; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentEncoding", { + /** + * Returns the value that was specified + * for the Content-Encoding request header. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentEncoding; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentLanguage", { + /** + * Returns the value that was specified + * for the Content-Language request header. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentLanguage; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobSequenceNumber", { + /** + * The current sequence number for a + * page blob. This header is not returned for block blobs or append blobs. + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobSequenceNumber; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobType", { + /** + * The blob's type. Possible values include: + * 'BlockBlob', 'PageBlob', 'AppendBlob'. + * + * @readonly + * @type {(BlobType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobType; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentLength", { + /** + * The number of bytes present in the + * response body. + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentLength; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentMD5", { + /** + * If the file has an MD5 hash and the + * request is to read the full file, this response header is returned so that + * the client can check for message content integrity. If the request is to + * read a specified range and the 'x-ms-range-get-content-md5' is set to + * true, then the request returns an MD5 hash for the range, as long as the + * range size is less than or equal to 4 MB. If neither of these sets of + * conditions is true, then no value is returned for the 'Content-MD5' + * header. + * + * @readonly + * @type {(Uint8Array | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentMD5; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentRange", { + /** + * Indicates the range of bytes returned if + * the client requested a subset of the file by setting the Range request + * header. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentRange; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentType", { + /** + * The content type specified for the file. + * The default content type is 'application/octet-stream' + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentType; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyCompletedOn", { + /** + * Conclusion time of the last attempted + * Copy File operation where this file was the destination file. This value + * can specify the time of a completed, aborted, or failed copy attempt. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyId", { + /** + * String identifier for the last attempted Copy + * File operation where this file was the destination file. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyProgress", { + /** + * Contains the number of bytes copied and + * the total bytes in the source in the last attempted Copy File operation + * where this file was the destination file. Can show between 0 and + * Content-Length bytes copied. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyProgress; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copySource", { + /** + * URL up to 2KB in length that specifies the + * source file used in the last attempted Copy File operation where this file + * was the destination file. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copySource; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyStatus", { + /** + * State of the copy operation + * identified by 'x-ms-copy-id'. Possible values include: 'pending', + * 'success', 'aborted', 'failed' + * + * @readonly + * @type {(CopyStatusType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyStatus; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "copyStatusDescription", { + /** + * Only appears when + * x-ms-copy-status is failed or pending. Describes cause of fatal or + * non-fatal copy operation failure. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.copyStatusDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "leaseDuration", { + /** + * When a blob is leased, + * specifies whether the lease is of infinite or fixed duration. Possible + * values include: 'infinite', 'fixed'. + * + * @readonly + * @type {(LeaseDurationType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.leaseDuration; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "leaseState", { + /** + * Lease state of the blob. Possible + * values include: 'available', 'leased', 'expired', 'breaking', 'broken'. + * + * @readonly + * @type {(LeaseStateType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.leaseState; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "leaseStatus", { + /** + * The current lease status of the + * blob. Possible values include: 'locked', 'unlocked'. + * + * @readonly + * @type {(LeaseStatusType | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.leaseStatus; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "date", { + /** + * A UTC date/time value generated by the service that + * indicates the time at which the response was initiated. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.date; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobCommittedBlockCount", { + /** + * The number of committed blocks + * present in the blob. This header is returned only for append blobs. + * + * @readonly + * @type {(number | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobCommittedBlockCount; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "etag", { + /** + * The ETag contains a value that you can use to + * perform operations conditionally, in quotes. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.etag; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "errorCode", { + /** + * The error code. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.errorCode; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "isServerEncrypted", { + /** + * The value of this header is set to + * true if the file data and application metadata are completely encrypted + * using the specified algorithm. Otherwise, the value is set to false (when + * the file is unencrypted, or if only parts of the file/application metadata + * are encrypted). + * + * @readonly + * @type {(boolean | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.isServerEncrypted; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobContentMD5", { + /** + * If the blob has a MD5 hash, and if + * request contains range header (Range or x-ms-range), this response header + * is returned with the value of the whole blob's MD5 value. This value may + * or may not be equal to the value returned in Content-MD5 header, with the + * latter calculated from the requested range. + * + * @readonly + * @type {(Uint8Array | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.blobContentMD5; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "lastModified", { + /** + * Returns the date and time the file was last + * modified. Any operation that modifies the file or its properties updates + * the last modified time. + * + * @readonly + * @type {(Date | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.lastModified; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "metadata", { + /** + * A name-value pair + * to associate with a file storage object. + * + * @readonly + * @type {(Metadata | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.metadata; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "requestId", { + /** + * This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.requestId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "clientRequestId", { + /** + * If a client request id header is sent in the request, this header will be present in the + * response with the same value. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.clientRequestId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "version", { + /** + * Indicates the version of the File service used + * to execute the request. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.version; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "encryptionKeySha256", { + /** + * The SHA-256 hash of the encryption key used to encrypt the blob. This value is only returned + * when the blob was encrypted with a customer-provided key. + * + * @readonly + * @type {(string | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.encryptionKeySha256; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "contentCrc64", { + /** + * If the request is to read a specified range and the x-ms-range-get-content-crc64 is set to + * true, then the request returns a crc64 for the range, as long as the range size is less than + * or equal to 4 MB. If both x-ms-range-get-content-crc64 & x-ms-range-get-content-md5 is + * specified in the same request, it will fail with 400(Bad Request) + * + * @type {(Uint8Array | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse.contentCrc64; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "blobBody", { + /** + * The response body as a browser Blob. + * Always undefined in node.js. + * + * @readonly + * @type {(Promise | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "readableStreamBody", { + /** + * The response body as a node.js Readable stream. + * Always undefined in the browser. + * + * It will parse avor data returned by blob query. + * + * @readonly + * @type {(NodeJS.ReadableStream | undefined)} + * @memberof BlobQueryResponse + */ + get: function () { + return coreHttp.isNode ? this.blobDownloadStream : undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlobQueryResponse.prototype, "_response", { + /** + * The HTTP response. + * + * @type {HttpResponse} + * @memberof BlobQueryResponse + */ + get: function () { + return this.originalResponse._response; + }, + enumerable: false, + configurable: true + }); + return BlobQueryResponse; +}()); // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -23065,12 +26548,6 @@ var StorageSharedKeyCredentialPolicy = /** @class */ (function (_super) { this.getCanonicalizedResourceString(request); var signature = this.factory.computeHMACSHA256(stringToSign); request.headers.set(HeaderConstants.AUTHORIZATION, "SharedKey " + this.factory.accountName + ":" + signature); - // Workaround for https://github.com/axios/axios/issues/2107 - // We should always keep the 'content-length' header once the issue is solved - // For a better explanation about this workaround, look here: https://github.com/Azure/azure-sdk-for-js/pull/3273 - if (typeof request.body !== "function" && !(request.body && request.onUploadProgress)) { - request.headers.remove(HeaderConstants.CONTENT_LENGTH); - } // console.log(`[URL]:${request.url}`); // console.log(`[HEADERS]:${request.headers.toString()}`); // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); @@ -23164,44 +26641,13 @@ var StorageSharedKeyCredentialPolicy = /** @class */ (function (_super) { queryKeys.sort(); for (var _i = 0, queryKeys_1 = queryKeys; _i < queryKeys_1.length; _i++) { var key = queryKeys_1[_i]; - canonicalizedResourceString += "\n" + key + ":" + decodeURIComponent(lowercaseQueries[key]); - } - } - return canonicalizedResourceString; - }; - return StorageSharedKeyCredentialPolicy; -}(CredentialPolicy)); - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -/** - * Credential is an abstract class for Azure Storage HTTP requests signing. This - * class will host an credentialPolicyCreator factory which generates CredentialPolicy. - * - * @export - * @abstract - * @class Credential - */ -var Credential = /** @class */ (function () { - function Credential() { - } - /** - * Creates a RequestPolicy object. - * - * @param {RequestPolicy} _nextPolicy - * @param {RequestPolicyOptions} _options - * @returns {RequestPolicy} - * @memberof Credential - */ - Credential.prototype.create = function ( - // tslint:disable-next-line:variable-name - _nextPolicy, - // tslint:disable-next-line:variable-name - _options) { - throw new Error("Method should be implemented in children classes."); + canonicalizedResourceString += "\n" + key + ":" + decodeURIComponent(lowercaseQueries[key]); + } + } + return canonicalizedResourceString; }; - return Credential; -}()); + return StorageSharedKeyCredentialPolicy; +}(CredentialPolicy)); // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -23253,58 +26699,365 @@ var StorageSharedKeyCredential = /** @class */ (function (_super) { return StorageSharedKeyCredential; }(Credential)); -// Copyright (c) Microsoft Corporation. All rights reserved. -/** - * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources - * or for use with Shared Access Signatures (SAS). +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. * - * @export - * @class AnonymousCredentialPolicy - * @extends {CredentialPolicy} + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. */ -var AnonymousCredentialPolicy = /** @class */ (function (_super) { - tslib.__extends(AnonymousCredentialPolicy, _super); +var packageName = "azure-storage-blob"; +var packageVersion = "12.3.0"; +var StorageClientContext = /** @class */ (function (_super) { + tslib.__extends(StorageClientContext, _super); /** - * Creates an instance of AnonymousCredentialPolicy. - * @param {RequestPolicy} nextPolicy - * @param {RequestPolicyOptions} options - * @memberof AnonymousCredentialPolicy + * Initializes a new instance of the StorageClientContext class. + * @param url The URL of the service account, container, or blob that is the targe of the desired + * operation. + * @param [options] The parameter options */ - function AnonymousCredentialPolicy(nextPolicy, options) { - return _super.call(this, nextPolicy, options) || this; + function StorageClientContext(url, options) { + var _this = this; + if (url == undefined) { + throw new Error("'url' cannot be null."); + } + if (!options) { + options = {}; + } + if (!options.userAgent) { + var defaultUserAgent = coreHttp.getDefaultUserAgentValue(); + options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent; + } + _this = _super.call(this, undefined, options) || this; + _this.version = "2020-02-10"; + _this.baseUri = "{url}"; + _this.requestContentType = "application/json; charset=utf-8"; + _this.url = url; + return _this; } - return AnonymousCredentialPolicy; -}(CredentialPolicy)); + return StorageClientContext; +}(coreHttp.ServiceClient)); + +// Copyright (c) Microsoft Corporation. All rights reserved. +(function (BlockBlobTier) { + /** + * Optimized for storing data that is accessed frequently. + */ + BlockBlobTier["Hot"] = "Hot"; + /** + * Optimized for storing data that is infrequently accessed and stored for at least 30 days. + */ + BlockBlobTier["Cool"] = "Cool"; + /** + * Optimized for storing data that is rarely accessed and stored for at least 180 days + * with flexible latency requirements (on the order of hours). + */ + BlockBlobTier["Archive"] = "Archive"; +})(exports.BlockBlobTier || (exports.BlockBlobTier = {})); +(function (PremiumPageBlobTier) { + /** + * P4 Tier. + */ + PremiumPageBlobTier["P4"] = "P4"; + /** + * P6 Tier. + */ + PremiumPageBlobTier["P6"] = "P6"; + /** + * P10 Tier. + */ + PremiumPageBlobTier["P10"] = "P10"; + /** + * P15 Tier. + */ + PremiumPageBlobTier["P15"] = "P15"; + /** + * P20 Tier. + */ + PremiumPageBlobTier["P20"] = "P20"; + /** + * P30 Tier. + */ + PremiumPageBlobTier["P30"] = "P30"; + /** + * P40 Tier. + */ + PremiumPageBlobTier["P40"] = "P40"; + /** + * P50 Tier. + */ + PremiumPageBlobTier["P50"] = "P50"; + /** + * P60 Tier. + */ + PremiumPageBlobTier["P60"] = "P60"; + /** + * P70 Tier. + */ + PremiumPageBlobTier["P70"] = "P70"; + /** + * P80 Tier. + */ + PremiumPageBlobTier["P80"] = "P80"; +})(exports.PremiumPageBlobTier || (exports.PremiumPageBlobTier = {})); +function toAccessTier(tier) { + if (tier == undefined) { + return undefined; + } + return tier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service). +} +function ensureCpkIfSpecified(cpk, isHttps) { + if (cpk && !isHttps) { + throw new RangeError("Customer-provided encryption key must be used over HTTPS."); + } + if (cpk && !cpk.encryptionAlgorithm) { + cpk.encryptionAlgorithm = EncryptionAlgorithmAES25; + } +} + +/** + * Function that converts PageRange and ClearRange to a common Range object. + * PageRange and ClearRange have start and end while Range offset and count + * this function normalizes to Range. + * @param response Model PageBlob Range response + */ +function rangeResponseFromModel(response) { + var pageRange = (response._response.parsedBody.pageRange || []).map(function (x) { return ({ + offset: x.start, + count: x.end - x.start + }); }); + var clearRange = (response._response.parsedBody.clearRange || []).map(function (x) { return ({ + offset: x.start, + count: x.end - x.start + }); }); + return tslib.__assign(tslib.__assign({}, response), { pageRange: pageRange, + clearRange: clearRange, _response: tslib.__assign(tslib.__assign({}, response._response), { parsedBody: { + pageRange: pageRange, + clearRange: clearRange + } }) }); +} // Copyright (c) Microsoft Corporation. All rights reserved. /** - * AnonymousCredential provides a credentialPolicyCreator member used to create - * AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with - * HTTP(S) requests that read public resources or for use with Shared Access - * Signatures (SAS). + * This is the poller returned by {@link BlobClient.beginCopyFromURL}. + * This can not be instantiated directly outside of this package. + * + * @ignore + */ +var BlobBeginCopyFromUrlPoller = /** @class */ (function (_super) { + tslib.__extends(BlobBeginCopyFromUrlPoller, _super); + function BlobBeginCopyFromUrlPoller(options) { + var _this = this; + var blobClient = options.blobClient, copySource = options.copySource, _a = options.intervalInMs, intervalInMs = _a === void 0 ? 15000 : _a, onProgress = options.onProgress, resumeFrom = options.resumeFrom, startCopyFromURLOptions = options.startCopyFromURLOptions; + var state; + if (resumeFrom) { + state = JSON.parse(resumeFrom).state; + } + var operation = makeBlobBeginCopyFromURLPollOperation(tslib.__assign(tslib.__assign({}, state), { blobClient: blobClient, + copySource: copySource, + startCopyFromURLOptions: startCopyFromURLOptions })); + _this = _super.call(this, operation) || this; + if (typeof onProgress === "function") { + _this.onProgress(onProgress); + } + _this.intervalInMs = intervalInMs; + return _this; + } + BlobBeginCopyFromUrlPoller.prototype.delay = function () { + return coreHttp.delay(this.intervalInMs); + }; + return BlobBeginCopyFromUrlPoller; +}(coreLro.Poller)); +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @ignore + */ +var cancel = function cancel(options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var state, copyId; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + state = this.state; + copyId = state.copyId; + if (state.isCompleted) { + return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + if (!copyId) { + state.isCancelled = true; + return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call + return [4 /*yield*/, state.blobClient.abortCopyFromURL(copyId, { + abortSignal: options.abortSignal + })]; + case 1: + // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call + _a.sent(); + state.isCancelled = true; + return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + }); + }); +}; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @ignore + */ +var update = function update(options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var state, blobClient, copySource, startCopyFromURLOptions, result, result, copyStatus, copyProgress, prevCopyProgress, err_1; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + state = this.state; + blobClient = state.blobClient, copySource = state.copySource, startCopyFromURLOptions = state.startCopyFromURLOptions; + if (!!state.isStarted) return [3 /*break*/, 2]; + state.isStarted = true; + return [4 /*yield*/, blobClient.startCopyFromURL(copySource, startCopyFromURLOptions)]; + case 1: + result = _a.sent(); + // copyId is needed to abort + state.copyId = result.copyId; + if (result.copyStatus === "success") { + state.result = result; + state.isCompleted = true; + } + return [3 /*break*/, 6]; + case 2: + if (!!state.isCompleted) return [3 /*break*/, 6]; + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4 /*yield*/, state.blobClient.getProperties({ abortSignal: options.abortSignal })]; + case 4: + result = _a.sent(); + copyStatus = result.copyStatus, copyProgress = result.copyProgress; + prevCopyProgress = state.copyProgress; + if (copyProgress) { + state.copyProgress = copyProgress; + } + if (copyStatus === "pending" && + copyProgress !== prevCopyProgress && + typeof options.fireProgress === "function") { + // trigger in setTimeout, or swallow error? + options.fireProgress(state); + } + else if (copyStatus === "success") { + state.result = result; + state.isCompleted = true; + } + else if (copyStatus === "failed") { + state.error = new Error("Blob copy failed with reason: \"" + (result.copyStatusDescription || "unknown") + "\""); + state.isCompleted = true; + } + return [3 /*break*/, 6]; + case 5: + err_1 = _a.sent(); + state.error = err_1; + state.isCompleted = true; + return [3 /*break*/, 6]; + case 6: return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; + } + }); + }); +}; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @ignore + */ +var toString = function toString() { + return JSON.stringify({ state: this.state }, function (key, value) { + // remove blobClient from serialized state since a client can't be hydrated from this info. + if (key === "blobClient") { + return undefined; + } + return value; + }); +}; +/** + * Creates a poll operation given the provided state. + * @ignore + */ +function makeBlobBeginCopyFromURLPollOperation(state) { + return { + state: tslib.__assign({}, state), + cancel: cancel, + toString: toString, + update: update + }; +} + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +/** + * Generate a range string. For example: + * + * "bytes=255-" or "bytes=0-511" * * @export - * @class AnonymousCredential - * @extends {Credential} + * @param {Range} iRange + * @returns {string} */ -var AnonymousCredential = /** @class */ (function (_super) { - tslib.__extends(AnonymousCredential, _super); - function AnonymousCredential() { - return _super !== null && _super.apply(this, arguments) || this; +function rangeToString(iRange) { + if (iRange.offset < 0) { + throw new RangeError("Range.offset cannot be smaller than 0."); + } + if (iRange.count && iRange.count <= 0) { + throw new RangeError("Range.count must be larger than 0. Leave it undefined if you want a range from offset to the end."); } + return iRange.count + ? "bytes=" + iRange.offset + "-" + (iRange.offset + iRange.count - 1) + : "bytes=" + iRange.offset + "-"; +} + +// Copyright (c) Microsoft Corporation. All rights reserved. +/** + * A StorageClient represents a based URL class for {@link BlobServiceClient}, {@link ContainerClient} + * and etc. + * + * @export + * @class StorageClient + */ +var StorageClient = /** @class */ (function () { /** - * Creates an {@link AnonymousCredentialPolicy} object. - * - * @param {RequestPolicy} nextPolicy - * @param {RequestPolicyOptions} options - * @returns {AnonymousCredentialPolicy} - * @memberof AnonymousCredential + * Creates an instance of StorageClient. + * @param {string} url url to resource + * @param {Pipeline} pipeline request policy pipeline. + * @memberof StorageClient */ - AnonymousCredential.prototype.create = function (nextPolicy, options) { - return new AnonymousCredentialPolicy(nextPolicy, options); - }; - return AnonymousCredential; -}(Credential)); + function StorageClient(url, pipeline) { + // URL should be encoded and only once, protocol layer shouldn't encode URL again + this.url = escapeURLPath(url); + this.accountName = getAccountNameFromUrl(url); + this.pipeline = pipeline; + this.storageClientContext = new StorageClientContext(this.url, pipeline.toServiceClientOptions()); + this.isHttps = iEqual(getURLScheme(this.url) || "", "https"); + this.credential = new AnonymousCredential(); + for (var _i = 0, _a = this.pipeline.factories; _i < _a.length; _i++) { + var factory = _a[_i]; + if ((coreHttp.isNode && factory instanceof StorageSharedKeyCredential) || + factory instanceof AnonymousCredential || + coreHttp.isTokenCredential(factory)) { + this.credential = factory; + } + } + // Override protocol layer's default content-type + var storageClientContext = this.storageClientContext; + storageClientContext.requestContentType = undefined; + } + return StorageClient; +}()); // Copyright (c) Microsoft Corporation. All rights reserved. /** @@ -23477,105 +27230,195 @@ var Batch = /** @class */ (function () { return Batch; }()); -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. All rights reserved. /** - * Creates a span using the global tracer. - * @param name The name of the operation being performed. - * @param tracingOptions The options for the underlying http request. - */ -function createSpan(operationName, tracingOptions) { - if (tracingOptions === void 0) { tracingOptions = {}; } - var tracer = coreTracing.getTracer(); - var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL }); - var span = tracer.startSpan("Azure.Storage.Blob." + operationName, spanOptions); - span.setAttribute("az.namespace", "Microsoft.Storage"); - var newOptions = tracingOptions.spanOptions || {}; - if (span.isRecording()) { - newOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.Storage" }) }); - } - return { - span: span, - spanOptions: newOptions - }; -} - -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * This class generates a readable stream from the data in an array of buffers. * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ -var packageName = "azure-storage-blob"; -var packageVersion = "12.1.2"; -var StorageClientContext = /** @class */ (function (_super) { - tslib.__extends(StorageClientContext, _super); + * @export + * @class BuffersStream + */ +var BuffersStream = /** @class */ (function (_super) { + tslib.__extends(BuffersStream, _super); + /** + * Creates an instance of BuffersStream that will emit the data + * contained in the array of buffers. + * + * @param {Buffer[]} buffers Array of buffers containing the data + * @param {number} byteLength The total length of data contained in the buffers + * @memberof BuffersStream + */ + function BuffersStream(buffers, byteLength, options) { + var _this = _super.call(this, options) || this; + _this.buffers = buffers; + _this.byteLength = byteLength; + _this.byteOffsetInCurrentBuffer = 0; + _this.bufferIndex = 0; + _this.pushedBytesLength = 0; + // check byteLength is no larger than buffers[] total length + var buffersLength = 0; + for (var _i = 0, _a = _this.buffers; _i < _a.length; _i++) { + var buf = _a[_i]; + buffersLength += buf.byteLength; + } + if (buffersLength < _this.byteLength) { + throw new Error("Data size shouldn't be larger than the total length of buffers."); + } + return _this; + } /** - * Initializes a new instance of the StorageClientContext class. - * @param url The URL of the service account, container, or blob that is the targe of the desired - * operation. - * @param [options] The parameter options - */ - function StorageClientContext(url, options) { - var _this = this; - if (url == undefined) { - throw new Error("'url' cannot be null."); + * Internal _read() that will be called when the stream wants to pull more data in. + * + * @param {number} size Optional. The size of data to be read + * @memberof BuffersStream + */ + BuffersStream.prototype._read = function (size) { + if (this.pushedBytesLength >= this.byteLength) { + this.push(null); + } + if (!size) { + size = this.readableHighWaterMark; + } + var outBuffers = []; + var i = 0; + while (i < size && this.pushedBytesLength < this.byteLength) { + // The last buffer may be longer than the data it contains. + var remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength; + var remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer; + var remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers); + if (remaining > size - i) { + // chunkSize = size - i + var end = this.byteOffsetInCurrentBuffer + size - i; + outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); + this.pushedBytesLength += size - i; + this.byteOffsetInCurrentBuffer = end; + i = size; + break; + } + else { + // chunkSize = remaining + var end = this.byteOffsetInCurrentBuffer + remaining; + outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); + if (remaining === remainingCapacityInThisBuffer) { + // this.buffers[this.bufferIndex] used up, shift to next one + this.byteOffsetInCurrentBuffer = 0; + this.bufferIndex++; + } + else { + this.byteOffsetInCurrentBuffer = end; + } + this.pushedBytesLength += remaining; + i += remaining; + } } - if (!options) { - options = {}; + if (outBuffers.length > 1) { + this.push(Buffer.concat(outBuffers)); } - if (!options.userAgent) { - var defaultUserAgent = coreHttp.getDefaultUserAgentValue(); - options.userAgent = packageName + "/" + packageVersion + " " + defaultUserAgent; + else if (outBuffers.length === 1) { + this.push(outBuffers[0]); } - _this = _super.call(this, undefined, options) || this; - _this.version = '2019-07-07'; - _this.baseUri = "{url}"; - _this.requestContentType = "application/json; charset=utf-8"; - _this.url = url; - return _this; - } - return StorageClientContext; -}(coreHttp.ServiceClient)); + }; + return BuffersStream; +}(stream.Readable)); // Copyright (c) Microsoft Corporation. All rights reserved. /** - * A StorageClient represents a based URL class for {@link BlobServiceClient}, {@link ContainerClient} - * and etc. + * maxBufferLength is max size of each buffer in the pooled buffers. + */ +// Can't use import as Typescript doesn't recognize "buffer". +var maxBufferLength = __webpack_require__(293).constants.MAX_LENGTH; +/** + * This class provides a buffer container which conceptually has no hard size limit. + * It accepts a capacity, an array of input buffers and the total length of input data. + * It will allocate an internal "buffer" of the capacity and fill the data in the input buffers + * into the internal "buffer" serially with respect to the total length. + * Then by calling PooledBuffer.getReadableStream(), you can get a readable stream + * assembled from all the data in the internal "buffer". * * @export - * @class StorageClient + * @class BufferScheduler */ -var StorageClient = /** @class */ (function () { +var PooledBuffer = /** @class */ (function () { + function PooledBuffer(capacity, buffers, totalLength) { + /** + * Internal buffers used to keep the data. + * Each buffer has a length of the maxBufferLength except last one. + * + * @private + * @type {Buffer[]} + * @memberof PooledBuffer + */ + this.buffers = []; + this.capacity = capacity; + this._size = 0; + // allocate + var bufferNum = Math.ceil(capacity / maxBufferLength); + for (var i = 0; i < bufferNum; i++) { + var len = i === bufferNum - 1 ? capacity % maxBufferLength : maxBufferLength; + if (len === 0) { + len = maxBufferLength; + } + this.buffers.push(Buffer.allocUnsafe(len)); + } + if (buffers) { + this.fill(buffers, totalLength); + } + } + Object.defineProperty(PooledBuffer.prototype, "size", { + /** + * The size of the data contained in the pooled buffers. + */ + get: function () { + return this._size; + }, + enumerable: false, + configurable: true + }); /** - * Creates an instance of StorageClient. - * @param {string} url url to resource - * @param {Pipeline} pipeline request policy pipeline. - * @memberof StorageClient + * Fill the internal buffers with data in the input buffers serially + * with respect to the total length and the total capacity of the internal buffers. + * Data copied will be shift out of the input buffers. + * + * @param {Buffer[]} buffers Input buffers containing the data to be filled in the pooled buffer + * @param {number} totalLength Total length of the data to be filled in. + * + * @returns {void} + * @memberof PooledBuffer */ - function StorageClient(url, pipeline) { - // URL should be encoded and only once, protocol layer shouldn't encode URL again - this.url = escapeURLPath(url); - this.accountName = getAccountNameFromUrl(url); - this.pipeline = pipeline; - this.storageClientContext = new StorageClientContext(this.url, pipeline.toServiceClientOptions()); - this.isHttps = iEqual(getURLScheme(this.url) || "", "https"); - this.credential = new AnonymousCredential(); - for (var _i = 0, _a = this.pipeline.factories; _i < _a.length; _i++) { - var factory = _a[_i]; - if ((coreHttp.isNode && factory instanceof StorageSharedKeyCredential) || - factory instanceof AnonymousCredential || - coreHttp.isTokenCredential(factory)) { - this.credential = factory; + PooledBuffer.prototype.fill = function (buffers, totalLength) { + this._size = Math.min(this.capacity, totalLength); + var i = 0, j = 0, targetOffset = 0, sourceOffset = 0, totalCopiedNum = 0; + while (totalCopiedNum < this._size) { + var source = buffers[i]; + var target = this.buffers[j]; + var copiedNum = source.copy(target, targetOffset, sourceOffset); + totalCopiedNum += copiedNum; + sourceOffset += copiedNum; + targetOffset += copiedNum; + if (sourceOffset === source.length) { + i++; + sourceOffset = 0; + } + if (targetOffset === target.length) { + j++; + targetOffset = 0; } } - // Override protocol layer's default content-type - var storageClientContext = this.storageClientContext; - storageClientContext.requestContentType = undefined; - } - return StorageClient; + // clear copied from source buffers + buffers.splice(0, i); + if (buffers.length > 0) { + buffers[0] = buffers[0].slice(sourceOffset); + } + }; + /** + * Get the readable stream assembled from all the data in the internal buffers. + * + * @returns {Readable} + * @memberof PooledBuffer + */ + PooledBuffer.prototype.getReadableStream = function () { + return new BuffersStream(this.buffers, this.size); + }; + return PooledBuffer; }()); // Copyright (c) Microsoft Corporation. All rights reserved. @@ -23690,7 +27533,7 @@ var BufferScheduler = /** @class */ (function () { * The array includes all the available buffers can be used to fill data from stream. * * @private - * @type {Buffer[]} + * @type {PooledBuffer[]} * @memberof BufferScheduler */ this.incoming = []; @@ -23698,7 +27541,7 @@ var BufferScheduler = /** @class */ (function () { * The array (queue) includes all the buffers filled from stream data. * * @private - * @type {Buffer[]} + * @type {PooledBuffer[]} * @memberof BufferScheduler */ this.outgoing = []; @@ -23756,7 +27599,8 @@ var BufferScheduler = /** @class */ (function () { } if (_this.isStreamEnd && _this.executingOutgoingHandlers === 0) { if (_this.unresolvedLength > 0 && _this.unresolvedLength < _this.bufferSize) { - _this.outgoingHandler(_this.shiftBufferFromUnresolvedDataArray(), _this.offset) + var buffer_1 = _this.shiftBufferFromUnresolvedDataArray(); + _this.outgoingHandler(function () { return buffer_1.getReadableStream(); }, buffer_1.size, _this.offset) .then(resolve) .catch(reject); } @@ -23788,32 +27632,18 @@ var BufferScheduler = /** @class */ (function () { * than blockSize when data in unresolvedDataArray is less than bufferSize. * * @private - * @returns {Buffer} + * @returns {PooledBuffer} * @memberof BufferScheduler */ - BufferScheduler.prototype.shiftBufferFromUnresolvedDataArray = function () { - if (this.unresolvedLength >= this.bufferSize) { - if (this.bufferSize === this.unresolvedDataArray[0].length) { - this.unresolvedLength -= this.bufferSize; - return this.unresolvedDataArray.shift(); - } - // Lazy concat because Buffer.concat highly drops performance - var merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); - var buffer = merged.slice(0, this.bufferSize); - merged = merged.slice(this.bufferSize); - this.unresolvedDataArray = [merged]; - this.unresolvedLength -= buffer.length; - return buffer; - } - else if (this.unresolvedLength > 0) { - var merged = Buffer.concat(this.unresolvedDataArray, this.unresolvedLength); - this.unresolvedDataArray = []; - this.unresolvedLength = 0; - return merged; + BufferScheduler.prototype.shiftBufferFromUnresolvedDataArray = function (buffer) { + if (!buffer) { + buffer = new PooledBuffer(this.bufferSize, this.unresolvedDataArray, this.unresolvedLength); } else { - return Buffer.allocUnsafe(0); + buffer.fill(this.unresolvedDataArray, this.unresolvedLength); } + this.unresolvedLength -= buffer.size; + return buffer; }; /** * Resolve data in unresolvedDataArray. For every buffer with size in blockSize @@ -23831,10 +27661,11 @@ var BufferScheduler = /** @class */ (function () { var buffer = void 0; if (this.incoming.length > 0) { buffer = this.incoming.shift(); + this.shiftBufferFromUnresolvedDataArray(buffer); } else { if (this.numBuffers < this.maxBuffers) { - buffer = Buffer.allocUnsafe(this.bufferSize); + buffer = this.shiftBufferFromUnresolvedDataArray(); this.numBuffers++; } else { @@ -23842,7 +27673,6 @@ var BufferScheduler = /** @class */ (function () { return false; } } - buffer.fill(this.shiftBufferFromUnresolvedDataArray()); this.outgoing.push(buffer); this.triggerOutgoingHandlers(); } @@ -23886,13 +27716,13 @@ var BufferScheduler = /** @class */ (function () { return tslib.__generator(this, function (_a) { switch (_a.label) { case 0: - bufferLength = buffer.length; + bufferLength = buffer.size; this.executingOutgoingHandlers++; this.offset += bufferLength; _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.outgoingHandler(buffer, this.offset - bufferLength)]; + return [4 /*yield*/, this.outgoingHandler(function () { return buffer.getReadableStream(); }, bufferLength, this.offset - bufferLength)]; case 2: _a.sent(); return [3 /*break*/, 4]; @@ -23925,188 +27755,150 @@ var BufferScheduler = /** @class */ (function () { return BufferScheduler; }()); +// Copyright (c) Microsoft Corporation. /** - * Function that converts PageRange and ClearRange to a common Range object. - * PageRange and ClearRange have start and end while Range offset and count - * this function normalizes to Range. - * @param response Model PageBlob Range response + * Creates a span using the global tracer. + * @param name The name of the operation being performed. + * @param tracingOptions The options for the underlying http request. */ -function rangeResponseFromModel(response) { - var pageRange = (response._response.parsedBody.pageRange || []).map(function (x) { return ({ - offset: x.start, - count: x.end - x.start - }); }); - var clearRange = (response._response.parsedBody.clearRange || []).map(function (x) { return ({ - offset: x.start, - count: x.end - x.start - }); }); - return tslib.__assign(tslib.__assign({}, response), { pageRange: pageRange, - clearRange: clearRange, _response: tslib.__assign(tslib.__assign({}, response._response), { parsedBody: { - pageRange: pageRange, - clearRange: clearRange - } }) }); +function createSpan(operationName, tracingOptions) { + if (tracingOptions === void 0) { tracingOptions = {}; } + var tracer = coreTracing.getTracer(); + var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL }); + var span = tracer.startSpan("Azure.Storage.Blob." + operationName, spanOptions); + span.setAttribute("az.namespace", "Microsoft.Storage"); + var newOptions = tracingOptions.spanOptions || {}; + if (span.isRecording()) { + newOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.Storage" }) }); + } + return { + span: span, + spanOptions: newOptions + }; } // Copyright (c) Microsoft Corporation. All rights reserved. /** - * This is the poller returned by {@link BlobClient.beginCopyFromURL}. - * This can not be instantiated directly outside of this package. + * Reads a readable stream into buffer. Fill the buffer from offset to end. * - * @ignore - */ -var BlobBeginCopyFromUrlPoller = /** @class */ (function (_super) { - tslib.__extends(BlobBeginCopyFromUrlPoller, _super); - function BlobBeginCopyFromUrlPoller(options) { - var _this = this; - var blobClient = options.blobClient, copySource = options.copySource, _a = options.intervalInMs, intervalInMs = _a === void 0 ? 15000 : _a, onProgress = options.onProgress, resumeFrom = options.resumeFrom, startCopyFromURLOptions = options.startCopyFromURLOptions; - var state; - if (resumeFrom) { - state = JSON.parse(resumeFrom).state; - } - var operation = makeBlobBeginCopyFromURLPollOperation(tslib.__assign(tslib.__assign({}, state), { blobClient: blobClient, - copySource: copySource, - startCopyFromURLOptions: startCopyFromURLOptions })); - _this = _super.call(this, operation) || this; - if (typeof onProgress === "function") { - _this.onProgress(onProgress); - } - _this.intervalInMs = intervalInMs; - return _this; - } - BlobBeginCopyFromUrlPoller.prototype.delay = function () { - return coreHttp.delay(this.intervalInMs); - }; - return BlobBeginCopyFromUrlPoller; -}(coreLro.Poller)); -/** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @ignore + * @export + * @param {NodeJS.ReadableStream} stream A Node.js Readable stream + * @param {Buffer} buffer Buffer to be filled, length must >= offset + * @param {number} offset From which position in the buffer to be filled, inclusive + * @param {number} end To which position in the buffer to be filled, exclusive + * @param {string} [encoding] Encoding of the Readable stream + * @returns {Promise} */ -var cancel = function cancel(options) { - if (options === void 0) { options = {}; } +function streamToBuffer(stream, buffer, offset, end, encoding) { return tslib.__awaiter(this, void 0, void 0, function () { - var state, copyId; + var pos, count; return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - state = this.state; - copyId = state.copyId; - if (state.isCompleted) { - return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } - if (!copyId) { - state.isCancelled = true; - return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } - // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call - return [4 /*yield*/, state.blobClient.abortCopyFromURL(copyId, { - abortSignal: options.abortSignal - })]; - case 1: - // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call - _a.sent(); - state.isCancelled = true; - return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } + pos = 0; + count = end - offset; + return [2 /*return*/, new Promise(function (resolve, reject) { + stream.on("readable", function () { + if (pos >= count) { + resolve(); + return; + } + var chunk = stream.read(); + if (!chunk) { + return; + } + if (typeof chunk === "string") { + chunk = Buffer.from(chunk, encoding); + } + // How much data needed in this chunk + var chunkLength = pos + chunk.length > count ? count - pos : chunk.length; + buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); + pos += chunkLength; + }); + stream.on("end", function () { + if (pos < count) { + reject(new Error("Stream drains before getting enough data needed. Data read: " + pos + ", data need: " + count)); + } + resolve(); + }); + stream.on("error", reject); + })]; }); }); -}; +} /** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @ignore + * Reads a readable stream into buffer entirely. + * + * @export + * @param {NodeJS.ReadableStream} stream A Node.js Readable stream + * @param {Buffer} buffer Buffer to be filled, length must >= offset + * @param {string} [encoding] Encoding of the Readable stream + * @returns {Promise} with the count of bytes read. + * @throws {RangeError} If buffer size is not big enough. */ -var update = function update(options) { - if (options === void 0) { options = {}; } +function streamToBuffer2(stream, buffer, encoding) { return tslib.__awaiter(this, void 0, void 0, function () { - var state, blobClient, copySource, startCopyFromURLOptions, result, result, copyStatus, copyProgress, prevCopyProgress, err_1; + var pos, bufferSize; return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - state = this.state; - blobClient = state.blobClient, copySource = state.copySource, startCopyFromURLOptions = state.startCopyFromURLOptions; - if (!!state.isStarted) return [3 /*break*/, 2]; - state.isStarted = true; - return [4 /*yield*/, blobClient.startCopyFromURL(copySource, startCopyFromURLOptions)]; - case 1: - result = _a.sent(); - // copyId is needed to abort - state.copyId = result.copyId; - if (result.copyStatus === "success") { - state.result = result; - state.isCompleted = true; - } - return [3 /*break*/, 6]; - case 2: - if (!!state.isCompleted) return [3 /*break*/, 6]; - _a.label = 3; - case 3: - _a.trys.push([3, 5, , 6]); - return [4 /*yield*/, state.blobClient.getProperties({ abortSignal: options.abortSignal })]; - case 4: - result = _a.sent(); - copyStatus = result.copyStatus, copyProgress = result.copyProgress; - prevCopyProgress = state.copyProgress; - if (copyProgress) { - state.copyProgress = copyProgress; - } - if (copyStatus === "pending" && - copyProgress !== prevCopyProgress && - typeof options.fireProgress === "function") { - // trigger in setTimeout, or swallow error? - options.fireProgress(state); - } - else if (copyStatus === "success") { - state.result = result; - state.isCompleted = true; - } - else if (copyStatus === "failed") { - state.error = new Error("Blob copy failed with reason: \"" + (result.copyStatusDescription || "unknown") + "\""); - state.isCompleted = true; - } - return [3 /*break*/, 6]; - case 5: - err_1 = _a.sent(); - state.error = err_1; - state.isCompleted = true; - return [3 /*break*/, 6]; - case 6: return [2 /*return*/, makeBlobBeginCopyFromURLPollOperation(state)]; - } + pos = 0; + bufferSize = buffer.length; + return [2 /*return*/, new Promise(function (resolve, reject) { + stream.on("readable", function () { + var chunk = stream.read(); + if (!chunk) { + return; + } + if (typeof chunk === "string") { + chunk = Buffer.from(chunk, encoding); + } + if (pos + chunk.length > bufferSize) { + reject(new Error("Stream exceeds buffer size. Buffer size: " + bufferSize)); + return; + } + buffer.fill(chunk, pos, pos + chunk.length); + pos += chunk.length; + }); + stream.on("end", function () { + resolve(pos); + }); + stream.on("error", reject); + })]; }); }); -}; +} /** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @ignore + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. + * + * @export + * @param {NodeJS.ReadableStream} rs The read stream. + * @param {string} file Destination file path. + * @returns {Promise} */ -var toString = function toString() { - return JSON.stringify({ state: this.state }, function (key, value) { - // remove blobClient from serialized state since a client can't be hydrated from this info. - if (key === "blobClient") { - return undefined; - } - return value; +function readStreamToLocalFile(rs, file) { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 /*return*/, new Promise(function (resolve, reject) { + var ws = fs.createWriteStream(file); + rs.on("error", function (err) { + reject(err); + }); + ws.on("error", function (err) { + reject(err); + }); + ws.on("close", resolve); + rs.pipe(ws); + })]; + }); }); -}; +} /** - * Creates a poll operation given the provided state. - * @ignore + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Promisified version of fs.stat(). */ -function makeBlobBeginCopyFromURLPollOperation(state) { - return { - state: tslib.__assign({}, state), - cancel: cancel, - toString: toString, - update: update - }; -} +var fsStat = util.promisify(fs.stat); +var fsCreateReadStream = fs.createReadStream; -// Copyright (c) Microsoft Corporation. All rights reserved. /** * A BlobClient represents a URL to an Azure Storage blob; the blob may be a block blob, * append blob, or page blob. @@ -24184,7 +27976,7 @@ var BlobClient = /** @class */ (function (_super) { get: function () { return this._name; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobClient.prototype, "containerName", { @@ -24194,7 +27986,7 @@ var BlobClient = /** @class */ (function (_super) { get: function () { return this._containerName; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -24208,6 +28000,17 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.withSnapshot = function (snapshot) { return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline); }; + /** + * Creates a new BlobClient object pointing to a version of this blob. + * Provide "" will remove the versionId and return a Client to the base blob. + * + * @param {string} versionId The versionId. + * @returns {BlobClient} A new BlobClient object pointing to the version of this blob. + * @memberof BlobClient + */ + BlobClient.prototype.withVersion = function (versionId) { + return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.VERSIONID, versionId.length === 0 ? undefined : versionId), this.pipeline); + }; /** * Creates a AppendBlobClient object. * @@ -24247,7 +28050,7 @@ var BlobClient = /** @class */ (function (_super) { * @param {number} [offset] From which position of the blob to download, >= 0 * @param {number} [count] How much data to be downloaded, > 0. Will download to the end when undefined * @param {BlobDownloadOptions} [options] Optional options to Blob Download operation. - * @returns {Promise} + * @returns {Promise} * @memberof BlobClient * * Example usage (Node.js): @@ -24255,20 +28058,20 @@ var BlobClient = /** @class */ (function (_super) { * ```js * // Download and convert a blob to a string * const downloadBlockBlobResponse = await blobClient.download(); - * const downloaded = await streamToString(downloadBlockBlobResponse.readableStreamBody); - * console.log("Downloaded blob content:", downloaded); - * - * async function streamToString(readableStream) { - * return new Promise((resolve, reject) => { - * const chunks = []; - * readableStream.on("data", (data) => { - * chunks.push(data.toString()); - * }); - * readableStream.on("end", () => { - * resolve(chunks.join("")); - * }); - * readableStream.on("error", reject); - * }); + * const downloaded = await streamToBuffer(downloadBlockBlobResponse.readableStreamBody); + * console.log("Downloaded blob content:", downloaded.toString()); + * + * async function streamToBuffer(readableStream) { + * return new Promise((resolve, reject) => { + * const chunks = []; + * readableStream.on("data", (data) => { + * chunks.push(data instanceof Buffer ? data : Buffer.from(data)); + * }); + * readableStream.on("end", () => { + * resolve(Buffer.concat(chunks)); + * }); + * readableStream.on("error", reject); + * }); * } * ``` * @@ -24296,25 +28099,26 @@ var BlobClient = /** @class */ (function (_super) { * ``` */ BlobClient.prototype.download = function (offset, count, options) { + var _a; if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, res_1, e_1; + var _b, span, spanOptions, res_1, wrappedRes, e_1; var _this = this; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; options.conditions = options.conditions || {}; ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); - _a = createSpan("BlobClient-download", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlobClient-download", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.download({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress, range: offset === 0 && !count ? undefined : rangeToString({ offset: offset, count: count }), rangeGetContentMD5: options.rangeGetContentMD5, @@ -24324,7 +28128,8 @@ var BlobClient = /** @class */ (function (_super) { spanOptions: spanOptions })]; case 2: - res_1 = _b.sent(); + res_1 = _c.sent(); + wrappedRes = tslib.__assign(tslib.__assign({}, res_1), { _response: res_1._response, objectReplicationDestinationPolicyId: res_1.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res_1.objectReplicationRules) }); // We support retrying when download stream unexpected ends in Node.js runtime // Following code shouldn't be bundled into browser build, however some // bundlers may try to bundle following code and "FileReadResponse.ts". @@ -24340,10 +28145,11 @@ var BlobClient = /** @class */ (function (_super) { if (!res_1.etag) { throw new RangeError("File download response doesn't contain valid etag header"); } - return [2 /*return*/, new BlobDownloadResponse(res_1, function (start) { return tslib.__awaiter(_this, void 0, void 0, function () { + return [2 /*return*/, new BlobDownloadResponse(wrappedRes, function (start) { return tslib.__awaiter(_this, void 0, void 0, function () { var updatedOptions; - return tslib.__generator(this, function (_a) { - switch (_a.label) { + var _a; + return tslib.__generator(this, function (_b) { + switch (_b.label) { case 0: updatedOptions = { leaseAccessConditions: options.conditions, @@ -24351,7 +28157,8 @@ var BlobClient = /** @class */ (function (_super) { ifMatch: options.conditions.ifMatch || res_1.etag, ifModifiedSince: options.conditions.ifModifiedSince, ifNoneMatch: options.conditions.ifNoneMatch, - ifUnmodifiedSince: options.conditions.ifUnmodifiedSince + ifUnmodifiedSince: options.conditions.ifUnmodifiedSince, + ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }, range: rangeToString({ count: offset + res_1.contentLength - start, @@ -24370,7 +28177,7 @@ var BlobClient = /** @class */ (function (_super) { // updatedOptions.range // }, options: ${JSON.stringify(updatedOptions)}` // ); - return [2 /*return*/, (_a.sent()).readableStreamBody]; + return [2 /*return*/, (_b.sent()).readableStreamBody]; } }); }); }, offset, res_1.contentLength, { @@ -24379,7 +28186,7 @@ var BlobClient = /** @class */ (function (_super) { onProgress: options.onProgress })]; case 3: - e_1 = _b.sent(); + e_1 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e_1.message @@ -24394,7 +28201,7 @@ var BlobClient = /** @class */ (function (_super) { }); }; /** - * Returns true if the Azrue blob resource represented by this client exists; false otherwise. + * Returns true if the Azure blob resource represented by this client exists; false otherwise. * * NOTE: use this function with care since an existing blob might be deleted by other clients or * applications. Vice versa new blobs might be added by other clients or applications after this @@ -24419,6 +28226,7 @@ var BlobClient = /** @class */ (function (_super) { return [4 /*yield*/, this.getProperties({ abortSignal: options.abortSignal, customerProvidedKey: options.customerProvidedKey, + conditions: options.conditions, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) })]; case 2: @@ -24461,28 +28269,31 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.getProperties = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_3; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, res, e_3; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-getProperties", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlobClient-getProperties", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); options.conditions = options.conditions || {}; ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.getProperties({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: + res = _c.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) })]; case 3: - e_3 = _b.sent(); + e_3 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e_3.message @@ -24508,27 +28319,28 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.delete = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_4; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_4; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-delete", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-delete", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.deleteMethod({ abortSignal: options.abortSignal, deleteSnapshots: options.deleteSnapshots, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_4 = _b.sent(); + e_4 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e_4.message @@ -24542,6 +28354,56 @@ var BlobClient = /** @class */ (function (_super) { }); }); }; + /** + * Marks the specified blob or snapshot for deletion if it exists. The blob is later deleted + * during garbage collection. Note that in order to delete a blob, you must delete + * all of its snapshots. You can delete both at the same time with the Delete + * Blob operation. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob + * + * @param {BlobDeleteOptions} [options] Optional options to Blob Delete operation. + * @returns {Promise} + * @memberof BlobClient + */ + BlobClient.prototype.deleteIfExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, res, e_5; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("BlobClient-deleteIfExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_5 = _d.sent(); + if (((_a = e_5.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobNotFound") { + span.setStatus({ + code: api.CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a blob or snapshot only if it exists." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_5.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_5.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_5.message + }); + throw e_5; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; /** * Restores the contents and metadata of soft deleted blob and any associated * soft deleted snapshots. Undelete Blob is supported only on version 2017-07-29 @@ -24555,7 +28417,7 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.undelete = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_5; + var _a, span, spanOptions, e_6; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -24569,12 +28431,12 @@ var BlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_5 = _b.sent(); + e_6 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_5.message + message: e_6.message }); - throw e_5; + throw e_6; case 4: span.end(); return [7 /*endfinally*/]; @@ -24586,46 +28448,47 @@ var BlobClient = /** @class */ (function (_super) { /** * Sets system properties on the blob. * - * If no value provided, or no value provided for the specificed blob HTTP headers, + * If no value provided, or no value provided for the specified blob HTTP headers, * these blob HTTP headers without a value will be cleared. * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties * * @param {BlobHTTPHeaders} [blobHTTPHeaders] If no value provided, or no value provided for - * the specificed blob HTTP headers, these blob HTTP + * the specified blob HTTP headers, these blob HTTP * headers without a value will be cleared. * @param {BlobSetHTTPHeadersOptions} [options] Optional options to Blob Set HTTP Headers operation. * @returns {Promise} * @memberof BlobClient */ BlobClient.prototype.setHTTPHeaders = function (blobHTTPHeaders, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_6; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_7; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-setHTTPHeaders", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-setHTTPHeaders", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.setHTTPHeaders({ abortSignal: options.abortSignal, blobHTTPHeaders: blobHTTPHeaders, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_6 = _b.sent(); + e_7 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_6.message + message: e_7.message }); - throw e_6; + throw e_7; case 4: span.end(); return [7 /*endfinally*/]; @@ -24648,35 +28511,124 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.setMetadata = function (metadata, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_7; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_8; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-setMetadata", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-setMetadata", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.setMetadata({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_7 = _b.sent(); + e_8 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_7.message + message: e_8.message }); - throw e_7; + throw e_8; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets tags on the underlying blob. + * A blob can have up to 10 tags. Tag keys must be between 1 and 128 characters. Tag values must be between 0 and 256 characters. + * Valid tag key and value characters include lower and upper case letters, digits (0-9), + * space (' '), plus ('+'), minus ('-'), period ('.'), foward slash ('/'), colon (':'), equals ('='), and underscore ('_'). + * + * @param {Tags} tags + * @param {BlobSetTagsOptions} [options={}] + * @returns {Promise} + * @memberof BlobClient + */ + BlobClient.prototype.setTags = function (tags, options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, e_9; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = createSpan("BlobClient-setTags", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.blobContext.setTags({ + abortSignal: options.abortSignal, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions, + tags: toBlobTags(tags) + })]; + case 2: return [2 /*return*/, _c.sent()]; + case 3: + e_9 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_9.message + }); + throw e_9; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets the tags associated with the underlying blob. + * + * @param {BlobGetTagsOptions} [options={}] + * @returns {Promise} + * @memberof BlobClient + */ + BlobClient.prototype.getTags = function (options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, response, wrappedResponse, e_10; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = createSpan("BlobClient-getTags", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.blobContext.getTags({ + abortSignal: options.abortSignal, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions + })]; + case 2: + response = _c.sent(); + wrappedResponse = tslib.__assign(tslib.__assign({}, response), { _response: response._response, tags: toTags({ blobTagSet: response.blobTagSet }) || {} }); + return [2 /*return*/, wrappedResponse]; + case 3: + e_10 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_10.message + }); + throw e_10; case 4: span.end(); return [7 /*endfinally*/]; @@ -24704,35 +28656,36 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.createSnapshot = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_8; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_11; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-createSnapshot", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-createSnapshot", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blobContext.createSnapshot({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_8 = _b.sent(); + e_11 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_8.message + message: e_11.message }); - throw e_8; + throw e_11; case 4: span.end(); return [7 /*endfinally*/]; @@ -24877,7 +28830,7 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.abortCopyFromURL = function (copyId, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_9; + var _a, span, spanOptions, e_12; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -24892,12 +28845,12 @@ var BlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_9 = _b.sent(); + e_12 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_9.message + message: e_12.message }); - throw e_9; + throw e_12; case 4: span.end(); return [7 /*endfinally*/]; @@ -24917,23 +28870,24 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.syncCopyFromURL = function (copySource, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_10; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_13; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-syncCopyFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-syncCopyFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.copyFromURL(copySource, { abortSignal: options.abortSignal, metadata: options.metadata, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, @@ -24941,16 +28895,17 @@ var BlobClient = /** @class */ (function (_super) { sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince }, sourceContentMD5: options.sourceContentMD5, + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_10 = _b.sent(); + e_13 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_10.message + message: e_13.message }); - throw e_10; + throw e_13; case 4: span.end(); return [7 /*endfinally*/]; @@ -24973,30 +28928,32 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.setAccessTier = function (tier, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_11; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_14; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-setAccessTier", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlobClient-setAccessTier", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.setTier(toAccessTier(tier), { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), rehydratePriority: options.rehydratePriority, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_11 = _b.sent(); + e_14 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_11.message + message: e_14.message }); - throw e_11; + throw e_14; case 4: span.end(); return [7 /*endfinally*/]; @@ -25008,7 +28965,7 @@ var BlobClient = /** @class */ (function (_super) { BlobClient.prototype.downloadToBuffer = function (param1, param2, param3, param4) { if (param4 === void 0) { param4 = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var buffer, offset, count, options, _a, span, spanOptions, response, transferProgress_1, batch, _loop_1, off, e_12; + var buffer, offset, count, options, _a, span, spanOptions, response, transferProgress_1, batch, _loop_1, off, e_15; var _this = this; return tslib.__generator(this, function (_b) { switch (_b.label) { @@ -25086,6 +29043,7 @@ var BlobClient = /** @class */ (function (_super) { abortSignal: options.abortSignal, conditions: options.conditions, maxRetryRequests: options.maxRetryRequestsPerBlock, + customerProvidedKey: options.customerProvidedKey, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) })]; case 1: @@ -25114,12 +29072,12 @@ var BlobClient = /** @class */ (function (_super) { _b.sent(); return [2 /*return*/, buffer]; case 5: - e_12 = _b.sent(); + e_15 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_12.message + message: e_15.message }); - throw e_12; + throw e_15; case 6: span.end(); return [7 /*endfinally*/]; @@ -25139,7 +29097,7 @@ var BlobClient = /** @class */ (function (_super) { * @param {number} [offset] From which position of the block blob to download. * @param {number} [count] How much data to be downloaded. Will download to the end when passing undefined. * @param {BlobDownloadOptions} [options] Options to Blob download options. - * @returns {Promise} The response data for blob download operation, + * @returns {Promise} The response data for blob download operation, * but with readableStreamBody set to undefined since its * content is already read and written into a local file * at the specified path. @@ -25149,7 +29107,7 @@ var BlobClient = /** @class */ (function (_super) { if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, e_13; + var _a, span, spanOptions, response, e_16; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25170,12 +29128,12 @@ var BlobClient = /** @class */ (function (_super) { response.blobDownloadStream = undefined; return [2 /*return*/, response]; case 5: - e_13 = _b.sent(); + e_16 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_13.message + message: e_16.message }); - throw e_13; + throw e_16; case 6: span.end(); return [7 /*endfinally*/]; @@ -25203,7 +29161,7 @@ var BlobClient = /** @class */ (function (_super) { containerName = pathComponents[1]; blobName = pathComponents[3]; } - else { + else if (isIpEndpointStyle(parsedUrl)) { // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername/blob // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername/blob // .getPath() -> /devstoreaccount1/containername/blob @@ -25211,6 +29169,13 @@ var BlobClient = /** @class */ (function (_super) { containerName = pathComponents[2]; blobName = pathComponents[4]; } + else { + // "https://customdomain.com/containername/blob". + // .getPath() -> /containername/blob + var pathComponents = parsedUrl.getPath().match("/([^/]*)(/(.*))?"); + containerName = pathComponents[1]; + blobName = pathComponents[3]; + } // decode the encoded blobName, containerName - to get all the special characters that might be present in them containerName = decodeURIComponent(containerName); blobName = decodeURIComponent(blobName); @@ -25245,41 +29210,45 @@ var BlobClient = /** @class */ (function (_super) { * @memberof BlobClient */ BlobClient.prototype.startCopyFromURL = function (copySource, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_14; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_17; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlobClient-startCopyFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("BlobClient-startCopyFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blobContext.startCopyFromURL(copySource, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, sourceIfNoneMatch: options.sourceConditions.ifNoneMatch, - sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince + sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince, + sourceIfTags: options.sourceConditions.tagConditions }, rehydratePriority: options.rehydratePriority, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), + sealBlob: options.sealBlob, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_14 = _b.sent(); + e_17 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_14.message + message: e_17.message }); - throw e_14; + throw e_17; case 4: span.end(); return [7 /*endfinally*/]; @@ -25388,36 +29357,130 @@ var AppendBlobClient = /** @class */ (function (_super) { * ``` */ AppendBlobClient.prototype.create = function (options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_15; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_18; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("AppendBlobClient-create", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("AppendBlobClient-create", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.appendBlobContext.create(0, { abortSignal: options.abortSignal, blobHTTPHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_15 = _b.sent(); + e_18 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_15.message + message: e_18.message }); - throw e_15; + throw e_18; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. + * If the blob with the same name already exists, the content of the existing blob will remain unchanged. + * @see https://docs.microsoft.com/rest/api/storageservices/put-blob + * + * @param {AppendBlobCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof AppendBlobClient + */ + AppendBlobClient.prototype.createIfNotExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, conditions, res, e_19; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("AppendBlobClient-createIfNotExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + conditions = { ifNoneMatch: ETagAny }; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.create(tslib.__assign(tslib.__assign({}, options), { conditions: conditions, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_19 = _d.sent(); + if (((_a = e_19.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") { + span.setStatus({ + code: api.CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_19.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_19.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_19.message + }); + throw e_19; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Seals the append blob, making it read only. + * + * @param {AppendBlobSealOptions} [options={}] + * @returns {Promise} + * @memberof AppendBlobClient + */ + AppendBlobClient.prototype.seal = function (options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, e_20; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + _b = createSpan("AppendBlobClient-seal", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + options.conditions = options.conditions || {}; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.appendBlobContext.seal({ + abortSignal: options.abortSignal, + appendPositionAccessConditions: options.conditions, + leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions + })]; + case 2: return [2 /*return*/, _c.sent()]; + case 3: + e_20 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_20.message + }); + throw e_20; case 4: span.end(); return [7 /*endfinally*/]; @@ -25452,23 +29515,24 @@ var AppendBlobClient = /** @class */ (function (_super) { * ``` */ AppendBlobClient.prototype.appendBlock = function (body, contentLength, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_16; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_21; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("AppendBlobClient-appendBlock", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("AppendBlobClient-appendBlock", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.appendBlobContext.appendBlock(body, contentLength, { abortSignal: options.abortSignal, appendPositionAccessConditions: options.conditions, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onUploadProgress: options.onProgress, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, @@ -25476,14 +29540,14 @@ var AppendBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_16 = _b.sent(); + e_21 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_16.message + message: e_21.message }); - throw e_16; + throw e_21; case 4: span.end(); return [7 /*endfinally*/]; @@ -25509,18 +29573,19 @@ var AppendBlobClient = /** @class */ (function (_super) { * @memberof AppendBlobClient */ AppendBlobClient.prototype.appendBlockFromURL = function (sourceURL, sourceOffset, count, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_17; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_22; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("AppendBlobClient-appendBlockFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b = createSpan("AppendBlobClient-appendBlockFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _b.label = 1; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.appendBlobContext.appendBlockFromUrl(sourceURL, 0, { abortSignal: options.abortSignal, @@ -25529,7 +29594,7 @@ var AppendBlobClient = /** @class */ (function (_super) { sourceContentCrc64: options.sourceContentCrc64, leaseAccessConditions: options.conditions, appendPositionAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, @@ -25540,14 +29605,14 @@ var AppendBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_17 = _b.sent(); + e_22 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_17.message + message: e_22.message }); - throw e_17; + throw e_22; case 4: span.end(); return [7 /*endfinally*/]; @@ -25626,6 +29691,7 @@ var BlockBlobClient = /** @class */ (function (_super) { } _this = _super.call(this, url, pipeline) || this; _this.blockBlobContext = new BlockBlob(_this.storageClientContext); + _this._blobContext = new Blob$1(_this.storageClientContext); return _this; } /** @@ -25640,6 +29706,84 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.withSnapshot = function (snapshot) { return new BlockBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline); }; + /** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Quick query for a JSON or CSV formatted blob. + * + * Example usage (Node.js): + * + * ```js + * // Query and convert a blob to a string + * const queryBlockBlobResponse = await blockBlobClient.query("select * from BlobStorage"); + * const downloaded = (await streamToBuffer(queryBlockBlobResponse.readableStreamBody)).toString(); + * console.log("Query blob content:", downloaded); + * + * async function streamToBuffer(readableStream) { + * return new Promise((resolve, reject) => { + * const chunks = []; + * readableStream.on("data", (data) => { + * chunks.push(data instanceof Buffer ? data : Buffer.from(data)); + * }); + * readableStream.on("end", () => { + * resolve(Buffer.concat(chunks)); + * }); + * readableStream.on("error", reject); + * }); + * } + * ``` + * + * @param {string} query + * @param {BlockBlobQueryOptions} [options={}] + * @returns {Promise} + * @memberof BlockBlobClient + */ + BlockBlobClient.prototype.query = function (query, options) { + var _a; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _b, span, spanOptions, response, e_23; + return tslib.__generator(this, function (_c) { + switch (_c.label) { + case 0: + ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); + _b = createSpan("BlockBlobClient-query", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; + case 1: + _c.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this._blobContext.query({ + abortSignal: options.abortSignal, + queryRequest: { + expression: query, + inputSerialization: toQuerySerialization(options.inputTextConfiguration), + outputSerialization: toQuerySerialization(options.outputTextConfiguration) + }, + leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), + spanOptions: spanOptions + })]; + case 2: + response = _c.sent(); + return [2 /*return*/, new BlobQueryResponse(response, { + abortSignal: options.abortSignal, + onProgress: options.onProgress, + onError: options.onError + })]; + case 3: + e_23 = _c.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_23.message + }); + throw e_23; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; /** * Creates a new block blob, or updates the content of an existing block blob. * Updating an existing block blob overwrites any existing metadata on the blob. @@ -25669,38 +29813,40 @@ var BlockBlobClient = /** @class */ (function (_super) { * ``` */ BlockBlobClient.prototype.upload = function (body, contentLength, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_18; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_24; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("BlockBlobClient-upload", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlockBlobClient-upload", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blockBlobContext.upload(body, contentLength, { abortSignal: options.abortSignal, blobHTTPHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onUploadProgress: options.onProgress, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_18 = _b.sent(); + e_24 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_18.message + message: e_24.message }); - throw e_18; + throw e_24; case 4: span.end(); return [7 /*endfinally*/]; @@ -25724,7 +29870,7 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.stageBlock = function (blockId, body, contentLength, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_19; + var _a, span, spanOptions, e_25; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25745,12 +29891,12 @@ var BlockBlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_19 = _b.sent(); + e_25 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_19.message + message: e_25.message }); - throw e_19; + throw e_25; case 4: span.end(); return [7 /*endfinally*/]; @@ -25785,7 +29931,7 @@ var BlockBlobClient = /** @class */ (function (_super) { if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_20; + var _a, span, spanOptions, e_26; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25806,12 +29952,12 @@ var BlockBlobClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_20 = _b.sent(); + e_26 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_20.message + message: e_26.message }); - throw e_20; + throw e_26; case 4: span.end(); return [7 /*endfinally*/]; @@ -25834,37 +29980,39 @@ var BlockBlobClient = /** @class */ (function (_super) { * @memberof BlockBlobClient */ BlockBlobClient.prototype.commitBlockList = function (blocks, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_21; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_27; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("BlockBlobClient-commitBlockList", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlockBlobClient-commitBlockList", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.blockBlobContext.commitBlockList({ latest: blocks }, { abortSignal: options.abortSignal, blobHTTPHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_21 = _b.sent(); + e_27 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_21.message + message: e_27.message }); - throw e_21; + throw e_27; case 4: span.end(); return [7 /*endfinally*/]; @@ -25885,23 +30033,25 @@ var BlockBlobClient = /** @class */ (function (_super) { * @memberof BlockBlobClient */ BlockBlobClient.prototype.getBlockList = function (listType, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, res, e_22; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, res, e_28; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("BlockBlobClient-getBlockList", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("BlockBlobClient-getBlockList", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.blockBlobContext.getBlockList(listType, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; case 2: - res = _b.sent(); + res = _c.sent(); if (!res.committedBlocks) { res.committedBlocks = []; } @@ -25910,12 +30060,12 @@ var BlockBlobClient = /** @class */ (function (_super) { } return [2 /*return*/, res]; case 3: - e_22 = _b.sent(); + e_28 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_22.message + message: e_28.message }); - throw e_22; + throw e_28; case 4: span.end(); return [7 /*endfinally*/]; @@ -25925,6 +30075,56 @@ var BlockBlobClient = /** @class */ (function (_super) { }); }; // High level functions + /** + * Uploads a Buffer(Node.js)/Blob(browsers)/ArrayBuffer/ArrayBufferView object to a BlockBlob. + * + * When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is + * {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload. + * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} + * to commit the block list. + * + * @export + * @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView + * @param {BlockBlobParallelUploadOptions} [options] + * @returns {Promise} + * @memberof BlockBlobClient + */ + BlockBlobClient.prototype.uploadData = function (data, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a, span, spanOptions, buffer_1, browserBlob_1; + return tslib.__generator(this, function (_b) { + _a = createSpan("BlockBlobClient-uploadData", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + try { + if (true) { + if (data instanceof Buffer) { + buffer_1 = data; + } + else if (data instanceof ArrayBuffer) { + buffer_1 = Buffer.from(data); + } + else { + data = data; + buffer_1 = Buffer.from(data.buffer, data.byteOffset, data.byteLength); + } + return [2 /*return*/, this.uploadSeekableInternal(function (offset, size) { return buffer_1.slice(offset, offset + size); }, buffer_1.byteLength, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + } + else {} + } + catch (e) { + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } + finally { + span.end(); + } + return [2 /*return*/]; + }); + }); + }; /** * ONLY AVAILABLE IN BROWSERS. * @@ -25934,6 +30134,8 @@ var BlockBlobClient = /** @class */ (function (_super) { * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call * {@link commitBlockList} to commit the block list. * + * @deprecated Use {@link uploadData} instead. + * * @export * @param {Blob | ArrayBuffer | ArrayBufferView} browserData Blob, File, ArrayBuffer or ArrayBufferView * @param {BlockBlobParallelUploadOptions} [options] Options to upload browser data. @@ -25943,7 +30145,7 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.uploadBrowserData = function (browserData, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, browserBlob_1, e_23; + var _a, span, spanOptions, browserBlob_2, e_29; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -25951,18 +30153,16 @@ var BlockBlobClient = /** @class */ (function (_super) { _b.label = 1; case 1: _b.trys.push([1, 3, 4, 5]); - browserBlob_1 = new Blob([browserData]); - return [4 /*yield*/, this.uploadSeekableBlob(function (offset, size) { - return browserBlob_1.slice(offset, offset + size); - }, browserBlob_1.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + browserBlob_2 = new Blob([browserData]); + return [4 /*yield*/, this.uploadSeekableInternal(function (offset, size) { return browserBlob_2.slice(offset, offset + size); }, browserBlob_2.size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_23 = _b.sent(); + e_29 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_23.message + message: e_29.message }); - throw e_23; + throw e_29; case 4: span.end(); return [7 /*endfinally*/]; @@ -25972,25 +30172,25 @@ var BlockBlobClient = /** @class */ (function (_super) { }); }; /** - * ONLY AVAILABLE IN BROWSERS. * - * Uploads a browser {@link Blob} object to block blob. Requires a blobFactory as the data source, - * which need to return a {@link Blob} object with the offset and size provided. + * Uploads data to block blob. Requires a bodyFactory as the data source, + * which need to return a {@link HttpRequestBody} object with the offset and size provided. * - * When buffer length <= 256MB, this method will use 1 upload call to finish the upload. - * Otherwise, this method will call stageBlock to upload blocks, and finally call commitBlockList + * When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is + * {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload. + * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} * to commit the block list. * - * @param {(offset: number, size: number) => Blob} blobFactory + * @param {(offset: number, size: number) => HttpRequestBody} bodyFactory * @param {number} size size of the data to upload. * @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation. * @returns {Promise} Response data for the Blob Upload operation. * @memberof BlockBlobClient */ - BlockBlobClient.prototype.uploadSeekableBlob = function (blobFactory, size, options) { + BlockBlobClient.prototype.uploadSeekableInternal = function (bodyFactory, size, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, numBlocks_1, blockList_1, blockIDPrefix_1, transferProgress_2, batch, _loop_2, i, e_24; + var _a, span, spanOptions, numBlocks_1, blockList_1, blockIDPrefix_1, transferProgress_2, batch, _loop_2, i, e_30; var _this = this; return tslib.__generator(this, function (_b) { switch (_b.label) { @@ -26025,12 +30225,12 @@ var BlockBlobClient = /** @class */ (function (_super) { if (!options.conditions) { options.conditions = {}; } - _a = createSpan("BlockBlobClient-UploadSeekableBlob", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _a = createSpan("BlockBlobClient-uploadSeekableInternal", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; _b.label = 1; case 1: _b.trys.push([1, 5, 6, 7]); if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3]; - return [4 /*yield*/, this.upload(blobFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + return [4 /*yield*/, this.upload(bodyFactory(0, size), size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: numBlocks_1 = Math.floor((size - 1) / options.blockSize) + 1; @@ -26053,7 +30253,7 @@ var BlockBlobClient = /** @class */ (function (_super) { end = i === numBlocks_1 - 1 ? size : start + options.blockSize; contentLength = end - start; blockList_1.push(blockID); - return [4 /*yield*/, this.stageBlock(blockID, blobFactory(start, contentLength), contentLength, { + return [4 /*yield*/, this.stageBlock(blockID, bodyFactory(start, contentLength), contentLength, { abortSignal: options.abortSignal, conditions: options.conditions, encryptionScope: options.encryptionScope, @@ -26082,12 +30282,12 @@ var BlockBlobClient = /** @class */ (function (_super) { _b.sent(); return [2 /*return*/, this.commitBlockList(blockList_1, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 5: - e_24 = _b.sent(); + e_30 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_24.message + message: e_30.message }); - throw e_24; + throw e_30; case 6: span.end(); return [7 /*endfinally*/]; @@ -26113,7 +30313,7 @@ var BlockBlobClient = /** @class */ (function (_super) { BlockBlobClient.prototype.uploadFile = function (filePath, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, size, e_25; + var _a, span, spanOptions, size, e_31; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -26124,21 +30324,23 @@ var BlockBlobClient = /** @class */ (function (_super) { return [4 /*yield*/, fsStat(filePath)]; case 2: size = (_b.sent()).size; - return [4 /*yield*/, this.uploadResetableStream(function (offset, count) { - return fs.createReadStream(filePath, { - autoClose: true, - end: count ? offset + count - 1 : Infinity, - start: offset - }); + return [4 /*yield*/, this.uploadSeekableInternal(function (offset, count) { + return function () { + return fsCreateReadStream(filePath, { + autoClose: true, + end: count ? offset + count - 1 : Infinity, + start: offset + }); + }; }, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 3: return [2 /*return*/, _b.sent()]; case 4: - e_25 = _b.sent(); + e_31 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_25.message + message: e_31.message }); - throw e_25; + throw e_31; case 5: span.end(); return [7 /*endfinally*/]; @@ -26169,7 +30371,7 @@ var BlockBlobClient = /** @class */ (function (_super) { if (maxConcurrency === void 0) { maxConcurrency = 5; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, blockNum_1, blockIDPrefix_2, transferProgress_3, blockList_2, scheduler, e_26; + var _a, span, spanOptions, blockNum_1, blockIDPrefix_2, transferProgress_3, blockList_2, scheduler, e_32; var _this = this; return tslib.__generator(this, function (_b) { switch (_b.label) { @@ -26188,7 +30390,7 @@ var BlockBlobClient = /** @class */ (function (_super) { blockIDPrefix_2 = coreHttp.generateUuid(); transferProgress_3 = 0; blockList_2 = []; - scheduler = new BufferScheduler(stream, bufferSize, maxConcurrency, function (buffer) { return tslib.__awaiter(_this, void 0, void 0, function () { + scheduler = new BufferScheduler(stream, bufferSize, maxConcurrency, function (body, length) { return tslib.__awaiter(_this, void 0, void 0, function () { var blockID; return tslib.__generator(this, function (_a) { switch (_a.label) { @@ -26196,7 +30398,7 @@ var BlockBlobClient = /** @class */ (function (_super) { blockID = generateBlockID(blockIDPrefix_2, blockNum_1); blockList_2.push(blockID); blockNum_1++; - return [4 /*yield*/, this.stageBlock(blockID, buffer, buffer.length, { + return [4 /*yield*/, this.stageBlock(blockID, body, length, { conditions: options.conditions, encryptionScope: options.encryptionScope, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) @@ -26204,7 +30406,7 @@ var BlockBlobClient = /** @class */ (function (_super) { case 1: _a.sent(); // Update progress after block is successfully uploaded to server, in case of block trying - transferProgress_3 += buffer.length; + transferProgress_3 += length; if (options.onProgress) { options.onProgress({ loadedBytes: transferProgress_3 }); } @@ -26223,12 +30425,12 @@ var BlockBlobClient = /** @class */ (function (_super) { return [4 /*yield*/, this.commitBlockList(blockList_2, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 3: return [2 /*return*/, _b.sent()]; case 4: - e_26 = _b.sent(); + e_32 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_26.message + message: e_32.message }); - throw e_26; + throw e_32; case 5: span.end(); return [7 /*endfinally*/]; @@ -26237,132 +30439,6 @@ var BlockBlobClient = /** @class */ (function (_super) { }); }); }; - /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * Accepts a Node.js Readable stream factory, and uploads in blocks to a block blob. - * The Readable stream factory must returns a Node.js Readable stream starting from the offset defined. The offset - * is the offset in the block blob to be uploaded. - * - * When buffer length <= 256MB, this method will use 1 upload call to finish the upload. - * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} - * to commit the block list. - * - * @export - * @param {(offset: number) => NodeJS.ReadableStream} streamFactory Returns a Node.js Readable stream starting - * from the offset defined - * @param {number} size Size of the block blob - * @param {BlockBlobParallelUploadOptions} [options] Options to Upload to Block Blob operation. - * @returns {(Promise)} Response data for the Blob Upload operation. - * @memberof BlockBlobClient - */ - BlockBlobClient.prototype.uploadResetableStream = function (streamFactory, size, options) { - if (options === void 0) { options = {}; } - return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, numBlocks_2, blockList_3, blockIDPrefix_3, transferProgress_4, batch, _loop_3, i, e_27; - var _this = this; - return tslib.__generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!options.blockSize) { - options.blockSize = 0; - } - if (options.blockSize < 0 || options.blockSize > BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) { - throw new RangeError("blockSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES); - } - if (options.maxSingleShotSize !== 0 && !options.maxSingleShotSize) { - options.maxSingleShotSize = BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES; - } - if (options.maxSingleShotSize < 0 || - options.maxSingleShotSize > BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES) { - throw new RangeError("maxSingleShotSize option must be >= 0 and <= " + BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES); - } - if (options.blockSize === 0) { - if (size > BLOCK_BLOB_MAX_BLOCKS * BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES) { - throw new RangeError(size + " is too larger to upload to a block blob."); - } - if (size > options.maxSingleShotSize) { - options.blockSize = Math.ceil(size / BLOCK_BLOB_MAX_BLOCKS); - if (options.blockSize < DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES) { - options.blockSize = DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES; - } - } - } - if (!options.blobHTTPHeaders) { - options.blobHTTPHeaders = {}; - } - if (!options.conditions) { - options.conditions = {}; - } - _a = createSpan("BlockBlobClient-uploadResetableStream", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; - case 1: - _b.trys.push([1, 6, 7, 8]); - if (!(size <= options.maxSingleShotSize)) return [3 /*break*/, 3]; - return [4 /*yield*/, this.upload(function () { return streamFactory(0); }, size, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; - case 2: return [2 /*return*/, _b.sent()]; - case 3: - numBlocks_2 = Math.floor((size - 1) / options.blockSize) + 1; - if (numBlocks_2 > BLOCK_BLOB_MAX_BLOCKS) { - throw new RangeError("The buffer's size is too big or the BlockSize is too small;" + - ("the number of blocks must be <= " + BLOCK_BLOB_MAX_BLOCKS)); - } - blockList_3 = []; - blockIDPrefix_3 = coreHttp.generateUuid(); - transferProgress_4 = 0; - batch = new Batch(options.concurrency); - _loop_3 = function (i) { - batch.addOperation(function () { return tslib.__awaiter(_this, void 0, void 0, function () { - var blockID, start, end, contentLength; - return tslib.__generator(this, function (_a) { - switch (_a.label) { - case 0: - blockID = generateBlockID(blockIDPrefix_3, i); - start = options.blockSize * i; - end = i === numBlocks_2 - 1 ? size : start + options.blockSize; - contentLength = end - start; - blockList_3.push(blockID); - return [4 /*yield*/, this.stageBlock(blockID, function () { return streamFactory(start, contentLength); }, contentLength, { - abortSignal: options.abortSignal, - conditions: options.conditions, - encryptionScope: options.encryptionScope, - tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) - })]; - case 1: - _a.sent(); - // Update progress after block is successfully uploaded to server, in case of block trying - transferProgress_4 += contentLength; - if (options.onProgress) { - options.onProgress({ loadedBytes: transferProgress_4 }); - } - return [2 /*return*/]; - } - }); - }); }); - }; - for (i = 0; i < numBlocks_2; i++) { - _loop_3(i); - } - return [4 /*yield*/, batch.do()]; - case 4: - _b.sent(); - return [4 /*yield*/, this.commitBlockList(blockList_3, tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; - case 5: return [2 /*return*/, _b.sent()]; - case 6: - e_27 = _b.sent(); - span.setStatus({ - code: api.CanonicalCode.UNKNOWN, - message: e_27.message - }); - throw e_27; - case 7: - span.end(); - return [7 /*endfinally*/]; - case 8: return [2 /*return*/]; - } - }); - }); - }; return BlockBlobClient; }(BlobClient)); /** @@ -26458,17 +30534,18 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.create = function (size, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_28; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_33; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-create", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-create", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.pageBlobContext.create(0, size, { abortSignal: options.abortSignal, @@ -26476,20 +30553,72 @@ var PageBlobClient = /** @class */ (function (_super) { blobSequenceNumber: options.blobSequenceNumber, leaseAccessConditions: options.conditions, metadata: options.metadata, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, tier: toAccessTier(options.tier), + blobTagsString: toBlobTagsString(options.tags), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_28 = _b.sent(); + e_33 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_28.message + message: e_33.message }); - throw e_28; + throw e_33; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Creates a page blob of the specified length. Call uploadPages to upload data + * data to a page blob. If the blob with the same name already exists, the content + * of the existing blob will remain unchanged. + * @see https://docs.microsoft.com/rest/api/storageservices/put-blob + * + * @param {number} size size of the page blob. + * @param {PageBlobCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof PageBlobClient + */ + PageBlobClient.prototype.createIfNotExists = function (size, options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, conditions, res, e_34; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("PageBlobClient-createIfNotExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + conditions = { ifNoneMatch: ETagAny }; + return [4 /*yield*/, this.create(size, tslib.__assign(tslib.__assign({}, options), { conditions: conditions, tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_34 = _d.sent(); + if (((_a = e_34.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") { + span.setStatus({ + code: api.CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_34.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_34.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_34.message + }); + throw e_34; case 4: span.end(); return [7 /*endfinally*/]; @@ -26510,22 +30639,23 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.uploadPages = function (body, offset, count, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_29; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_35; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-uploadPages", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-uploadPages", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.pageBlobContext.uploadPages(body, count, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), onUploadProgress: options.onProgress, range: rangeToString({ offset: offset, count: count }), sequenceNumberAccessConditions: options.conditions, @@ -26535,14 +30665,14 @@ var PageBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_29 = _b.sent(); + e_35 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_29.message + message: e_35.message }); - throw e_29; + throw e_35; case 4: span.end(); return [7 /*endfinally*/]; @@ -26565,18 +30695,19 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.uploadPagesFromURL = function (sourceURL, sourceOffset, destOffset, count, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_30; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_36; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; options.sourceConditions = options.sourceConditions || {}; - _a = createSpan("PageBlobClient-uploadPagesFromURL", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-uploadPagesFromURL", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps); return [4 /*yield*/, this.pageBlobContext.uploadPagesFromURL(sourceURL, rangeToString({ offset: sourceOffset, count: count }), 0, rangeToString({ offset: destOffset, count: count }), { abortSignal: options.abortSignal, @@ -26584,7 +30715,7 @@ var PageBlobClient = /** @class */ (function (_super) { sourceContentCrc64: options.sourceContentCrc64, leaseAccessConditions: options.conditions, sequenceNumberAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), sourceModifiedAccessConditions: { sourceIfMatch: options.sourceConditions.ifMatch, sourceIfModifiedSince: options.sourceConditions.ifModifiedSince, @@ -26595,14 +30726,14 @@ var PageBlobClient = /** @class */ (function (_super) { encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_30 = _b.sent(); + e_36 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_30.message + message: e_36.message }); - throw e_30; + throw e_36; case 4: span.end(); return [7 /*endfinally*/]; @@ -26622,36 +30753,37 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.clearPages = function (offset, count, options) { + var _a; if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_31; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_37; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-clearPages", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-clearPages", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.clearPages(0, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset: offset, count: count }), sequenceNumberAccessConditions: options.conditions, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_31 = _b.sent(); + e_37 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_31.message + message: e_37.message }); - throw e_31; + throw e_37; case 4: span.end(); return [7 /*endfinally*/]; @@ -26671,35 +30803,36 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.getPageRanges = function (offset, count, options) { + var _a; if (offset === void 0) { offset = 0; } if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_32; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_38; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-getPageRanges", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-getPageRanges", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext .getPageRanges({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset: offset, count: count }), spanOptions: spanOptions }) .then(rangeResponseFromModel)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_32 = _b.sent(); + e_38 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_32.message + message: e_38.message }); - throw e_32; + throw e_38; case 4: span.end(); return [7 /*endfinally*/]; @@ -26714,41 +30847,42 @@ var PageBlobClient = /** @class */ (function (_super) { * * @param {number} offset Starting byte position of the page blob * @param {number} count Number of bytes to get ranges diff. - * @param {string} prevSnapshot Timestamp of snapshot to retrive the difference. + * @param {string} prevSnapshot Timestamp of snapshot to retrieve the difference. * @param {PageBlobGetPageRangesDiffOptions} [options] Options to the Page Blob Get Page Ranges Diff operation. * @returns {Promise} Response data for the Page Blob Get Page Range Diff operation. * @memberof PageBlobClient */ PageBlobClient.prototype.getPageRangesDiff = function (offset, count, prevSnapshot, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_33; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_39; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-getPageRangesDiff", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-getPageRangesDiff", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext .getPageRangesDiff({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevsnapshot: prevSnapshot, range: rangeToString({ offset: offset, count: count }), spanOptions: spanOptions }) .then(rangeResponseFromModel)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_33 = _b.sent(); + e_39 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_33.message + message: e_39.message }); - throw e_33; + throw e_39; case 4: span.end(); return [7 /*endfinally*/]; @@ -26763,41 +30897,42 @@ var PageBlobClient = /** @class */ (function (_super) { * * @param {number} offset Starting byte position of the page blob * @param {number} count Number of bytes to get ranges diff. - * @param {string} prevSnapshotUrl URL of snapshot to retrive the difference. + * @param {string} prevSnapshotUrl URL of snapshot to retrieve the difference. * @param {PageBlobGetPageRangesDiffOptions} [options] Options to the Page Blob Get Page Ranges Diff operation. * @returns {Promise} Response data for the Page Blob Get Page Range Diff operation. * @memberof PageBlobClient */ PageBlobClient.prototype.getPageRangesDiffForManagedDisks = function (offset, count, prevSnapshotUrl, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_34; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_40; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-GetPageRangesDiffForManagedDisks", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-GetPageRangesDiffForManagedDisks", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext .getPageRangesDiff({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevSnapshotUrl: prevSnapshotUrl, range: rangeToString({ offset: offset, count: count }), spanOptions: spanOptions }) .then(rangeResponseFromModel)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_34 = _b.sent(); + e_40 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_34.message + message: e_40.message }); - throw e_34; + throw e_40; case 4: span.end(); return [7 /*endfinally*/]; @@ -26816,32 +30951,33 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.resize = function (size, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_35; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_41; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-resize", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-resize", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.resize(size, { abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), encryptionScope: options.encryptionScope, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_35 = _b.sent(); + e_41 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_35.message + message: e_41.message }); - throw e_35; + throw e_41; case 4: span.end(); return [7 /*endfinally*/]; @@ -26861,32 +30997,33 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.updateSequenceNumber = function (sequenceNumberAction, sequenceNumber, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_36; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_42; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: options.conditions = options.conditions || {}; - _a = createSpan("PageBlobClient-updateSequenceNumber", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-updateSequenceNumber", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.updateSequenceNumber(sequenceNumberAction, { abortSignal: options.abortSignal, blobSequenceNumber: sequenceNumber, leaseAccessConditions: options.conditions, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_36 = _b.sent(); + e_42 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_36.message + message: e_42.message }); - throw e_36; + throw e_42; case 4: span.end(); return [7 /*endfinally*/]; @@ -26910,29 +31047,30 @@ var PageBlobClient = /** @class */ (function (_super) { * @memberof PageBlobClient */ PageBlobClient.prototype.startCopyIncremental = function (copySource, options) { + var _a; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_37; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _b, span, spanOptions, e_43; + return tslib.__generator(this, function (_c) { + switch (_c.label) { case 0: - _a = createSpan("PageBlobClient-startCopyIncremental", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _b = createSpan("PageBlobClient-startCopyIncremental", options.tracingOptions), span = _b.span, spanOptions = _b.spanOptions; + _c.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _c.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.pageBlobContext.copyIncremental(copySource, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _c.sent()]; case 3: - e_37 = _b.sent(); + e_43 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_37.message + message: e_43.message }); - throw e_37; + throw e_43; case 4: span.end(); return [7 /*endfinally*/]; @@ -26960,9 +31098,11 @@ var BlobLeaseClient = /** @class */ (function () { var clientContext = new StorageClientContext(client.url, client.pipeline.toServiceClientOptions()); this._url = client.url; if (client instanceof ContainerClient) { + this._isContainer = true; this._containerOrBlobOperation = new Container(clientContext); } else { + this._isContainer = false; this._containerOrBlobOperation = new Blob$1(clientContext); } if (!leaseId) { @@ -26981,7 +31121,7 @@ var BlobLeaseClient = /** @class */ (function () { get: function () { return this._leaseId; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(BlobLeaseClient.prototype, "url", { @@ -26995,7 +31135,7 @@ var BlobLeaseClient = /** @class */ (function () { get: function () { return this._url; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -27012,31 +31152,37 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.acquireLease = function (duration, options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_38; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, e_44; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-acquireLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-acquireLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.acquireLease({ abortSignal: options.abortSignal, duration: duration, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), proposedLeaseId: this._leaseId, spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_38 = _b.sent(); + e_44 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_38.message + message: e_44.message }); - throw e_38; + throw e_44; case 4: span.end(); return [7 /*endfinally*/]; @@ -27057,32 +31203,38 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.changeLease = function (proposedLeaseId, options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, e_39; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, response, e_45; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-changeLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-changeLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.changeLease(this._leaseId, proposedLeaseId, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions })]; case 2: - response = _b.sent(); + response = _h.sent(); this._leaseId = proposedLeaseId; return [2 /*return*/, response]; case 3: - e_39 = _b.sent(); + e_45 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_39.message + message: e_45.message }); - throw e_39; + throw e_45; case 4: span.end(); return [7 /*endfinally*/]; @@ -27103,29 +31255,35 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.releaseLease = function (options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_40; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, e_46; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-releaseLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-releaseLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.releaseLease(this._leaseId, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_40 = _b.sent(); + e_46 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_40.message + message: e_46.message }); - throw e_40; + throw e_46; case 4: span.end(); return [7 /*endfinally*/]; @@ -27145,29 +31303,35 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.renewLease = function (options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_41; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, e_47; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-renewLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-renewLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this._containerOrBlobOperation.renewLease(this._leaseId, { abortSignal: options.abortSignal, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions })]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_41 = _b.sent(); + e_47 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_41.message + message: e_47.message }); - throw e_41; + throw e_47; case 4: span.end(); return [7 /*endfinally*/]; @@ -27190,31 +31354,37 @@ var BlobLeaseClient = /** @class */ (function () { * @memberof BlobLeaseClient */ BlobLeaseClient.prototype.breakLease = function (breakPeriod, options) { + var _a, _b, _c, _d, _e, _f; if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, operationOptions, e_42; - return tslib.__generator(this, function (_b) { - switch (_b.label) { + var _g, span, spanOptions, operationOptions, e_48; + return tslib.__generator(this, function (_h) { + switch (_h.label) { case 0: - _a = createSpan("BlobLeaseClient-breakLease", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; - _b.label = 1; + _g = createSpan("BlobLeaseClient-breakLease", options.tracingOptions), span = _g.span, spanOptions = _g.spanOptions; + if (this._isContainer && + ((((_a = options.conditions) === null || _a === void 0 ? void 0 : _a.ifMatch) && ((_b = options.conditions) === null || _b === void 0 ? void 0 : _b.ifMatch) !== ETagNone) || + (((_c = options.conditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch) && ((_d = options.conditions) === null || _d === void 0 ? void 0 : _d.ifNoneMatch) !== ETagNone) || ((_e = options.conditions) === null || _e === void 0 ? void 0 : _e.tagConditions))) { + throw new RangeError("The IfMatch, IfNoneMatch and tags access conditions are ignored by the service. Values other than undefined or their default values are not acceptable."); + } + _h.label = 1; case 1: - _b.trys.push([1, 3, 4, 5]); + _h.trys.push([1, 3, 4, 5]); operationOptions = { abortSignal: options.abortSignal, breakPeriod: breakPeriod, - modifiedAccessConditions: options.conditions, + modifiedAccessConditions: tslib.__assign(tslib.__assign({}, options.conditions), { ifTags: (_f = options.conditions) === null || _f === void 0 ? void 0 : _f.tagConditions }), spanOptions: spanOptions }; return [4 /*yield*/, this._containerOrBlobOperation.breakLease(operationOptions)]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: return [2 /*return*/, _h.sent()]; case 3: - e_42 = _b.sent(); + e_48 = _h.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_42.message + message: e_48.message }); - throw e_42; + throw e_48; case 4: span.end(); return [7 /*endfinally*/]; @@ -27296,7 +31466,7 @@ var ContainerClient = /** @class */ (function (_super) { get: function () { return this._containerName; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -27319,7 +31489,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.create = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_43; + var _a, span, spanOptions, e_49; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27333,12 +31503,12 @@ var ContainerClient = /** @class */ (function (_super) { // this will filter out unwanted properties from the response object into result object return [2 /*return*/, _b.sent()]; case 3: - e_43 = _b.sent(); + e_49 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_43.message + message: e_49.message }); - throw e_43; + throw e_49; case 4: span.end(); return [7 /*endfinally*/]; @@ -27348,7 +31518,55 @@ var ContainerClient = /** @class */ (function (_super) { }); }; /** - * Returns true if the Azrue container resource represented by this client exists; false otherwise. + * Creates a new container under the specified account. If the container with + * the same name already exists, it is not changed. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container + * + * @param {ContainerCreateOptions} [options] + * @returns {Promise} + * @memberof ContainerClient + */ + ContainerClient.prototype.createIfNotExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, res, e_50; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("ContainerClient-createIfNotExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.create(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_50 = _d.sent(); + if (((_a = e_50.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") { + span.setStatus({ + code: api.CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a container only if it does not already exist." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_50.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_50.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_50.message + }); + throw e_50; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns true if the Azure container resource represented by this client exists; false otherwise. * * NOTE: use this function with care since an existing container might be deleted by other clients or * applications. Vice versa new containers with the same name might be added by other clients or @@ -27361,7 +31579,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.exists = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_44; + var _a, span, spanOptions, e_51; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27377,8 +31595,8 @@ var ContainerClient = /** @class */ (function (_super) { _b.sent(); return [2 /*return*/, true]; case 3: - e_44 = _b.sent(); - if (e_44.statusCode === 404) { + e_51 = _b.sent(); + if (e_51.statusCode === 404) { span.setStatus({ code: api.CanonicalCode.NOT_FOUND, message: "Expected exception when checking container existence" @@ -27387,9 +31605,9 @@ var ContainerClient = /** @class */ (function (_super) { } span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_44.message + message: e_51.message }); - throw e_44; + throw e_51; case 4: span.end(); return [7 /*endfinally*/]; @@ -27464,7 +31682,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.getProperties = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_45; + var _a, span, spanOptions, e_52; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27478,12 +31696,12 @@ var ContainerClient = /** @class */ (function (_super) { return [4 /*yield*/, this.containerContext.getProperties(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal }, options.conditions), { spanOptions: spanOptions }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_45 = _b.sent(); + e_52 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_45.message + message: e_52.message }); - throw e_45; + throw e_52; case 4: span.end(); return [7 /*endfinally*/]; @@ -27504,18 +31722,13 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.delete = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_46; + var _a, span, spanOptions, e_53; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: if (!options.conditions) { options.conditions = {}; } - if ((options.conditions.ifMatch && options.conditions.ifMatch !== ETagNone) || - (options.conditions.ifNoneMatch && options.conditions.ifNoneMatch !== ETagNone)) { - throw new RangeError("the IfMatch and IfNoneMatch access conditions must have their default\ - values because they are ignored by the service"); - } _a = createSpan("ContainerClient-delete", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; _b.label = 1; case 1: @@ -27528,12 +31741,60 @@ var ContainerClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_46 = _b.sent(); + e_53 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_46.message + message: e_53.message }); - throw e_46; + throw e_53; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Marks the specified container for deletion if it exists. The container and any blobs + * contained within it are later deleted during garbage collection. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container + * + * @param {ContainerDeleteMethodOptions} [options] Options to Container Delete operation. + * @returns {Promise} + * @memberof ContainerClient + */ + ContainerClient.prototype.deleteIfExists = function (options) { + var _a, _b; + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _c, span, spanOptions, res, e_54; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = createSpan("ContainerClient-deleteIfExists", options.tracingOptions), span = _c.span, spanOptions = _c.spanOptions; + _d.label = 1; + case 1: + _d.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + res = _d.sent(); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable + })]; + case 3: + e_54 = _d.sent(); + if (((_a = e_54.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") { + span.setStatus({ + code: api.CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a container only if it exists." + }); + return [2 /*return*/, tslib.__assign(tslib.__assign({ succeeded: false }, (_b = e_54.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e_54.response })]; + } + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_54.message + }); + throw e_54; case 4: span.end(); return [7 /*endfinally*/]; @@ -27559,18 +31820,15 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.setMetadata = function (metadata, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_47; + var _a, span, spanOptions, e_55; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: if (!options.conditions) { options.conditions = {}; } - if (options.conditions.ifUnmodifiedSince || - (options.conditions.ifMatch && options.conditions.ifMatch !== ETagNone) || - (options.conditions.ifNoneMatch && options.conditions.ifNoneMatch !== ETagNone)) { - throw new RangeError("the IfUnmodifiedSince, IfMatch, and IfNoneMatch must have their default values\ - because they are ignored by the blob service"); + if (options.conditions.ifUnmodifiedSince) { + throw new RangeError("the IfUnmodifiedSince must have their default values because they are ignored by the blob service"); } _a = createSpan("ContainerClient-setMetadata", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; _b.label = 1; @@ -27585,12 +31843,12 @@ var ContainerClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_47 = _b.sent(); + e_55 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_47.message + message: e_55.message }); - throw e_47; + throw e_55; case 4: span.end(); return [7 /*endfinally*/]; @@ -27615,7 +31873,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.getAccessPolicy = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_48; + var _a, span, spanOptions, response, res, _i, response_1, identifier, accessPolicy, e_56; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27666,12 +31924,12 @@ var ContainerClient = /** @class */ (function (_super) { } return [2 /*return*/, res]; case 3: - e_48 = _b.sent(); + e_56 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_48.message + message: e_56.message }); - throw e_48; + throw e_56; case 4: span.end(); return [7 /*endfinally*/]; @@ -27702,7 +31960,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.setAccessPolicy = function (access, containerAcl, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, acl, _i, _b, identifier, e_49; + var _a, span, spanOptions, acl, _i, _b, identifier, e_57; return tslib.__generator(this, function (_c) { switch (_c.label) { case 0: @@ -27737,12 +31995,12 @@ var ContainerClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _c.sent()]; case 3: - e_49 = _c.sent(); + e_57 = _c.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_49.message + message: e_57.message }); - throw e_49; + throw e_57; case 4: span.end(); return [7 /*endfinally*/]; @@ -27787,7 +32045,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.uploadBlockBlob = function (blobName, body, contentLength, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, blockBlobClient, response, e_50; + var _a, span, spanOptions, blockBlobClient, response, e_58; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27804,12 +32062,12 @@ var ContainerClient = /** @class */ (function (_super) { response: response }]; case 3: - e_50 = _b.sent(); + e_58 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_50.message + message: e_58.message }); - throw e_50; + throw e_58; case 4: span.end(); return [7 /*endfinally*/]; @@ -27826,14 +32084,14 @@ var ContainerClient = /** @class */ (function (_super) { * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob * * @param {string} blobName - * @param {BlobDeleteOptions} [options] Options to Blob Delete operation. + * @param {ContainerDeleteBlobOptions} [options] Options to Blob Delete operation. * @returns {Promise} Block blob deletion response data. * @memberof ContainerClient */ ContainerClient.prototype.deleteBlob = function (blobName, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, blobClient, e_51; + var _a, span, spanOptions, blobClient, e_59; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27842,15 +32100,18 @@ var ContainerClient = /** @class */ (function (_super) { case 1: _b.trys.push([1, 3, 4, 5]); blobClient = this.getBlobClient(blobName); + if (options.versionId) { + blobClient = blobClient.withVersion(options.versionId); + } return [4 /*yield*/, blobClient.delete(tslib.__assign(tslib.__assign({}, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_51 = _b.sent(); + e_59 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_51.message + message: e_59.message }); - throw e_51; + throw e_59; case 4: span.end(); return [7 /*endfinally*/]; @@ -27874,7 +32135,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listBlobFlatSegment = function (marker, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_52; + var _a, span, spanOptions, response, wrappedResponse, e_60; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27883,14 +32144,20 @@ var ContainerClient = /** @class */ (function (_super) { case 1: _b.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.containerContext.listBlobFlatSegment(tslib.__assign(tslib.__assign({ marker: marker }, options), { spanOptions: spanOptions }))]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: + response = _b.sent(); + wrappedResponse = tslib.__assign(tslib.__assign({}, response), { _response: response._response, segment: tslib.__assign(tslib.__assign({}, response.segment), { blobItems: response.segment.blobItems.map(function (blobItemInteral) { + var blobItem = tslib.__assign(tslib.__assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) }); + return blobItem; + }) }) }); + return [2 /*return*/, wrappedResponse]; case 3: - e_52 = _b.sent(); + e_60 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_52.message + message: e_60.message }); - throw e_52; + throw e_60; case 4: span.end(); return [7 /*endfinally*/]; @@ -27906,7 +32173,7 @@ var ContainerClient = /** @class */ (function (_super) { * again (passing the the previously-returned Marker) to get the next segment. * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs * - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {string} [marker] A string value that identifies the portion of the list to be returned with the next list operation. * @param {ContainerListBlobsSegmentOptions} [options] Options to Container List Blob Hierarchy Segment operation. * @returns {Promise} @@ -27915,7 +32182,7 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listBlobHierarchySegment = function (delimiter, marker, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_53; + var _a, span, spanOptions, response, wrappedResponse, e_61; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -27924,14 +32191,20 @@ var ContainerClient = /** @class */ (function (_super) { case 1: _b.trys.push([1, 3, 4, 5]); return [4 /*yield*/, this.containerContext.listBlobHierarchySegment(delimiter, tslib.__assign(tslib.__assign({ marker: marker }, options), { spanOptions: spanOptions }))]; - case 2: return [2 /*return*/, _b.sent()]; + case 2: + response = _b.sent(); + wrappedResponse = tslib.__assign(tslib.__assign({}, response), { _response: response._response, segment: tslib.__assign(tslib.__assign({}, response.segment), { blobItems: response.segment.blobItems.map(function (blobItemInteral) { + var blobItem = tslib.__assign(tslib.__assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) }); + return blobItem; + }) }) }); + return [2 /*return*/, wrappedResponse]; case 3: - e_53 = _b.sent(); + e_61 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_53.message + message: e_61.message }); - throw e_53; + throw e_61; case 4: span.end(); return [7 /*endfinally*/]; @@ -27993,8 +32266,8 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listItems = function (options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listItems_1() { - var marker, _a, _b, listBlobsFlatSegmentResponse, e_54_1; - var e_54, _c; + var marker, _a, _b, listBlobsFlatSegmentResponse, e_62_1; + var e_62, _c; return tslib.__generator(this, function (_d) { switch (_d.label) { case 0: @@ -28013,8 +32286,8 @@ var ContainerClient = /** @class */ (function (_super) { case 5: return [3 /*break*/, 1]; case 6: return [3 /*break*/, 13]; case 7: - e_54_1 = _d.sent(); - e_54 = { error: e_54_1 }; + e_62_1 = _d.sent(); + e_62 = { error: e_62_1 }; return [3 /*break*/, 13]; case 8: _d.trys.push([8, , 11, 12]); @@ -28025,7 +32298,7 @@ var ContainerClient = /** @class */ (function (_super) { _d.label = 10; case 10: return [3 /*break*/, 12]; case 11: - if (e_54) throw e_54.error; + if (e_62) throw e_62.error; return [7 /*endfinally*/]; case 12: return [7 /*endfinally*/]; case 13: return [2 /*return*/]; @@ -28121,9 +32394,15 @@ var ContainerClient = /** @class */ (function (_super) { if (options.includeSnapshots) { include.push("snapshots"); } + if (options.includeVersions) { + include.push("versions"); + } if (options.includeUncommitedBlobs) { include.push("uncommittedblobs"); } + if (options.includeTags) { + include.push("tags"); + } if (options.prefix === "") { options.prefix = undefined; } @@ -28157,7 +32436,7 @@ var ContainerClient = /** @class */ (function (_super) { * Returns an AsyncIterableIterator for ContainerListBlobHierarchySegmentResponse * * @private - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {string} [marker] A string value that identifies the portion of * the list of blobs to be returned with the next listing operation. The * operation returns the ContinuationToken value within the response body if the @@ -28168,7 +32447,8 @@ var ContainerClient = /** @class */ (function (_super) { * @param {ContainerListBlobsSegmentOptions} [options] Options to list blobs operation. * @returns {AsyncIterableIterator} * @memberof ContainerClient - */ ContainerClient.prototype.listHierarchySegments = function (delimiter, marker, options) { + */ + ContainerClient.prototype.listHierarchySegments = function (delimiter, marker, options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listHierarchySegments_1() { var listBlobsHierarchySegmentResponse; @@ -28199,7 +32479,7 @@ var ContainerClient = /** @class */ (function (_super) { * Returns an AsyncIterableIterator for {@link BlobPrefix} and {@link BlobItem} objects. * * @private - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {ContainerListBlobsSegmentOptions} [options] Options to list blobs operation. * @returns {AsyncIterableIterator<{ kind: "prefix" } & BlobPrefix | { kind: "blob" } & BlobItem>} * @memberof ContainerClient @@ -28207,8 +32487,8 @@ var ContainerClient = /** @class */ (function (_super) { ContainerClient.prototype.listItemsByHierarchy = function (delimiter, options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listItemsByHierarchy_1() { - var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_55_1; - var e_55, _f; + var marker, _a, _b, listBlobsHierarchySegmentResponse, segment, _i, _c, prefix, _d, _e, blob, e_63_1; + var e_63, _f; return tslib.__generator(this, function (_g) { switch (_g.label) { case 0: @@ -28251,8 +32531,8 @@ var ContainerClient = /** @class */ (function (_super) { case 12: return [3 /*break*/, 1]; case 13: return [3 /*break*/, 20]; case 14: - e_55_1 = _g.sent(); - e_55 = { error: e_55_1 }; + e_63_1 = _g.sent(); + e_63 = { error: e_63_1 }; return [3 /*break*/, 20]; case 15: _g.trys.push([15, , 18, 19]); @@ -28263,7 +32543,7 @@ var ContainerClient = /** @class */ (function (_super) { _g.label = 17; case 17: return [3 /*break*/, 19]; case 18: - if (e_55) throw e_55.error; + if (e_63) throw e_63.error; return [7 /*endfinally*/]; case 19: return [7 /*endfinally*/]; case 20: return [2 /*return*/]; @@ -28292,7 +32572,7 @@ var ContainerClient = /** @class */ (function (_super) { * Example using `iter.next()`: * * ```js - * let iter = await containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" }); + * let iter = containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" }); * let entity = await iter.next(); * while (!entity.done) { * let item = entity.value; @@ -28344,7 +32624,7 @@ var ContainerClient = /** @class */ (function (_super) { * } * ``` * - * @param {string} delimiter The charactor or string used to define the virtual hierarchy + * @param {string} delimiter The character or string used to define the virtual hierarchy * @param {ContainerListBlobsOptions} [options={}] Options to list blobs operation. * @returns {(PagedAsyncIterableIterator< * { kind: "prefix" } & BlobPrefix | { kind: "blob" } & BlobItem, @@ -28356,6 +32636,9 @@ var ContainerClient = /** @class */ (function (_super) { var _a; var _this = this; if (options === void 0) { options = {}; } + if (delimiter === "") { + throw new RangeError("delimiter should contain one or more characters"); + } var include = []; if (options.includeCopy) { include.push("copy"); @@ -28369,9 +32652,15 @@ var ContainerClient = /** @class */ (function (_super) { if (options.includeSnapshots) { include.push("snapshots"); } + if (options.includeVersions) { + include.push("versions"); + } if (options.includeUncommitedBlobs) { include.push("uncommittedblobs"); } + if (options.includeTags) { + include.push("tags"); + } if (options.prefix === "") { options.prefix = undefined; } @@ -28416,15 +32705,21 @@ var ContainerClient = /** @class */ (function (_super) { var parsedUrl = coreHttp.URLBuilder.parse(this.url); if (parsedUrl.getHost().split(".")[1] === "blob") { // "https://myaccount.blob.core.windows.net/containername". + // "https://customdomain.com/containername". // .getPath() -> /containername containerName = parsedUrl.getPath().split("/")[1]; } - else { + else if (isIpEndpointStyle(parsedUrl)) { // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername // .getPath() -> /devstoreaccount1/containername containerName = parsedUrl.getPath().split("/")[2]; } + else { + // "https://customdomain.com/containername". + // .getPath() -> /containername + containerName = parsedUrl.getPath().split("/")[1]; + } // decode the encoded containerName - to get all the special characters that might be present in it containerName = decodeURIComponent(containerName); if (!containerName) { @@ -28893,7 +33188,7 @@ var InnerBatchRequest = /** @class */ (function () { this.subRequests = new Map(); } /** - * Create pipeline to assemble sub requests. The idea here is to use exising + * Create pipeline to assemble sub requests. The idea here is to use existing * credential and serialization/deserialization components, with additional policies to * filter unnecessary headers, assemble sub requests into request's body * and intercept request from going to wire. @@ -28901,7 +33196,7 @@ var InnerBatchRequest = /** @class */ (function () { */ InnerBatchRequest.prototype.createPipeline = function (credential) { var isAnonymousCreds = credential instanceof AnonymousCredential; - var policyFactoryLength = 3 + (isAnonymousCreds ? 0 : 1); // [deserilizationPolicy, BatchHeaderFilterPolicyFactory, (Optional)Credential, BatchRequestAssemblePolicyFactory] + var policyFactoryLength = 3 + (isAnonymousCreds ? 0 : 1); // [deserializationPolicy, BatchHeaderFilterPolicyFactory, (Optional)Credential, BatchRequestAssemblePolicyFactory] var factories = new Array(policyFactoryLength); factories[0] = coreHttp.deserializationPolicy(); // Default deserializationPolicy is provided by protocol layer factories[1] = new BatchHeaderFilterPolicyFactory(); // Use batch header filter policy to exclude unnecessary headers @@ -29355,6 +33650,48 @@ var BlobServiceClient = /** @class */ (function (_super) { }); }); }; + /** + * Restore a previously deleted Blob container. + * This API is only functional if Container Soft Delete is enabled for the storage account associated with the container. + * + * @param {string} deletedContainerName Name of the previously deleted container. + * @param {string} deletedContainerVersion Version of the previously deleted container, used to uniquely identify the deleted container. + * @returns {Promise} Container deletion response. + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.undeleteContainer = function (deletedContainerName, deletedContainerVersion, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a, span, spanOptions, containerClient, containerContext, containerUndeleteResponse, e_3; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = createSpan("BlobServiceClient-undeleteContainer", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b.label = 1; + case 1: + _b.trys.push([1, 3, 4, 5]); + containerClient = this.getContainerClient(options.destinationContainerName || deletedContainerName); + containerContext = new Container(containerClient["storageClientContext"]); + return [4 /*yield*/, containerContext.restore(tslib.__assign(tslib.__assign({ deletedContainerName: deletedContainerName, + deletedContainerVersion: deletedContainerVersion }, options), { tracingOptions: tslib.__assign(tslib.__assign({}, options.tracingOptions), { spanOptions: spanOptions }) }))]; + case 2: + containerUndeleteResponse = _b.sent(); + return [2 /*return*/, { containerClient: containerClient, containerUndeleteResponse: containerUndeleteResponse }]; + case 3: + e_3 = _b.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_3.message + }); + throw e_3; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; /** * Gets the properties of a storage account’s Blob service, including properties * for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -29367,7 +33704,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getProperties = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_3; + var _a, span, spanOptions, e_4; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29381,12 +33718,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_3 = _b.sent(); + e_4 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_3.message + message: e_4.message }); - throw e_3; + throw e_4; case 4: span.end(); return [7 /*endfinally*/]; @@ -29408,7 +33745,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.setProperties = function (properties, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_4; + var _a, span, spanOptions, e_5; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29422,12 +33759,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_4 = _b.sent(); + e_5 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_4.message + message: e_5.message }); - throw e_4; + throw e_5; case 4: span.end(); return [7 /*endfinally*/]; @@ -29449,7 +33786,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getStatistics = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_5; + var _a, span, spanOptions, e_6; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29463,12 +33800,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_5 = _b.sent(); + e_6 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_5.message + message: e_6.message }); - throw e_5; + throw e_6; case 4: span.end(); return [7 /*endfinally*/]; @@ -29491,7 +33828,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getAccountInfo = function (options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_6; + var _a, span, spanOptions, e_7; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29505,12 +33842,12 @@ var BlobServiceClient = /** @class */ (function (_super) { })]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_6 = _b.sent(); + e_7 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_6.message + message: e_7.message }); - throw e_6; + throw e_7; case 4: span.end(); return [7 /*endfinally*/]; @@ -29525,9 +33862,9 @@ var BlobServiceClient = /** @class */ (function (_super) { * * @param {string} [marker] A string value that identifies the portion of * the list of containers to be returned with the next listing operation. The - * operation returns the NextMarker value within the response body if the + * operation returns the continuationToken value within the response body if the * listing operation did not return all containers remaining to be listed - * with the current page. The NextMarker value can be used as the value for + * with the current page. The continuationToken value can be used as the value for * the marker parameter in a subsequent call to request the next page of list * items. The marker value is opaque to the client. * @param {ServiceListContainersSegmentOptions} [options] Options to the Service List Container Segment operation. @@ -29537,7 +33874,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.listContainersSegment = function (marker, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, e_7; + var _a, span, spanOptions, e_8; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29545,15 +33882,15 @@ var BlobServiceClient = /** @class */ (function (_super) { _b.label = 1; case 1: _b.trys.push([1, 3, 4, 5]); - return [4 /*yield*/, this.serviceContext.listContainersSegment(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal, marker: marker }, options), { spanOptions: spanOptions }))]; + return [4 /*yield*/, this.serviceContext.listContainersSegment(tslib.__assign(tslib.__assign({ abortSignal: options.abortSignal, marker: marker }, options), { include: typeof options.include === "string" ? [options.include] : options.include, spanOptions: spanOptions }))]; case 2: return [2 /*return*/, _b.sent()]; case 3: - e_7 = _b.sent(); + e_8 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_7.message + message: e_8.message }); - throw e_7; + throw e_8; case 4: span.end(); return [7 /*endfinally*/]; @@ -29562,15 +33899,282 @@ var BlobServiceClient = /** @class */ (function (_super) { }); }); }; + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags + * match a given search expression. Filter blobs searches across all containers within a + * storage account but can be scoped within the expression to a single container. + * + * @private + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {string} [marker] A string value that identifies the portion of + * the list of blobs to be returned with the next listing operation. The + * operation returns the continuationToken value within the response body if the + * listing operation did not return all blobs remaining to be listed + * with the current page. The continuationToken value can be used as the value for + * the marker parameter in a subsequent call to request the next page of list + * items. The marker value is opaque to the client. + * @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags. + * @returns {Promise} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTagsSegment = function (tagFilterSqlExpression, marker, options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a, span, spanOptions, e_9; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = createSpan("BlobServiceClient-findBlobsByTagsSegment", options.tracingOptions), span = _a.span, spanOptions = _a.spanOptions; + _b.label = 1; + case 1: + _b.trys.push([1, 3, 4, 5]); + return [4 /*yield*/, this.serviceContext.filterBlobs({ + abortSignal: options.abortSignal, + where: tagFilterSqlExpression, + marker: marker, + maxPageSize: options.maxPageSize, + spanOptions: spanOptions + })]; + case 2: return [2 /*return*/, _b.sent()]; + case 3: + e_9 = _b.sent(); + span.setStatus({ + code: api.CanonicalCode.UNKNOWN, + message: e_9.message + }); + throw e_9; + case 4: + span.end(); + return [7 /*endfinally*/]; + case 5: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns an AsyncIterableIterator for ServiceFindBlobsByTagsSegmentResponse. + * + * @private + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {string} [marker] A string value that identifies the portion of + * the list of blobs to be returned with the next listing operation. The + * operation returns the continuationToken value within the response body if the + * listing operation did not return all blobs remaining to be listed + * with the current page. The continuationToken value can be used as the value for + * the marker parameter in a subsequent call to request the next page of list + * items. The marker value is opaque to the client. + * @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to find blobs by tags. + * @returns {AsyncIterableIterator} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTagsSegments = function (tagFilterSqlExpression, marker, options) { + if (options === void 0) { options = {}; } + return tslib.__asyncGenerator(this, arguments, function findBlobsByTagsSegments_1() { + var response; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(!!marker || marker === undefined)) return [3 /*break*/, 6]; + _a.label = 1; + case 1: return [4 /*yield*/, tslib.__await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options))]; + case 2: + response = _a.sent(); + response.blobs = response.blobs || []; + marker = response.continuationToken; + return [4 /*yield*/, tslib.__await(response)]; + case 3: return [4 /*yield*/, _a.sent()]; + case 4: + _a.sent(); + _a.label = 5; + case 5: + if (marker) return [3 /*break*/, 1]; + _a.label = 6; + case 6: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns an AsyncIterableIterator for blobs. + * + * @private + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {ServiceFindBlobsByTagsSegmentOptions} [options={}] Options to findBlobsByTagsItems. + * @returns {AsyncIterableIterator} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTagsItems = function (tagFilterSqlExpression, options) { + if (options === void 0) { options = {}; } + return tslib.__asyncGenerator(this, arguments, function findBlobsByTagsItems_1() { + var marker, _a, _b, segment, e_10_1; + var e_10, _c; + return tslib.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 7, 8, 13]); + _a = tslib.__asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)); + _d.label = 1; + case 1: return [4 /*yield*/, tslib.__await(_a.next())]; + case 2: + if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6]; + segment = _b.value; + return [5 /*yield**/, tslib.__values(tslib.__asyncDelegator(tslib.__asyncValues(segment.blobs)))]; + case 3: return [4 /*yield*/, tslib.__await.apply(void 0, [_d.sent()])]; + case 4: + _d.sent(); + _d.label = 5; + case 5: return [3 /*break*/, 1]; + case 6: return [3 /*break*/, 13]; + case 7: + e_10_1 = _d.sent(); + e_10 = { error: e_10_1 }; + return [3 /*break*/, 13]; + case 8: + _d.trys.push([8, , 11, 12]); + if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10]; + return [4 /*yield*/, tslib.__await(_c.call(_a))]; + case 9: + _d.sent(); + _d.label = 10; + case 10: return [3 /*break*/, 12]; + case 11: + if (e_10) throw e_10.error; + return [7 /*endfinally*/]; + case 12: return [7 /*endfinally*/]; + case 13: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns an async iterable iterator to find all blobs with specified tag + * under the specified account. + * + * .byPage() returns an async iterable iterator to list the blobs in pages. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties + * + * Example using `for await` syntax: + * + * ```js + * let i = 1; + * for await (const blob of blobServiceClient.findBlobsByTags("tagkey='tagvalue'")) { + * console.log(`Blob ${i++}: ${container.name}`); + * } + * ``` + * + * Example using `iter.next()`: + * + * ```js + * let i = 1; + * const iter = blobServiceClient.findBlobsByTags("tagkey='tagvalue'"); + * let blobItem = await iter.next(); + * while (!blobItem.done) { + * console.log(`Blob ${i++}: ${blobItem.value.name}`); + * blobItem = await iter.next(); + * } + * ``` + * + * Example using `byPage()`: + * + * ```js + * // passing optional maxPageSize in the page settings + * let i = 1; + * for await (const response of blobServiceClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) { + * if (response.blobs) { + * for (const blob of response.blobs) { + * console.log(`Blob ${i++}: ${blob.name}`); + * } + * } + * } + * ``` + * + * Example using paging with a marker: + * + * ```js + * let i = 1; + * let iterator = blobServiceClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 }); + * let response = (await iterator.next()).value; + * + * // Prints 2 blob names + * if (response.blobs) { + * for (const blob of response.blobs) { + * console.log(`Blob ${i++}: ${blob.name}`); + * } + * } + * + * // Gets next marker + * let marker = response.continuationToken; + * // Passing next marker as continuationToken + * iterator = blobServiceClient + * .findBlobsByTags("tagkey='tagvalue'") + * .byPage({ continuationToken: marker, maxPageSize: 10 }); + * response = (await iterator.next()).value; + * + * // Prints blob names + * if (response.blobs) { + * for (const blob of response.blobs) { + * console.log(`Blob ${i++}: ${blob.name}`); + * } + * } + * ``` + * + * @param {string} tagFilterSqlExpression The where parameter enables the caller to query blobs whose tags match a given expression. + * The given expression must evaluate to true for a blob to be returned in the results. + * The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter; + * however, only a subset of the OData filter syntax is supported in the Blob service. + * @param {ServiceFindBlobByTagsOptions} [options={}] Options to find blobs by tags. + * @returns {PagedAsyncIterableIterator} + * @memberof BlobServiceClient + */ + BlobServiceClient.prototype.findBlobsByTags = function (tagFilterSqlExpression, options) { + var _a; + var _this = this; + if (options === void 0) { options = {}; } + // AsyncIterableIterator to iterate over blobs + var listSegmentOptions = tslib.__assign({}, options); + var iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions); + return _a = { + /** + * @member {Promise} [next] The next method, part of the iteration protocol + */ + next: function () { + return iter.next(); + } + }, + /** + * @member {Symbol} [asyncIterator] The connection to the async iterator, part of the iteration protocol + */ + _a[Symbol.asyncIterator] = function () { + return this; + }, + /** + * @member {Function} [byPage] Return an AsyncIterableIterator that works a page at a time + */ + _a.byPage = function (settings) { + if (settings === void 0) { settings = {}; } + return _this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, tslib.__assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions)); + }, + _a; + }; /** * Returns an AsyncIterableIterator for ServiceListContainersSegmentResponses * * @private * @param {string} [marker] A string value that identifies the portion of * the list of containers to be returned with the next listing operation. The - * operation returns the NextMarker value within the response body if the + * operation returns the continuationToken value within the response body if the * listing operation did not return all containers remaining to be listed - * with the current page. The NextMarker value can be used as the value for + * with the current page. The continuationToken value can be used as the value for * the marker parameter in a subsequent call to request the next page of list * items. The marker value is opaque to the client. * @param {ServiceListContainersSegmentOptions} [options] Options to list containers operation. @@ -29617,8 +34221,8 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.listItems = function (options) { if (options === void 0) { options = {}; } return tslib.__asyncGenerator(this, arguments, function listItems_1() { - var marker, _a, _b, segment, e_8_1; - var e_8, _c; + var marker, _a, _b, segment, e_11_1; + var e_11, _c; return tslib.__generator(this, function (_d) { switch (_d.label) { case 0: @@ -29637,8 +34241,8 @@ var BlobServiceClient = /** @class */ (function (_super) { case 5: return [3 /*break*/, 1]; case 6: return [3 /*break*/, 13]; case 7: - e_8_1 = _d.sent(); - e_8 = { error: e_8_1 }; + e_11_1 = _d.sent(); + e_11 = { error: e_11_1 }; return [3 /*break*/, 13]; case 8: _d.trys.push([8, , 11, 12]); @@ -29649,7 +34253,7 @@ var BlobServiceClient = /** @class */ (function (_super) { _d.label = 10; case 10: return [3 /*break*/, 12]; case 11: - if (e_8) throw e_8.error; + if (e_11) throw e_11.error; return [7 /*endfinally*/]; case 12: return [7 /*endfinally*/]; case 13: return [2 /*return*/]; @@ -29739,8 +34343,15 @@ var BlobServiceClient = /** @class */ (function (_super) { if (options.prefix === "") { options.prefix = undefined; } + var include = []; + if (options.includeDeleted) { + include.push("deleted"); + } + if (options.includeMetadata) { + include.push("metadata"); + } // AsyncIterableIterator to iterate over containers - var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (options.includeMetadata ? { include: "metadata" } : {})); + var listSegmentOptions = tslib.__assign(tslib.__assign({}, options), (include.length > 0 ? { include: include } : {})); var iter = this.listItems(listSegmentOptions); return _a = { /** @@ -29781,7 +34392,7 @@ var BlobServiceClient = /** @class */ (function (_super) { BlobServiceClient.prototype.getUserDelegationKey = function (startsOn, expiresOn, options) { if (options === void 0) { options = {}; } return tslib.__awaiter(this, void 0, void 0, function () { - var _a, span, spanOptions, response, userDelegationKey, res, e_9; + var _a, span, spanOptions, response, userDelegationKey, res, e_12; return tslib.__generator(this, function (_b) { switch (_b.label) { case 0: @@ -29810,12 +34421,12 @@ var BlobServiceClient = /** @class */ (function (_super) { res = tslib.__assign({ _response: response._response, requestId: response.requestId, clientRequestId: response.clientRequestId, version: response.version, date: response.date, errorCode: response.errorCode }, userDelegationKey); return [2 /*return*/, res]; case 3: - e_9 = _b.sent(); + e_12 = _b.sent(); span.setStatus({ code: api.CanonicalCode.UNKNOWN, - message: e_9.message + message: e_12.message }); - throw e_9; + throw e_12; case 4: span.end(); return [7 /*endfinally*/]; @@ -29875,6 +34486,13 @@ var AccountSASPermissions = /** @class */ (function () { * @memberof AccountSASPermissions */ this.delete = false; + /** + * Permission to delete versions granted. + * + * @type {boolean} + * @memberof AccountSASPermissions + */ + this.deleteVersion = false; /** * Permission to list blob containers, blobs, shares, directories, and files granted. * @@ -29910,6 +34528,20 @@ var AccountSASPermissions = /** @class */ (function () { * @memberof AccountSASPermissions */ this.process = false; + /** + * Specfies Tag access granted. + * + * @type {boolean} + * @memberof AccountSASPermissions + */ + this.tag = false; + /** + * Permission to filter blobs. + * + * @type {boolean} + * @memberof AccountSASPermissions + */ + this.filter = false; } /** * Parse initializes the AccountSASPermissions fields from a string. @@ -29933,6 +34565,9 @@ var AccountSASPermissions = /** @class */ (function () { case "d": accountSASPermissions.delete = true; break; + case "x": + accountSASPermissions.deleteVersion = true; + break; case "l": accountSASPermissions.list = true; break; @@ -29948,6 +34583,12 @@ var AccountSASPermissions = /** @class */ (function () { case "p": accountSASPermissions.process = true; break; + case "t": + accountSASPermissions.tag = true; + break; + case "f": + accountSASPermissions.filter = true; + break; default: throw new RangeError("Invalid permission character: " + c); } @@ -29980,6 +34621,15 @@ var AccountSASPermissions = /** @class */ (function () { if (this.delete) { permissions.push("d"); } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.filter) { + permissions.push("f"); + } + if (this.tag) { + permissions.push("t"); + } if (this.list) { permissions.push("l"); } @@ -30232,52 +34882,61 @@ function ipRangeToString(ipRange) { * @class SASQueryParameters */ var SASQueryParameters = /** @class */ (function () { - /** - * Creates an instance of SASQueryParameters. - * - * @param {string} version Representing the storage version - * @param {string} signature Representing the signature for the SAS token - * @param {string} [permissions] Representing the storage permissions - * @param {string} [services] Representing the storage services being accessed (only for Account SAS) - * @param {string} [resourceTypes] Representing the storage resource types being accessed (only for Account SAS) - * @param {SASProtocol} [protocol] Representing the allowed HTTP protocol(s) - * @param {Date} [startsOn] Representing the start time for this SAS token - * @param {Date} [expiresOn] Representing the expiry time for this SAS token - * @param {SasIPRange} [ipRange] Representing the range of valid IP addresses for this SAS token - * @param {string} [identifier] Representing the signed identifier (only for Service SAS) - * @param {string} [resource] Representing the storage container or blob (only for Service SAS) - * @param {string} [cacheControl] Representing the cache-control header (only for Blob/File Service SAS) - * @param {string} [contentDisposition] Representing the content-disposition header (only for Blob/File Service SAS) - * @param {string} [contentEncoding] Representing the content-encoding header (only for Blob/File Service SAS) - * @param {string} [contentLanguage] Representing the content-language header (only for Blob/File Service SAS) - * @param {string} [contentType] Representing the content-type header (only for Blob/File Service SAS) - * @param {userDelegationKey} [userDelegationKey] Representing the user delegation key properties - * @memberof SASQueryParameters - */ - function SASQueryParameters(version, signature, permissions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey) { + function SASQueryParameters(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId) { this.version = version; - this.services = services; - this.resourceTypes = resourceTypes; - this.expiresOn = expiresOn; - this.permissions = permissions; - this.protocol = protocol; - this.startsOn = startsOn; - this.ipRangeInner = ipRange; - this.identifier = identifier; - this.resource = resource; this.signature = signature; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.contentEncoding = contentEncoding; - this.contentLanguage = contentLanguage; - this.contentType = contentType; - if (userDelegationKey) { - this.signedOid = userDelegationKey.signedObjectId; - this.signedTenentId = userDelegationKey.signedTenantId; - this.signedStartsOn = userDelegationKey.signedStartsOn; - this.signedExpiresOn = userDelegationKey.signedExpiresOn; - this.signedService = userDelegationKey.signedService; - this.signedVersion = userDelegationKey.signedVersion; + if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") { + // SASQueryParametersOptions + this.permissions = permissionsOrOptions.permissions; + this.services = permissionsOrOptions.services; + this.resourceTypes = permissionsOrOptions.resourceTypes; + this.protocol = permissionsOrOptions.protocol; + this.startsOn = permissionsOrOptions.startsOn; + this.expiresOn = permissionsOrOptions.expiresOn; + this.ipRangeInner = permissionsOrOptions.ipRange; + this.identifier = permissionsOrOptions.identifier; + this.resource = permissionsOrOptions.resource; + this.cacheControl = permissionsOrOptions.cacheControl; + this.contentDisposition = permissionsOrOptions.contentDisposition; + this.contentEncoding = permissionsOrOptions.contentEncoding; + this.contentLanguage = permissionsOrOptions.contentLanguage; + this.contentType = permissionsOrOptions.contentType; + if (permissionsOrOptions.userDelegationKey) { + this.signedOid = permissionsOrOptions.userDelegationKey.signedObjectId; + this.signedTenantId = permissionsOrOptions.userDelegationKey.signedTenantId; + this.signedStartsOn = permissionsOrOptions.userDelegationKey.signedStartsOn; + this.signedExpiresOn = permissionsOrOptions.userDelegationKey.signedExpiresOn; + this.signedService = permissionsOrOptions.userDelegationKey.signedService; + this.signedVersion = permissionsOrOptions.userDelegationKey.signedVersion; + this.preauthorizedAgentObjectId = permissionsOrOptions.preauthorizedAgentObjectId; + this.correlationId = permissionsOrOptions.correlationId; + } + } + else { + this.services = services; + this.resourceTypes = resourceTypes; + this.expiresOn = expiresOn; + this.permissions = permissionsOrOptions; + this.protocol = protocol; + this.startsOn = startsOn; + this.ipRangeInner = ipRange; + this.identifier = identifier; + this.resource = resource; + this.cacheControl = cacheControl; + this.contentDisposition = contentDisposition; + this.contentEncoding = contentEncoding; + this.contentLanguage = contentLanguage; + this.contentType = contentType; + if (userDelegationKey) { + this.signedOid = userDelegationKey.signedObjectId; + this.signedTenantId = userDelegationKey.signedTenantId; + this.signedStartsOn = userDelegationKey.signedStartsOn; + this.signedExpiresOn = userDelegationKey.signedExpiresOn; + this.signedService = userDelegationKey.signedService; + this.signedVersion = userDelegationKey.signedVersion; + this.preauthorizedAgentObjectId = preauthorizedAgentObjectId; + this.correlationId = correlationId; + } } } Object.defineProperty(SASQueryParameters.prototype, "ipRange", { @@ -30297,7 +34956,7 @@ var SASQueryParameters = /** @class */ (function () { } return undefined; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -30329,7 +34988,9 @@ var SASQueryParameters = /** @class */ (function () { "rscd", "rsce", "rscl", - "rsct" + "rsct", + "saoid", + "scid" ]; var queries = []; for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { @@ -30363,7 +35024,7 @@ var SASQueryParameters = /** @class */ (function () { this.tryAppendQueryParameter(queries, param, this.signedOid); break; case "sktid": // Signed tenant ID - this.tryAppendQueryParameter(queries, param, this.signedTenentId); + this.tryAppendQueryParameter(queries, param, this.signedTenantId); break; case "skt": // Signed key start time this.tryAppendQueryParameter(queries, param, this.signedStartsOn ? truncatedISO8061Date(this.signedStartsOn, false) : undefined); @@ -30401,6 +35062,12 @@ var SASQueryParameters = /** @class */ (function () { case "rsct": this.tryAppendQueryParameter(queries, param, this.contentType); break; + case "saoid": + this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId); + break; + case "scid": + this.tryAppendQueryParameter(queries, param, this.correlationId); + break; } } return queries.join("&"); @@ -30446,6 +35113,21 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC var version = accountSASSignatureValues.version ? accountSASSignatureValues.version : SERVICE_VERSION; + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.tag && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.filter && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when provided 'f' permission."); + } var parsedPermissions = AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString()); var parsedServices = AccountSASServices.parse(accountSASSignatureValues.services).toString(); var parsedResourceTypes = AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString(); @@ -30518,6 +35200,34 @@ var BlobSASPermissions = /** @class */ (function () { * @memberof BlobSASPermissions */ this.delete = false; + /** + * Specifies Delete version access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.deleteVersion = false; + /** + * Specfies Tag access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.tag = false; + /** + * Specifies Move access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.move = false; + /** + * Specifies Execute access granted. + * + * @type {boolean} + * @memberof BlobSASPermissions + */ + this.execute = false; } /** * Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an @@ -30548,6 +35258,18 @@ var BlobSASPermissions = /** @class */ (function () { case "d": blobSASPermissions.delete = true; break; + case "x": + blobSASPermissions.deleteVersion = true; + break; + case "t": + blobSASPermissions.tag = true; + break; + case "m": + blobSASPermissions.move = true; + break; + case "e": + blobSASPermissions.execute = true; + break; default: throw new RangeError("Invalid permission: " + char); } @@ -30578,6 +35300,18 @@ var BlobSASPermissions = /** @class */ (function () { if (this.delete) { permissions.push("d"); } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.tag) { + permissions.push("t"); + } + if (this.move) { + permissions.push("m"); + } + if (this.execute) { + permissions.push("e"); + } return permissions.join(""); }; return BlobSASPermissions; @@ -30632,6 +35366,13 @@ var ContainerSASPermissions = /** @class */ (function () { * @memberof ContainerSASPermissions */ this.delete = false; + /** + * Specifies Delete version access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.deleteVersion = false; /** * Specifies List access granted. * @@ -30639,6 +35380,27 @@ var ContainerSASPermissions = /** @class */ (function () { * @memberof ContainerSASPermissions */ this.list = false; + /** + * Specfies Tag access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.tag = false; + /** + * Specifies Move access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.move = false; + /** + * Specifies Execute access granted. + * + * @type {boolean} + * @memberof ContainerSASPermissions + */ + this.execute = false; } /** * Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an @@ -30672,6 +35434,18 @@ var ContainerSASPermissions = /** @class */ (function () { case "l": containerSASPermissions.list = true; break; + case "t": + containerSASPermissions.tag = true; + break; + case "x": + containerSASPermissions.deleteVersion = true; + break; + case "m": + containerSASPermissions.move = true; + break; + case "e": + containerSASPermissions.execute = true; + break; default: throw new RangeError("Invalid permission " + char); } @@ -30705,9 +35479,21 @@ var ContainerSASPermissions = /** @class */ (function () { if (this.delete) { permissions.push("d"); } + if (this.deleteVersion) { + permissions.push("x"); + } if (this.list) { permissions.push("l"); } + if (this.tag) { + permissions.push("t"); + } + if (this.move) { + permissions.push("m"); + } + if (this.execute) { + permissions.push("e"); + } return permissions.join(""); }; return ContainerSASPermissions; @@ -30763,6 +35549,7 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent if (sharedKeyCredential === undefined && userDelegationKeyCredential === undefined) { throw TypeError("Invalid sharedKeyCredential, userDelegationKey or accountName."); } + // Version 2019-12-12 adds support for the blob tags permission. // Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields. // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string if (version >= "2018-11-09") { @@ -30770,7 +35557,13 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential); } else { - return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential); + // Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId. + if (version >= "2020-02-10") { + return generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential); + } + else { + return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential); + } } } if (version >= "2015-04-05") { @@ -30801,20 +35594,18 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent * @returns {SASQueryParameters} */ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); if (!blobSASSignatureValues.identifier && - !blobSASSignatureValues.permissions && !blobSASSignatureValues.expiresOn) { + !blobSASSignatureValues.permissions && + !blobSASSignatureValues.expiresOn) { throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; var resource = "c"; - var verifiedPermissions; - if (blobSASSignatureValues.snapshotTime) { - throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'."); - } if (blobSASSignatureValues.blobName) { resource = "b"; } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + var verifiedPermissions; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); @@ -30836,7 +35627,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe blobSASSignatureValues.identifier, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", @@ -30844,7 +35635,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "" ].join("\n"); var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); } /** * ONLY AVAILABLE IN NODE.JS RUNTIME. @@ -30864,23 +35655,26 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe * @returns {SASQueryParameters} */ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); if (!blobSASSignatureValues.identifier && - !blobSASSignatureValues.permissions && !blobSASSignatureValues.expiresOn) { + !blobSASSignatureValues.permissions && + !blobSASSignatureValues.expiresOn) { throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; var resource = "c"; - var verifiedPermissions; - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); - } + var timestamp = blobSASSignatureValues.snapshotTime; if (blobSASSignatureValues.blobName) { resource = "b"; if (blobSASSignatureValues.snapshotTime) { resource = "bs"; } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + var verifiedPermissions; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); @@ -30902,9 +35696,9 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe blobSASSignatureValues.identifier, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, resource, - blobSASSignatureValues.snapshotTime, + timestamp, blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", @@ -30912,7 +35706,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "" ].join("\n"); var signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType); } /** * ONLY AVAILABLE IN NODE.JS RUNTIME. @@ -30921,7 +35715,7 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe * Creates an instance of SASQueryParameters. * * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. + * set corresponding properties directly, such as permissions, startsOn. * * WARNING: identifier will be ignored, permissions and expiresOn are required. * @@ -30930,22 +35724,102 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe * @returns {SASQueryParameters} */ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); } - var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; var resource = "c"; + var timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } + } + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. var verifiedPermissions; - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } + else { + verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } } + // Signature is generated on the un-url-encoded values. + var stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? truncatedISO8061Date(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType + ].join("\n"); + var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey); +} +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-02-10. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param {BlobSASSignatureValues} blobSASSignatureValues + * @param {UserDelegationKeyCredential} userDelegationKeyCredential + * @returns {SASQueryParameters} + */ +function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); + } + var resource = "c"; + var timestamp = blobSASSignatureValues.snapshotTime; if (blobSASSignatureValues.blobName) { resource = "b"; if (blobSASSignatureValues.snapshotTime) { resource = "bs"; } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + var verifiedPermissions; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); @@ -30974,11 +35848,14 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD : "", userDelegationKeyCredential.userDelegationKey.signedService, userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.preauthorizedAgentObjectId, + undefined, + blobSASSignatureValues.correlationId, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, resource, - blobSASSignatureValues.snapshotTime, + timestamp, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, @@ -30986,7 +35863,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD blobSASSignatureValues.contentType ].join("\n"); var signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters(version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey); + return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId); } function getCanonicalName(accountName, containerName, blobName) { // Container: "/blob/account/containerName" @@ -30997,6 +35874,42 @@ function getCanonicalName(accountName, containerName, blobName) { } return elements.join(""); } +function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) { + var version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; + if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") { + throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'."); + } + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { + throw RangeError("Must provide 'blobName' when providing 'snapshotTime'."); + } + if (blobSASSignatureValues.versionId && version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'."); + } + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { + throw RangeError("Must provide 'blobName' when providing 'versionId'."); + } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission."); + } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.tag && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission."); + } + if (version < "2020-02-10" && + blobSASSignatureValues.permissions && + (blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) { + throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission."); + } + if (version < "2020-02-10" && + (blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) { + throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'."); + } + blobSASSignatureValues.version = version; + return blobSASSignatureValues; +} Object.defineProperty(exports, 'BaseRequestPolicy', { enumerable: true, @@ -31069,58 +35982,7 @@ exports.newPipeline = newPipeline; /***/ }), -/* 374 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpanKind = void 0; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var SpanKind; -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(SpanKind = exports.SpanKind || (exports.SpanKind = {})); -//# sourceMappingURL=span_kind.js.map - -/***/ }), +/* 374 */, /* 375 */, /* 376 */, /* 377 */, @@ -31134,10 +35996,20 @@ var SpanKind; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const assert = __webpack_require__(357); -const path = __webpack_require__(622); -const pathHelper = __webpack_require__(972); +const path = __importStar(__webpack_require__(622)); +const pathHelper = __importStar(__webpack_require__(972)); +const assert_1 = __importDefault(__webpack_require__(357)); const IS_WINDOWS = process.platform === 'win32'; /** * Helper class for parsing paths into segments @@ -31151,7 +36023,7 @@ class Path { this.segments = []; // String if (typeof itemPath === 'string') { - assert(itemPath, `Parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); // Normalize slashes and trim unnecessary trailing slash itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); // Not rooted @@ -31178,24 +36050,24 @@ class Path { // Array else { // Must not be empty - assert(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); + assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); // Each segment for (let i = 0; i < itemPath.length; i++) { let segment = itemPath[i]; // Must not be empty - assert(segment, `Parameter 'itemPath' must not contain any empty segments`); + assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`); // Normalize slashes segment = pathHelper.normalizeSeparators(itemPath[i]); // Root segment if (i === 0 && pathHelper.hasRoot(segment)) { segment = pathHelper.safeTrimTrailingSeparator(segment); - assert(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); + assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); this.segments.push(segment); } // All other segments else { // Must not contain slash - assert(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); + assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); this.segments.push(segment); } } @@ -31617,30 +36489,7 @@ exports.endpoint = endpoint; /* 388 */, /* 389 */, /* 390 */, -/* 391 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Event.js.map - -/***/ }), +/* 391 */, /* 392 */, /* 393 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -34150,34 +38999,7 @@ module.exports = __webpack_require__(141); module.exports = require("crypto"); /***/ }), -/* 418 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports._globalThis = void 0; -/** only globals that common to node and browsers are allowed */ -// eslint-disable-next-line node/no-unsupported-features/es-builtins -exports._globalThis = typeof globalThis === 'object' ? globalThis : global; -//# sourceMappingURL=globalThis.js.map - -/***/ }), +/* 418 */, /* 419 */, /* 420 */, /* 421 */, @@ -35174,48 +39996,14 @@ exports.createTar = createTar; /* 436 */, /* 437 */, /* 438 */, -/* 439 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.defaultSetter = void 0; -/** - * Default setter which sets value via direct property access - * - * @param carrier - * @param key - */ -function defaultSetter(carrier, key, value) { - carrier[key] = value; -} -exports.defaultSetter = defaultSetter; -//# sourceMappingURL=setter.js.map - -/***/ }), +/* 439 */, /* 440 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35229,35 +40017,67 @@ exports.defaultSetter = defaultSetter; * See the License for the specific language governing permissions and * limitations under the License. */ -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(2)); -__export(__webpack_require__(744)); -__export(__webpack_require__(553)); -__export(__webpack_require__(40)); -__export(__webpack_require__(43)); -__export(__webpack_require__(625)); -__export(__webpack_require__(450)); -__export(__webpack_require__(767)); -__export(__webpack_require__(151)); -__export(__webpack_require__(162)); -__export(__webpack_require__(670)); -__export(__webpack_require__(932)); -__export(__webpack_require__(975)); -var context_base_1 = __webpack_require__(459); -exports.Context = context_base_1.Context; -const context_1 = __webpack_require__(492); +exports.propagation = exports.metrics = exports.trace = exports.context = void 0; +__exportStar(__webpack_require__(276), exports); +__exportStar(__webpack_require__(158), exports); +__exportStar(__webpack_require__(2), exports); +__exportStar(__webpack_require__(33), exports); +__exportStar(__webpack_require__(744), exports); +__exportStar(__webpack_require__(553), exports); +__exportStar(__webpack_require__(278), exports); +__exportStar(__webpack_require__(40), exports); +__exportStar(__webpack_require__(318), exports); +__exportStar(__webpack_require__(551), exports); +__exportStar(__webpack_require__(659), exports); +__exportStar(__webpack_require__(702), exports); +__exportStar(__webpack_require__(43), exports); +__exportStar(__webpack_require__(625), exports); +__exportStar(__webpack_require__(450), exports); +__exportStar(__webpack_require__(107), exports); +__exportStar(__webpack_require__(189), exports); +__exportStar(__webpack_require__(906), exports); +__exportStar(__webpack_require__(727), exports); +__exportStar(__webpack_require__(165), exports); +__exportStar(__webpack_require__(851), exports); +__exportStar(__webpack_require__(95), exports); +__exportStar(__webpack_require__(767), exports); +__exportStar(__webpack_require__(151), exports); +__exportStar(__webpack_require__(162), exports); +__exportStar(__webpack_require__(781), exports); +__exportStar(__webpack_require__(340), exports); +__exportStar(__webpack_require__(607), exports); +__exportStar(__webpack_require__(670), exports); +__exportStar(__webpack_require__(586), exports); +__exportStar(__webpack_require__(220), exports); +__exportStar(__webpack_require__(932), exports); +__exportStar(__webpack_require__(839), exports); +__exportStar(__webpack_require__(975), exports); +__exportStar(__webpack_require__(70), exports); +__exportStar(__webpack_require__(694), exports); +__exportStar(__webpack_require__(695), exports); +var context_base_1 = __webpack_require__(231); +Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_base_1.Context; } }); +var context_1 = __webpack_require__(492); /** Entrypoint for context API */ exports.context = context_1.ContextAPI.getInstance(); -const trace_1 = __webpack_require__(875); +var trace_1 = __webpack_require__(875); /** Entrypoint for trace API */ exports.trace = trace_1.TraceAPI.getInstance(); -const metrics_1 = __webpack_require__(136); +var metrics_1 = __webpack_require__(136); /** Entrypoint for metrics API */ exports.metrics = metrics_1.MetricsAPI.getInstance(); -const propagation_1 = __webpack_require__(22); +var propagation_1 = __webpack_require__(21); /** Entrypoint for propagation API */ exports.propagation = propagation_1.PropagationAPI.getInstance(); exports.default = { @@ -35298,7 +40118,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setCacheState = exports.isExactKeyMatch = void 0; const core = __importStar(__webpack_require__(470)); -const constants_1 = __webpack_require__(694); +const constants_1 = __webpack_require__(196); function isExactKeyMatch(key, cacheKey) { return !!(cacheKey && cacheKey.localeCompare(key, undefined, { @@ -35334,30 +40154,7 @@ exports.isValidEvent = isValidEvent; /***/ }), /* 444 */, -/* 445 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=link_context.js.map - -/***/ }), +/* 445 */, /* 446 */, /* 447 */, /* 448 */ @@ -35549,8 +40346,8 @@ exports.Octokit = Octokit; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35565,16 +40362,20 @@ exports.Octokit = Octokit; * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopMeter_1 = __webpack_require__(625); +exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0; +var NoopMeter_1 = __webpack_require__(625); /** * An implementation of the {@link MeterProvider} which returns an impotent Meter * for all calls to `getMeter` */ -class NoopMeterProvider { - getMeter(_name, _version) { - return NoopMeter_1.NOOP_METER; +var NoopMeterProvider = /** @class */ (function () { + function NoopMeterProvider() { } -} + NoopMeterProvider.prototype.getMeter = function (_name, _version) { + return NoopMeter_1.NOOP_METER; + }; + return NoopMeterProvider; +}()); exports.NoopMeterProvider = NoopMeterProvider; exports.NOOP_METER_PROVIDER = new NoopMeterProvider(); //# sourceMappingURL=NoopMeterProvider.js.map @@ -37304,30 +42105,7 @@ exports.FetchError = FetchError; /***/ }), /* 455 */, /* 456 */, -/* 457 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=TimedEvent.js.map - -/***/ }), +/* 457 */, /* 458 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -37510,35 +42288,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); /***/ }), -/* 459 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(560)); -__export(__webpack_require__(53)); -//# sourceMappingURL=index.js.map - -/***/ }), +/* 459 */, /* 460 */ /***/ (function(module) { @@ -38047,47 +42797,7 @@ exports.getState = getState; /* 481 */, /* 482 */, /* 483 */, -/* 484 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_HTTP_TEXT_PROPAGATOR = exports.NoopHttpTextPropagator = void 0; -/** - * No-op implementations of {@link HttpTextPropagator}. - */ -var NoopHttpTextPropagator = /** @class */ (function () { - function NoopHttpTextPropagator() { - } - /** Noop inject function does nothing */ - NoopHttpTextPropagator.prototype.inject = function (context, carrier, setter) { }; - /** Noop extract function does nothing and returns the input context */ - NoopHttpTextPropagator.prototype.extract = function (context, carrier, getter) { - return context; - }; - return NoopHttpTextPropagator; -}()); -exports.NoopHttpTextPropagator = NoopHttpTextPropagator; -exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); -//# sourceMappingURL=NoopHttpTextPropagator.js.map - -/***/ }), +/* 484 */, /* 485 */, /* 486 */, /* 487 */, @@ -38154,8 +42864,8 @@ exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38170,83 +42880,76 @@ exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const context_base_1 = __webpack_require__(459); +exports.ContextAPI = void 0; +var context_base_1 = __webpack_require__(231); +var global_utils_1 = __webpack_require__(976); +var NOOP_CONTEXT_MANAGER = new context_base_1.NoopContextManager(); /** * Singleton object which represents the entry point to the OpenTelemetry Context API */ -class ContextAPI { +var ContextAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._contextManager = new context_base_1.NoopContextManager(); + function ContextAPI() { } /** Get the singleton instance of the Context API */ - static getInstance() { + ContextAPI.getInstance = function () { if (!this._instance) { this._instance = new ContextAPI(); } return this._instance; - } + }; /** * Set the current context manager. Returns the initialized context manager */ - setGlobalContextManager(contextManager) { - this._contextManager = contextManager; + ContextAPI.prototype.setGlobalContextManager = function (contextManager) { + if (global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) { + // global context manager has already been set + return this._getContextManager(); + } + global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, contextManager, NOOP_CONTEXT_MANAGER); return contextManager; - } + }; /** * Get the currently active context */ - active() { - return this._contextManager.active(); - } + ContextAPI.prototype.active = function () { + return this._getContextManager().active(); + }; /** * Execute a function with an active context * * @param context context to be active during function execution * @param fn function to execute in a context */ - with(context, fn) { - return this._contextManager.with(context, fn); - } + ContextAPI.prototype.with = function (context, fn) { + return this._getContextManager().with(context, fn); + }; /** * Bind a context to a target function or event emitter * * @param target function or event emitter to bind * @param context context to bind to the event emitter or function. Defaults to the currently active context */ - bind(target, context = this.active()) { - return this._contextManager.bind(target, context); - } -} + ContextAPI.prototype.bind = function (target, context) { + if (context === void 0) { context = this.active(); } + return this._getContextManager().bind(target, context); + }; + ContextAPI.prototype._getContextManager = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NOOP_CONTEXT_MANAGER); + }; + /** Disable and remove the global context manager */ + ContextAPI.prototype.disable = function () { + this._getContextManager().disable(); + delete global_utils_1._global[global_utils_1.GLOBAL_CONTEXT_MANAGER_API_KEY]; + }; + return ContextAPI; +}()); exports.ContextAPI = ContextAPI; //# sourceMappingURL=context.js.map /***/ }), -/* 493 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EntryTtl = void 0; -/** - * EntryTtl is an integer that represents number of hops an entry can propagate. - * - * For now, ONLY special values (0 and -1) are supported. - */ -var EntryTtl; -(function (EntryTtl) { - /** - * NO_PROPAGATION is considered to have local context and is used within the - * process it created. - */ - EntryTtl[EntryTtl["NO_PROPAGATION"] = 0] = "NO_PROPAGATION"; - /** UNLIMITED_PROPAGATION can propagate unlimited hops. */ - EntryTtl[EntryTtl["UNLIMITED_PROPAGATION"] = -1] = "UNLIMITED_PROPAGATION"; -})(EntryTtl = exports.EntryTtl || (exports.EntryTtl = {})); -//# sourceMappingURL=EntryValue.js.map - -/***/ }), +/* 493 */, /* 494 */, /* 495 */, /* 496 */, @@ -38359,21 +43062,6 @@ module.exports = {"application/1d-interleaved-parityfec":{"source":"iana"},"appl "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); @@ -38381,12 +43069,115 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi if (k2 === undefined) k2 = k; o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(__webpack_require__(418), exports); -//# sourceMappingURL=index.js.map +exports.addBinToPath = exports.run = void 0; +const core = __importStar(__webpack_require__(470)); +const io = __importStar(__webpack_require__(1)); +const installer = __importStar(__webpack_require__(634)); +const path_1 = __importDefault(__webpack_require__(622)); +const child_process_1 = __importDefault(__webpack_require__(129)); +const fs_1 = __importDefault(__webpack_require__(747)); +const url_1 = __webpack_require__(835); +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + // + // versionSpec is optional. If supplied, install / use from the tool cache + // If not supplied then problem matchers will still be setup. Useful for self-hosted. + // + let versionSpec = core.getInput('go-version'); + // stable will be true unless false is the exact input + // since getting unstable versions should be explicit + let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE'; + core.info(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`); + if (versionSpec) { + let token = core.getInput('token'); + let auth = !token || isGhes() ? undefined : `token ${token}`; + const installDir = yield installer.getGo(versionSpec, stable, auth); + core.exportVariable('GOROOT', installDir); + core.addPath(path_1.default.join(installDir, 'bin')); + core.info('Added go to the path'); + let added = yield addBinToPath(); + core.debug(`add bin ${added}`); + core.info(`Successfully setup go version ${versionSpec}`); + } + // add problem matchers + const matchersPath = path_1.default.join(__dirname, '..', 'matchers.json'); + core.info(`##[add-matcher]${matchersPath}`); + // output the version actually being used + let goPath = yield io.which('go'); + let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); + core.info(goVersion); + core.startGroup('go env'); + let goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString(); + core.info(goEnv); + core.endGroup(); + } + catch (error) { + core.setFailed(error.message); + } + }); +} +exports.run = run; +function addBinToPath() { + return __awaiter(this, void 0, void 0, function* () { + let added = false; + let g = yield io.which('go'); + core.debug(`which go :${g}:`); + if (!g) { + core.debug('go not in the path'); + return added; + } + let buf = child_process_1.default.execSync('go env GOPATH'); + if (buf) { + let gp = buf.toString().trim(); + core.debug(`go env GOPATH :${gp}:`); + if (!fs_1.default.existsSync(gp)) { + // some of the hosted images have go install but not profile dir + core.debug(`creating ${gp}`); + io.mkdirP(gp); + } + let bp = path_1.default.join(gp, 'bin'); + if (!fs_1.default.existsSync(bp)) { + core.debug(`creating ${bp}`); + io.mkdirP(bp); + } + core.addPath(bp); + added = true; + } + return added; + }); +} +exports.addBinToPath = addBinToPath; +function isGhes() { + const ghUrl = new url_1.URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); + return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; +} + /***/ }), /* 515 */ @@ -40095,15 +44886,38 @@ CombinedStream.prototype._emitError = function(err) { /* 548 */, /* 549 */, /* 550 */, -/* 551 */, +/* 551 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=BoundInstrument.js.map + +/***/ }), /* 552 */, /* 553 */ /***/ (function(__unusedmodule, exports) { "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40118,6 +44932,7 @@ CombinedStream.prototype._emitError = function(err) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultSetter = void 0; /** * Default setter which sets value via direct property access * @@ -40417,90 +45232,7 @@ exports.defaultSetter = defaultSetter; /***/ }), -/* 560 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/*! - * Copyright 2020, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Class which stores and manages current context values. All methods which - * update context such as get and delete do not modify an existing context, - * but create a new one with updated values. - */ -class Context { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - constructor(parentContext) { - this._currentContext = parentContext ? new Map(parentContext) : new Map(); - } - /** Get a key to uniquely identify a context value */ - static createKey(description) { - return Symbol(description); - } - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - getValue(key) { - return this._currentContext.get(key); - } - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - setValue(key, value) { - const context = new Context(this._currentContext); - context._currentContext.set(key, value); - return context; - } - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - deleteValue(key) { - const context = new Context(this._currentContext); - context._currentContext.delete(key); - return context; - } -} -exports.Context = Context; -/** The root context is used as the default parent context when there is no active context */ -Context.ROOT_CONTEXT = new Context(); -/** - * This is another identifier to the root context which allows developers to easily search the - * codebase for direct uses of context which need to be removed in later PRs. - * - * It's existence is temporary and it should be removed when all references are fixed. - */ -Context.TODO = Context.ROOT_CONTEXT; -//# sourceMappingURL=context.js.map - -/***/ }), +/* 560 */, /* 561 */, /* 562 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -40547,15 +45279,7 @@ exports.getPublicSuffix = getPublicSuffix; /***/ }), -/* 563 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=attributes.js.map - -/***/ }), +/* 563 */, /* 564 */, /* 565 */, /* 566 */ @@ -40607,43 +45331,7 @@ function clean(key) /* 578 */, /* 579 */, /* 580 */, -/* 581 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(__webpack_require__(47), exports); -__exportStar(__webpack_require__(966), exports); -__exportStar(__webpack_require__(267), exports); -//# sourceMappingURL=index.js.map - -/***/ }), +/* 581 */, /* 582 */ /***/ (function(module) { @@ -40821,7 +45509,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de /***/ }), /* 586 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -40841,114 +45529,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceAPI = void 0; -var NoopTracerProvider_1 = __webpack_require__(222); -var global_utils_1 = __webpack_require__(591); -/** - * Singleton object which represents the entry point to the OpenTelemetry Tracing API - */ -var TraceAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function TraceAPI() { - } - /** Get the singleton instance of the Trace API */ - TraceAPI.getInstance = function () { - if (!this._instance) { - this._instance = new TraceAPI(); - } - return this._instance; - }; - /** - * Set the current global tracer. Returns the initialized global tracer provider - */ - TraceAPI.prototype.setGlobalTracerProvider = function (provider) { - if (global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) { - // global tracer provider has already been set - return this.getTracerProvider(); - } - global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopTracerProvider_1.NOOP_TRACER_PROVIDER); - return this.getTracerProvider(); - }; - /** - * Returns the global tracer provider. - */ - TraceAPI.prototype.getTracerProvider = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopTracerProvider_1.NOOP_TRACER_PROVIDER); - }; - /** - * Returns a tracer from the global tracer provider. - */ - TraceAPI.prototype.getTracer = function (name, version) { - return this.getTracerProvider().getTracer(name, version); - }; - /** Remove the global tracer provider */ - TraceAPI.prototype.disable = function () { - delete global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]; - }; - return TraceAPI; -}()); -exports.TraceAPI = TraceAPI; -//# sourceMappingURL=trace.js.map +//# sourceMappingURL=span.js.map /***/ }), /* 587 */, /* 588 */, /* 589 */, /* 590 */, -/* 591 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_TRACE_API_KEY = exports.GLOBAL_PROPAGATION_API_KEY = exports.GLOBAL_METRICS_API_KEY = exports.GLOBAL_CONTEXT_MANAGER_API_KEY = void 0; -var platform_1 = __webpack_require__(165); -exports.GLOBAL_CONTEXT_MANAGER_API_KEY = Symbol.for('io.opentelemetry.js.api.context'); -exports.GLOBAL_METRICS_API_KEY = Symbol.for('io.opentelemetry.js.api.metrics'); -exports.GLOBAL_PROPAGATION_API_KEY = Symbol.for('io.opentelemetry.js.api.propagation'); -exports.GLOBAL_TRACE_API_KEY = Symbol.for('io.opentelemetry.js.api.trace'); -exports._global = platform_1._globalThis; -/** - * Make a function which accepts a version integer and returns the instance of an API if the version - * is compatible, or a fallback version (usually NOOP) if it is not. - * - * @param requiredVersion Backwards compatibility version which is required to return the instance - * @param instance Instance which should be returned if the required version is compatible - * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible - */ -function makeGetter(requiredVersion, instance, fallback) { - return function (version) { - return version === requiredVersion ? instance : fallback; - }; -} -exports.makeGetter = makeGetter; -/** - * A number which should be incremented each time a backwards incompatible - * change is made to the API. This number is used when an API package - * attempts to access the global API to ensure it is getting a compatible - * version. If the global API is not compatible with the API package - * attempting to get it, a NOOP API implementation will be returned. - */ -exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0; -//# sourceMappingURL=global-utils.js.map - -/***/ }), +/* 591 */, /* 592 */, /* 593 */, /* 594 */, @@ -40959,8 +45547,15 @@ exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const pathHelper = __webpack_require__(972); +const pathHelper = __importStar(__webpack_require__(972)); const internal_match_kind_1 = __webpack_require__(327); const IS_WINDOWS = process.platform === 'win32'; /** @@ -41042,8 +45637,15 @@ exports.partialMatch = partialMatch; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const core = __webpack_require__(470); +const core = __importStar(__webpack_require__(470)); /** * Returns a copy with defaults filled in. */ @@ -41338,7 +45940,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _rng = _interopRequireDefault(__webpack_require__(733)); +var _rng = _interopRequireDefault(__webpack_require__(944)); var _stringify = _interopRequireDefault(__webpack_require__(855)); @@ -41370,7 +45972,30 @@ var _default = v4; exports.default = _default; /***/ }), -/* 607 */, +/* 607 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=span_context.js.map + +/***/ }), /* 608 */, /* 609 */, /* 610 */, @@ -41419,23 +46044,63 @@ exports.default = _default; "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer.js.map +function getProxyUrl(reqUrl) { + let usingSsl = reqUrl.protocol === 'https:'; + let proxyUrl; + if (checkBypass(reqUrl)) { + return proxyUrl; + } + let proxyVar; + if (usingSsl) { + proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; + } + else { + proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; + } + if (proxyVar) { + proxyUrl = new URL(proxyVar); + } + return proxyUrl; +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + let upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (let upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; + /***/ }), /* 619 */, @@ -41519,8 +46184,8 @@ module.exports = require("path"); "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41534,41 +46199,74 @@ module.exports = require("path"); * See the License for the specific language governing permissions and * limitations under the License. */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + 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 extendStatics(d, b); + }; + 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 }); +exports.NOOP_BATCH_OBSERVER_METRIC = exports.NOOP_SUM_OBSERVER_METRIC = exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = exports.NOOP_VALUE_OBSERVER_METRIC = exports.NOOP_BOUND_BASE_OBSERVER = exports.NOOP_VALUE_RECORDER_METRIC = exports.NOOP_BOUND_VALUE_RECORDER = exports.NOOP_COUNTER_METRIC = exports.NOOP_BOUND_COUNTER = exports.NOOP_METER = exports.NoopBoundBaseObserver = exports.NoopBoundValueRecorder = exports.NoopBoundCounter = exports.NoopBatchObserverMetric = exports.NoopBaseObserverMetric = exports.NoopValueRecorderMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0; /** * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses * constant NoopMetrics for all of its methods. */ -class NoopMeter { - constructor() { } +var NoopMeter = /** @class */ (function () { + function NoopMeter() { + } /** - * Returns constant noop measure. + * Returns constant noop value recorder. * @param name the name of the metric. * @param [options] the metric options. */ - createMeasure(name, options) { - return exports.NOOP_MEASURE_METRIC; - } + NoopMeter.prototype.createValueRecorder = function (name, options) { + return exports.NOOP_VALUE_RECORDER_METRIC; + }; /** * Returns a constant noop counter. * @param name the name of the metric. * @param [options] the metric options. */ - createCounter(name, options) { + NoopMeter.prototype.createCounter = function (name, options) { return exports.NOOP_COUNTER_METRIC; - } + }; /** - * Returns constant noop observer. + * Returns a constant noop UpDownCounter. * @param name the name of the metric. * @param [options] the metric options. */ - createObserver(name, options) { - return exports.NOOP_OBSERVER_METRIC; - } -} + NoopMeter.prototype.createUpDownCounter = function (name, options) { + return exports.NOOP_COUNTER_METRIC; + }; + /** + * Returns constant noop value observer. + * @param name the name of the metric. + * @param [options] the metric options. + * @param [callback] the value observer callback + */ + NoopMeter.prototype.createValueObserver = function (name, options, callback) { + return exports.NOOP_VALUE_OBSERVER_METRIC; + }; + /** + * Returns constant noop batch observer. + * @param name the name of the metric. + * @param callback the batch observer callback + */ + NoopMeter.prototype.createBatchObserver = function (name, callback) { + return exports.NOOP_BATCH_OBSERVER_METRIC; + }; + return NoopMeter; +}()); exports.NoopMeter = NoopMeter; -class NoopMetric { - constructor(instrument) { +var NoopMetric = /** @class */ (function () { + function NoopMetric(instrument) { this._instrument = instrument; } /** @@ -41578,32 +46276,42 @@ class NoopMetric { * @param labels key-values pairs that are associated with a specific metric * that you want to record. */ - bind(labels) { + NoopMetric.prototype.bind = function (labels) { return this._instrument; - } + }; /** * Removes the Binding from the metric, if it is present. * @param labels key-values pairs that are associated with a specific metric. */ - unbind(labels) { + NoopMetric.prototype.unbind = function (labels) { return; - } + }; /** * Clears all timeseries from the Metric. */ - clear() { + NoopMetric.prototype.clear = function () { return; - } -} + }; + return NoopMetric; +}()); exports.NoopMetric = NoopMetric; -class NoopCounterMetric extends NoopMetric { - add(value, labels) { - this.bind(labels).add(value); +var NoopCounterMetric = /** @class */ (function (_super) { + __extends(NoopCounterMetric, _super); + function NoopCounterMetric() { + return _super !== null && _super.apply(this, arguments) || this; } -} + NoopCounterMetric.prototype.add = function (value, labels) { + this.bind(labels).add(value); + }; + return NoopCounterMetric; +}(NoopMetric)); exports.NoopCounterMetric = NoopCounterMetric; -class NoopMeasureMetric extends NoopMetric { - record(value, labels, correlationContext, spanContext) { +var NoopValueRecorderMetric = /** @class */ (function (_super) { + __extends(NoopValueRecorderMetric, _super); + function NoopValueRecorderMetric() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoopValueRecorderMetric.prototype.record = function (value, labels, correlationContext, spanContext) { if (typeof correlationContext === 'undefined') { this.bind(labels).record(value); } @@ -41613,36 +46321,67 @@ class NoopMeasureMetric extends NoopMetric { else { this.bind(labels).record(value, correlationContext, spanContext); } + }; + return NoopValueRecorderMetric; +}(NoopMetric)); +exports.NoopValueRecorderMetric = NoopValueRecorderMetric; +var NoopBaseObserverMetric = /** @class */ (function (_super) { + __extends(NoopBaseObserverMetric, _super); + function NoopBaseObserverMetric() { + return _super !== null && _super.apply(this, arguments) || this; } -} -exports.NoopMeasureMetric = NoopMeasureMetric; -class NoopObserverMetric extends NoopMetric { - setCallback(callback) { } -} -exports.NoopObserverMetric = NoopObserverMetric; -class NoopBoundCounter { - add(value) { - return; + NoopBaseObserverMetric.prototype.observation = function () { + return { + observer: this, + value: 0, + }; + }; + return NoopBaseObserverMetric; +}(NoopMetric)); +exports.NoopBaseObserverMetric = NoopBaseObserverMetric; +var NoopBatchObserverMetric = /** @class */ (function (_super) { + __extends(NoopBatchObserverMetric, _super); + function NoopBatchObserverMetric() { + return _super !== null && _super.apply(this, arguments) || this; } -} + return NoopBatchObserverMetric; +}(NoopMetric)); +exports.NoopBatchObserverMetric = NoopBatchObserverMetric; +var NoopBoundCounter = /** @class */ (function () { + function NoopBoundCounter() { + } + NoopBoundCounter.prototype.add = function (value) { + return; + }; + return NoopBoundCounter; +}()); exports.NoopBoundCounter = NoopBoundCounter; -class NoopBoundMeasure { - record(value, correlationContext, spanContext) { +var NoopBoundValueRecorder = /** @class */ (function () { + function NoopBoundValueRecorder() { + } + NoopBoundValueRecorder.prototype.record = function (value, correlationContext, spanContext) { return; + }; + return NoopBoundValueRecorder; +}()); +exports.NoopBoundValueRecorder = NoopBoundValueRecorder; +var NoopBoundBaseObserver = /** @class */ (function () { + function NoopBoundBaseObserver() { } -} -exports.NoopBoundMeasure = NoopBoundMeasure; -class NoopBoundObserver { - setCallback(callback) { } -} -exports.NoopBoundObserver = NoopBoundObserver; + NoopBoundBaseObserver.prototype.update = function (value) { }; + return NoopBoundBaseObserver; +}()); +exports.NoopBoundBaseObserver = NoopBoundBaseObserver; exports.NOOP_METER = new NoopMeter(); exports.NOOP_BOUND_COUNTER = new NoopBoundCounter(); exports.NOOP_COUNTER_METRIC = new NoopCounterMetric(exports.NOOP_BOUND_COUNTER); -exports.NOOP_BOUND_MEASURE = new NoopBoundMeasure(); -exports.NOOP_MEASURE_METRIC = new NoopMeasureMetric(exports.NOOP_BOUND_MEASURE); -exports.NOOP_BOUND_OBSERVER = new NoopBoundObserver(); -exports.NOOP_OBSERVER_METRIC = new NoopObserverMetric(exports.NOOP_BOUND_OBSERVER); +exports.NOOP_BOUND_VALUE_RECORDER = new NoopBoundValueRecorder(); +exports.NOOP_VALUE_RECORDER_METRIC = new NoopValueRecorderMetric(exports.NOOP_BOUND_VALUE_RECORDER); +exports.NOOP_BOUND_BASE_OBSERVER = new NoopBoundBaseObserver(); +exports.NOOP_VALUE_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); +exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); +exports.NOOP_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); +exports.NOOP_BATCH_OBSERVER_METRIC = new NoopBatchObserverMetric(); //# sourceMappingURL=NoopMeter.js.map /***/ }), @@ -43761,129 +48500,7 @@ exports.getArch = getArch; /***/ }), -/* 647 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - 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) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.addBinToPath = exports.run = void 0; -const core = __importStar(__webpack_require__(470)); -const io = __importStar(__webpack_require__(1)); -const installer = __importStar(__webpack_require__(634)); -const path_1 = __importDefault(__webpack_require__(622)); -const child_process_1 = __importDefault(__webpack_require__(129)); -const fs_1 = __importDefault(__webpack_require__(747)); -const url_1 = __webpack_require__(835); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - // - // versionSpec is optional. If supplied, install / use from the tool cache - // If not supplied then problem matchers will still be setup. Useful for self-hosted. - // - let versionSpec = core.getInput('go-version'); - // stable will be true unless false is the exact input - // since getting unstable versions should be explicit - let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE'; - core.info(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`); - if (versionSpec) { - let token = core.getInput('token'); - let auth = !token || isGhes() ? undefined : `token ${token}`; - const installDir = yield installer.getGo(versionSpec, stable, auth); - core.exportVariable('GOROOT', installDir); - core.addPath(path_1.default.join(installDir, 'bin')); - core.info('Added go to the path'); - let added = yield addBinToPath(); - core.debug(`add bin ${added}`); - core.info(`Successfully setup go version ${versionSpec}`); - } - // add problem matchers - const matchersPath = path_1.default.join(__dirname, '..', 'matchers.json'); - core.info(`##[add-matcher]${matchersPath}`); - // output the version actually being used - let goPath = yield io.which('go'); - let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); - core.info(goVersion); - core.startGroup('go env'); - let goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString(); - core.info(goEnv); - core.endGroup(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.run = run; -function addBinToPath() { - return __awaiter(this, void 0, void 0, function* () { - let added = false; - let g = yield io.which('go'); - core.debug(`which go :${g}:`); - if (!g) { - core.debug('go not in the path'); - return added; - } - let buf = child_process_1.default.execSync('go env GOPATH'); - if (buf) { - let gp = buf.toString().trim(); - core.debug(`go env GOPATH :${gp}:`); - if (!fs_1.default.existsSync(gp)) { - // some of the hosted images have go install but not profile dir - core.debug(`creating ${gp}`); - io.mkdirP(gp); - } - let bp = path_1.default.join(gp, 'bin'); - if (!fs_1.default.existsSync(bp)) { - core.debug(`creating ${bp}`); - io.mkdirP(bp); - } - core.addPath(bp); - added = true; - } - return added; - }); -} -exports.addBinToPath = addBinToPath; -function isGhes() { - const ghUrl = new url_1.URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); - return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; -} - - -/***/ }), +/* 647 */, /* 648 */, /* 649 */, /* 650 */, @@ -43933,7 +48550,7 @@ const core = __importStar(__webpack_require__(470)); const tc = __importStar(__webpack_require__(533)); const os_1 = __importDefault(__webpack_require__(87)); const path_1 = __importDefault(__webpack_require__(622)); -const main_1 = __webpack_require__(647); +const main_1 = __webpack_require__(514); const downloadURL = "https://github.com/golangci/golangci-lint/releases/download"; const getAssetURL = (versionConfig) => { let ext = "tar.gz"; @@ -44038,7 +48655,30 @@ exports.installGo = installGo; /***/ }), /* 658 */, -/* 659 */, +/* 659 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Meter.js.map + +/***/ }), /* 660 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -44201,8 +48841,10 @@ module.exports = require("util"); "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SpanKind = void 0; +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44216,11 +48858,6 @@ module.exports = require("util"); * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Type of span. Can be used to specify additional relationships between spans - * in addition to a parent/child relationship. - */ var SpanKind; (function (SpanKind) { /** Default value. Indicates that the span is used internally. */ @@ -44453,30 +49090,7 @@ function isUnixExecutable(stats) { //# sourceMappingURL=io-util.js.map /***/ }), -/* 673 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Plugin.js.map - -/***/ }), +/* 673 */, /* 674 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -44677,30 +49291,49 @@ exports.Deprecation = Deprecation; "use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.RefKey = exports.Events = exports.State = exports.Inputs = void 0; -var Inputs; -(function (Inputs) { - Inputs["Key"] = "key"; - Inputs["Path"] = "path"; - Inputs["RestoreKeys"] = "restore-keys"; -})(Inputs = exports.Inputs || (exports.Inputs = {})); -var State; -(function (State) { - State["CachePrimaryKey"] = "CACHE_KEY"; - State["CacheMatchedKey"] = "CACHE_RESULT"; -})(State = exports.State || (exports.State = {})); -var Events; -(function (Events) { - Events["Key"] = "GITHUB_EVENT_NAME"; - Events["Push"] = "push"; - Events["PullRequest"] = "pull_request"; -})(Events = exports.Events || (exports.Events = {})); -exports.RefKey = "GITHUB_REF"; +//# sourceMappingURL=tracer_provider.js.map +/***/ }), +/* 695 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=tracer.js.map /***/ }), -/* 695 */, /* 696 */ /***/ (function(module) { @@ -45052,7 +49685,30 @@ module.exports = isPlainObject; /***/ }), -/* 702 */, +/* 702 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=MeterProvider.js.map + +/***/ }), /* 703 */, /* 704 */, /* 705 */, @@ -45135,7 +49791,18 @@ module.exports = isPlainObject; /***/ }), /* 709 */, /* 710 */, -/* 711 */, +/* 711 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", { value: true }); +__webpack_require__(71); + + +/***/ }), /* 712 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -45182,7 +49849,87 @@ module.exports = isPlainObject; /***/ }), /* 713 */, /* 714 */, -/* 715 */, +/* 715 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Context = void 0; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var Context = /** @class */ (function () { + /** + * Construct a new context which inherits values from an optional parent context. + * + * @param parentContext a context from which to inherit values + */ + function Context(parentContext) { + this._currentContext = parentContext ? new Map(parentContext) : new Map(); + } + /** Get a key to uniquely identify a context value */ + Context.createKey = function (description) { + return Symbol(description); + }; + /** + * Get a value from the context. + * + * @param key key which identifies a context value + */ + Context.prototype.getValue = function (key) { + return this._currentContext.get(key); + }; + /** + * Create a new context which inherits from this context and has + * the given key set to the given value. + * + * @param key context key for which to set the value + * @param value value to set for the given key + */ + Context.prototype.setValue = function (key, value) { + var context = new Context(this._currentContext); + context._currentContext.set(key, value); + return context; + }; + /** + * Return a new context which inherits from this context but does + * not contain a value for the given key. + * + * @param key context key for which to clear a value + */ + Context.prototype.deleteValue = function (key) { + var context = new Context(this._currentContext); + context._currentContext.delete(key); + return context; + }; + /** The root context is used as the default parent context when there is no active context */ + Context.ROOT_CONTEXT = new Context(); + /** + * This is another identifier to the root context which allows developers to easily search the + * codebase for direct uses of context which need to be removed in later PRs. + * + * It's existence is temporary and it should be removed when all references are fixed. + */ + Context.TODO = Context.ROOT_CONTEXT; + return Context; +}()); +exports.Context = Context; +//# sourceMappingURL=context.js.map + +/***/ }), /* 716 */, /* 717 */, /* 718 */, @@ -45232,7 +49979,7 @@ const core = __importStar(__webpack_require__(470)); const crypto = __importStar(__webpack_require__(417)); const fs = __importStar(__webpack_require__(747)); const path_1 = __importDefault(__webpack_require__(622)); -const constants_1 = __webpack_require__(694); +const constants_1 = __webpack_require__(196); const utils = __importStar(__webpack_require__(443)); function checksumFile(hashName, path) { return new Promise((resolve, reject) => { @@ -45379,16 +50126,31 @@ exports.saveCache = saveCache; /***/ }), /* 725 */, -/* 726 */ +/* 726 */, +/* 727 */ /***/ (function(__unusedmodule, exports) { "use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=trace_state.js.map +//# sourceMappingURL=Event.js.map /***/ }), -/* 727 */, /* 728 */ /***/ (function(__unusedmodule, exports) { @@ -45407,99 +50169,71 @@ exports.SearchState = SearchState; /***/ }), /* 729 */, /* 730 */, -/* 731 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MetricsAPI = void 0; -var NoopMeterProvider_1 = __webpack_require__(984); -var global_utils_1 = __webpack_require__(591); -/** - * Singleton object which represents the entry point to the OpenTelemetry Metrics API - */ -var MetricsAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function MetricsAPI() { - } - /** Get the singleton instance of the Metrics API */ - MetricsAPI.getInstance = function () { - if (!this._instance) { - this._instance = new MetricsAPI(); - } - return this._instance; - }; - /** - * Set the current global meter. Returns the initialized global meter provider. - */ - MetricsAPI.prototype.setGlobalMeterProvider = function (provider) { - if (global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) { - // global meter provider has already been set - return this.getMeterProvider(); - } - global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopMeterProvider_1.NOOP_METER_PROVIDER); - return provider; - }; - /** - * Returns the global meter provider. - */ - MetricsAPI.prototype.getMeterProvider = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopMeterProvider_1.NOOP_METER_PROVIDER); - }; - /** - * Returns a meter from the global meter provider. - */ - MetricsAPI.prototype.getMeter = function (name, version) { - return this.getMeterProvider().getMeter(name, version); - }; - /** Remove the global meter provider */ - MetricsAPI.prototype.disable = function () { - delete global_utils_1._global[global_utils_1.GLOBAL_METRICS_API_KEY]; - }; - return MetricsAPI; -}()); -exports.MetricsAPI = MetricsAPI; -//# sourceMappingURL=metrics.js.map - -/***/ }), +/* 731 */, /* 732 */, /* 733 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = rng; - -var _crypto = _interopRequireDefault(__webpack_require__(417)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const rnds8 = new Uint8Array(16); - -function rng() { - return _crypto.default.randomFillSync(rnds8); +Object.defineProperty(exports, "__esModule", { value: true }); +class BasicCredentialHandler { + constructor(username, password) { + this.username = username; + this.password = password; + } + prepareRequest(options) { + options.headers['Authorization'] = + 'Basic ' + + Buffer.from(this.username + ':' + this.password).toString('base64'); + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +exports.BasicCredentialHandler = BasicCredentialHandler; +class BearerCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + options.headers['Authorization'] = 'Bearer ' + this.token; + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } +} +exports.BearerCredentialHandler = BearerCredentialHandler; +class PersonalAccessTokenCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + options.headers['Authorization'] = + 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64'); + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } } +exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; + /***/ }), /* 734 */, @@ -45748,30 +50482,7 @@ function rng() { /***/ }), /* 739 */, /* 740 */, -/* 741 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=span_context.js.map - -/***/ }), +/* 741 */, /* 742 */, /* 743 */, /* 744 */ @@ -45779,8 +50490,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45795,17 +50506,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.NOOP_HTTP_TEXT_PROPAGATOR = exports.NoopHttpTextPropagator = void 0; /** * No-op implementations of {@link HttpTextPropagator}. */ -class NoopHttpTextPropagator { +var NoopHttpTextPropagator = /** @class */ (function () { + function NoopHttpTextPropagator() { + } /** Noop inject function does nothing */ - inject(context, carrier, setter) { } + NoopHttpTextPropagator.prototype.inject = function (context, carrier, setter) { }; /** Noop extract function does nothing and returns the input context */ - extract(context, carrier, getter) { + NoopHttpTextPropagator.prototype.extract = function (context, carrier, getter) { return context; - } -} + }; + return NoopHttpTextPropagator; +}()); exports.NoopHttpTextPropagator = NoopHttpTextPropagator; exports.NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator(); //# sourceMappingURL=NoopHttpTextPropagator.js.map @@ -46308,7 +51023,41 @@ module.exports = require("zlib"); /***/ }), /* 762 */, /* 763 */, -/* 764 */, +/* 764 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(145), exports); +//# sourceMappingURL=index.js.map + +/***/ }), /* 765 */, /* 766 */ /***/ (function(module) { @@ -46331,8 +51080,8 @@ module.exports = function(dst, src) { "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46347,10 +51096,11 @@ module.exports = function(dst, src) { * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const trace_flags_1 = __webpack_require__(975); +exports.NOOP_SPAN = exports.NoopSpan = exports.INVALID_SPAN_ID = exports.INVALID_TRACE_ID = void 0; +var trace_flags_1 = __webpack_require__(975); exports.INVALID_TRACE_ID = '0'; exports.INVALID_SPAN_ID = '0'; -const INVALID_SPAN_CONTEXT = { +var INVALID_SPAN_CONTEXT = { traceId: exports.INVALID_TRACE_ID, spanId: exports.INVALID_SPAN_ID, traceFlags: trace_flags_1.TraceFlags.NONE, @@ -46360,41 +51110,43 @@ const INVALID_SPAN_CONTEXT = { * implementation is available. All operations are no-op including context * propagation. */ -class NoopSpan { - constructor(_spanContext = INVALID_SPAN_CONTEXT) { +var NoopSpan = /** @class */ (function () { + function NoopSpan(_spanContext) { + if (_spanContext === void 0) { _spanContext = INVALID_SPAN_CONTEXT; } this._spanContext = _spanContext; } // Returns a SpanContext. - context() { + NoopSpan.prototype.context = function () { return this._spanContext; - } + }; // By default does nothing - setAttribute(key, value) { + NoopSpan.prototype.setAttribute = function (key, value) { return this; - } + }; // By default does nothing - setAttributes(attributes) { + NoopSpan.prototype.setAttributes = function (attributes) { return this; - } + }; // By default does nothing - addEvent(name, attributes) { + NoopSpan.prototype.addEvent = function (name, attributes) { return this; - } + }; // By default does nothing - setStatus(status) { + NoopSpan.prototype.setStatus = function (status) { return this; - } + }; // By default does nothing - updateName(name) { + NoopSpan.prototype.updateName = function (name) { return this; - } + }; // By default does nothing - end(endTime) { } + NoopSpan.prototype.end = function (endTime) { }; // isRecording always returns false for noopSpan. - isRecording() { + NoopSpan.prototype.isRecording = function () { return false; - } -} + }; + return NoopSpan; +}()); exports.NoopSpan = NoopSpan; exports.NOOP_SPAN = new NoopSpan(); //# sourceMappingURL=NoopSpan.js.map @@ -47140,7 +51892,30 @@ function populateMaps (extensions, types) { /***/ }), /* 780 */, -/* 781 */, +/* 781 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Sampler.js.map + +/***/ }), /* 782 */, /* 783 */, /* 784 */, @@ -47923,94 +52698,301 @@ exports.createTokenAuth = createTokenAuth; /***/ }), /* 814 */, /* 815 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module) { -"use strict"; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __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 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, 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 }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PropagationAPI = void 0; -var getter_1 = __webpack_require__(331); -var NoopHttpTextPropagator_1 = __webpack_require__(484); -var setter_1 = __webpack_require__(439); -var context_1 = __webpack_require__(284); -var global_utils_1 = __webpack_require__(591); -var contextApi = context_1.ContextAPI.getInstance(); -/** - * Singleton object which represents the entry point to the OpenTelemetry Propagation API - */ -var PropagationAPI = /** @class */ (function () { - /** Empty private constructor prevents end users from constructing a new instance of the API */ - function PropagationAPI() { - } - /** Get the singleton instance of the Propagator API */ - PropagationAPI.getInstance = function () { - if (!this._instance) { - this._instance = new PropagationAPI(); - } - return this._instance; - }; - /** - * Set the current propagator. Returns the initialized propagator - */ - PropagationAPI.prototype.setGlobalPropagator = function (propagator) { - if (global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) { - // global propagator has already been set - return this._getGlobalPropagator(); - } - global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, propagator, NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); - return propagator; - }; - /** - * Inject context into a carrier to be propagated inter-process - * - * @param carrier carrier to inject context into - * @param setter Function used to set values on the carrier - * @param context Context carrying tracing data to inject. Defaults to the currently active context. - */ - PropagationAPI.prototype.inject = function (carrier, setter, context) { - if (setter === void 0) { setter = setter_1.defaultSetter; } - if (context === void 0) { context = contextApi.active(); } - return this._getGlobalPropagator().inject(context, carrier, setter); - }; - /** - * Extract context from a carrier - * - * @param carrier Carrier to extract context from - * @param getter Function used to extract keys from a carrier - * @param context Context which the newly created context will inherit from. Defaults to the currently active context. - */ - PropagationAPI.prototype.extract = function (carrier, getter, context) { - if (getter === void 0) { getter = getter_1.defaultGetter; } - if (context === void 0) { context = contextApi.active(); } - return this._getGlobalPropagator().extract(context, carrier, getter); - }; - /** Remove the global propagator */ - PropagationAPI.prototype.disable = function () { - delete global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]; - }; - PropagationAPI.prototype._getGlobalPropagator = function () { - var _a, _b; - return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR); - }; - return PropagationAPI; -}()); -exports.PropagationAPI = PropagationAPI; -//# sourceMappingURL=propagation.js.map /***/ }), /* 816 */, @@ -48058,8 +53040,25 @@ module.exports = v4; /***/ }), -/* 827 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/* 827 */, +/* 828 */, +/* 829 */, +/* 830 */, +/* 831 */, +/* 832 */, +/* 833 */, +/* 834 */, +/* 835 */ +/***/ (function(module) { + +module.exports = require("url"); + +/***/ }), +/* 836 */, +/* 837 */, +/* 838 */, +/* 839 */ +/***/ (function(__unusedmodule, exports) { "use strict"; @@ -48078,95 +53077,10 @@ module.exports = v4; * See the License for the specific language governing permissions and * limitations under the License. */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.propagation = exports.metrics = exports.trace = exports.context = void 0; -__exportStar(__webpack_require__(362), exports); -__exportStar(__webpack_require__(109), exports); -__exportStar(__webpack_require__(331), exports); -__exportStar(__webpack_require__(177), exports); -__exportStar(__webpack_require__(484), exports); -__exportStar(__webpack_require__(439), exports); -__exportStar(__webpack_require__(168), exports); -__exportStar(__webpack_require__(493), exports); -__exportStar(__webpack_require__(890), exports); -__exportStar(__webpack_require__(237), exports); -__exportStar(__webpack_require__(949), exports); -__exportStar(__webpack_require__(272), exports); -__exportStar(__webpack_require__(993), exports); -__exportStar(__webpack_require__(982), exports); -__exportStar(__webpack_require__(984), exports); -__exportStar(__webpack_require__(119), exports); -__exportStar(__webpack_require__(169), exports); -__exportStar(__webpack_require__(563), exports); -__exportStar(__webpack_require__(391), exports); -__exportStar(__webpack_require__(673), exports); -__exportStar(__webpack_require__(445), exports); -__exportStar(__webpack_require__(100), exports); -__exportStar(__webpack_require__(340), exports); -__exportStar(__webpack_require__(980), exports); -__exportStar(__webpack_require__(222), exports); -__exportStar(__webpack_require__(225), exports); -__exportStar(__webpack_require__(868), exports); -__exportStar(__webpack_require__(741), exports); -__exportStar(__webpack_require__(374), exports); -__exportStar(__webpack_require__(246), exports); -__exportStar(__webpack_require__(871), exports); -__exportStar(__webpack_require__(883), exports); -__exportStar(__webpack_require__(457), exports); -__exportStar(__webpack_require__(917), exports); -__exportStar(__webpack_require__(726), exports); -__exportStar(__webpack_require__(889), exports); -__exportStar(__webpack_require__(618), exports); -var context_base_1 = __webpack_require__(581); -Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_base_1.Context; } }); -var context_1 = __webpack_require__(284); -/** Entrypoint for context API */ -exports.context = context_1.ContextAPI.getInstance(); -var trace_1 = __webpack_require__(586); -/** Entrypoint for trace API */ -exports.trace = trace_1.TraceAPI.getInstance(); -var metrics_1 = __webpack_require__(731); -/** Entrypoint for metrics API */ -exports.metrics = metrics_1.MetricsAPI.getInstance(); -var propagation_1 = __webpack_require__(815); -/** Entrypoint for propagation API */ -exports.propagation = propagation_1.PropagationAPI.getInstance(); -exports.default = { - trace: exports.trace, - metrics: exports.metrics, - context: exports.context, - propagation: exports.propagation, -}; -//# sourceMappingURL=index.js.map - -/***/ }), -/* 828 */, -/* 829 */, -/* 830 */, -/* 831 */, -/* 832 */, -/* 833 */, -/* 834 */, -/* 835 */ -/***/ (function(module) { - -module.exports = require("url"); +//# sourceMappingURL=TimedEvent.js.map /***/ }), -/* 836 */, -/* 837 */, -/* 838 */, -/* 839 */, /* 840 */, /* 841 */, /* 842 */ @@ -49391,7 +54305,30 @@ exports.restEndpointMethods = restEndpointMethods; /* 848 */, /* 849 */, /* 850 */, -/* 851 */, +/* 851 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=link_context.js.map + +/***/ }), /* 852 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -51620,92 +56557,23 @@ function removeHook (state, name, method) { } var index = state.registry[name] - .map(function (registered) { return registered.orig }) - .indexOf(method) - - if (index === -1) { - return - } - - state.registry[name].splice(index, 1) -} - - -/***/ }), -/* 867 */, -/* 868 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SamplingDecision = void 0; -/** - * A sampling decision that determines how a {@link Span} will be recorded - * and collected. - */ -var SamplingDecision; -(function (SamplingDecision) { - /** - * `Span.isRecording() === false`, span will not be recorded and all events - * and attributes will be dropped. - */ - SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; - /** - * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} - * MUST NOT be set. - */ - SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; - /** - * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} - * MUST be set. - */ - SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; -})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); -//# sourceMappingURL=SamplingResult.js.map + .map(function (registered) { return registered.orig }) + .indexOf(method) -/***/ }), -/* 869 */, -/* 870 */, -/* 871 */ -/***/ (function(__unusedmodule, exports) { + if (index === -1) { + return + } -"use strict"; + state.registry[name].splice(index, 1) +} -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=SpanOptions.js.map /***/ }), +/* 867 */, +/* 868 */, +/* 869 */, +/* 870 */, +/* 871 */, /* 872 */, /* 873 */, /* 874 */, @@ -51714,8 +56582,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; -/*! - * Copyright 2020, OpenTelemetry Authors +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51730,42 +56598,53 @@ Object.defineProperty(exports, "__esModule", { value: true }); * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -const NoopTracerProvider_1 = __webpack_require__(162); +exports.TraceAPI = void 0; +var NoopTracerProvider_1 = __webpack_require__(162); +var global_utils_1 = __webpack_require__(976); /** * Singleton object which represents the entry point to the OpenTelemetry Tracing API */ -class TraceAPI { +var TraceAPI = /** @class */ (function () { /** Empty private constructor prevents end users from constructing a new instance of the API */ - constructor() { - this._tracerProvider = NoopTracerProvider_1.NOOP_TRACER_PROVIDER; + function TraceAPI() { } /** Get the singleton instance of the Trace API */ - static getInstance() { + TraceAPI.getInstance = function () { if (!this._instance) { this._instance = new TraceAPI(); } return this._instance; - } + }; /** * Set the current global tracer. Returns the initialized global tracer provider */ - setGlobalTracerProvider(provider) { - this._tracerProvider = provider; - return provider; - } + TraceAPI.prototype.setGlobalTracerProvider = function (provider) { + if (global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) { + // global tracer provider has already been set + return this.getTracerProvider(); + } + global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopTracerProvider_1.NOOP_TRACER_PROVIDER); + return this.getTracerProvider(); + }; /** * Returns the global tracer provider. */ - getTracerProvider() { - return this._tracerProvider; - } + TraceAPI.prototype.getTracerProvider = function () { + var _a, _b; + return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopTracerProvider_1.NOOP_TRACER_PROVIDER); + }; /** * Returns a tracer from the global tracer provider. */ - getTracer(name, version) { + TraceAPI.prototype.getTracer = function (name, version) { return this.getTracerProvider().getTracer(name, version); - } -} + }; + /** Remove the global tracer provider */ + TraceAPI.prototype.disable = function () { + delete global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]; + }; + return TraceAPI; +}()); exports.TraceAPI = TraceAPI; //# sourceMappingURL=trace.js.map @@ -51777,153 +56656,7 @@ exports.TraceAPI = TraceAPI; /* 880 */, /* 881 */, /* 882 */, -/* 883 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CanonicalCode = void 0; -/** - * An enumeration of canonical status codes. - */ -var CanonicalCode; -(function (CanonicalCode) { - /** - * Not an error; returned on success - */ - CanonicalCode[CanonicalCode["OK"] = 0] = "OK"; - /** - * The operation was cancelled (typically by the caller). - */ - CanonicalCode[CanonicalCode["CANCELLED"] = 1] = "CANCELLED"; - /** - * Unknown error. An example of where this error may be returned is - * if a status value received from another address space belongs to - * an error-space that is not known in this address space. Also - * errors raised by APIs that do not return enough error information - * may be converted to this error. - */ - CanonicalCode[CanonicalCode["UNKNOWN"] = 2] = "UNKNOWN"; - /** - * Client specified an invalid argument. Note that this differs - * from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments - * that are problematic regardless of the state of the system - * (e.g., a malformed file name). - */ - CanonicalCode[CanonicalCode["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT"; - /** - * Deadline expired before operation could complete. For operations - * that change the state of the system, this error may be returned - * even if the operation has completed successfully. For example, a - * successful response from a server could have been delayed long - * enough for the deadline to expire. - */ - CanonicalCode[CanonicalCode["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED"; - /** - * Some requested entity (e.g., file or directory) was not found. - */ - CanonicalCode[CanonicalCode["NOT_FOUND"] = 5] = "NOT_FOUND"; - /** - * Some entity that we attempted to create (e.g., file or directory) - * already exists. - */ - CanonicalCode[CanonicalCode["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS"; - /** - * The caller does not have permission to execute the specified - * operation. PERMISSION_DENIED must not be used for rejections - * caused by exhausting some resource (use RESOURCE_EXHAUSTED - * instead for those errors). PERMISSION_DENIED must not be - * used if the caller can not be identified (use UNAUTHENTICATED - * instead for those errors). - */ - CanonicalCode[CanonicalCode["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED"; - /** - * Some resource has been exhausted, perhaps a per-user quota, or - * perhaps the entire file system is out of space. - */ - CanonicalCode[CanonicalCode["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED"; - /** - * Operation was rejected because the system is not in a state - * required for the operation's execution. For example, directory - * to be deleted may be non-empty, an rmdir operation is applied to - * a non-directory, etc. - * - * A litmus test that may help a service implementor in deciding - * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - * - * - Use UNAVAILABLE if the client can retry just the failing call. - * - Use ABORTED if the client should retry at a higher-level - * (e.g., restarting a read-modify-write sequence). - * - Use FAILED_PRECONDITION if the client should not retry until - * the system state has been explicitly fixed. E.g., if an "rmdir" - * fails because the directory is non-empty, FAILED_PRECONDITION - * should be returned since the client should not retry unless - * they have first fixed up the directory by deleting files from it. - * - Use FAILED_PRECONDITION if the client performs conditional - * REST Get/Update/Delete on a resource and the resource on the - * server does not match the condition. E.g., conflicting - * read-modify-write on the same resource. - */ - CanonicalCode[CanonicalCode["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION"; - /** - * The operation was aborted, typically due to a concurrency issue - * like sequencer check failures, transaction aborts, etc. - * - * See litmus test above for deciding between FAILED_PRECONDITION, - * ABORTED, and UNAVAILABLE. - */ - CanonicalCode[CanonicalCode["ABORTED"] = 10] = "ABORTED"; - /** - * Operation was attempted past the valid range. E.g., seeking or - * reading past end of file. - * - * Unlike INVALID_ARGUMENT, this error indicates a problem that may - * be fixed if the system state changes. For example, a 32-bit file - * system will generate INVALID_ARGUMENT if asked to read at an - * offset that is not in the range [0,2^32-1], but it will generate - * OUT_OF_RANGE if asked to read from an offset past the current - * file size. - * - * There is a fair bit of overlap between FAILED_PRECONDITION and - * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific - * error) when it applies so that callers who are iterating through - * a space can easily look for an OUT_OF_RANGE error to detect when - * they are done. - */ - CanonicalCode[CanonicalCode["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE"; - /** - * Operation is not implemented or not supported/enabled in this service. - */ - CanonicalCode[CanonicalCode["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED"; - /** - * Internal errors. Means some invariants expected by underlying - * system has been broken. If you see one of these errors, - * something is very broken. - */ - CanonicalCode[CanonicalCode["INTERNAL"] = 13] = "INTERNAL"; - /** - * The service is currently unavailable. This is a most likely a - * transient condition and may be corrected by retrying with - * a backoff. - * - * See litmus test above for deciding between FAILED_PRECONDITION, - * ABORTED, and UNAVAILABLE. - */ - CanonicalCode[CanonicalCode["UNAVAILABLE"] = 14] = "UNAVAILABLE"; - /** - * Unrecoverable data loss or corruption. - */ - CanonicalCode[CanonicalCode["DATA_LOSS"] = 15] = "DATA_LOSS"; - /** - * The request does not have valid authentication credentials for the - * operation. - */ - CanonicalCode[CanonicalCode["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED"; -})(CanonicalCode = exports.CanonicalCode || (exports.CanonicalCode = {})); -//# sourceMappingURL=status.js.map - -/***/ }), +/* 883 */, /* 884 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -52426,794 +57159,566 @@ var CanonicalCode; /***/ }), /* 886 */, -/* 887 */, -/* 888 */, -/* 889 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=tracer_provider.js.map - -/***/ }), -/* 890 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=BatchObserverResult.js.map - -/***/ }), -/* 891 */, -/* 892 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -var iterate = __webpack_require__(157) - , initState = __webpack_require__(903) - , terminator = __webpack_require__(939) - ; - -// Public API -module.exports = serialOrdered; -// sorting helpers -module.exports.ascending = ascending; -module.exports.descending = descending; - -/** - * Runs iterator over provided sorted array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} sortMethod - custom sort function - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serialOrdered(list, iterator, sortMethod, callback) -{ - var state = initState(list, sortMethod); - - iterate(list, iterator, state, function iteratorHandler(error, result) - { - if (error) - { - callback(error, result); - return; - } - - state.index++; - - // are we there yet? - if (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, iteratorHandler); - return; - } - - // done here - callback(null, state.results); - }); - - return terminator.bind(state, callback); -} - -/* - * -- Sort methods - */ - -/** - * sort helper to sort array elements in ascending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function ascending(a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} - -/** - * sort helper to sort array elements in descending order - * - * @param {mixed} a - an item to compare - * @param {mixed} b - an item to compare - * @returns {number} - comparison result - */ -function descending(a, b) -{ - return -1 * ascending(a, b); -} - - -/***/ }), -/* 893 */, -/* 894 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, '__esModule', { value: true }); - -var api = __webpack_require__(827); -var tslib = __webpack_require__(865); - -// Copyright (c) Microsoft Corporation. -/** - * A no-op implementation of Span that can safely be used without side-effects. - */ -var NoOpSpan = /** @class */ (function () { - function NoOpSpan() { - } - /** - * Returns the SpanContext associated with this Span. - */ - NoOpSpan.prototype.context = function () { - return { - spanId: "", - traceId: "", - traceFlags: api.TraceFlags.NONE - }; - }; - /** - * Marks the end of Span execution. - * @param _endTime The time to use as the Span's end time. Defaults to - * the current time. - */ - NoOpSpan.prototype.end = function (_endTime) { - /* Noop */ - }; - /** - * Sets an attribute on the Span - * @param _key the attribute key - * @param _value the attribute value - */ - NoOpSpan.prototype.setAttribute = function (_key, _value) { - return this; - }; - /** - * Sets attributes on the Span - * @param _attributes the attributes to add - */ - NoOpSpan.prototype.setAttributes = function (_attributes) { - return this; - }; - /** - * Adds an event to the Span - * @param _name The name of the event - * @param _attributes The associated attributes to add for this event - */ - NoOpSpan.prototype.addEvent = function (_name, _attributes) { - return this; - }; - /** - * Sets a status on the span. Overrides the default of CanonicalCode.OK. - * @param _status The status to set. - */ - NoOpSpan.prototype.setStatus = function (_status) { - return this; - }; - /** - * Updates the name of the Span - * @param _name the new Span name - */ - NoOpSpan.prototype.updateName = function (_name) { - return this; - }; - /** - * Returns whether this span will be recorded - */ - NoOpSpan.prototype.isRecording = function () { - return false; - }; - return NoOpSpan; -}()); - -// Copyright (c) Microsoft Corporation. -/** - * A no-op implementation of Tracer that can be used when tracing - * is disabled. - */ -var NoOpTracer = /** @class */ (function () { - function NoOpTracer() { - } - /** - * Starts a new Span. - * @param _name The name of the span. - * @param _options The SpanOptions used during Span creation. - */ - NoOpTracer.prototype.startSpan = function (_name, _options) { - return new NoOpSpan(); - }; - /** - * Returns the current Span from the current context, if available. - */ - NoOpTracer.prototype.getCurrentSpan = function () { - return new NoOpSpan(); - }; - /** - * Executes the given function within the context provided by a Span. - * @param _span The span that provides the context. - * @param fn The function to be executed. - */ - NoOpTracer.prototype.withSpan = function (_span, fn) { - return fn(); - }; - /** - * Bind a Span as the target's scope - * @param target An object to bind the scope. - * @param _span A specific Span to use. Otherwise, use the current one. - */ - NoOpTracer.prototype.bind = function (target, _span) { - return target; - }; - return NoOpTracer; -}()); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -function getGlobalObject() { - return global; -} - -// Copyright (c) Microsoft Corporation. -// V1 = OpenTelemetry 0.1 -// V2 = OpenTelemetry 0.2 -// V3 = OpenTelemetry 0.6.1 -var GLOBAL_TRACER_VERSION = 3; -// preview5 shipped with @azure/core-tracing.tracerCache -// and didn't have smart detection for collisions -var GLOBAL_TRACER_SYMBOL = Symbol.for("@azure/core-tracing.tracerCache2"); -var cache; -function loadTracerCache() { - var globalObj = getGlobalObject(); - var existingCache = globalObj[GLOBAL_TRACER_SYMBOL]; - var setGlobalCache = true; - if (existingCache) { - if (existingCache.version === GLOBAL_TRACER_VERSION) { - cache = existingCache; - } - else { - setGlobalCache = false; - if (existingCache.tracer) { - throw new Error("Two incompatible versions of @azure/core-tracing have been loaded.\n This library is " + GLOBAL_TRACER_VERSION + ", existing is " + existingCache.version + "."); - } - } - } - if (!cache) { - cache = { - tracer: undefined, - version: GLOBAL_TRACER_VERSION - }; - } - if (setGlobalCache) { - globalObj[GLOBAL_TRACER_SYMBOL] = cache; - } -} -function getCache() { - if (!cache) { - loadTracerCache(); - } - return cache; -} +/* 887 */, +/* 888 */, +/* 889 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { -// Copyright (c) Microsoft Corporation. -var defaultTracer; -function getDefaultTracer() { - if (!defaultTracer) { - defaultTracer = new NoOpTracer(); - } - return defaultTracer; -} -/** - * Sets the global tracer, enabling tracing for the Azure SDK. - * @param tracer An OpenTelemetry Tracer instance. - */ -function setTracer(tracer) { - var cache = getCache(); - cache.tracer = tracer; -} -/** - * Retrieves the active tracer, or returns a - * no-op implementation if one is not set. +"use strict"; +/*! + * Copyright (c) Microsoft and contributors. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Azure Core LRO SDK for JavaScript - 1.0.2 */ -function getTracer() { - var cache = getCache(); - if (!cache.tracer) { - return getDefaultTracer(); - } - return cache.tracer; -} + + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = __webpack_require__(422); // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. /** - * @ignore - * @internal + * When a poller is manually stopped through the `stopPolling` method, + * the poller will be rejected with an instance of the PollerStoppedError. */ -var OpenCensusTraceStateWrapper = /** @class */ (function () { - function OpenCensusTraceStateWrapper(state) { - this._state = state; +var PollerStoppedError = /** @class */ (function (_super) { + tslib.__extends(PollerStoppedError, _super); + function PollerStoppedError(message) { + var _this = _super.call(this, message) || this; + _this.name = "PollerStoppedError"; + Object.setPrototypeOf(_this, PollerStoppedError.prototype); + return _this; } - OpenCensusTraceStateWrapper.prototype.get = function (_key) { - throw new Error("Method not implemented."); - }; - OpenCensusTraceStateWrapper.prototype.set = function (_key, _value) { - throw new Error("Method not implemented."); - }; - OpenCensusTraceStateWrapper.prototype.unset = function (_key) { - throw new Error("Method not implemented"); - }; - OpenCensusTraceStateWrapper.prototype.serialize = function () { - return this._state || ""; - }; - return OpenCensusTraceStateWrapper; -}()); - -// Copyright (c) Microsoft Corporation. -function isWrappedSpan(span) { - return !!span && span.getWrappedSpan !== undefined; -} -function isTracer(tracerOrSpan) { - return tracerOrSpan.getWrappedTracer !== undefined; -} + return PollerStoppedError; +}(Error)); /** - * An implementation of OpenTelemetry Span that wraps an OpenCensus Span. + * When a poller is cancelled through the `cancelOperation` method, + * the poller will be rejected with an instance of the PollerCancelledError. */ -var OpenCensusSpanWrapper = /** @class */ (function () { - function OpenCensusSpanWrapper(tracerOrSpan, name, options) { - if (name === void 0) { name = ""; } - if (options === void 0) { options = {}; } - if (isTracer(tracerOrSpan)) { - var parent = isWrappedSpan(options.parent) ? options.parent.getWrappedSpan() : undefined; - this._span = tracerOrSpan.getWrappedTracer().startChildSpan({ - name: name, - childOf: parent - }); - this._span.start(); - if (options.links) { - for (var _i = 0, _a = options.links; _i < _a.length; _i++) { - var link = _a[_i]; - // Since there is no way to set the link relationship, leave it as Unspecified. - this._span.addLink(link.context.traceId, link.context.spanId, 0 /* LinkType.UNSPECIFIED */, link.attributes); - } - } - } - else { - this._span = tracerOrSpan; - } +var PollerCancelledError = /** @class */ (function (_super) { + tslib.__extends(PollerCancelledError, _super); + function PollerCancelledError(message) { + var _this = _super.call(this, message) || this; + _this.name = "PollerCancelledError"; + Object.setPrototypeOf(_this, PollerCancelledError.prototype); + return _this; } - /** - * The underlying OpenCensus Span - */ - OpenCensusSpanWrapper.prototype.getWrappedSpan = function () { - return this._span; - }; - /** - * Marks the end of Span execution. - * @param endTime The time to use as the Span's end time. Defaults to - * the current time. - */ - OpenCensusSpanWrapper.prototype.end = function (_endTime) { - this._span.end(); - }; - /** - * Returns the SpanContext associated with this Span. - */ - OpenCensusSpanWrapper.prototype.context = function () { - var openCensusSpanContext = this._span.spanContext; - return { - spanId: openCensusSpanContext.spanId, - traceId: openCensusSpanContext.traceId, - traceFlags: openCensusSpanContext.options, - traceState: new OpenCensusTraceStateWrapper(openCensusSpanContext.traceState) - }; - }; - /** - * Sets an attribute on the Span - * @param key the attribute key - * @param value the attribute value - */ - OpenCensusSpanWrapper.prototype.setAttribute = function (key, value) { - this._span.addAttribute(key, value); - return this; - }; - /** - * Sets attributes on the Span - * @param attributes the attributes to add - */ - OpenCensusSpanWrapper.prototype.setAttributes = function (attributes) { - this._span.attributes = attributes; - return this; - }; - /** - * Adds an event to the Span - * @param name The name of the event - * @param attributes The associated attributes to add for this event - */ - OpenCensusSpanWrapper.prototype.addEvent = function (_name, _attributes) { - throw new Error("Method not implemented."); - }; - /** - * Sets a status on the span. Overrides the default of CanonicalCode.OK. - * @param status The status to set. - */ - OpenCensusSpanWrapper.prototype.setStatus = function (status) { - this._span.setStatus(status.code, status.message); - return this; - }; - /** - * Updates the name of the Span - * @param name the new Span name - */ - OpenCensusSpanWrapper.prototype.updateName = function (name) { - this._span.name = name; - return this; - }; - /** - * Returns whether this span will be recorded - */ - OpenCensusSpanWrapper.prototype.isRecording = function () { - // NoRecordSpans have an empty traceId - return !!this._span.traceId; - }; - return OpenCensusSpanWrapper; -}()); - -// Copyright (c) Microsoft Corporation. + return PollerCancelledError; +}(Error)); /** - * An implementation of OpenTelemetry Tracer that wraps an OpenCensus Tracer. + * A class that represents the definition of a program that polls through consecutive requests + * until it reaches a state of completion. + * + * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. + * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. + * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. + * + * ```ts + * const poller = new MyPoller(); + * + * // Polling just once: + * await poller.poll(); + * + * // We can try to cancel the request here, by calling: + * // + * // await poller.cancelOperation(); + * // + * + * // Getting the final result: + * const result = await poller.pollUntilDone(); + * ``` + * + * The Poller is defined by two types, a type representing the state of the poller, which + * must include a basic set of properties from `PollOperationState`, + * and a return type defined by `TResult`, which can be anything. + * + * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having + * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. + * + * ```ts + * class Client { + * public async makePoller: PollerLike { + * const poller = new MyPoller({}); + * // It might be preferred to return the poller after the first request is made, + * // so that some information can be obtained right away. + * await poller.poll(); + * return poller; + * } + * } + * + * const poller: PollerLike = myClient.makePoller(); + * ``` + * + * A poller can be created through its constructor, then it can be polled until it's completed. + * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. + * At any point in time, the intermediate forms of the result type can be requested without delay. + * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. + * + * ```ts + * const poller = myClient.makePoller(); + * const state: MyOperationState = poller.getOperationState(); + * + * // The intermediate result can be obtained at any time. + * const result: MyResult | undefined = poller.getResult(); + * + * // The final result can only be obtained after the poller finishes. + * const result: MyResult = await poller.pollUntilDone(); + * ``` + * */ -var OpenCensusTracerWrapper = /** @class */ (function () { +var Poller = /** @class */ (function () { /** - * Create a new wrapper around a given OpenCensus Tracer. - * @param tracer The OpenCensus Tracer to wrap. + * A poller needs to be initialized by passing in at least the basic properties of the PollOperation. + * + * When writing an implementation of a Poller, this implementation needs to deal with the initialization + * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's + * operation has already been defined, at least its basic properties. The code below shows how to approach + * the definition of the constructor of a new custom poller. + * + * ```ts + * export class MyPoller extends Poller { + * constructor({ + * // Anything you might need outside of the basics + * }) { + * let state: MyOperationState = { + * privateProperty: private, + * publicProperty: public, + * }; + * + * const operation = { + * state, + * update, + * cancel, + * toString + * } + * + * // Sending the operation to the parent's constructor. + * super(operation); + * + * // You can assign more local properties here. + * } + * } + * ``` + * + * Inside of this constructor, a new promise is created. This will be used to + * tell the user when the poller finishes (see `pollUntilDone()`). The promise's + * resolve and reject methods are also used internally to control when to resolve + * or reject anyone waiting for the poller to finish. + * + * The constructor of a custom implementation of a poller is where any serialized version of + * a previous poller's operation should be deserialized into the operation sent to the + * base constructor. For example: + * + * ```ts + * export class MyPoller extends Poller { + * constructor( + * baseOperation: string | undefined + * ) { + * let state: MyOperationState = {}; + * if (baseOperation) { + * state = { + * ...JSON.parse(baseOperation).state, + * ...state + * }; + * } + * const operation = { + * state, + * // ... + * } + * super(operation); + * } + * } + * ``` + * + * @param operation Must contain the basic properties of PollOperation. */ - function OpenCensusTracerWrapper(tracer) { - this._tracer = tracer; + function Poller(operation) { + var _this = this; + this.stopped = true; + this.pollProgressCallbacks = []; + this.operation = operation; + this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. + // The above warning would get thrown if `poller.poll` is called, it returns an error, + // and pullUntilDone did not have a .catch or await try/catch on it's return value. + this.promise.catch(function () { }); } /** - * The wrapped OpenCensus Tracer - */ - OpenCensusTracerWrapper.prototype.getWrappedTracer = function () { - return this._tracer; - }; - /** - * Starts a new Span. - * @param name The name of the span. - * @param options The SpanOptions used during Span creation. - */ - OpenCensusTracerWrapper.prototype.startSpan = function (name, options) { - return new OpenCensusSpanWrapper(this, name, options); - }; - /** - * Returns the current Span from the current context, if available. - */ - OpenCensusTracerWrapper.prototype.getCurrentSpan = function () { - return undefined; - }; - /** - * Executes the given function within the context provided by a Span. - * @param _span The span that provides the context. - * @param _fn The function to be executed. + * @internal + * @ignore + * Starts a loop that will break only if the poller is done + * or if the poller is stopped. */ - OpenCensusTracerWrapper.prototype.withSpan = function (_span, _fn) { - throw new Error("Method not implemented."); + Poller.prototype.startPolling = function () { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (this.stopped) { + this.stopped = false; + } + _a.label = 1; + case 1: + if (!(!this.isStopped() && !this.isDone())) return [3 /*break*/, 4]; + return [4 /*yield*/, this.poll()]; + case 2: + _a.sent(); + return [4 /*yield*/, this.delay()]; + case 3: + _a.sent(); + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + }); }; /** - * Bind a Span as the target's scope - * @param target An object to bind the scope. - * @param _span A specific Span to use. Otherwise, use the current one. + * @internal + * @ignore + * pollOnce does one polling, by calling to the update method of the underlying + * poll operation to make any relevant change effective. + * + * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. + * + * @param options Optional properties passed to the operation's update method. */ - OpenCensusTracerWrapper.prototype.bind = function (_target, _span) { - throw new Error("Method not implemented."); + Poller.prototype.pollOnce = function (options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var state, _a, e_1; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + state = this.operation.state; + _b.label = 1; + case 1: + _b.trys.push([1, 4, , 5]); + if (!!this.isDone()) return [3 /*break*/, 3]; + _a = this; + return [4 /*yield*/, this.operation.update({ + abortSignal: options.abortSignal, + fireProgress: this.fireProgress.bind(this) + })]; + case 2: + _a.operation = _b.sent(); + if (this.isDone() && this.resolve) { + this.resolve(state.result); + } + _b.label = 3; + case 3: return [3 /*break*/, 5]; + case 4: + e_1 = _b.sent(); + state.error = e_1; + if (this.reject) { + this.reject(e_1); + } + throw e_1; + case 5: return [2 /*return*/]; + } + }); + }); }; - return OpenCensusTracerWrapper; -}()); - -// Copyright (c) Microsoft Corporation. -/** - * A mock span useful for testing. - */ -var TestSpan = /** @class */ (function (_super) { - tslib.__extends(TestSpan, _super); - /** - * Starts a new Span. - * @param parentTracer The tracer that created this Span - * @param name The name of the span. - * @param context The SpanContext this span belongs to - * @param kind The SpanKind of this Span - * @param parentSpanId The identifier of the parent Span - * @param startTime The startTime of the event (defaults to now) - */ - function TestSpan(parentTracer, name, context, kind, parentSpanId, startTime) { - if (startTime === void 0) { startTime = Date.now(); } - var _this = _super.call(this) || this; - _this._tracer = parentTracer; - _this.name = name; - _this.kind = kind; - _this.startTime = startTime; - _this.parentSpanId = parentSpanId; - _this.status = { - code: api.CanonicalCode.OK - }; - _this.endCalled = false; - _this._context = context; - _this.attributes = {}; - return _this; - } /** - * Returns the Tracer that created this Span + * @internal + * @ignore + * fireProgress calls the functions passed in via onProgress the method of the poller. + * + * It loops over all of the callbacks received from onProgress, and executes them, sending them + * the current operation state. + * + * @param state The current operation state. */ - TestSpan.prototype.tracer = function () { - return this._tracer; + Poller.prototype.fireProgress = function (state) { + for (var _i = 0, _a = this.pollProgressCallbacks; _i < _a.length; _i++) { + var callback = _a[_i]; + callback(state); + } }; /** - * Returns the SpanContext associated with this Span. + * @internal + * @ignore + * Invokes the underlying operation's cancel method, and rejects the + * pollUntilDone promise. */ - TestSpan.prototype.context = function () { - return this._context; + Poller.prototype.cancelOnce = function (options) { + if (options === void 0) { options = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + var _a; + return tslib.__generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = this; + return [4 /*yield*/, this.operation.cancel(options)]; + case 1: + _a.operation = _b.sent(); + if (this.reject) { + this.reject(new PollerCancelledError("Poller cancelled")); + } + return [2 /*return*/]; + } + }); + }); }; /** - * Marks the end of Span execution. - * @param _endTime The time to use as the Span's end time. Defaults to - * the current time. + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + * + * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. + * + * @param options Optional properties passed to the operation's update method. */ - TestSpan.prototype.end = function (_endTime) { - this.endCalled = true; + Poller.prototype.poll = function (options) { + var _this = this; + if (options === void 0) { options = {}; } + if (!this.pollOncePromise) { + this.pollOncePromise = this.pollOnce(options); + var clearPollOncePromise = function () { + _this.pollOncePromise = undefined; + }; + this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise); + } + return this.pollOncePromise; }; /** - * Sets a status on the span. Overrides the default of CanonicalCode.OK. - * @param status The status to set. + * Returns a promise that will resolve once the underlying operation is completed. */ - TestSpan.prototype.setStatus = function (status) { - this.status = status; - return this; + Poller.prototype.pollUntilDone = function () { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + if (this.stopped) { + this.startPolling().catch(this.reject); + } + return [2 /*return*/, this.promise]; + }); + }); }; /** - * Returns whether this span will be recorded + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. */ - TestSpan.prototype.isRecording = function () { - return true; + Poller.prototype.onProgress = function (callback) { + var _this = this; + this.pollProgressCallbacks.push(callback); + return function () { + _this.pollProgressCallbacks = _this.pollProgressCallbacks.filter(function (c) { return c !== callback; }); + }; }; /** - * Sets an attribute on the Span - * @param key the attribute key - * @param value the attribute value + * Returns true if the poller has finished polling. */ - TestSpan.prototype.setAttribute = function (key, value) { - this.attributes[key] = value; - return this; + Poller.prototype.isDone = function () { + var state = this.operation.state; + return Boolean(state.isCompleted || state.isCancelled || state.error); }; /** - * Sets attributes on the Span - * @param attributes the attributes to add + * Stops the poller from continuing to poll. */ - TestSpan.prototype.setAttributes = function (attributes) { - for (var _i = 0, _a = Object.keys(attributes); _i < _a.length; _i++) { - var key = _a[_i]; - this.attributes[key] = attributes[key]; + Poller.prototype.stopPolling = function () { + if (!this.stopped) { + this.stopped = true; + if (this.reject) { + this.reject(new PollerStoppedError("This poller is already stopped")); + } } - return this; - }; - return TestSpan; -}(NoOpSpan)); - -// Copyright (c) Microsoft Corporation. -/** - * A mock tracer useful for testing - */ -var TestTracer = /** @class */ (function (_super) { - tslib.__extends(TestTracer, _super); - function TestTracer() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.traceIdCounter = 0; - _this.spanIdCounter = 0; - _this.rootSpans = []; - _this.knownSpans = []; - return _this; - } - TestTracer.prototype.getNextTraceId = function () { - this.traceIdCounter++; - return String(this.traceIdCounter); - }; - TestTracer.prototype.getNextSpanId = function () { - this.spanIdCounter++; - return String(this.spanIdCounter); }; /** - * Returns all Spans that were created without a parent + * Returns true if the poller is stopped. */ - TestTracer.prototype.getRootSpans = function () { - return this.rootSpans; + Poller.prototype.isStopped = function () { + return this.stopped; }; /** - * Returns all Spans this Tracer knows about + * Attempts to cancel the underlying operation. + * + * It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike. + * + * If it's called again before it finishes, it will throw an error. + * + * @param options Optional properties passed to the operation's update method. */ - TestTracer.prototype.getKnownSpans = function () { - return this.knownSpans; + Poller.prototype.cancelOperation = function (options) { + if (options === void 0) { options = {}; } + if (!this.stopped) { + this.stopped = true; + } + if (!this.cancelPromise) { + this.cancelPromise = this.cancelOnce(options); + } + else if (options.abortSignal) { + throw new Error("A cancel request is currently pending"); + } + return this.cancelPromise; }; /** - * Returns all Spans where end() has not been called + * Returns the state of the operation. + * + * Even though TState will be the same type inside any of the methods of any extension of the Poller class, + * implementations of the pollers can customize what's shared with the public by writing their own + * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller + * and a public type representing a safe to share subset of the properties of the internal state. + * Their definition of getOperationState can then return their public type. + * + * Example: + * + * ```ts + * // Let's say we have our poller's operation state defined as: + * interface MyOperationState extends PollOperationState { + * privateProperty?: string; + * publicProperty?: string; + * } + * + * // To allow us to have a true separation of public and private state, we have to define another interface: + * interface PublicState extends PollOperationState { + * publicProperty?: string; + * } + * + * // Then, we define our Poller as follows: + * export class MyPoller extends Poller { + * // ... More content is needed here ... + * + * public getOperationState(): PublicState { + * const state: PublicState = this.operation.state; + * return { + * // Properties from PollOperationState + * isStarted: state.isStarted, + * isCompleted: state.isCompleted, + * isCancelled: state.isCancelled, + * error: state.error, + * result: state.result, + * + * // The only other property needed by PublicState. + * publicProperty: state.publicProperty + * } + * } + * } + * ``` + * + * You can see this in the tests of this repository, go to the file: + * `../test/utils/testPoller.ts` + * and look for the getOperationState implementation. */ - TestTracer.prototype.getActiveSpans = function () { - return this.knownSpans.filter(function (span) { - return !span.endCalled; - }); + Poller.prototype.getOperationState = function () { + return this.operation.state; }; /** - * Return all Spans for a particular trace, grouped by their - * parent Span in a tree-like structure - * @param traceId The traceId to return the graph for + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. */ - TestTracer.prototype.getSpanGraph = function (traceId) { - var traceSpans = this.knownSpans.filter(function (span) { - return span.context().traceId === traceId; - }); - var roots = []; - var nodeMap = new Map(); - for (var _i = 0, traceSpans_1 = traceSpans; _i < traceSpans_1.length; _i++) { - var span = traceSpans_1[_i]; - var spanId = span.context().spanId; - var node = { - name: span.name, - children: [] - }; - nodeMap.set(spanId, node); - if (span.parentSpanId) { - var parent = nodeMap.get(span.parentSpanId); - if (!parent) { - throw new Error("Span with name " + node.name + " has an unknown parentSpan with id " + span.parentSpanId); - } - parent.children.push(node); - } - else { - roots.push(node); - } - } - return { - roots: roots - }; + Poller.prototype.getResult = function () { + var state = this.operation.state; + return state.result; }; /** - * Starts a new Span. - * @param name The name of the span. - * @param options The SpanOptions used during Span creation. + * Returns a serialized version of the poller's operation + * by invoking the operation's toString method. */ - TestTracer.prototype.startSpan = function (name, options) { - if (options === void 0) { options = {}; } - var parentContext = this._getParentContext(options); - var traceId; - var isRootSpan = false; - if (parentContext && parentContext.traceId) { - traceId = parentContext.traceId; - } - else { - traceId = this.getNextTraceId(); - isRootSpan = true; - } - var context = { - traceId: traceId, - spanId: this.getNextSpanId(), - traceFlags: api.TraceFlags.NONE - }; - var span = new TestSpan(this, name, context, options.kind || api.SpanKind.INTERNAL, parentContext ? parentContext.spanId : undefined, options.startTime); - this.knownSpans.push(span); - if (isRootSpan) { - this.rootSpans.push(span); - } - return span; - }; - TestTracer.prototype._getParentContext = function (options) { - var parent = options.parent; - var result; - if (parent) { - if ("traceId" in parent) { - result = parent; - } - else { - result = parent.context(); - } - } - return result; + Poller.prototype.toString = function () { + return this.operation.toString(); }; - return TestTracer; -}(NoOpTracer)); + return Poller; +}()); + +exports.Poller = Poller; +exports.PollerCancelledError = PollerCancelledError; +exports.PollerStoppedError = PollerStoppedError; +//# sourceMappingURL=index.js.map + + +/***/ }), +/* 890 */, +/* 891 */, +/* 892 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +var iterate = __webpack_require__(157) + , initState = __webpack_require__(903) + , terminator = __webpack_require__(939) + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -var VERSION = "00"; /** - * Generates a `SpanContext` given a `traceparent` header value. - * @param traceParent Serialized span context data as a `traceparent` header value. - * @returns The `SpanContext` generated from the `traceparent` value. + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator */ -function extractSpanContextFromTraceParentHeader(traceParentHeader) { - var parts = traceParentHeader.split("-"); - if (parts.length !== 4) { - return; +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; } - var version = parts[0], traceId = parts[1], spanId = parts[2], traceOptions = parts[3]; - if (version !== VERSION) { - return; + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; } - var traceFlags = parseInt(traceOptions, 16); - var spanContext = { - spanId: spanId, - traceId: traceId, - traceFlags: traceFlags - }; - return spanContext; + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); } + +/* + * -- Sort methods + */ + /** - * Generates a `traceparent` value given a span context. - * @param spanContext Contains context for a specific span. - * @returns The `spanContext` represented as a `traceparent` value. + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result */ -function getTraceParentHeader(spanContext) { - var missingFields = []; - if (!spanContext.traceId) { - missingFields.push("traceId"); - } - if (!spanContext.spanId) { - missingFields.push("spanId"); - } - if (missingFields.length) { - return; - } - var flags = spanContext.traceFlags || 0 /* NONE */; - var hexFlags = flags.toString(16); - var traceFlags = hexFlags.length === 1 ? "0" + hexFlags : hexFlags; - // https://www.w3.org/TR/trace-context/#traceparent-header-field-values - return VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-" + traceFlags; +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; } -exports.NoOpSpan = NoOpSpan; -exports.NoOpTracer = NoOpTracer; -exports.OpenCensusSpanWrapper = OpenCensusSpanWrapper; -exports.OpenCensusTracerWrapper = OpenCensusTracerWrapper; -exports.TestSpan = TestSpan; -exports.TestTracer = TestTracer; -exports.extractSpanContextFromTraceParentHeader = extractSpanContextFromTraceParentHeader; -exports.getTraceParentHeader = getTraceParentHeader; -exports.getTracer = getTracer; -exports.setTracer = setTracer; -//# sourceMappingURL=index.js.map +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} /***/ }), +/* 893 */, +/* 894 */, /* 895 */, /* 896 */ /***/ (function(module) { @@ -53360,7 +57865,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const http_client_1 = __webpack_require__(539); +const http_client_1 = __webpack_require__(22); +const constants_1 = __webpack_require__(931); function isSuccessStatusCode(statusCode) { if (!statusCode) { return false; @@ -53387,47 +57893,74 @@ function isRetryableStatusCode(statusCode) { return retryableStatusCodes.includes(statusCode); } exports.isRetryableStatusCode = isRetryableStatusCode; -function retry(name, method, getStatusCode, maxAttempts = 2) { +function sleep(milliseconds) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(resolve => setTimeout(resolve, milliseconds)); + }); +} +function retry(name, method, getStatusCode, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay, onError = undefined) { return __awaiter(this, void 0, void 0, function* () { - let response = undefined; - let statusCode = undefined; - let isRetryable = false; let errorMessage = ''; let attempt = 1; while (attempt <= maxAttempts) { + let response = undefined; + let statusCode = undefined; + let isRetryable = false; try { response = yield method(); + } + catch (error) { + if (onError) { + response = onError(error); + } + isRetryable = true; + errorMessage = error.message; + } + if (response) { statusCode = getStatusCode(response); if (!isServerErrorStatusCode(statusCode)) { return response; } + } + if (statusCode) { isRetryable = isRetryableStatusCode(statusCode); errorMessage = `Cache service responded with ${statusCode}`; } - catch (error) { - isRetryable = true; - errorMessage = error.message; - } core.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); if (!isRetryable) { core.debug(`${name} - Error is not retryable`); break; } + yield sleep(delay); attempt++; } throw Error(`${name} failed: ${errorMessage}`); }); } exports.retry = retry; -function retryTypedResponse(name, method, maxAttempts = 2) { +function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { return __awaiter(this, void 0, void 0, function* () { - return yield retry(name, method, (response) => response.statusCode, maxAttempts); + return yield retry(name, method, (response) => response.statusCode, maxAttempts, delay, + // If the error object contains the statusCode property, extract it and return + // an ITypedResponse so it can be processed by the retry logic. + (error) => { + if (error instanceof http_client_1.HttpClientError) { + return { + statusCode: error.statusCode, + result: null, + headers: {} + }; + } + else { + return undefined; + } + }); }); } exports.retryTypedResponse = retryTypedResponse; -function retryHttpClientResponse(name, method, maxAttempts = 2) { +function retryHttpClientResponse(name, method, maxAttempts = constants_1.DefaultRetryAttempts, delay = constants_1.DefaultRetryDelay) { return __awaiter(this, void 0, void 0, function* () { - return yield retry(name, method, (response) => response.message.statusCode, maxAttempts); + return yield retry(name, method, (response) => response.message.statusCode, maxAttempts, delay); }); } exports.retryHttpClientResponse = retryHttpClientResponse; @@ -53482,24 +58015,23 @@ function state(list, sortMethod) /***/ }), /* 904 */, /* 905 */, -/* 906 */, +/* 906 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=attributes.js.map + +/***/ }), /* 907 */, /* 908 */, /* 909 */, -/* 910 */, -/* 911 */, -/* 912 */, -/* 913 */, -/* 914 */, -/* 915 */, -/* 916 */, -/* 917 */ -/***/ (function(__unusedmodule, exports) { +/* 910 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TraceFlags = void 0; /* * Copyright The OpenTelemetry Authors * @@ -53515,16 +58047,28 @@ exports.TraceFlags = void 0; * See the License for the specific language governing permissions and * limitations under the License. */ -var TraceFlags; -(function (TraceFlags) { - /** Represents no flag set. */ - TraceFlags[TraceFlags["NONE"] = 0] = "NONE"; - /** Bit to represent whether trace is sampled in trace flags. */ - TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED"; -})(TraceFlags = exports.TraceFlags || (exports.TraceFlags = {})); -//# sourceMappingURL=trace_flags.js.map +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(764), exports); +//# sourceMappingURL=index.js.map /***/ }), +/* 911 */, +/* 912 */, +/* 913 */, +/* 914 */, +/* 915 */, +/* 916 */, +/* 917 */, /* 918 */, /* 919 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -53576,17 +58120,27 @@ var TraceFlags; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const assert = __webpack_require__(357); -const os = __webpack_require__(87); -const path = __webpack_require__(622); -const pathHelper = __webpack_require__(972); +const os = __importStar(__webpack_require__(87)); +const path = __importStar(__webpack_require__(622)); +const pathHelper = __importStar(__webpack_require__(972)); +const assert_1 = __importDefault(__webpack_require__(357)); const minimatch_1 = __webpack_require__(93); const internal_match_kind_1 = __webpack_require__(327); const internal_path_1 = __webpack_require__(383); const IS_WINDOWS = process.platform === 'win32'; class Pattern { - constructor(patternOrNegate, segments) { + constructor(patternOrNegate, segments, homedir) { /** * Indicates whether matches should be excluded from the result set */ @@ -53600,9 +58154,9 @@ class Pattern { else { // Convert to pattern segments = segments || []; - assert(segments.length, `Parameter 'segments' must not empty`); + assert_1.default(segments.length, `Parameter 'segments' must not empty`); const root = Pattern.getLiteral(segments[0]); - assert(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); + assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); pattern = new internal_path_1.Path(segments).toString().trim(); if (patternOrNegate) { pattern = `!${pattern}`; @@ -53614,7 +58168,7 @@ class Pattern { pattern = pattern.substr(1).trim(); } // Normalize slashes and ensures absolute root - pattern = Pattern.fixupPattern(pattern); + pattern = Pattern.fixupPattern(pattern, homedir); // Segments this.segments = new internal_path_1.Path(pattern).segments; // Trailing slash indicates the pattern should only match directories, not regular files @@ -53651,11 +58205,11 @@ class Pattern { // Normalize slashes itemPath = pathHelper.normalizeSeparators(itemPath); // Append a trailing slash. Otherwise Minimatch will not match the directory immediately - // preceeding the globstar. For example, given the pattern `/foo/**`, Minimatch returns + // preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns // false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk. if (!itemPath.endsWith(path.sep)) { // Note, this is safe because the constructor ensures the pattern has an absolute root. - // For example, formats like C: and C:foo on Windows are resolved to an aboslute root. + // For example, formats like C: and C:foo on Windows are resolved to an absolute root. itemPath = `${itemPath}${path.sep}`; } } @@ -53693,15 +58247,15 @@ class Pattern { /** * Normalizes slashes and ensures absolute root */ - static fixupPattern(pattern) { + static fixupPattern(pattern, homedir) { // Empty - assert(pattern, 'pattern cannot be empty'); + assert_1.default(pattern, 'pattern cannot be empty'); // Must not contain `.` segment, unless first segment // Must not contain `..` segment const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); - assert(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); + assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r - assert(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); + assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); // Normalize slashes pattern = pathHelper.normalizeSeparators(pattern); // Replace leading `.` segment @@ -53710,9 +58264,9 @@ class Pattern { } // Replace leading `~` segment else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { - const homedir = os.homedir(); - assert(homedir, 'Unable to determine HOME directory'); - assert(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); + homedir = homedir || os.homedir(); + assert_1.default(homedir, 'Unable to determine HOME directory'); + assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); pattern = Pattern.globEscape(homedir) + pattern.substr(1); } // Replace relative drive root, e.g. pattern is C: or C:foo @@ -53808,7 +58362,53 @@ exports.Pattern = Pattern; //# sourceMappingURL=internal-pattern.js.map /***/ }), -/* 924 */, +/* 924 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NoopContextManager = void 0; +var context_1 = __webpack_require__(715); +var NoopContextManager = /** @class */ (function () { + function NoopContextManager() { + } + NoopContextManager.prototype.active = function () { + return context_1.Context.ROOT_CONTEXT; + }; + NoopContextManager.prototype.with = function (context, fn) { + return fn(); + }; + NoopContextManager.prototype.bind = function (target, context) { + return target; + }; + NoopContextManager.prototype.enable = function () { + return this; + }; + NoopContextManager.prototype.disable = function () { + return this; + }; + return NoopContextManager; +}()); +exports.NoopContextManager = NoopContextManager; +//# sourceMappingURL=NoopContextManager.js.map + +/***/ }), /* 925 */, /* 926 */, /* 927 */, @@ -54133,6 +58733,10 @@ var CompressionMethod; CompressionMethod["ZstdWithoutLong"] = "zstd-without-long"; CompressionMethod["Zstd"] = "zstd"; })(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {})); +// The default number of retry attempts. +exports.DefaultRetryAttempts = 2; +// The default delay in milliseconds between retry attempts. +exports.DefaultRetryDelay = 5000; // Socket timeout in milliseconds during download. If no traffic is received // over the socket during this period, the socket is destroyed and the download // is aborted. @@ -54145,22 +58749,8 @@ exports.SocketTimeout = 5000; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.CanonicalCode = void 0; /** * An enumeration of canonical status codes. */ @@ -54346,35 +58936,41 @@ function terminator(callback) /* 941 */, /* 942 */, /* 943 */, -/* 944 */, -/* 945 */, -/* 946 */, -/* 947 */, -/* 948 */, -/* 949 */ -/***/ (function(__unusedmodule, exports) { +/* 944 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=Meter.js.map + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = rng; + +var _crypto = _interopRequireDefault(__webpack_require__(417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} /***/ }), +/* 945 */, +/* 946 */, +/* 947 */, +/* 948 */, +/* 949 */, /* 950 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -54491,87 +59087,7 @@ exports.checkBypass = checkBypass; /* 963 */, /* 964 */, /* 965 */, -/* 966 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Context = void 0; -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var Context = /** @class */ (function () { - /** - * Construct a new context which inherits values from an optional parent context. - * - * @param parentContext a context from which to inherit values - */ - function Context(parentContext) { - this._currentContext = parentContext ? new Map(parentContext) : new Map(); - } - /** Get a key to uniquely identify a context value */ - Context.createKey = function (description) { - return Symbol(description); - }; - /** - * Get a value from the context. - * - * @param key key which identifies a context value - */ - Context.prototype.getValue = function (key) { - return this._currentContext.get(key); - }; - /** - * Create a new context which inherits from this context and has - * the given key set to the given value. - * - * @param key context key for which to set the value - * @param value value to set for the given key - */ - Context.prototype.setValue = function (key, value) { - var context = new Context(this._currentContext); - context._currentContext.set(key, value); - return context; - }; - /** - * Return a new context which inherits from this context but does - * not contain a value for the given key. - * - * @param key context key for which to clear a value - */ - Context.prototype.deleteValue = function (key) { - var context = new Context(this._currentContext); - context._currentContext.delete(key); - return context; - }; - /** The root context is used as the default parent context when there is no active context */ - Context.ROOT_CONTEXT = new Context(); - /** - * This is another identifier to the root context which allows developers to easily search the - * codebase for direct uses of context which need to be removed in later PRs. - * - * It's existence is temporary and it should be removed when all references are fixed. - */ - Context.TODO = Context.ROOT_CONTEXT; - return Context; -}()); -exports.Context = Context; -//# sourceMappingURL=context.js.map - -/***/ }), +/* 966 */, /* 967 */, /* 968 */, /* 969 */, @@ -54582,9 +59098,19 @@ exports.Context = Context; "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const assert = __webpack_require__(357); -const path = __webpack_require__(622); +const path = __importStar(__webpack_require__(622)); +const assert_1 = __importDefault(__webpack_require__(357)); const IS_WINDOWS = process.platform === 'win32'; /** * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. @@ -54624,8 +59150,8 @@ exports.dirname = dirname; * or `C:` are expanded based on the current working directory. */ function ensureAbsoluteRoot(root, itemPath) { - assert(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); - assert(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); + assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); + assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); // Already rooted if (hasAbsoluteRoot(itemPath)) { return itemPath; @@ -54635,7 +59161,7 @@ function ensureAbsoluteRoot(root, itemPath) { // Check for itemPath like C: or C:foo if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { let cwd = process.cwd(); - assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); + assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); // Drive letter matches cwd? Expand to cwd if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { // Drive only, e.g. C: @@ -54660,11 +59186,11 @@ function ensureAbsoluteRoot(root, itemPath) { // Check for itemPath like \ or \foo else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { const cwd = process.cwd(); - assert(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); + assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); return `${cwd[0]}:\\${itemPath.substr(1)}`; } } - assert(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); + assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); // Otherwise ensure root ends with a separator if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { // Intentionally empty @@ -54681,7 +59207,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot; * `\\hello\share` and `C:\hello` (and using alternate separator). */ function hasAbsoluteRoot(itemPath) { - assert(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); // Normalize separators itemPath = normalizeSeparators(itemPath); // Windows @@ -54698,7 +59224,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot; * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). */ function hasRoot(itemPath) { - assert(itemPath, `isRooted parameter 'itemPath' must not be empty`); + assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`); // Normalize separators itemPath = normalizeSeparators(itemPath); // Windows @@ -54765,8 +59291,10 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; "use strict"; -/*! - * Copyright 2019, OpenTelemetry Authors +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TraceFlags = void 0; +/* + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54780,12 +59308,6 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * An enumeration that represents global trace flags. These flags are - * propagated to all child {@link Span}. These determine features such as - * whether a Span should be traced. It is implemented as a bitmask. - */ var TraceFlags; (function (TraceFlags) { /** Represents no flag set. */ @@ -54796,7 +59318,59 @@ var TraceFlags; //# sourceMappingURL=trace_flags.js.map /***/ }), -/* 976 */, +/* 976 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.API_BACKWARDS_COMPATIBILITY_VERSION = exports.makeGetter = exports._global = exports.GLOBAL_TRACE_API_KEY = exports.GLOBAL_PROPAGATION_API_KEY = exports.GLOBAL_METRICS_API_KEY = exports.GLOBAL_CONTEXT_MANAGER_API_KEY = void 0; +var platform_1 = __webpack_require__(910); +exports.GLOBAL_CONTEXT_MANAGER_API_KEY = Symbol.for('io.opentelemetry.js.api.context'); +exports.GLOBAL_METRICS_API_KEY = Symbol.for('io.opentelemetry.js.api.metrics'); +exports.GLOBAL_PROPAGATION_API_KEY = Symbol.for('io.opentelemetry.js.api.propagation'); +exports.GLOBAL_TRACE_API_KEY = Symbol.for('io.opentelemetry.js.api.trace'); +exports._global = platform_1._globalThis; +/** + * Make a function which accepts a version integer and returns the instance of an API if the version + * is compatible, or a fallback version (usually NOOP) if it is not. + * + * @param requiredVersion Backwards compatibility version which is required to return the instance + * @param instance Instance which should be returned if the required version is compatible + * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible + */ +function makeGetter(requiredVersion, instance, fallback) { + return function (version) { + return version === requiredVersion ? instance : fallback; + }; +} +exports.makeGetter = makeGetter; +/** + * A number which should be incremented each time a backwards incompatible + * change is made to the API. This number is used when an API package + * attempts to access the global API to ensure it is getting a compatible + * version. If the global API is not compatible with the API package + * attempting to get it, a NOOP API implementation will be returned. + */ +exports.API_BACKWARDS_COMPATIBILITY_VERSION = 0; +//# sourceMappingURL=global-utils.js.map + +/***/ }), /* 977 */, /* 978 */, /* 979 */ @@ -54875,303 +59449,11 @@ exports.RetryHelper = RetryHelper; //# sourceMappingURL=retry-helper.js.map /***/ }), -/* 980 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_TRACER = exports.NoopTracer = void 0; -var NoopSpan_1 = __webpack_require__(340); -/** - * No-op implementations of {@link Tracer}. - */ -var NoopTracer = /** @class */ (function () { - function NoopTracer() { - } - NoopTracer.prototype.getCurrentSpan = function () { - return NoopSpan_1.NOOP_SPAN; - }; - // startSpan starts a noop span. - NoopTracer.prototype.startSpan = function (name, options) { - return NoopSpan_1.NOOP_SPAN; - }; - NoopTracer.prototype.withSpan = function (span, fn) { - return fn(); - }; - NoopTracer.prototype.bind = function (target, span) { - return target; - }; - return NoopTracer; -}()); -exports.NoopTracer = NoopTracer; -exports.NOOP_TRACER = new NoopTracer(); -//# sourceMappingURL=NoopTracer.js.map - -/***/ }), +/* 980 */, /* 981 */, -/* 982 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - 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 extendStatics(d, b); - }; - 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 }); -exports.NOOP_BATCH_OBSERVER_METRIC = exports.NOOP_SUM_OBSERVER_METRIC = exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = exports.NOOP_VALUE_OBSERVER_METRIC = exports.NOOP_BOUND_BASE_OBSERVER = exports.NOOP_VALUE_RECORDER_METRIC = exports.NOOP_BOUND_VALUE_RECORDER = exports.NOOP_COUNTER_METRIC = exports.NOOP_BOUND_COUNTER = exports.NOOP_METER = exports.NoopBoundBaseObserver = exports.NoopBoundValueRecorder = exports.NoopBoundCounter = exports.NoopBatchObserverMetric = exports.NoopBaseObserverMetric = exports.NoopValueRecorderMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0; -/** - * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses - * constant NoopMetrics for all of its methods. - */ -var NoopMeter = /** @class */ (function () { - function NoopMeter() { - } - /** - * Returns constant noop value recorder. - * @param name the name of the metric. - * @param [options] the metric options. - */ - NoopMeter.prototype.createValueRecorder = function (name, options) { - return exports.NOOP_VALUE_RECORDER_METRIC; - }; - /** - * Returns a constant noop counter. - * @param name the name of the metric. - * @param [options] the metric options. - */ - NoopMeter.prototype.createCounter = function (name, options) { - return exports.NOOP_COUNTER_METRIC; - }; - /** - * Returns a constant noop UpDownCounter. - * @param name the name of the metric. - * @param [options] the metric options. - */ - NoopMeter.prototype.createUpDownCounter = function (name, options) { - return exports.NOOP_COUNTER_METRIC; - }; - /** - * Returns constant noop value observer. - * @param name the name of the metric. - * @param [options] the metric options. - * @param [callback] the value observer callback - */ - NoopMeter.prototype.createValueObserver = function (name, options, callback) { - return exports.NOOP_VALUE_OBSERVER_METRIC; - }; - /** - * Returns constant noop batch observer. - * @param name the name of the metric. - * @param callback the batch observer callback - */ - NoopMeter.prototype.createBatchObserver = function (name, callback) { - return exports.NOOP_BATCH_OBSERVER_METRIC; - }; - return NoopMeter; -}()); -exports.NoopMeter = NoopMeter; -var NoopMetric = /** @class */ (function () { - function NoopMetric(instrument) { - this._instrument = instrument; - } - /** - * Returns a Bound Instrument associated with specified Labels. - * It is recommended to keep a reference to the Bound Instrument instead of - * always calling this method for every operations. - * @param labels key-values pairs that are associated with a specific metric - * that you want to record. - */ - NoopMetric.prototype.bind = function (labels) { - return this._instrument; - }; - /** - * Removes the Binding from the metric, if it is present. - * @param labels key-values pairs that are associated with a specific metric. - */ - NoopMetric.prototype.unbind = function (labels) { - return; - }; - /** - * Clears all timeseries from the Metric. - */ - NoopMetric.prototype.clear = function () { - return; - }; - return NoopMetric; -}()); -exports.NoopMetric = NoopMetric; -var NoopCounterMetric = /** @class */ (function (_super) { - __extends(NoopCounterMetric, _super); - function NoopCounterMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - NoopCounterMetric.prototype.add = function (value, labels) { - this.bind(labels).add(value); - }; - return NoopCounterMetric; -}(NoopMetric)); -exports.NoopCounterMetric = NoopCounterMetric; -var NoopValueRecorderMetric = /** @class */ (function (_super) { - __extends(NoopValueRecorderMetric, _super); - function NoopValueRecorderMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - NoopValueRecorderMetric.prototype.record = function (value, labels, correlationContext, spanContext) { - if (typeof correlationContext === 'undefined') { - this.bind(labels).record(value); - } - else if (typeof spanContext === 'undefined') { - this.bind(labels).record(value, correlationContext); - } - else { - this.bind(labels).record(value, correlationContext, spanContext); - } - }; - return NoopValueRecorderMetric; -}(NoopMetric)); -exports.NoopValueRecorderMetric = NoopValueRecorderMetric; -var NoopBaseObserverMetric = /** @class */ (function (_super) { - __extends(NoopBaseObserverMetric, _super); - function NoopBaseObserverMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - NoopBaseObserverMetric.prototype.observation = function () { - return { - observer: this, - value: 0, - }; - }; - return NoopBaseObserverMetric; -}(NoopMetric)); -exports.NoopBaseObserverMetric = NoopBaseObserverMetric; -var NoopBatchObserverMetric = /** @class */ (function (_super) { - __extends(NoopBatchObserverMetric, _super); - function NoopBatchObserverMetric() { - return _super !== null && _super.apply(this, arguments) || this; - } - return NoopBatchObserverMetric; -}(NoopMetric)); -exports.NoopBatchObserverMetric = NoopBatchObserverMetric; -var NoopBoundCounter = /** @class */ (function () { - function NoopBoundCounter() { - } - NoopBoundCounter.prototype.add = function (value) { - return; - }; - return NoopBoundCounter; -}()); -exports.NoopBoundCounter = NoopBoundCounter; -var NoopBoundValueRecorder = /** @class */ (function () { - function NoopBoundValueRecorder() { - } - NoopBoundValueRecorder.prototype.record = function (value, correlationContext, spanContext) { - return; - }; - return NoopBoundValueRecorder; -}()); -exports.NoopBoundValueRecorder = NoopBoundValueRecorder; -var NoopBoundBaseObserver = /** @class */ (function () { - function NoopBoundBaseObserver() { - } - NoopBoundBaseObserver.prototype.update = function (value) { }; - return NoopBoundBaseObserver; -}()); -exports.NoopBoundBaseObserver = NoopBoundBaseObserver; -exports.NOOP_METER = new NoopMeter(); -exports.NOOP_BOUND_COUNTER = new NoopBoundCounter(); -exports.NOOP_COUNTER_METRIC = new NoopCounterMetric(exports.NOOP_BOUND_COUNTER); -exports.NOOP_BOUND_VALUE_RECORDER = new NoopBoundValueRecorder(); -exports.NOOP_VALUE_RECORDER_METRIC = new NoopValueRecorderMetric(exports.NOOP_BOUND_VALUE_RECORDER); -exports.NOOP_BOUND_BASE_OBSERVER = new NoopBoundBaseObserver(); -exports.NOOP_VALUE_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); -exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); -exports.NOOP_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER); -exports.NOOP_BATCH_OBSERVER_METRIC = new NoopBatchObserverMetric(); -//# sourceMappingURL=NoopMeter.js.map - -/***/ }), +/* 982 */, /* 983 */, -/* 984 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0; -var NoopMeter_1 = __webpack_require__(982); -/** - * An implementation of the {@link MeterProvider} which returns an impotent Meter - * for all calls to `getMeter` - */ -var NoopMeterProvider = /** @class */ (function () { - function NoopMeterProvider() { - } - NoopMeterProvider.prototype.getMeter = function (_name, _version) { - return NoopMeter_1.NOOP_METER; - }; - return NoopMeterProvider; -}()); -exports.NoopMeterProvider = NoopMeterProvider; -exports.NOOP_METER_PROVIDER = new NoopMeterProvider(); -//# sourceMappingURL=NoopMeterProvider.js.map - -/***/ }), +/* 984 */, /* 985 */, /* 986 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -55273,37 +59555,7 @@ exports.exec = exec; /***/ }), -/* 993 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueType = void 0; -/** The Type of value. It describes how the data is reported. */ -var ValueType; -(function (ValueType) { - ValueType[ValueType["INT"] = 0] = "INT"; - ValueType[ValueType["DOUBLE"] = 1] = "DOUBLE"; -})(ValueType = exports.ValueType || (exports.ValueType = {})); -//# sourceMappingURL=Metric.js.map - -/***/ }), +/* 993 */, /* 994 */, /* 995 */, /* 996 */, @@ -55319,8 +59571,8 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var uuid = __webpack_require__(585); var tslib = __webpack_require__(865); +var uuid = __webpack_require__(585); var tough = __webpack_require__(393); var http = __webpack_require__(605); var https = __webpack_require__(211); @@ -55328,14 +59580,15 @@ var node_fetch = _interopDefault(__webpack_require__(454)); var abortController = __webpack_require__(106); var FormData = _interopDefault(__webpack_require__(790)); var util = __webpack_require__(669); +var url = __webpack_require__(835); var stream = __webpack_require__(794); var tunnel = __webpack_require__(413); var coreAuth = __webpack_require__(229); var logger$1 = __webpack_require__(928); var xml2js = __webpack_require__(992); var os = __webpack_require__(87); -var coreTracing = __webpack_require__(894); -var api = __webpack_require__(827); +var coreTracing = __webpack_require__(263); +var api = __webpack_require__(440); // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. @@ -55511,7 +59764,7 @@ var Constants = { * @const * @type {string} */ - coreHttpVersion: "1.1.6", + coreHttpVersion: "1.2.1", /** * Specifies HTTP. * @@ -55540,6 +59793,20 @@ var Constants = { * @type {string} */ HTTPS_PROXY: "HTTPS_PROXY", + /** + * Specifies NO Proxy. + * + * @const + * @type {string} + */ + NO_PROXY: "NO_PROXY", + /** + * Specifies ALL Proxy. + * + * @const + * @type {string} + */ + ALL_PROXY: "ALL_PROXY", HttpConstants: { /** * Http Verbs @@ -55591,6 +59858,17 @@ var Constants = { } }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +/** + * Default key used to access the XML attributes. + */ +var XML_ATTRKEY = "$"; +/** + * Default key used to access the XML value content. + */ +var XML_CHARKEY = "_"; + // Copyright (c) Microsoft Corporation. var 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; /** @@ -55730,12 +60008,17 @@ function promiseToServiceCallback(promise) { }); }; } -function prepareXMLRootList(obj, elementName) { - var _a; +function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) { + var _a, _b, _c; if (!Array.isArray(obj)) { obj = [obj]; } - return _a = {}, _a[elementName] = obj, _a; + if (!xmlNamespaceKey || !xmlNamespace) { + return _a = {}, _a[elementName] = obj, _a; + } + var result = (_b = {}, _b[elementName] = obj, _b); + result[XML_ATTRKEY] = (_c = {}, _c[xmlNamespaceKey] = xmlNamespace, _c); + return result; } /** * Applies the properties on the prototype of sourceCtors to the prototype of targetCtor @@ -55777,6 +60060,15 @@ function replaceAll(value, searchValue, replaceValue) { function isPrimitiveType(value) { return (typeof value !== "object" && typeof value !== "function") || value === null; } +function getEnvironmentValue(name) { + if (process.env[name]) { + return process.env[name]; + } + else if (process.env[name.toLowerCase()]) { + return process.env[name.toLowerCase()]; + } + return undefined; +} // Copyright (c) Microsoft Corporation. var Serializer = /** @class */ (function () { @@ -55839,9 +60131,18 @@ var Serializer = /** @class */ (function () { * * @param {string} objectName Name of the serialized object * + * @param {options} options additional options to deserialization + * * @returns {object|string|Array|number|boolean|Date|stream} A valid serialized Javascript object */ - Serializer.prototype.serialize = function (mapper, object, objectName) { + Serializer.prototype.serialize = function (mapper, object, objectName, options) { + var _a, _b, _c; + if (options === void 0) { options = {}; } + var updatedOptions = { + rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "", + includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false, + xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY + }; var payload = {}; var mapperType = mapper.type.name; if (!objectName) { @@ -55898,13 +60199,13 @@ var Serializer = /** @class */ (function () { payload = serializeBase64UrlType(objectName, object); } else if (mapperType.match(/^Sequence$/i) !== null) { - payload = serializeSequenceType(this, mapper, object, objectName); + payload = serializeSequenceType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions); } else if (mapperType.match(/^Dictionary$/i) !== null) { - payload = serializeDictionaryType(this, mapper, object, objectName); + payload = serializeDictionaryType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions); } else if (mapperType.match(/^Composite$/i) !== null) { - payload = serializeCompositeType(this, mapper, object, objectName); + payload = serializeCompositeType(this, mapper, object, objectName, Boolean(this.isXML), updatedOptions); } } return payload; @@ -55918,9 +60219,18 @@ var Serializer = /** @class */ (function () { * * @param {string} objectName Name of the deserialized object * + * @param options Controls behavior of XML parser and builder. + * * @returns {object|string|Array|number|boolean|Date|stream} A valid deserialized Javascript object */ - Serializer.prototype.deserialize = function (mapper, responseBody, objectName) { + Serializer.prototype.deserialize = function (mapper, responseBody, objectName, options) { + var _a, _b, _c; + if (options === void 0) { options = {}; } + var updatedOptions = { + rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "", + includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false, + xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY + }; if (responseBody == undefined) { if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) { // Edge case for empty XML non-wrapped lists. xml2js can't distinguish @@ -55940,17 +60250,18 @@ var Serializer = /** @class */ (function () { objectName = mapper.serializedName; } if (mapperType.match(/^Composite$/i) !== null) { - payload = deserializeCompositeType(this, mapper, responseBody, objectName); + payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions); } else { if (this.isXML) { + var xmlCharKey = updatedOptions.xmlCharKey; /** * If the mapper specifies this as a non-composite type value but the responseBody contains - * both header ("$") and body ("_") properties, then just reduce the responseBody value to - * the body ("_") property. + * 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["$"] != undefined && responseBody["_"] != undefined) { - responseBody = responseBody["_"]; + if (responseBody[XML_ATTRKEY] != undefined && responseBody[xmlCharKey] != undefined) { + responseBody = responseBody[xmlCharKey]; } } if (mapperType.match(/^Number$/i) !== null) { @@ -55986,10 +60297,10 @@ var Serializer = /** @class */ (function () { payload = base64UrlToByteArray(responseBody); } else if (mapperType.match(/^Sequence$/i) !== null) { - payload = deserializeSequenceType(this, mapper, responseBody, objectName); + payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions); } else if (mapperType.match(/^Dictionary$/i) !== null) { - payload = deserializeDictionaryType(this, mapper, responseBody, objectName); + payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions); } } if (mapper.isConstant) { @@ -56094,7 +60405,7 @@ function serializeBasicTypes(typeName, objectName, value) { objectType !== "function" && !(value instanceof ArrayBuffer) && !ArrayBuffer.isView(value) && - !(typeof Blob === "function" && value instanceof Blob)) { + !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) { throw new Error(objectName + " must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream."); } } @@ -56178,7 +60489,8 @@ function serializeDateTypes(typeName, value, objectName) { } return value; } -function serializeSequenceType(serializer, mapper, object, objectName) { +function serializeSequenceType(serializer, mapper, object, objectName, isXml, options) { + var _a, _b; if (!Array.isArray(object)) { throw new Error(objectName + " must be of type Array."); } @@ -56189,11 +60501,29 @@ function serializeSequenceType(serializer, mapper, object, objectName) { } var tempArray = []; for (var i = 0; i < object.length; i++) { - tempArray[i] = serializer.serialize(elementType, object[i], objectName); + var serializedValue = serializer.serialize(elementType, object[i], objectName, options); + if (isXml && elementType.xmlNamespace) { + var xmlnsKey = elementType.xmlNamespacePrefix + ? "xmlns:" + elementType.xmlNamespacePrefix + : "xmlns"; + if (elementType.type.name === "Composite") { + tempArray[i] = tslib.__assign({}, serializedValue); + tempArray[i][XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = elementType.xmlNamespace, _a); + } + else { + tempArray[i] = {}; + tempArray[i][options.xmlCharKey] = serializedValue; + tempArray[i][XML_ATTRKEY] = (_b = {}, _b[xmlnsKey] = elementType.xmlNamespace, _b); + } + } + else { + tempArray[i] = serializedValue; + } } return tempArray; } -function serializeDictionaryType(serializer, mapper, object, objectName) { +function serializeDictionaryType(serializer, mapper, object, objectName, isXml, options) { + var _a; if (typeof object !== "object") { throw new Error(objectName + " must be of type object."); } @@ -56203,12 +60533,48 @@ function serializeDictionaryType(serializer, mapper, object, objectName) { ("mapper and it must of type \"object\" in " + objectName + ".")); } var tempDictionary = {}; - for (var _i = 0, _a = Object.keys(object); _i < _a.length; _i++) { - var key = _a[_i]; - tempDictionary[key] = serializer.serialize(valueType, object[key], objectName + "." + key); + for (var _i = 0, _b = Object.keys(object); _i < _b.length; _i++) { + var key = _b[_i]; + var 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) { + var xmlnsKey = mapper.xmlNamespacePrefix ? "xmlns:" + mapper.xmlNamespacePrefix : "xmlns"; + var result = tempDictionary; + result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a); + 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) { + var additionalProperties = mapper.type.additionalProperties; + if (!additionalProperties && mapper.type.className) { + var 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) { + var 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 @@ -56217,32 +60583,28 @@ function serializeDictionaryType(serializer, mapper, object, objectName) { function resolveModelProperties(serializer, mapper, objectName) { var modelProps = mapper.type.modelProperties; if (!modelProps) { - var 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) + "\"."); - } - var modelMapper = serializer.modelMappers[className]; + var modelMapper = resolveReferencedMapper(serializer, mapper, objectName); if (!modelMapper) { - throw new Error("mapper() cannot be null or undefined for model \"" + className + "\"."); + throw new Error("mapper() cannot be null or undefined for model \"" + mapper.type.className + "\"."); } - modelProps = modelMapper.type.modelProperties; + 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 \"" + className + "\" for object \"" + objectName + "\".")); + ("mapper \"" + JSON.stringify(modelMapper) + "\" of type \"" + mapper.type.className + "\" for object \"" + objectName + "\".")); } } return modelProps; } -function serializeCompositeType(serializer, mapper, object, objectName) { - var _a; +function serializeCompositeType(serializer, mapper, object, objectName, isXml, options) { + var _a, _b; if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) { mapper = getPolymorphicMapper(serializer, mapper, object, "clientName"); } if (object != undefined) { var payload = {}; var modelProps = resolveModelProperties(serializer, mapper, objectName); - for (var _i = 0, _b = Object.keys(modelProps); _i < _b.length; _i++) { - var key = _b[_i]; + for (var _i = 0, _c = Object.keys(modelProps); _i < _c.length; _i++) { + var key = _c[_i]; var propertyMapper = modelProps[key]; if (propertyMapper.readOnly) { continue; @@ -56260,8 +60622,8 @@ function serializeCompositeType(serializer, mapper, object, objectName) { else { var paths = splitSerializeName(propertyMapper.serializedName); propName = paths.pop(); - for (var _c = 0, paths_1 = paths; _c < paths_1.length; _c++) { - var pathName = paths_1[_c]; + for (var _d = 0, paths_1 = paths; _d < paths_1.length; _d++) { + var pathName = paths_1[_d]; var childObject = parentObject[pathName]; if (childObject == undefined && (object[key] != undefined || propertyMapper.defaultValue !== undefined)) { @@ -56271,6 +60633,12 @@ function serializeCompositeType(serializer, mapper, object, objectName) { } } if (parentObject != undefined) { + if (isXml && mapper.xmlNamespace) { + var xmlnsKey = mapper.xmlNamespacePrefix + ? "xmlns:" + mapper.xmlNamespacePrefix + : "xmlns"; + parentObject[XML_ATTRKEY] = tslib.__assign(tslib.__assign({}, parentObject[XML_ATTRKEY]), (_a = {}, _a[xmlnsKey] = mapper.xmlNamespace, _a)); + } var propertyObjectName = propertyMapper.serializedName !== "" ? objectName + "." + propertyMapper.serializedName : objectName; @@ -56281,31 +60649,32 @@ function serializeCompositeType(serializer, mapper, object, objectName) { toSerialize == undefined) { toSerialize = mapper.serializedName; } - var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName); + var serializedValue = serializer.serialize(propertyMapper, toSerialize, propertyObjectName, options); if (serializedValue !== undefined && propName != undefined) { - if (propertyMapper.xmlIsAttribute) { - // $ is the key attributes are kept under in xml2js. + var 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.$ = parentObject.$ || {}; - parentObject.$[propName] = serializedValue; + parentObject[XML_ATTRKEY] = parentObject[XML_ATTRKEY] || {}; + parentObject[XML_ATTRKEY][propName] = serializedValue; } - else if (propertyMapper.xmlIsWrapped) { - parentObject[propName] = (_a = {}, _a[propertyMapper.xmlElementName] = serializedValue, _a); + else if (isXml && propertyMapper.xmlIsWrapped) { + parentObject[propName] = (_b = {}, _b[propertyMapper.xmlElementName] = value, _b); } else { - parentObject[propName] = serializedValue; + parentObject[propName] = value; } } } } - var additionalPropertiesMapper = mapper.type.additionalProperties; + var additionalPropertiesMapper = resolveAdditionalProperties(serializer, mapper, objectName); if (additionalPropertiesMapper) { var propNames = Object.keys(modelProps); var _loop_1 = function (clientPropName) { var isAdditionalProperty = propNames.every(function (pn) { return pn !== clientPropName; }); if (isAdditionalProperty) { - payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]'); + payload[clientPropName] = serializer.serialize(additionalPropertiesMapper, object[clientPropName], objectName + '["' + clientPropName + '"]', options); } }; for (var clientPropName in object) { @@ -56316,18 +60685,43 @@ function serializeCompositeType(serializer, mapper, object, objectName) { } return object; } -function isSpecialXmlProperty(propertyName) { - return ["$", "_"].includes(propertyName); +function getXmlObjectValue(propertyMapper, serializedValue, isXml, options) { + var _a; + if (!isXml || !propertyMapper.xmlNamespace) { + return serializedValue; + } + var xmlnsKey = propertyMapper.xmlNamespacePrefix + ? "xmlns:" + propertyMapper.xmlNamespacePrefix + : "xmlns"; + var xmlNamespace = (_a = {}, _a[xmlnsKey] = propertyMapper.xmlNamespace, _a); + if (["Composite"].includes(propertyMapper.type.name)) { + if (serializedValue[XML_ATTRKEY]) { + return serializedValue; + } + else { + var result_1 = tslib.__assign({}, serializedValue); + result_1[XML_ATTRKEY] = xmlNamespace; + return result_1; + } + } + var result = {}; + result[options.xmlCharKey] = serializedValue; + result[XML_ATTRKEY] = xmlNamespace; + return result; +} +function isSpecialXmlProperty(propertyName, options) { + return [XML_ATTRKEY, options.xmlCharKey].includes(propertyName); } -function deserializeCompositeType(serializer, mapper, responseBody, objectName) { +function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) { + var _a; if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) { mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName"); } var modelProps = resolveModelProperties(serializer, mapper, objectName); var instance = {}; var handledPropertyNames = []; - for (var _i = 0, _a = Object.keys(modelProps); _i < _a.length; _i++) { - var key = _a[_i]; + for (var _i = 0, _b = Object.keys(modelProps); _i < _b.length; _i++) { + var key = _b[_i]; var propertyMapper = modelProps[key]; var paths = splitSerializeName(modelProps[key].serializedName); handledPropertyNames.push(paths[0]); @@ -56339,31 +60733,44 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) var headerCollectionPrefix = propertyMapper.headerCollectionPrefix; if (headerCollectionPrefix) { var dictionary = {}; - for (var _b = 0, _c = Object.keys(responseBody); _b < _c.length; _b++) { - var headerKey = _c[_b]; + for (var _c = 0, _d = Object.keys(responseBody); _c < _d.length; _c++) { + var headerKey = _d[_c]; if (headerKey.startsWith(headerCollectionPrefix)) { - dictionary[headerKey.substring(headerCollectionPrefix.length)] = serializer.deserialize(propertyMapper.type.value, responseBody[headerKey], propertyObjectName); + 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.$) { - instance[key] = serializer.deserialize(propertyMapper, responseBody.$[xmlName], propertyObjectName); + if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) { + instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options); } else { var propertyName = xmlElementName || xmlName || serializedName; - var unwrappedProperty = responseBody[propertyName]; if (propertyMapper.xmlIsWrapped) { - unwrappedProperty = responseBody[xmlName]; - unwrappedProperty = unwrappedProperty && unwrappedProperty[xmlElementName]; - var isEmptyWrappedList = unwrappedProperty === undefined; - if (isEmptyWrappedList) { - unwrappedProperty = []; - } + /* a list of wrapped by + For the xml example below + + ... + ... + + the responseBody has + { + Cors: { + CorsRule: [{...}, {...}] + } + } + xmlName is "Cors" and xmlElementName is"CorsRule". + */ + var wrapped = responseBody[xmlName]; + var elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : []; + instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options); + } + else { + var property = responseBody[propertyName]; + instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options); } - instance[key] = serializer.deserialize(propertyMapper, unwrappedProperty, propertyObjectName); } } else { @@ -56371,8 +60778,8 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) var propertyInstance = void 0; var res = responseBody; // traversing the object step by step. - for (var _d = 0, paths_2 = paths; _d < paths_2.length; _d++) { - var item = paths_2[_d]; + for (var _e = 0, paths_2 = paths; _e < paths_2.length; _e++) { + var item = paths_2[_e]; if (!res) break; res = res[item]; @@ -56397,10 +60804,10 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) // paging if (Array.isArray(responseBody[key]) && modelProps[key].serializedName === "") { propertyInstance = responseBody[key]; - instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName); + instance = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options); } else if (propertyInstance !== undefined || propertyMapper.defaultValue !== undefined) { - serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName); + serializedValue = serializer.deserialize(propertyMapper, propertyInstance, propertyObjectName, options); instance[key] = serializedValue; } } @@ -56418,23 +60825,23 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName) }; for (var responsePropName in responseBody) { if (isAdditionalProperty(responsePropName)) { - instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]'); + instance[responsePropName] = serializer.deserialize(additionalPropertiesMapper, responseBody[responsePropName], objectName + '["' + responsePropName + '"]', options); } } } else if (responseBody) { - for (var _e = 0, _f = Object.keys(responseBody); _e < _f.length; _e++) { - var key = _f[_e]; + for (var _f = 0, _g = Object.keys(responseBody); _f < _g.length; _f++) { + var key = _g[_f]; if (instance[key] === undefined && !handledPropertyNames.includes(key) && - !isSpecialXmlProperty(key)) { + !isSpecialXmlProperty(key, options)) { instance[key] = responseBody[key]; } } } return instance; } -function deserializeDictionaryType(serializer, mapper, responseBody, objectName) { +function deserializeDictionaryType(serializer, mapper, responseBody, objectName, options) { var value = mapper.type.value; if (!value || typeof value !== "object") { throw new Error("\"value\" metadata for a Dictionary must be defined in the " + @@ -56444,13 +60851,13 @@ function deserializeDictionaryType(serializer, mapper, responseBody, objectName) var tempDictionary = {}; for (var _i = 0, _a = Object.keys(responseBody); _i < _a.length; _i++) { var key = _a[_i]; - tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName); + tempDictionary[key] = serializer.deserialize(value, responseBody[key], objectName, options); } return tempDictionary; } return responseBody; } -function deserializeSequenceType(serializer, mapper, responseBody, objectName) { +function deserializeSequenceType(serializer, mapper, responseBody, objectName, options) { var element = mapper.type.element; if (!element || typeof element !== "object") { throw new Error("element\" metadata for an Array must be defined in the " + @@ -56463,7 +60870,7 @@ function deserializeSequenceType(serializer, mapper, responseBody, objectName) { } var tempArray = []; for (var i = 0; i < responseBody.length; i++) { - tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]"); + tempArray[i] = serializer.deserialize(element, responseBody[i], objectName + "[" + i + "]", options); } return tempArray; } @@ -56764,7 +61171,7 @@ var WebResource = /** @class */ (function () { if (!this.headers.get("Content-Type")) { this.headers.set("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 + // set the request body. request.js automatically sets the Content-Length request header, so we need not set it explicitly this.body = options.body; if (options.body !== undefined && options.body !== null) { // body as a stream special case. set the body as-is and check for some special request headers specific to sending a stream. @@ -56917,11 +61324,6 @@ var URLQuery = /** @class */ (function () { break; case "ParameterValue": switch (currentCharacter) { - case "=": - parameterName = ""; - parameterValue = ""; - currentState = "Invalid"; - break; case "&": result.set(parameterName, parameterValue); parameterName = ""; @@ -56933,11 +61335,6 @@ var URLQuery = /** @class */ (function () { break; } break; - case "Invalid": - if (currentCharacter === "&") { - currentState = "ParameterName"; - } - break; default: throw new Error("Unrecognized URLQuery parse state: " + currentState); } @@ -57633,8 +62030,9 @@ var FetchHttpClient = /** @class */ (function () { if (typeof value === "function") { value = value(); } - // eslint-disable-next-line no-prototype-builtins - if (value && value.hasOwnProperty("value") && value.hasOwnProperty("options")) { + if (value && + Object.prototype.hasOwnProperty.call(value, "value") && + Object.prototype.hasOwnProperty.call(value, "options")) { requestForm_1.append(key, value.value, value.options); } else { @@ -57685,7 +62083,7 @@ var FetchHttpClient = /** @class */ (function () { return [4 /*yield*/, this.prepareRequest(httpRequest)]; case 1: platformSpecificRequestInit = _d.sent(); - requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal }, platformSpecificRequestInit); + requestInit = tslib.__assign({ body: body, headers: httpRequest.headers.rawHeaders(), method: httpRequest.method, signal: abortController$1.signal, redirect: "manual" }, platformSpecificRequestInit); _d.label = 2; case 2: _d.trys.push([2, 8, 9, 10]); @@ -58165,13 +62563,12 @@ var xml2jsDefaultOptionsV2 = { trim: false, normalize: false, normalizeTags: false, - attrkey: "$", - charkey: "_", + attrkey: XML_ATTRKEY, explicitArray: true, ignoreAttrs: false, mergeAttrs: false, explicitRoot: true, - validator: null, + validator: undefined, xmlns: false, explicitChildren: false, preserveChildrenOrder: false, @@ -58180,17 +62577,17 @@ var xml2jsDefaultOptionsV2 = { includeWhiteChars: false, async: false, strict: true, - attrNameProcessors: null, - attrValueProcessors: null, - tagNameProcessors: null, - valueProcessors: null, + attrNameProcessors: undefined, + attrValueProcessors: undefined, + tagNameProcessors: undefined, + valueProcessors: undefined, rootName: "root", xmldec: { version: "1.0", encoding: "UTF-8", standalone: true }, - doctype: null, + doctype: undefined, renderOpts: { pretty: true, indent: " ", @@ -58217,7 +62614,10 @@ xml2jsBuilderSettings.renderOpts = { * `rootName` indicates the name of the root element in the resulting XML */ function stringifyXML(obj, opts) { - xml2jsBuilderSettings.rootName = (opts || {}).rootName; + var _a; + if (opts === void 0) { opts = {}; } + xml2jsBuilderSettings.rootName = opts.rootName; + xml2jsBuilderSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY; var builder = new xml2js.Builder(xml2jsBuilderSettings); return builder.buildObject(obj); } @@ -58228,7 +62628,10 @@ function stringifyXML(obj, opts) { * `includeRoot` indicates whether the root element is to be included or not in the output */ function parseXML(str, opts) { - xml2jsParserSettings.explicitRoot = !!(opts && opts.includeRoot); + var _a; + if (opts === void 0) { opts = {}; } + xml2jsParserSettings.explicitRoot = !!opts.includeRoot; + xml2jsParserSettings.charkey = (_a = opts.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY; var xmlParser = new xml2js.Parser(xml2jsParserSettings); return new Promise(function (resolve, reject) { if (!str) { @@ -58252,10 +62655,10 @@ function parseXML(str, opts) { * Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they * pass through the HTTP pipeline. */ -function deserializationPolicy(deserializationContentTypes) { +function deserializationPolicy(deserializationContentTypes, parsingOptions) { return { create: function (nextPolicy, options) { - return new DeserializationPolicy(nextPolicy, deserializationContentTypes, options); + return new DeserializationPolicy(nextPolicy, options, deserializationContentTypes, parsingOptions); } }; } @@ -58273,22 +62676,25 @@ var DefaultDeserializationOptions = { */ var DeserializationPolicy = /** @class */ (function (_super) { tslib.__extends(DeserializationPolicy, _super); - function DeserializationPolicy(nextPolicy, deserializationContentTypes, options) { - var _this = _super.call(this, nextPolicy, options) || this; + function DeserializationPolicy(nextPolicy, requestPolicyOptions, deserializationContentTypes, parsingOptions) { + if (parsingOptions === void 0) { parsingOptions = {}; } + var _a; + var _this = _super.call(this, nextPolicy, requestPolicyOptions) || this; _this.jsonContentTypes = (deserializationContentTypes && deserializationContentTypes.json) || defaultJsonContentTypes; _this.xmlContentTypes = (deserializationContentTypes && deserializationContentTypes.xml) || defaultXmlContentTypes; + _this.xmlCharKey = (_a = parsingOptions.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY; return _this; } DeserializationPolicy.prototype.sendRequest = function (request) { return tslib.__awaiter(this, void 0, void 0, function () { var _this = this; return tslib.__generator(this, function (_a) { - return [2 /*return*/, this._nextPolicy - .sendRequest(request) - .then(function (response) { - return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response); + return [2 /*return*/, this._nextPolicy.sendRequest(request).then(function (response) { + return deserializeResponseBody(_this.jsonContentTypes, _this.xmlContentTypes, response, { + xmlCharKey: _this.xmlCharKey + }); })]; }); }); @@ -58324,8 +62730,15 @@ function shouldDeserializeResponse(parsedResponse) { } return result; } -function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { - return parse(jsonContentTypes, xmlContentTypes, response).then(function (parsedResponse) { +function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, options) { + var _a, _b, _c; + if (options === void 0) { options = {}; } + var updatedOptions = { + rootName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "", + includeRoot: (_b = options.includeRoot) !== null && _b !== void 0 ? _b : false, + xmlCharKey: (_c = options.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY + }; + return parse(jsonContentTypes, xmlContentTypes, response, updatedOptions).then(function (parsedResponse) { if (!shouldDeserializeResponse(parsedResponse)) { return parsedResponse; } @@ -58334,54 +62747,13 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { return parsedResponse; } var responseSpec = getOperationResponse(parsedResponse); - var expectedStatusCodes = Object.keys(operationSpec.responses); - var hasNoExpectedStatusCodes = expectedStatusCodes.length === 0 || - (expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"); - var isExpectedStatusCode = hasNoExpectedStatusCodes - ? 200 <= parsedResponse.status && parsedResponse.status < 300 - : !!responseSpec; - // There is no operation response spec for current status code. - // So, treat it as an error case and use the default response spec to deserialize the response. - if (!isExpectedStatusCode) { - var defaultResponseSpec = operationSpec.responses.default; - if (!defaultResponseSpec) { - return parsedResponse; - } - var defaultBodyMapper = defaultResponseSpec.bodyMapper; - var defaultHeadersMapper = defaultResponseSpec.headersMapper; - var initialErrorMessage = isStreamOperation(operationSpec) - ? "Unexpected status code: " + parsedResponse.status - : parsedResponse.bodyAsText; - var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, parsedResponse); - try { - // If error response has a body, try to extract error code & message from it - // Then try to deserialize it using default body mapper - if (parsedResponse.parsedBody) { - var parsedBody = parsedResponse.parsedBody; - var internalError = parsedBody.error || parsedBody; - error.code = internalError.code; - if (internalError.message) { - error.message = internalError.message; - } - if (defaultBodyMapper) { - var valueToDeserialize = parsedBody; - if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) { - valueToDeserialize = - typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : []; - } - error.response.parsedBody = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody"); - } - } - // 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.rawHeaders(), "operationRes.parsedHeaders"); - } - } - catch (defaultError) { - error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response."; - } + var _a = handleErrorResponse(parsedResponse, operationSpec, responseSpec), error = _a.error, shouldReturnResponse = _a.shouldReturnResponse; + 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) { @@ -58394,7 +62766,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { : []; } try { - parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody"); + parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options); } catch (error) { var restError = new RestError("Error " + error + " occurred in deserializing the responseBody - " + parsedResponse.bodyAsText, undefined, parsedResponse.status, parsedResponse.request, parsedResponse); @@ -58406,13 +62778,78 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response) { parsedResponse.parsedBody = response.status >= 200 && response.status < 300; } if (responseSpec.headersMapper) { - parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders"); + parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options); } } return parsedResponse; }); } -function parse(jsonContentTypes, xmlContentTypes, operationResponse) { +function isOperationSpecEmpty(operationSpec) { + var expectedStatusCodes = Object.keys(operationSpec.responses); + return (expectedStatusCodes.length === 0 || + (expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default")); +} +function handleErrorResponse(parsedResponse, operationSpec, responseSpec) { + var isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300; + var isExpectedStatusCode = isOperationSpecEmpty(operationSpec) + ? isSuccessByStatus + : !!responseSpec; + if (isExpectedStatusCode) { + if (responseSpec) { + if (!responseSpec.isError) { + return { error: null, shouldReturnResponse: false }; + } + } + else { + return { error: null, shouldReturnResponse: false }; + } + } + var errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default; + var initialErrorMessage = isStreamOperation(operationSpec) + ? "Unexpected status code: " + parsedResponse.status + : parsedResponse.bodyAsText; + var error = new RestError(initialErrorMessage, undefined, parsedResponse.status, parsedResponse.request, 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; + } + var defaultBodyMapper = errorResponseSpec.bodyMapper; + var 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) { + var parsedBody = parsedResponse.parsedBody; + var parsedError = void 0; + if (defaultBodyMapper) { + var valueToDeserialize = parsedBody; + if (operationSpec.isXML && defaultBodyMapper.type.name === MapperType.Sequence) { + valueToDeserialize = + typeof parsedBody === "object" ? parsedBody[defaultBodyMapper.xmlElementName] : []; + } + parsedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody"); + } + var internalError = parsedBody.error || parsedError || parsedBody; + error.code = internalError.code; + if (internalError.message) { + error.message = internalError.message; + } + if (defaultBodyMapper) { + error.response.parsedBody = parsedError; + } + } + // 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.rawHeaders(), "operationRes.parsedHeaders"); + } + } + catch (defaultError) { + error.message = "Error \"" + defaultError.message + "\" occurred in deserializing the responseBody - \"" + parsedResponse.bodyAsText + "\" for the default response."; + } + return { error: error, shouldReturnResponse: false }; +} +function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts) { var errorHandler = function (err) { var msg = "Error \"" + err + "\" occurred while parsing the response body - " + operationResponse.bodyAsText + "."; var errCode = err.code || RestError.PARSE_ERROR; @@ -58433,7 +62870,7 @@ function parse(jsonContentTypes, xmlContentTypes, operationResponse) { }).catch(errorHandler); } else if (contentComponents.some(function (component) { return xmlContentTypes.indexOf(component) !== -1; })) { - return parseXML(text_1) + return parseXML(text_1, opts) .then(function (body) { operationResponse.parsedBody = body; return operationResponse; @@ -58703,6 +63140,10 @@ var UserAgentPolicy = /** @class */ (function (_super) { }(BaseRequestPolicy)); // Copyright (c) Microsoft Corporation. +/** + * Methods that are allowed to follow redirects 301 and 302 + */ +var allowedRedirect = ["GET", "HEAD"]; var DefaultRedirectOptions = { handleRedirects: true, maxRetries: 20 @@ -58735,7 +63176,11 @@ function handleRedirect(policy, response, currentRetries) { var request = response.request, status = response.status; var locationHeader = response.headers.get("location"); if (locationHeader && - (status === 300 || status === 307 || (status === 303 && request.method === "POST")) && + (status === 300 || + (status === 301 && allowedRedirect.includes(request.method)) || + (status === 302 && allowedRedirect.includes(request.method)) || + (status === 303 && request.method === "POST") || + status === 307) && (!policy.maxRetries || currentRetries < policy.maxRetries)) { var builder = URLBuilder.parse(request.url); builder.setPath(locationHeader); @@ -58744,6 +63189,7 @@ function handleRedirect(policy, response, currentRetries) { // redirected GET request if the redirect url is present in the location header if (status === 303) { request.method = "GET"; + delete request.body; } return policy._nextPolicy .sendRequest(request) @@ -58946,6 +63392,71 @@ var ExpiringAccessTokenCache = /** @class */ (function () { }()); // Copyright (c) Microsoft Corporation. +/** + * Helps the core-http token authentication policies with requesting a new token if we're not currently waiting for a new token. + */ +var AccessTokenRefresher = /** @class */ (function () { + function AccessTokenRefresher(credential, scopes, requiredMillisecondsBeforeNewRefresh) { + if (requiredMillisecondsBeforeNewRefresh === void 0) { requiredMillisecondsBeforeNewRefresh = 30000; } + this.credential = credential; + this.scopes = scopes; + this.requiredMillisecondsBeforeNewRefresh = requiredMillisecondsBeforeNewRefresh; + this.lastCalled = 0; + } + /** + * Returns true if the required milliseconds(defaulted to 30000) have been passed signifying + * that we are ready for a new refresh. + * + * @returns {boolean} + */ + AccessTokenRefresher.prototype.isReady = function () { + // We're only ready for a new refresh if the required milliseconds have passed. + return (!this.lastCalled || Date.now() - this.lastCalled > this.requiredMillisecondsBeforeNewRefresh); + }; + /** + * Stores the time in which it is called, + * then requests a new token, + * then sets this.promise to undefined, + * then returns the token. + * @param options getToken options + */ + AccessTokenRefresher.prototype.getToken = function (options) { + return tslib.__awaiter(this, void 0, void 0, function () { + var token; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + this.lastCalled = Date.now(); + return [4 /*yield*/, this.credential.getToken(this.scopes, options)]; + case 1: + token = _a.sent(); + this.promise = undefined; + return [2 /*return*/, token || undefined]; + } + }); + }); + }; + /** + * Requests a new token if we're not currently waiting for a new token. + * Returns null if the required time between each call hasn't been reached. + * @param options getToken options + */ + AccessTokenRefresher.prototype.refresh = function (options) { + if (!this.promise) { + this.promise = this.getToken(options); + } + return this.promise; + }; + return AccessTokenRefresher; +}()); + +// Copyright (c) Microsoft Corporation. +/** + * The automated token refresh will only start to happen at the + * expiration date minus the value of timeBetweenRefreshAttemptsInMs, + * which is by default 30 seconds. + */ +var timeBetweenRefreshAttemptsInMs = 30000; /** * Creates a new BearerTokenAuthenticationPolicy factory. * @@ -58954,9 +63465,10 @@ var ExpiringAccessTokenCache = /** @class */ (function () { */ function bearerTokenAuthenticationPolicy(credential, scopes) { var tokenCache = new ExpiringAccessTokenCache(); + var tokenRefresher = new AccessTokenRefresher(credential, scopes, timeBetweenRefreshAttemptsInMs); return { create: function (nextPolicy, options) { - return new BearerTokenAuthenticationPolicy(nextPolicy, options, credential, scopes, tokenCache); + return new BearerTokenAuthenticationPolicy(nextPolicy, options, tokenCache, tokenRefresher); } }; } @@ -58978,11 +63490,10 @@ var BearerTokenAuthenticationPolicy = /** @class */ (function (_super) { * @param scopes The scopes for which the bearer token applies. * @param tokenCache The cache for the most recent AccessToken returned from the TokenCredential. */ - function BearerTokenAuthenticationPolicy(nextPolicy, options, credential, scopes, tokenCache) { + function BearerTokenAuthenticationPolicy(nextPolicy, options, tokenCache, tokenRefresher) { var _this = _super.call(this, nextPolicy, options) || this; - _this.credential = credential; - _this.scopes = scopes; _this.tokenCache = tokenCache; + _this.tokenRefresher = tokenRefresher; return _this; } /** @@ -59011,6 +63522,26 @@ var BearerTokenAuthenticationPolicy = /** @class */ (function (_super) { }); }); }; + /** + * Attempts a token update if any other time related conditionals have been reached based on the tokenRefresher class. + */ + BearerTokenAuthenticationPolicy.prototype.updateTokenIfNeeded = function (options) { + return tslib.__awaiter(this, void 0, void 0, function () { + var accessToken; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.tokenRefresher.isReady()) return [3 /*break*/, 2]; + return [4 /*yield*/, this.tokenRefresher.refresh(options)]; + case 1: + accessToken = _a.sent(); + this.tokenCache.setCachedToken(accessToken); + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }); + }; BearerTokenAuthenticationPolicy.prototype.getToken = function (options) { return tslib.__awaiter(this, void 0, void 0, function () { var accessToken; @@ -59019,12 +63550,20 @@ var BearerTokenAuthenticationPolicy = /** @class */ (function (_super) { case 0: accessToken = this.tokenCache.getCachedToken(); if (!(accessToken === undefined)) return [3 /*break*/, 2]; - return [4 /*yield*/, this.credential.getToken(this.scopes, options)]; + return [4 /*yield*/, this.tokenRefresher.refresh(options)]; case 1: - accessToken = (_a.sent()) || undefined; + // Waiting for the next refresh only if the cache is unable to retrieve the access token, + // which means that it has expired, or it has never been set. + accessToken = _a.sent(); this.tokenCache.setCachedToken(accessToken); - _a.label = 2; - case 2: return [2 /*return*/, accessToken ? accessToken.token : undefined]; + return [3 /*break*/, 3]; + case 2: + // If we still have a cached access token, + // And any other time related conditionals have been reached based on the tokenRefresher class, + // then attempt to refresh without waiting. + this.updateTokenIfNeeded(options); + _a.label = 3; + case 3: return [2 /*return*/, accessToken ? accessToken.token : undefined]; } }); }); @@ -59125,23 +63664,57 @@ function retry$1(policy, request, operationResponse, err, retryData) { })(exports.QueryCollectionFormat || (exports.QueryCollectionFormat = {})); // Copyright (c) Microsoft Corporation. +var noProxyList = []; +var isNoProxyInitalized = false; +var byPassedList = new Map(); function loadEnvironmentProxyValue() { if (!process) { return undefined; } - if (process.env[Constants.HTTPS_PROXY]) { - return process.env[Constants.HTTPS_PROXY]; - } - else if (process.env[Constants.HTTPS_PROXY.toLowerCase()]) { - return process.env[Constants.HTTPS_PROXY.toLowerCase()]; + var httpsProxy = getEnvironmentValue(Constants.HTTPS_PROXY); + var allProxy = getEnvironmentValue(Constants.ALL_PROXY); + var httpProxy = getEnvironmentValue(Constants.HTTP_PROXY); + return httpsProxy || allProxy || httpProxy; +} +// Check whether the given `uri` matches the noProxyList. If it matches, any request sent to that same `uri` won't set the proxy settings. +function isBypassed(uri) { + if (byPassedList.has(uri)) { + return byPassedList.get(uri); + } + loadNoProxy(); + var isBypassed = false; + var host = URLBuilder.parse(uri).getHost(); + for (var _i = 0, noProxyList_1 = noProxyList; _i < noProxyList_1.length; _i++) { + var proxyString = noProxyList_1[_i]; + if (proxyString[0] === ".") { + if (uri.endsWith(proxyString)) { + isBypassed = true; + } + else { + if (host === proxyString.slice(1) && host.length === proxyString.length - 1) { + isBypassed = true; + } + } + } + else { + if (host === proxyString) { + isBypassed = true; + } + } } - else if (process.env[Constants.HTTP_PROXY]) { - return process.env[Constants.HTTP_PROXY]; + byPassedList.set(uri, isBypassed); + return isBypassed; +} +function loadNoProxy() { + if (isNoProxyInitalized) { + return; } - else if (process.env[Constants.HTTP_PROXY.toLowerCase()]) { - return process.env[Constants.HTTP_PROXY.toLowerCase()]; + var noProxy = getEnvironmentValue(Constants.NO_PROXY); + if (noProxy) { + var list = noProxy.split(","); + noProxyList = list.map(function (item) { return item.trim(); }).filter(function (item) { return item.length; }); } - return undefined; + isNoProxyInitalized = true; } function getDefaultProxySettings(proxyUrl) { if (!proxyUrl) { @@ -59197,7 +63770,7 @@ var ProxyPolicy = /** @class */ (function (_super) { return _this; } ProxyPolicy.prototype.sendRequest = function (request) { - if (!request.proxySettings) { + if (!request.proxySettings && !isBypassed(request.url)) { request.proxySettings = this.proxySettings; } return this._nextPolicy.sendRequest(request); @@ -59472,6 +64045,51 @@ var DisableResponseDecompressionPolicy = /** @class */ (function (_super) { return DisableResponseDecompressionPolicy; }(BaseRequestPolicy)); +// Copyright (c) Microsoft Corporation. +function ndJsonPolicy() { + return { + create: function (nextPolicy, options) { + return new NdJsonPolicy(nextPolicy, options); + } + }; +} +/** + * NdJsonPolicy that formats a JSON array as newline-delimited JSON + */ +var NdJsonPolicy = /** @class */ (function (_super) { + tslib.__extends(NdJsonPolicy, _super); + /** + * Creates an instance of KeepAlivePolicy. + * + * @param nextPolicy + * @param options + */ + function NdJsonPolicy(nextPolicy, options) { + return _super.call(this, nextPolicy, options) || this; + } + /** + * Sends a request. + * + * @param request + */ + NdJsonPolicy.prototype.sendRequest = function (request) { + return tslib.__awaiter(this, void 0, void 0, function () { + var body; + return tslib.__generator(this, function (_a) { + // There currently isn't a good way to bypass the serializer + if (typeof request.body === "string" && request.body.startsWith("[")) { + body = JSON.parse(request.body); + if (Array.isArray(body)) { + request.body = body.map(function (item) { return JSON.stringify(item) + "\n"; }).join(""); + } + } + return [2 /*return*/, this._nextPolicy.sendRequest(request)]; + }); + }); + }; + return NdJsonPolicy; +}(BaseRequestPolicy)); + // Copyright (c) Microsoft Corporation. /** * @class @@ -59513,10 +64131,15 @@ var ServiceClient = /** @class */ (function () { var bearerTokenPolicyFactory = undefined; // eslint-disable-next-line @typescript-eslint/no-this-alias var serviceClient = _this; + var serviceClientOptions = options; return { create: function (nextPolicy, options) { + var credentialScopes = getCredentialScopes(serviceClientOptions, serviceClient.baseUri); + if (!credentialScopes) { + throw new Error("When using credential, the ServiceClient must contain a baseUri or a credentialScopes in ServiceClientOptions. Unable to create a bearerTokenAuthenticationPolicy"); + } if (bearerTokenPolicyFactory === undefined || bearerTokenPolicyFactory === null) { - bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, (serviceClient.baseUri || "") + "/.default"); + bearerTokenPolicyFactory = bearerTokenAuthenticationPolicy(credentials, credentialScopes); } return bearerTokenPolicyFactory.create(nextPolicy, options); } @@ -59580,19 +64203,21 @@ var ServiceClient = /** @class */ (function () { * @param {ServiceCallback} callback The callback to call when the response is received. */ ServiceClient.prototype.sendOperationRequest = function (operationArguments, operationSpec, callback) { + var _a; return tslib.__awaiter(this, void 0, void 0, function () { - var httpRequest, result, baseUri, requestUrl, _i, _a, urlParameter, urlParameterValue, _b, _c, queryParameter, queryParameterValue, index, item, index, contentType, _d, _e, headerParameter, headerValue, headerCollectionPrefix, _f, _g, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb; - return tslib.__generator(this, function (_h) { - switch (_h.label) { + var serializerOptions, httpRequest, result, baseUri, requestUrl, _i, _b, urlParameter, urlParameterValue, _c, _d, queryParameter, queryParameterValue, index, item, index, contentType, _e, _f, headerParameter, headerValue, headerCollectionPrefix, _g, _h, key, options, customHeaderName, rawResponse, sendRequestError, error_1, error_2, cb; + return tslib.__generator(this, function (_j) { + switch (_j.label) { case 0: if (typeof operationArguments.options === "function") { callback = operationArguments.options; operationArguments.options = undefined; } + serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions; httpRequest = new WebResource(); - _h.label = 1; + _j.label = 1; case 1: - _h.trys.push([1, 6, , 7]); + _j.trys.push([1, 6, , 7]); baseUri = operationSpec.baseUrl || this.baseUri; if (!baseUri) { throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use."); @@ -59604,10 +64229,10 @@ var ServiceClient = /** @class */ (function () { requestUrl.appendPath(operationSpec.path); } if (operationSpec.urlParameters && operationSpec.urlParameters.length > 0) { - for (_i = 0, _a = operationSpec.urlParameters; _i < _a.length; _i++) { - urlParameter = _a[_i]; + for (_i = 0, _b = operationSpec.urlParameters; _i < _b.length; _i++) { + urlParameter = _b[_i]; urlParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, urlParameter, operationSpec.serializer); - urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter)); + urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter), serializerOptions); if (!urlParameter.skipEncoding) { urlParameterValue = encodeURIComponent(urlParameterValue); } @@ -59615,16 +64240,17 @@ var ServiceClient = /** @class */ (function () { } } if (operationSpec.queryParameters && operationSpec.queryParameters.length > 0) { - for (_b = 0, _c = operationSpec.queryParameters; _b < _c.length; _b++) { - queryParameter = _c[_b]; + for (_c = 0, _d = operationSpec.queryParameters; _c < _d.length; _c++) { + queryParameter = _d[_c]; queryParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, queryParameter, operationSpec.serializer); if (queryParameterValue !== undefined && queryParameterValue !== null) { - queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter)); + queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter), serializerOptions); if (queryParameter.collectionFormat !== undefined && queryParameter.collectionFormat !== null) { if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Multi) { if (queryParameterValue.length === 0) { - queryParameterValue = ""; + // The collection is empty, no need to try serializing the current queryParam + continue; } else { for (index in queryParameterValue) { @@ -59669,16 +64295,16 @@ var ServiceClient = /** @class */ (function () { httpRequest.headers.set("Content-Type", contentType); } if (operationSpec.headerParameters) { - for (_d = 0, _e = operationSpec.headerParameters; _d < _e.length; _d++) { - headerParameter = _e[_d]; + for (_e = 0, _f = operationSpec.headerParameters; _e < _f.length; _e++) { + headerParameter = _f[_e]; headerValue = getOperationArgumentValueFromParameter(this, operationArguments, headerParameter, operationSpec.serializer); if (headerValue !== undefined && headerValue !== null) { - headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter)); + headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter), serializerOptions); headerCollectionPrefix = headerParameter.mapper .headerCollectionPrefix; if (headerCollectionPrefix) { - for (_f = 0, _g = Object.keys(headerValue); _f < _g.length; _f++) { - key = _g[_f]; + for (_g = 0, _h = Object.keys(headerValue); _g < _h.length; _g++) { + key = _h[_g]; httpRequest.headers.set(headerCollectionPrefix + key, headerValue[key]); } } @@ -59722,15 +64348,15 @@ var ServiceClient = /** @class */ (function () { } rawResponse = void 0; sendRequestError = void 0; - _h.label = 2; + _j.label = 2; case 2: - _h.trys.push([2, 4, , 5]); + _j.trys.push([2, 4, , 5]); return [4 /*yield*/, this.sendRequest(httpRequest)]; case 3: - rawResponse = _h.sent(); + rawResponse = _j.sent(); return [3 /*break*/, 5]; case 4: - error_1 = _h.sent(); + error_1 = _j.sent(); sendRequestError = error_1; return [3 /*break*/, 5]; case 5: @@ -59746,7 +64372,7 @@ var ServiceClient = /** @class */ (function () { } return [3 /*break*/, 7]; case 6: - error_2 = _h.sent(); + error_2 = _j.sent(); result = Promise.reject(error_2); return [3 /*break*/, 7]; case 7: @@ -59765,29 +64391,42 @@ var ServiceClient = /** @class */ (function () { return ServiceClient; }()); function serializeRequestBody(serviceClient, httpRequest, operationArguments, operationSpec) { - var _a; + var _a, _b, _c, _d, _e, _f; + var serializerOptions = (_b = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions) !== null && _b !== void 0 ? _b : {}; + var updatedOptions = { + rootName: (_c = serializerOptions.rootName) !== null && _c !== void 0 ? _c : "", + includeRoot: (_d = serializerOptions.includeRoot) !== null && _d !== void 0 ? _d : false, + xmlCharKey: (_e = serializerOptions.xmlCharKey) !== null && _e !== void 0 ? _e : XML_CHARKEY + }; + var xmlCharKey = serializerOptions.xmlCharKey; if (operationSpec.requestBody && operationSpec.requestBody.mapper) { httpRequest.body = getOperationArgumentValueFromParameter(serviceClient, operationArguments, operationSpec.requestBody, operationSpec.serializer); var bodyMapper = operationSpec.requestBody.mapper; - var required = bodyMapper.required, xmlName = bodyMapper.xmlName, xmlElementName = bodyMapper.xmlElementName, serializedName = bodyMapper.serializedName; + var required = bodyMapper.required, xmlName = bodyMapper.xmlName, xmlElementName = bodyMapper.xmlElementName, serializedName = bodyMapper.serializedName, xmlNamespace = bodyMapper.xmlNamespace, xmlNamespacePrefix = bodyMapper.xmlNamespacePrefix; var typeName = bodyMapper.type.name; try { if ((httpRequest.body !== undefined && httpRequest.body !== null) || required) { var requestBodyParameterPathString = getPathStringFromParameter(operationSpec.requestBody); - httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString); + httpRequest.body = operationSpec.serializer.serialize(bodyMapper, httpRequest.body, requestBodyParameterPathString, updatedOptions); var isStream = typeName === MapperType.Stream; if (operationSpec.isXML) { + var xmlnsKey = xmlNamespacePrefix ? "xmlns:" + xmlNamespacePrefix : "xmlns"; + var value = getXmlValueWithNamespace(xmlNamespace, xmlnsKey, typeName, httpRequest.body, updatedOptions); if (typeName === MapperType.Sequence) { - httpRequest.body = stringifyXML(prepareXMLRootList(httpRequest.body, xmlElementName || xmlName || serializedName), { rootName: xmlName || serializedName }); + httpRequest.body = stringifyXML(prepareXMLRootList(value, xmlElementName || xmlName || serializedName, xmlnsKey, xmlNamespace), { + rootName: xmlName || serializedName, + xmlCharKey: xmlCharKey + }); } else if (!isStream) { - httpRequest.body = stringifyXML(httpRequest.body, { - rootName: xmlName || serializedName + httpRequest.body = stringifyXML(value, { + rootName: xmlName || serializedName, + xmlCharKey: xmlCharKey }); } } else if (typeName === MapperType.String && - (((_a = operationSpec.contentType) === null || _a === void 0 ? void 0 : _a.match("text/plain")) || operationSpec.mediaType === "text")) { + (((_f = operationSpec.contentType) === null || _f === void 0 ? void 0 : _f.match("text/plain")) || operationSpec.mediaType === "text")) { // the String serializer has validated that request body is a string // so just send the string. return; @@ -59803,16 +64442,31 @@ function serializeRequestBody(serviceClient, httpRequest, operationArguments, op } else if (operationSpec.formDataParameters && operationSpec.formDataParameters.length > 0) { httpRequest.formData = {}; - for (var _i = 0, _b = operationSpec.formDataParameters; _i < _b.length; _i++) { - var formDataParameter = _b[_i]; + for (var _i = 0, _g = operationSpec.formDataParameters; _i < _g.length; _i++) { + var formDataParameter = _g[_i]; var formDataParameterValue = getOperationArgumentValueFromParameter(serviceClient, operationArguments, formDataParameter, operationSpec.serializer); if (formDataParameterValue !== undefined && formDataParameterValue !== null) { var formDataParameterPropertyName = formDataParameter.mapper.serializedName || getPathStringFromParameter(formDataParameter); - httpRequest.formData[formDataParameterPropertyName] = operationSpec.serializer.serialize(formDataParameter.mapper, formDataParameterValue, getPathStringFromParameter(formDataParameter)); + httpRequest.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) { + var _a; + // 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)) { + var result = {}; + result[options.xmlCharKey] = serializedValue; + result[XML_ATTRKEY] = (_a = {}, _a[xmlnsKey] = xmlNamespace, _a); + return result; + } + return serializedValue; +} function getValueOrFunctionResult(value, defaultValueCreator) { var result; if (typeof value === "string") { @@ -59855,6 +64509,9 @@ function createDefaultRequestPolicyFactories(authPolicyFactory, options) { } function createPipelineFromOptions(pipelineOptions, authPolicyFactory) { var requestPolicyFactories = []; + if (pipelineOptions.sendStreamingJson) { + requestPolicyFactories.push(ndJsonPolicy()); + } var userAgentValue = undefined; if (pipelineOptions.userAgentOptions && pipelineOptions.userAgentOptions.userAgentPrefix) { var userAgentInfo = []; @@ -59895,10 +64552,12 @@ function getOperationArgumentValueFromParameter(serviceClient, operationArgument return getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameter.parameterPath, parameter.mapper, serializer); } function getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, parameterPath, parameterMapper, serializer) { + var _a; var value; if (typeof parameterPath === "string") { parameterPath = [parameterPath]; } + var serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions; if (Array.isArray(parameterPath)) { if (parameterPath.length > 0) { if (parameterMapper.isConstant) { @@ -59919,7 +64578,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu } // Serialize just for validation purposes. var parameterPathString = getPathStringFromParameterPath(parameterPath, parameterMapper); - serializer.serialize(parameterMapper, value, parameterPathString); + serializer.serialize(parameterMapper, value, parameterPathString, serializerOptions); } } else { @@ -59932,7 +64591,7 @@ function getOperationArgumentValueFromParameterPath(serviceClient, operationArgu var propertyValue = getOperationArgumentValueFromParameterPath(serviceClient, operationArguments, propertyPath, propertyMapper, serializer); // Serialize just for validation purposes. var propertyPathString = getPathStringFromParameterPath(propertyPath, propertyMapper); - serializer.serialize(propertyMapper, propertyValue, propertyPathString); + serializer.serialize(propertyMapper, propertyValue, propertyPathString, serializerOptions); if (propertyValue !== undefined && propertyValue !== null) { if (!value) { value = {}; @@ -60006,6 +64665,46 @@ function flattenResponse(_response, responseSpec) { } return addOperationResponse(tslib.__assign(tslib.__assign({}, parsedHeaders), _response.parsedBody)); } +function getCredentialScopes(options, baseUri) { + if (options === null || options === void 0 ? void 0 : options.credentialScopes) { + var scopes = options.credentialScopes; + return Array.isArray(scopes) + ? scopes.map(function (scope) { return new url.URL(scope).toString(); }) + : new url.URL(scopes).toString(); + } + if (baseUri) { + return baseUri + "/.default"; + } + return undefined; +} + +// Copyright (c) Microsoft Corporation. +/** + * Creates a function called createSpan to create spans using the global tracer. + * @ignore + * @param spanConfig The name of the operation being performed. + * @param tracingOptions The options for the underlying http request. + */ +function createSpanFunction(_a) { + var packagePrefix = _a.packagePrefix, namespace = _a.namespace; + return function (operationName, operationOptions) { + var tracer = coreTracing.getTracer(); + var tracingOptions = operationOptions.tracingOptions || {}; + var spanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { kind: api.SpanKind.INTERNAL }); + var span = tracer.startSpan(packagePrefix + "." + operationName, spanOptions); + span.setAttribute("az.namespace", namespace); + var newSpanOptions = tracingOptions.spanOptions || {}; + if (span.isRecording()) { + newSpanOptions = tslib.__assign(tslib.__assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: tslib.__assign(tslib.__assign({}, spanOptions.attributes), { "az.namespace": namespace }) }); + } + var newTracingOptions = tslib.__assign(tslib.__assign({}, tracingOptions), { spanOptions: newSpanOptions }); + var newOperationOptions = tslib.__assign(tslib.__assign({}, operationOptions), { tracingOptions: newTracingOptions }); + return { + span: span, + updatedOptions: newOperationOptions + }; + }; +} // Copyright (c) Microsoft Corporation. var HeaderConstants = Constants.HeaderConstants; @@ -60133,16 +64832,14 @@ Object.defineProperty(exports, 'isTokenCredential', { return coreAuth.isTokenCredential; } }); +exports.AccessTokenRefresher = AccessTokenRefresher; exports.ApiKeyCredentials = ApiKeyCredentials; exports.BaseRequestPolicy = BaseRequestPolicy; exports.BasicAuthenticationCredentials = BasicAuthenticationCredentials; -exports.BearerTokenAuthenticationPolicy = BearerTokenAuthenticationPolicy; exports.Constants = Constants; exports.DefaultHttpClient = NodeFetchHttpClient; -exports.DisableResponseDecompressionPolicy = DisableResponseDecompressionPolicy; exports.ExpiringAccessTokenCache = ExpiringAccessTokenCache; exports.HttpHeaders = HttpHeaders; -exports.KeepAlivePolicy = KeepAlivePolicy; exports.MapperType = MapperType; exports.RequestPolicyOptions = RequestPolicyOptions; exports.RestError = RestError; @@ -60152,9 +64849,12 @@ exports.TopicCredentials = TopicCredentials; exports.URLBuilder = URLBuilder; exports.URLQuery = URLQuery; exports.WebResource = WebResource; +exports.XML_ATTRKEY = XML_ATTRKEY; +exports.XML_CHARKEY = XML_CHARKEY; exports.applyMixins = applyMixins; exports.bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy; exports.createPipelineFromOptions = createPipelineFromOptions; +exports.createSpanFunction = createSpanFunction; exports.delay = delay; exports.deserializationPolicy = deserializationPolicy; exports.deserializeResponseBody = deserializeResponseBody; diff --git a/package-lock.json b/package-lock.json index 837d7b71c2..dc7f8bf1f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,2986 @@ { "name": "golanci-lint-action", "version": "2.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "golanci-lint-action", + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "@actions/cache": "^1.0.5", + "@actions/core": "^1.2.6", + "@actions/exec": "^1.0.1", + "@actions/github": "^4.0.0", + "@actions/tool-cache": "^1.6.1", + "@types/semver": "^7.3.4", + "@types/tmp": "^0.2.0", + "setup-go": "git+https://github.com/actions/setup-go.git#v2.1.3", + "tmp": "^0.2.1" + }, + "devDependencies": { + "@types/node": "^14.14.13", + "@types/uuid": "^8.3.0", + "@typescript-eslint/eslint-plugin": "^2.34.0", + "@typescript-eslint/parser": "^2.34.0", + "@zeit/ncc": "^0.22.3", + "eslint": "^6.6.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-prettier": "^3.3.0", + "eslint-plugin-simple-import-sort": "^7.0.0", + "prettier": "^2.2.1", + "typescript": "^4.1.3" + } + }, + "node_modules/@actions/cache": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.5.tgz", + "integrity": "sha512-TcvJOduwsPP27KLmIa5cqXsQYFK2GzILcEpnhvYmhGwi1aYx9XwhKmp6Im8X6DJMBxbvupKPsOntG6f6sSkIPA==", + "dependencies": { + "@actions/core": "^1.2.6", + "@actions/exec": "^1.0.1", + "@actions/glob": "^0.1.0", + "@actions/http-client": "^1.0.9", + "@actions/io": "^1.0.1", + "@azure/ms-rest-js": "^2.0.7", + "@azure/storage-blob": "^12.1.2", + "semver": "^6.1.0", + "uuid": "^3.3.3" + } + }, + "node_modules/@actions/cache/node_modules/@actions/http-client": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz", + "integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==", + "dependencies": { + "tunnel": "0.0.6" + } + }, + "node_modules/@actions/core": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", + "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" + }, + "node_modules/@actions/exec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", + "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", + "dependencies": { + "@actions/io": "^1.0.1" + } + }, + "node_modules/@actions/github": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", + "integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==", + "dependencies": { + "@actions/http-client": "^1.0.8", + "@octokit/core": "^3.0.0", + "@octokit/plugin-paginate-rest": "^2.2.3", + "@octokit/plugin-rest-endpoint-methods": "^4.0.0" + } + }, + "node_modules/@actions/glob": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.1.tgz", + "integrity": "sha512-ikM4GVZOgSGDNTjv0ECJ8AOqmDqQwtO4K1M4P465C9iikRq34+FwCjUVSwzgOYDP85qtddyWpzBw5lTub/9Xmg==", + "dependencies": { + "@actions/core": "^1.2.6", + "minimatch": "^3.0.4" + } + }, + "node_modules/@actions/http-client": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", + "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", + "dependencies": { + "tunnel": "0.0.6" + } + }, + "node_modules/@actions/io": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz", + "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==" + }, + "node_modules/@actions/tool-cache": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.6.1.tgz", + "integrity": "sha512-F+vwEDwfqcHMKuSkj79pihOnsAMv23EkG76nMpc82UsnXwyQdyEsktGxrB0SNtm7pRqTXEIOoAPTgrSQclXYTg==", + "dependencies": { + "@actions/core": "^1.2.6", + "@actions/exec": "^1.0.0", + "@actions/http-client": "^1.0.8", + "@actions/io": "^1.0.1", + "semver": "^6.1.0", + "uuid": "^3.3.2" + } + }, + "node_modules/@azure/abort-controller": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.1.tgz", + "integrity": "sha512-wP2Jw6uPp8DEDy0n4KNidvwzDjyVV2xnycEIq7nPzj1rHyb/r+t3OPeNT1INZePP2wy5ZqlwyuyOMTi0ePyY1A==", + "dependencies": { + "tslib": "^1.9.3" + } + }, + "node_modules/@azure/core-asynciterator-polyfill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.0.tgz", + "integrity": "sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg==" + }, + "node_modules/@azure/core-auth": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.1.3.tgz", + "integrity": "sha512-A4xigW0YZZpkj1zK7dKuzbBpGwnhEcRk6WWuIshdHC32raR3EQ1j6VA9XZqE+RFsUgH6OAmIK5BWIz+mZjnd6Q==", + "dependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/core-tracing": "1.0.0-preview.8", + "@opentelemetry/api": "^0.6.1", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@azure/core-auth/node_modules/@azure/core-tracing": { + "version": "1.0.0-preview.8", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.8.tgz", + "integrity": "sha512-ZKUpCd7Dlyfn7bdc+/zC/sf0aRIaNQMDuSj2RhYRFe3p70hVAnYGp3TX4cnG2yoEALp/LTj/XnZGQ8Xzf6Ja/Q==", + "dependencies": { + "@opencensus/web-types": "0.0.7", + "@opentelemetry/api": "^0.6.1", + "tslib": "^1.10.0" + } + }, + "node_modules/@azure/core-auth/node_modules/@azure/core-tracing/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@azure/core-auth/node_modules/@opentelemetry/api": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-0.6.1.tgz", + "integrity": "sha512-wpufGZa7tTxw7eAsjXJtiyIQ42IWQdX9iUQp7ACJcKo1hCtuhLU+K2Nv1U6oRwT1oAlZTE6m4CgWKZBhOiau3Q==", + "dependencies": { + "@opentelemetry/context-base": "^0.6.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@azure/core-auth/node_modules/tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" + }, + "node_modules/@azure/core-http": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.2.1.tgz", + "integrity": "sha512-vPHIQXjLVs4iin2BUaj7/sqIAfGq3MW1TLEc3yYKFNpi/sBQn2KI0g+Ow0EQYvAkkHhTHGArA7JKhcjsnJMGLw==", + "dependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/core-auth": "^1.1.3", + "@azure/core-tracing": "1.0.0-preview.9", + "@azure/logger": "^1.0.0", + "@opentelemetry/api": "^0.10.2", + "@types/node-fetch": "^2.5.0", + "@types/tunnel": "^0.0.1", + "form-data": "^3.0.0", + "node-fetch": "^2.6.0", + "process": "^0.11.10", + "tough-cookie": "^4.0.0", + "tslib": "^2.0.0", + "tunnel": "^0.0.6", + "uuid": "^8.3.0", + "xml2js": "^0.4.19" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@azure/core-http/node_modules/form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@azure/core-http/node_modules/tough-cookie": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@azure/core-http/node_modules/tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" + }, + "node_modules/@azure/core-http/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@azure/core-lro": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-1.0.2.tgz", + "integrity": "sha512-Yr0JD7GKryOmbcb5wHCQoQ4KCcH5QJWRNorofid+UvudLaxnbCfvKh/cUfQsGUqRjO9L/Bw4X7FP824DcHdMxw==", + "dependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/core-http": "^1.1.1", + "events": "^3.0.0", + "tslib": "^1.10.0" + } + }, + "node_modules/@azure/core-paging": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.1.3.tgz", + "integrity": "sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A==", + "dependencies": { + "@azure/core-asynciterator-polyfill": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@azure/core-tracing": { + "version": "1.0.0-preview.9", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.9.tgz", + "integrity": "sha512-zczolCLJ5QG42AEPQ+Qg9SRYNUyB+yZ5dzof4YEc+dyWczO9G2sBqbAjLB7IqrsdHN2apkiB2oXeDKCsq48jug==", + "dependencies": { + "@opencensus/web-types": "0.0.7", + "@opentelemetry/api": "^0.10.2", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@azure/core-tracing/node_modules/tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" + }, + "node_modules/@azure/logger": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.0.tgz", + "integrity": "sha512-g2qLDgvmhyIxR3JVS8N67CyIOeFRKQlX/llxYJQr1OSGQqM3HTpVP8MjmjcEKbL/OIt2N9C9UFaNQuKOw1laOA==", + "dependencies": { + "tslib": "^1.9.3" + } + }, + "node_modules/@azure/ms-rest-js": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.1.0.tgz", + "integrity": "sha512-4BXLVImYRt+jcUmEJ5LUWglI8RBNVQndY6IcyvQ4U8O4kIXdmlRz3cJdA/RpXf5rKT38KOoTO2T6Z1f6Z1HDBg==", + "dependencies": { + "@types/node-fetch": "^2.3.7", + "@types/tunnel": "0.0.1", + "abort-controller": "^3.0.0", + "form-data": "^2.5.0", + "node-fetch": "^2.6.0", + "tough-cookie": "^3.0.1", + "tslib": "^1.10.0", + "tunnel": "0.0.6", + "uuid": "^3.3.2", + "xml2js": "^0.4.19" + } + }, + "node_modules/@azure/storage-blob": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.3.0.tgz", + "integrity": "sha512-nCySzNfm782pEW3sg9GHj1zE4gBeVVMeEBdWb4MefifrCwQQOoz5cXZTNFiUJAJqAO+/72r2UjZcUwHk/QmzkA==", + "dependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/core-http": "^1.2.0", + "@azure/core-lro": "^1.0.2", + "@azure/core-paging": "^1.1.1", + "@azure/core-tracing": "1.0.0-preview.9", + "@azure/logger": "^1.0.0", + "@opentelemetry/api": "^0.10.2", + "events": "^3.0.0", + "tslib": "^2.0.0" + } + }, + "node_modules/@azure/storage-blob/node_modules/tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" + }, + "node_modules/@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.8.3" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.9.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", + "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "dev": true + }, + "node_modules/@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@octokit/auth-token": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz", + "integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==", + "dependencies": { + "@octokit/types": "^5.0.0" + } + }, + "node_modules/@octokit/core": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.1.tgz", + "integrity": "sha512-cQ2HGrtyNJ1IBxpTP1U5m/FkMAJvgw7d2j1q3c9P0XUuYilEgF6e4naTpsgm4iVcQeOnccZlw7XHRIUBy0ymcg==", + "dependencies": { + "@octokit/auth-token": "^2.4.0", + "@octokit/graphql": "^4.3.1", + "@octokit/request": "^5.4.0", + "@octokit/types": "^5.0.0", + "before-after-hook": "^2.1.0", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/endpoint": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz", + "integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==", + "dependencies": { + "@octokit/types": "^5.0.0", + "is-plain-object": "^4.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/graphql": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.3.tgz", + "integrity": "sha512-JyYvi3j2tOb5ofASEpcg1Advs07H+Ag+I+ez7buuZfNVAmh1IYcDTuxd4gnYH8S2PSGu+f5IdDGxMmkK+5zsdA==", + "dependencies": { + "@octokit/request": "^5.3.0", + "@octokit/types": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz", + "integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==", + "dependencies": { + "@octokit/types": "^5.2.0" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz", + "integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==", + "dependencies": { + "@octokit/types": "^5.1.1", + "deprecation": "^2.3.1" + } + }, + "node_modules/@octokit/request": { + "version": "5.4.7", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz", + "integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==", + "dependencies": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.0.0", + "@octokit/types": "^5.0.0", + "deprecation": "^2.0.0", + "is-plain-object": "^4.0.0", + "node-fetch": "^2.3.0", + "once": "^1.4.0", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/request-error": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz", + "integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==", + "dependencies": { + "@octokit/types": "^5.0.1", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "node_modules/@octokit/types": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.2.0.tgz", + "integrity": "sha512-XjOk9y4m8xTLIKPe1NFxNWBdzA2/z3PFFA/bwf4EoH6oS8hM0Y46mEa4Cb+KCyj/tFDznJFahzQ0Aj3o1FYq4A==", + "dependencies": { + "@types/node": ">= 8" + } + }, + "node_modules/@opencensus/web-types": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@opencensus/web-types/-/web-types-0.0.7.tgz", + "integrity": "sha512-xB+w7ZDAu3YBzqH44rCmG9/RlrOmFuDPt/bpf17eJr8eZSrLt7nc7LnWdxM9Mmoj/YKMHpxRg28txu3TcpiL+g==", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/@opentelemetry/api": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-0.10.2.tgz", + "integrity": "sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA==", + "dependencies": { + "@opentelemetry/context-base": "^0.10.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@opentelemetry/api/node_modules/@opentelemetry/context-base": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.10.2.tgz", + "integrity": "sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@opentelemetry/context-base": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.6.1.tgz", + "integrity": "sha512-5bHhlTBBq82ti3qPT15TRxkYTFPPQWbnkkQkmHPtqiS1XcTB69cEKd3Jm7Cfi/vkPoyxapmePE9tyA7EzLt8SQ==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "node_modules/@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "node_modules/@types/node": { + "version": "14.14.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.13.tgz", + "integrity": "sha512-vbxr0VZ8exFMMAjCW8rJwaya0dMCDyYW2ZRdTyjtrCvJoENMpdUHOT/eTzvgyA5ZnqRZ/sI0NwqAxNHKYokLJQ==" + }, + "node_modules/@types/node-fetch": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz", + "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==", + "dependencies": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "node_modules/@types/node-fetch/node_modules/form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ==" + }, + "node_modules/@types/tmp": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.0.tgz", + "integrity": "sha512-flgpHJjntpBAdJD43ShRosQvNC0ME97DCfGvZEDlAThQmnerRXrLbX6YgzRBQCZTthET9eAWFAMaYP0m0Y4HzQ==" + }, + "node_modules/@types/tunnel": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.1.tgz", + "integrity": "sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/uuid": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.0.tgz", + "integrity": "sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", + "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/experimental-utils": "2.34.0", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/experimental-utils": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/experimental-utils": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", + "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", + "dev": true, + "dependencies": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.34.0", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@zeit/ncc": { + "version": "0.22.3", + "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.22.3.tgz", + "integrity": "sha512-jnCLpLXWuw/PAiJiVbLjA8WBC0IJQbFeUwF4I9M+23MvIxTxk5pD4Q8byQBSPmHQjz5aBoA7AKAElQxMpjrCLQ==", + "dev": true, + "bin": { + "ncc": "dist/ncc/cli.js" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "dev": true + }, + "node_modules/ajv": { + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", + "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "dependencies": { + "type-fest": "^0.11.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-includes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", + "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0", + "is-string": "^1.0.5" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", + "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "node_modules/before-after-hook": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", + "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-width": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "dev": true + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/cross-spawn/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", + "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", + "dev": true, + "dependencies": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + } + }, + "node_modules/eslint-config-prettier": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz", + "integrity": "sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==", + "dev": true, + "dependencies": { + "get-stdin": "^6.0.0" + }, + "bin": { + "eslint-config-prettier-check": "bin/cli.js" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", + "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", + "dev": true, + "dependencies": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/eslint-module-utils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", + "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "dev": true, + "dependencies": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-module-utils/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "dependencies": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/eslint-plugin-prettier": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.0.tgz", + "integrity": "sha512-tMTwO8iUWlSRZIwS9k7/E4vrTsfvsrcM5p1eftyuqWH25nKsz/o6/54I7jwQ/3zobISyC7wMy9ZsFwgTxOcOpQ==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true + }, + "node_modules/eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint/node_modules/eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint/node_modules/regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true, + "engines": { + "node": ">=6.5.0" + } + }, + "node_modules/espree": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", + "dev": true, + "dependencies": { + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.0", + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", + "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "dependencies": { + "estraverse": "^4.1.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/external-editor/node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "dev": true + }, + "node_modules/fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "dependencies": { + "flat-cache": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "dependencies": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, + "node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "node_modules/get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "dependencies": { + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/inquirer": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/inquirer/node_modules/ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/inquirer/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/inquirer/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-callable": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-plain-object": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", + "integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash": { + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "dev": true + }, + "node_modules/mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dependencies": { + "mime-db": "1.44.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/object-inspect": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "dev": true + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign/node_modules/es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "dependencies": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", + "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "node_modules/path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "dependencies": { + "pify": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "dependencies": { + "find-up": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "dependencies": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "dependencies": { + "path-parse": "^1.0.6" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/rxjs": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "dev": true, + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/setup-go": { + "resolved": "git+ssh://git@github.com/actions/setup-go.git#37335c7bb261b353407cff977110895fa0b4f7d8", + "dependencies": { + "@actions/core": "^1.2.6", + "@actions/http-client": "^1.0.6", + "@actions/io": "^1.0.2", + "@actions/tool-cache": "^1.5.5", + "semver": "^6.1.1" + } + }, + "node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "node_modules/slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", + "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", + "dev": true + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", + "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "dependencies": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/table/node_modules/emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "node_modules/table/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, + "node_modules/tmp/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/tough-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", + "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", + "dependencies": { + "ip-regex": "^2.1.0", + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tslib": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==" + }, + "node_modules/tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/typescript": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", + "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "dependencies": { + "mkdirp": "^0.5.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } + } + }, "dependencies": { "@actions/cache": { "version": "1.0.5", @@ -2078,8 +5056,8 @@ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, "setup-go": { - "version": "git+https://github.com/actions/setup-go.git#37335c7bb261b353407cff977110895fa0b4f7d8", - "from": "git+https://github.com/actions/setup-go.git#v2.1.3", + "version": "git+ssh://git@github.com/actions/setup-go.git#37335c7bb261b353407cff977110895fa0b4f7d8", + "from": "setup-go@git+https://github.com/actions/setup-go.git#v2.1.3", "requires": { "@actions/core": "^1.2.6", "@actions/http-client": "^1.0.6", From dd4fe04fbcc64d660d50aa36ab3c8e5ddf0972eb Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Mon, 28 Dec 2020 22:36:31 -0600 Subject: [PATCH 3/3] update .eslintrc.json --- .eslintrc.json | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0ee3bb9cf1..159d062c74 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,13 @@ { - "env": { "node": true, "jest": true }, + "env": { + "node": true, + "jest": true + }, "parser": "@typescript-eslint/parser", - "parserOptions": { "ecmaVersion": 2020, "sourceType": "module" }, + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + }, "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", @@ -12,12 +18,16 @@ "plugin:prettier/recommended", "prettier/@typescript-eslint" ], - "plugins": ["@typescript-eslint", "simple-import-sort"], + "plugins": [ + "@typescript-eslint", + "simple-import-sort" + ], "rules": { "import/first": "error", "import/newline-after-import": "error", "import/no-duplicates": "error", - "simple-import-sort/sort": "error", + "simple-import-sort/imports": "error", + "simple-import-sort/exports": "error", "sort-imports": "off" } -} \ No newline at end of file +}