mirror of
https://github.com/tvytlx/ai-agent-deep-dive.git
synced 2026-04-04 16:14:50 +08:00
Add extracted source directory and README navigation
This commit is contained in:
188
extracted-source/node_modules/gaxios/build/src/common.js
generated
vendored
Normal file
188
extracted-source/node_modules/gaxios/build/src/common.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
"use strict";
|
||||
// Copyright 2018 Google LLC
|
||||
// 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
|
||||
//
|
||||
// http://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 __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GaxiosError = exports.GAXIOS_ERROR_SYMBOL = void 0;
|
||||
exports.defaultErrorRedactor = defaultErrorRedactor;
|
||||
const url_1 = require("url");
|
||||
const util_1 = require("./util");
|
||||
const extend_1 = __importDefault(require("extend"));
|
||||
/**
|
||||
* Support `instanceof` operator for `GaxiosError`s in different versions of this library.
|
||||
*
|
||||
* @see {@link GaxiosError[Symbol.hasInstance]}
|
||||
*/
|
||||
exports.GAXIOS_ERROR_SYMBOL = Symbol.for(`${util_1.pkg.name}-gaxios-error`);
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
class GaxiosError extends Error {
|
||||
/**
|
||||
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
|
||||
*
|
||||
* @see {@link GAXIOS_ERROR_SYMBOL}
|
||||
* @see {@link GaxiosError[GAXIOS_ERROR_SYMBOL]}
|
||||
*/
|
||||
static [(_a = exports.GAXIOS_ERROR_SYMBOL, Symbol.hasInstance)](instance) {
|
||||
if (instance &&
|
||||
typeof instance === 'object' &&
|
||||
exports.GAXIOS_ERROR_SYMBOL in instance &&
|
||||
instance[exports.GAXIOS_ERROR_SYMBOL] === util_1.pkg.version) {
|
||||
return true;
|
||||
}
|
||||
// fallback to native
|
||||
return Function.prototype[Symbol.hasInstance].call(GaxiosError, instance);
|
||||
}
|
||||
constructor(message, config, response, error) {
|
||||
var _b;
|
||||
super(message);
|
||||
this.config = config;
|
||||
this.response = response;
|
||||
this.error = error;
|
||||
/**
|
||||
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
|
||||
*
|
||||
* @see {@link GAXIOS_ERROR_SYMBOL}
|
||||
* @see {@link GaxiosError[Symbol.hasInstance]}
|
||||
* @see {@link https://github.com/microsoft/TypeScript/issues/13965#issuecomment-278570200}
|
||||
* @see {@link https://stackoverflow.com/questions/46618852/require-and-instanceof}
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/@@hasInstance#reverting_to_default_instanceof_behavior}
|
||||
*/
|
||||
this[_a] = util_1.pkg.version;
|
||||
// deep-copy config as we do not want to mutate
|
||||
// the existing config for future retries/use
|
||||
this.config = (0, extend_1.default)(true, {}, config);
|
||||
if (this.response) {
|
||||
this.response.config = (0, extend_1.default)(true, {}, this.response.config);
|
||||
}
|
||||
if (this.response) {
|
||||
try {
|
||||
this.response.data = translateData(this.config.responseType, (_b = this.response) === null || _b === void 0 ? void 0 : _b.data);
|
||||
}
|
||||
catch (_c) {
|
||||
// best effort - don't throw an error within an error
|
||||
// we could set `this.response.config.responseType = 'unknown'`, but
|
||||
// that would mutate future calls with this config object.
|
||||
}
|
||||
this.status = this.response.status;
|
||||
}
|
||||
if (error && 'code' in error && error.code) {
|
||||
this.code = error.code;
|
||||
}
|
||||
if (config.errorRedactor) {
|
||||
config.errorRedactor({
|
||||
config: this.config,
|
||||
response: this.response,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.GaxiosError = GaxiosError;
|
||||
function translateData(responseType, data) {
|
||||
switch (responseType) {
|
||||
case 'stream':
|
||||
return data;
|
||||
case 'json':
|
||||
return JSON.parse(JSON.stringify(data));
|
||||
case 'arraybuffer':
|
||||
return JSON.parse(Buffer.from(data).toString('utf8'));
|
||||
case 'blob':
|
||||
return JSON.parse(data.text());
|
||||
default:
|
||||
return data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* An experimental error redactor.
|
||||
*
|
||||
* @param config Config to potentially redact properties of
|
||||
* @param response Config to potentially redact properties of
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
function defaultErrorRedactor(data) {
|
||||
const REDACT = '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.';
|
||||
function redactHeaders(headers) {
|
||||
if (!headers)
|
||||
return;
|
||||
for (const key of Object.keys(headers)) {
|
||||
// any casing of `Authentication`
|
||||
if (/^authentication$/i.test(key)) {
|
||||
headers[key] = REDACT;
|
||||
}
|
||||
// any casing of `Authorization`
|
||||
if (/^authorization$/i.test(key)) {
|
||||
headers[key] = REDACT;
|
||||
}
|
||||
// anything containing secret, such as 'client secret'
|
||||
if (/secret/i.test(key)) {
|
||||
headers[key] = REDACT;
|
||||
}
|
||||
}
|
||||
}
|
||||
function redactString(obj, key) {
|
||||
if (typeof obj === 'object' &&
|
||||
obj !== null &&
|
||||
typeof obj[key] === 'string') {
|
||||
const text = obj[key];
|
||||
if (/grant_type=/i.test(text) ||
|
||||
/assertion=/i.test(text) ||
|
||||
/secret/i.test(text)) {
|
||||
obj[key] = REDACT;
|
||||
}
|
||||
}
|
||||
}
|
||||
function redactObject(obj) {
|
||||
if (typeof obj === 'object' && obj !== null) {
|
||||
if ('grant_type' in obj) {
|
||||
obj['grant_type'] = REDACT;
|
||||
}
|
||||
if ('assertion' in obj) {
|
||||
obj['assertion'] = REDACT;
|
||||
}
|
||||
if ('client_secret' in obj) {
|
||||
obj['client_secret'] = REDACT;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data.config) {
|
||||
redactHeaders(data.config.headers);
|
||||
redactString(data.config, 'data');
|
||||
redactObject(data.config.data);
|
||||
redactString(data.config, 'body');
|
||||
redactObject(data.config.body);
|
||||
try {
|
||||
const url = new url_1.URL('', data.config.url);
|
||||
if (url.searchParams.has('token')) {
|
||||
url.searchParams.set('token', REDACT);
|
||||
}
|
||||
if (url.searchParams.has('client_secret')) {
|
||||
url.searchParams.set('client_secret', REDACT);
|
||||
}
|
||||
data.config.url = url.toString();
|
||||
}
|
||||
catch (_b) {
|
||||
// ignore error - no need to parse an invalid URL
|
||||
}
|
||||
}
|
||||
if (data.response) {
|
||||
defaultErrorRedactor({ config: data.response.config });
|
||||
redactHeaders(data.response.headers);
|
||||
redactString(data.response, 'data');
|
||||
redactObject(data.response.data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
//# sourceMappingURL=common.js.map
|
||||
480
extracted-source/node_modules/gaxios/build/src/gaxios.js
generated
vendored
Normal file
480
extracted-source/node_modules/gaxios/build/src/gaxios.js
generated
vendored
Normal file
@@ -0,0 +1,480 @@
|
||||
"use strict";
|
||||
// Copyright 2018 Google LLC
|
||||
// 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
|
||||
//
|
||||
// http://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;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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 __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
};
|
||||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var _Gaxios_instances, _a, _Gaxios_urlMayUseProxy, _Gaxios_applyRequestInterceptors, _Gaxios_applyResponseInterceptors, _Gaxios_prepareRequest, _Gaxios_proxyAgent, _Gaxios_getProxyAgent;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Gaxios = void 0;
|
||||
const extend_1 = __importDefault(require("extend"));
|
||||
const https_1 = require("https");
|
||||
const node_fetch_1 = __importDefault(require("node-fetch"));
|
||||
const querystring_1 = __importDefault(require("querystring"));
|
||||
const is_stream_1 = __importDefault(require("is-stream"));
|
||||
const url_1 = require("url");
|
||||
const common_1 = require("./common");
|
||||
const retry_1 = require("./retry");
|
||||
const stream_1 = require("stream");
|
||||
const uuid_1 = require("uuid");
|
||||
const interceptor_1 = require("./interceptor");
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fetch = hasFetch() ? window.fetch : node_fetch_1.default;
|
||||
function hasWindow() {
|
||||
return typeof window !== 'undefined' && !!window;
|
||||
}
|
||||
function hasFetch() {
|
||||
return hasWindow() && !!window.fetch;
|
||||
}
|
||||
function hasBuffer() {
|
||||
return typeof Buffer !== 'undefined';
|
||||
}
|
||||
function hasHeader(options, header) {
|
||||
return !!getHeader(options, header);
|
||||
}
|
||||
function getHeader(options, header) {
|
||||
header = header.toLowerCase();
|
||||
for (const key of Object.keys((options === null || options === void 0 ? void 0 : options.headers) || {})) {
|
||||
if (header === key.toLowerCase()) {
|
||||
return options.headers[key];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
class Gaxios {
|
||||
/**
|
||||
* The Gaxios class is responsible for making HTTP requests.
|
||||
* @param defaults The default set of options to be used for this instance.
|
||||
*/
|
||||
constructor(defaults) {
|
||||
_Gaxios_instances.add(this);
|
||||
this.agentCache = new Map();
|
||||
this.defaults = defaults || {};
|
||||
this.interceptors = {
|
||||
request: new interceptor_1.GaxiosInterceptorManager(),
|
||||
response: new interceptor_1.GaxiosInterceptorManager(),
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Perform an HTTP request with the given options.
|
||||
* @param opts Set of HTTP options that will be used for this HTTP request.
|
||||
*/
|
||||
async request(opts = {}) {
|
||||
opts = await __classPrivateFieldGet(this, _Gaxios_instances, "m", _Gaxios_prepareRequest).call(this, opts);
|
||||
opts = await __classPrivateFieldGet(this, _Gaxios_instances, "m", _Gaxios_applyRequestInterceptors).call(this, opts);
|
||||
return __classPrivateFieldGet(this, _Gaxios_instances, "m", _Gaxios_applyResponseInterceptors).call(this, this._request(opts));
|
||||
}
|
||||
async _defaultAdapter(opts) {
|
||||
const fetchImpl = opts.fetchImplementation || fetch;
|
||||
const res = (await fetchImpl(opts.url, opts));
|
||||
const data = await this.getResponseData(opts, res);
|
||||
return this.translateResponse(opts, res, data);
|
||||
}
|
||||
/**
|
||||
* Internal, retryable version of the `request` method.
|
||||
* @param opts Set of HTTP options that will be used for this HTTP request.
|
||||
*/
|
||||
async _request(opts = {}) {
|
||||
var _b;
|
||||
try {
|
||||
let translatedResponse;
|
||||
if (opts.adapter) {
|
||||
translatedResponse = await opts.adapter(opts, this._defaultAdapter.bind(this));
|
||||
}
|
||||
else {
|
||||
translatedResponse = await this._defaultAdapter(opts);
|
||||
}
|
||||
if (!opts.validateStatus(translatedResponse.status)) {
|
||||
if (opts.responseType === 'stream') {
|
||||
let response = '';
|
||||
await new Promise(resolve => {
|
||||
(translatedResponse === null || translatedResponse === void 0 ? void 0 : translatedResponse.data).on('data', chunk => {
|
||||
response += chunk;
|
||||
});
|
||||
(translatedResponse === null || translatedResponse === void 0 ? void 0 : translatedResponse.data).on('end', resolve);
|
||||
});
|
||||
translatedResponse.data = response;
|
||||
}
|
||||
throw new common_1.GaxiosError(`Request failed with status code ${translatedResponse.status}`, opts, translatedResponse);
|
||||
}
|
||||
return translatedResponse;
|
||||
}
|
||||
catch (e) {
|
||||
const err = e instanceof common_1.GaxiosError
|
||||
? e
|
||||
: new common_1.GaxiosError(e.message, opts, undefined, e);
|
||||
const { shouldRetry, config } = await (0, retry_1.getRetryConfig)(err);
|
||||
if (shouldRetry && config) {
|
||||
err.config.retryConfig.currentRetryAttempt =
|
||||
config.retryConfig.currentRetryAttempt;
|
||||
// The error's config could be redacted - therefore we only want to
|
||||
// copy the retry state over to the existing config
|
||||
opts.retryConfig = (_b = err.config) === null || _b === void 0 ? void 0 : _b.retryConfig;
|
||||
return this._request(opts);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
async getResponseData(opts, res) {
|
||||
switch (opts.responseType) {
|
||||
case 'stream':
|
||||
return res.body;
|
||||
case 'json': {
|
||||
let data = await res.text();
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
catch (_b) {
|
||||
// continue
|
||||
}
|
||||
return data;
|
||||
}
|
||||
case 'arraybuffer':
|
||||
return res.arrayBuffer();
|
||||
case 'blob':
|
||||
return res.blob();
|
||||
case 'text':
|
||||
return res.text();
|
||||
default:
|
||||
return this.getResponseDataFromContentType(res);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* By default, throw for any non-2xx status code
|
||||
* @param status status code from the HTTP response
|
||||
*/
|
||||
validateStatus(status) {
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
/**
|
||||
* Encode a set of key/value pars into a querystring format (?foo=bar&baz=boo)
|
||||
* @param params key value pars to encode
|
||||
*/
|
||||
paramsSerializer(params) {
|
||||
return querystring_1.default.stringify(params);
|
||||
}
|
||||
translateResponse(opts, res, data) {
|
||||
// headers need to be converted from a map to an obj
|
||||
const headers = {};
|
||||
res.headers.forEach((value, key) => {
|
||||
headers[key] = value;
|
||||
});
|
||||
return {
|
||||
config: opts,
|
||||
data: data,
|
||||
headers,
|
||||
status: res.status,
|
||||
statusText: res.statusText,
|
||||
// XMLHttpRequestLike
|
||||
request: {
|
||||
responseURL: res.url,
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Attempts to parse a response by looking at the Content-Type header.
|
||||
* @param {FetchResponse} response the HTTP response.
|
||||
* @returns {Promise<any>} a promise that resolves to the response data.
|
||||
*/
|
||||
async getResponseDataFromContentType(response) {
|
||||
let contentType = response.headers.get('Content-Type');
|
||||
if (contentType === null) {
|
||||
// Maintain existing functionality by calling text()
|
||||
return response.text();
|
||||
}
|
||||
contentType = contentType.toLowerCase();
|
||||
if (contentType.includes('application/json')) {
|
||||
let data = await response.text();
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
catch (_b) {
|
||||
// continue
|
||||
}
|
||||
return data;
|
||||
}
|
||||
else if (contentType.match(/^text\//)) {
|
||||
return response.text();
|
||||
}
|
||||
else {
|
||||
// If the content type is something not easily handled, just return the raw data (blob)
|
||||
return response.blob();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates an async generator that yields the pieces of a multipart/related request body.
|
||||
* This implementation follows the spec: https://www.ietf.org/rfc/rfc2387.txt. However, recursive
|
||||
* multipart/related requests are not currently supported.
|
||||
*
|
||||
* @param {GaxioMultipartOptions[]} multipartOptions the pieces to turn into a multipart/related body.
|
||||
* @param {string} boundary the boundary string to be placed between each part.
|
||||
*/
|
||||
async *getMultipartRequest(multipartOptions, boundary) {
|
||||
const finale = `--${boundary}--`;
|
||||
for (const currentPart of multipartOptions) {
|
||||
const partContentType = currentPart.headers['Content-Type'] || 'application/octet-stream';
|
||||
const preamble = `--${boundary}\r\nContent-Type: ${partContentType}\r\n\r\n`;
|
||||
yield preamble;
|
||||
if (typeof currentPart.content === 'string') {
|
||||
yield currentPart.content;
|
||||
}
|
||||
else {
|
||||
yield* currentPart.content;
|
||||
}
|
||||
yield '\r\n';
|
||||
}
|
||||
yield finale;
|
||||
}
|
||||
}
|
||||
exports.Gaxios = Gaxios;
|
||||
_a = Gaxios, _Gaxios_instances = new WeakSet(), _Gaxios_urlMayUseProxy = function _Gaxios_urlMayUseProxy(url, noProxy = []) {
|
||||
var _b, _c;
|
||||
const candidate = new url_1.URL(url);
|
||||
const noProxyList = [...noProxy];
|
||||
const noProxyEnvList = ((_c = ((_b = process.env.NO_PROXY) !== null && _b !== void 0 ? _b : process.env.no_proxy)) === null || _c === void 0 ? void 0 : _c.split(',')) || [];
|
||||
for (const rule of noProxyEnvList) {
|
||||
noProxyList.push(rule.trim());
|
||||
}
|
||||
for (const rule of noProxyList) {
|
||||
// Match regex
|
||||
if (rule instanceof RegExp) {
|
||||
if (rule.test(candidate.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Match URL
|
||||
else if (rule instanceof url_1.URL) {
|
||||
if (rule.origin === candidate.origin) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Match string regex
|
||||
else if (rule.startsWith('*.') || rule.startsWith('.')) {
|
||||
const cleanedRule = rule.replace(/^\*\./, '.');
|
||||
if (candidate.hostname.endsWith(cleanedRule)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Basic string match
|
||||
else if (rule === candidate.origin ||
|
||||
rule === candidate.hostname ||
|
||||
rule === candidate.href) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}, _Gaxios_applyRequestInterceptors =
|
||||
/**
|
||||
* Applies the request interceptors. The request interceptors are applied after the
|
||||
* call to prepareRequest is completed.
|
||||
*
|
||||
* @param {GaxiosOptions} options The current set of options.
|
||||
*
|
||||
* @returns {Promise<GaxiosOptions>} Promise that resolves to the set of options or response after interceptors are applied.
|
||||
*/
|
||||
async function _Gaxios_applyRequestInterceptors(options) {
|
||||
let promiseChain = Promise.resolve(options);
|
||||
for (const interceptor of this.interceptors.request.values()) {
|
||||
if (interceptor) {
|
||||
promiseChain = promiseChain.then(interceptor.resolved, interceptor.rejected);
|
||||
}
|
||||
}
|
||||
return promiseChain;
|
||||
}, _Gaxios_applyResponseInterceptors =
|
||||
/**
|
||||
* Applies the response interceptors. The response interceptors are applied after the
|
||||
* call to request is made.
|
||||
*
|
||||
* @param {GaxiosOptions} options The current set of options.
|
||||
*
|
||||
* @returns {Promise<GaxiosOptions>} Promise that resolves to the set of options or response after interceptors are applied.
|
||||
*/
|
||||
async function _Gaxios_applyResponseInterceptors(response) {
|
||||
let promiseChain = Promise.resolve(response);
|
||||
for (const interceptor of this.interceptors.response.values()) {
|
||||
if (interceptor) {
|
||||
promiseChain = promiseChain.then(interceptor.resolved, interceptor.rejected);
|
||||
}
|
||||
}
|
||||
return promiseChain;
|
||||
}, _Gaxios_prepareRequest =
|
||||
/**
|
||||
* Validates the options, merges them with defaults, and prepare request.
|
||||
*
|
||||
* @param options The original options passed from the client.
|
||||
* @returns Prepared options, ready to make a request
|
||||
*/
|
||||
async function _Gaxios_prepareRequest(options) {
|
||||
var _b, _c, _d, _e;
|
||||
const opts = (0, extend_1.default)(true, {}, this.defaults, options);
|
||||
if (!opts.url) {
|
||||
throw new Error('URL is required.');
|
||||
}
|
||||
// baseUrl has been deprecated, remove in 2.0
|
||||
const baseUrl = opts.baseUrl || opts.baseURL;
|
||||
if (baseUrl) {
|
||||
opts.url = baseUrl.toString() + opts.url;
|
||||
}
|
||||
opts.paramsSerializer = opts.paramsSerializer || this.paramsSerializer;
|
||||
if (opts.params && Object.keys(opts.params).length > 0) {
|
||||
let additionalQueryParams = opts.paramsSerializer(opts.params);
|
||||
if (additionalQueryParams.startsWith('?')) {
|
||||
additionalQueryParams = additionalQueryParams.slice(1);
|
||||
}
|
||||
const prefix = opts.url.toString().includes('?') ? '&' : '?';
|
||||
opts.url = opts.url + prefix + additionalQueryParams;
|
||||
}
|
||||
if (typeof options.maxContentLength === 'number') {
|
||||
opts.size = options.maxContentLength;
|
||||
}
|
||||
if (typeof options.maxRedirects === 'number') {
|
||||
opts.follow = options.maxRedirects;
|
||||
}
|
||||
opts.headers = opts.headers || {};
|
||||
if (opts.multipart === undefined && opts.data) {
|
||||
const isFormData = typeof FormData === 'undefined'
|
||||
? false
|
||||
: (opts === null || opts === void 0 ? void 0 : opts.data) instanceof FormData;
|
||||
if (is_stream_1.default.readable(opts.data)) {
|
||||
opts.body = opts.data;
|
||||
}
|
||||
else if (hasBuffer() && Buffer.isBuffer(opts.data)) {
|
||||
// Do not attempt to JSON.stringify() a Buffer:
|
||||
opts.body = opts.data;
|
||||
if (!hasHeader(opts, 'Content-Type')) {
|
||||
opts.headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
}
|
||||
else if (typeof opts.data === 'object') {
|
||||
// If www-form-urlencoded content type has been set, but data is
|
||||
// provided as an object, serialize the content using querystring:
|
||||
if (!isFormData) {
|
||||
if (getHeader(opts, 'content-type') ===
|
||||
'application/x-www-form-urlencoded') {
|
||||
opts.body = opts.paramsSerializer(opts.data);
|
||||
}
|
||||
else {
|
||||
// } else if (!(opts.data instanceof FormData)) {
|
||||
if (!hasHeader(opts, 'Content-Type')) {
|
||||
opts.headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
opts.body = JSON.stringify(opts.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
opts.body = opts.data;
|
||||
}
|
||||
}
|
||||
else if (opts.multipart && opts.multipart.length > 0) {
|
||||
// note: once the minimum version reaches Node 16,
|
||||
// this can be replaced with randomUUID() function from crypto
|
||||
// and the dependency on UUID removed
|
||||
const boundary = (0, uuid_1.v4)();
|
||||
opts.headers['Content-Type'] = `multipart/related; boundary=${boundary}`;
|
||||
const bodyStream = new stream_1.PassThrough();
|
||||
opts.body = bodyStream;
|
||||
(0, stream_1.pipeline)(this.getMultipartRequest(opts.multipart, boundary), bodyStream, () => { });
|
||||
}
|
||||
opts.validateStatus = opts.validateStatus || this.validateStatus;
|
||||
opts.responseType = opts.responseType || 'unknown';
|
||||
if (!opts.headers['Accept'] && opts.responseType === 'json') {
|
||||
opts.headers['Accept'] = 'application/json';
|
||||
}
|
||||
opts.method = opts.method || 'GET';
|
||||
const proxy = opts.proxy ||
|
||||
((_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b.HTTPS_PROXY) ||
|
||||
((_c = process === null || process === void 0 ? void 0 : process.env) === null || _c === void 0 ? void 0 : _c.https_proxy) ||
|
||||
((_d = process === null || process === void 0 ? void 0 : process.env) === null || _d === void 0 ? void 0 : _d.HTTP_PROXY) ||
|
||||
((_e = process === null || process === void 0 ? void 0 : process.env) === null || _e === void 0 ? void 0 : _e.http_proxy);
|
||||
const urlMayUseProxy = __classPrivateFieldGet(this, _Gaxios_instances, "m", _Gaxios_urlMayUseProxy).call(this, opts.url, opts.noProxy);
|
||||
if (opts.agent) {
|
||||
// don't do any of the following options - use the user-provided agent.
|
||||
}
|
||||
else if (proxy && urlMayUseProxy) {
|
||||
const HttpsProxyAgent = await __classPrivateFieldGet(_a, _a, "m", _Gaxios_getProxyAgent).call(_a);
|
||||
if (this.agentCache.has(proxy)) {
|
||||
opts.agent = this.agentCache.get(proxy);
|
||||
}
|
||||
else {
|
||||
opts.agent = new HttpsProxyAgent(proxy, {
|
||||
cert: opts.cert,
|
||||
key: opts.key,
|
||||
});
|
||||
this.agentCache.set(proxy, opts.agent);
|
||||
}
|
||||
}
|
||||
else if (opts.cert && opts.key) {
|
||||
// Configure client for mTLS
|
||||
if (this.agentCache.has(opts.key)) {
|
||||
opts.agent = this.agentCache.get(opts.key);
|
||||
}
|
||||
else {
|
||||
opts.agent = new https_1.Agent({
|
||||
cert: opts.cert,
|
||||
key: opts.key,
|
||||
});
|
||||
this.agentCache.set(opts.key, opts.agent);
|
||||
}
|
||||
}
|
||||
if (typeof opts.errorRedactor !== 'function' &&
|
||||
opts.errorRedactor !== false) {
|
||||
opts.errorRedactor = common_1.defaultErrorRedactor;
|
||||
}
|
||||
return opts;
|
||||
}, _Gaxios_getProxyAgent = async function _Gaxios_getProxyAgent() {
|
||||
__classPrivateFieldSet(this, _a, __classPrivateFieldGet(this, _a, "f", _Gaxios_proxyAgent) || (await Promise.resolve().then(() => __importStar(require('https-proxy-agent')))).HttpsProxyAgent, "f", _Gaxios_proxyAgent);
|
||||
return __classPrivateFieldGet(this, _a, "f", _Gaxios_proxyAgent);
|
||||
};
|
||||
/**
|
||||
* A cache for the lazily-loaded proxy agent.
|
||||
*
|
||||
* Should use {@link Gaxios[#getProxyAgent]} to retrieve.
|
||||
*/
|
||||
// using `import` to dynamically import the types here
|
||||
_Gaxios_proxyAgent = { value: void 0 };
|
||||
//# sourceMappingURL=gaxios.js.map
|
||||
48
extracted-source/node_modules/gaxios/build/src/index.js
generated
vendored
Normal file
48
extracted-source/node_modules/gaxios/build/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
// Copyright 2018 Google LLC
|
||||
// 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
|
||||
//
|
||||
// http://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;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.instance = exports.Gaxios = exports.GaxiosError = void 0;
|
||||
exports.request = request;
|
||||
const gaxios_1 = require("./gaxios");
|
||||
Object.defineProperty(exports, "Gaxios", { enumerable: true, get: function () { return gaxios_1.Gaxios; } });
|
||||
var common_1 = require("./common");
|
||||
Object.defineProperty(exports, "GaxiosError", { enumerable: true, get: function () { return common_1.GaxiosError; } });
|
||||
__exportStar(require("./interceptor"), exports);
|
||||
/**
|
||||
* The default instance used when the `request` method is directly
|
||||
* invoked.
|
||||
*/
|
||||
exports.instance = new gaxios_1.Gaxios();
|
||||
/**
|
||||
* Make an HTTP request using the given options.
|
||||
* @param opts Options for the request
|
||||
*/
|
||||
async function request(opts) {
|
||||
return exports.instance.request(opts);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
22
extracted-source/node_modules/gaxios/build/src/interceptor.js
generated
vendored
Normal file
22
extracted-source/node_modules/gaxios/build/src/interceptor.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC
|
||||
// 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
|
||||
//
|
||||
// http://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.GaxiosInterceptorManager = void 0;
|
||||
/**
|
||||
* Class to manage collections of GaxiosInterceptors for both requests and responses.
|
||||
*/
|
||||
class GaxiosInterceptorManager extends Set {
|
||||
}
|
||||
exports.GaxiosInterceptorManager = GaxiosInterceptorManager;
|
||||
//# sourceMappingURL=interceptor.js.map
|
||||
166
extracted-source/node_modules/gaxios/build/src/retry.js
generated
vendored
Normal file
166
extracted-source/node_modules/gaxios/build/src/retry.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
// Copyright 2018 Google LLC
|
||||
// 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
|
||||
//
|
||||
// http://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.getRetryConfig = getRetryConfig;
|
||||
async function getRetryConfig(err) {
|
||||
let config = getConfig(err);
|
||||
if (!err || !err.config || (!config && !err.config.retry)) {
|
||||
return { shouldRetry: false };
|
||||
}
|
||||
config = config || {};
|
||||
config.currentRetryAttempt = config.currentRetryAttempt || 0;
|
||||
config.retry =
|
||||
config.retry === undefined || config.retry === null ? 3 : config.retry;
|
||||
config.httpMethodsToRetry = config.httpMethodsToRetry || [
|
||||
'GET',
|
||||
'HEAD',
|
||||
'PUT',
|
||||
'OPTIONS',
|
||||
'DELETE',
|
||||
];
|
||||
config.noResponseRetries =
|
||||
config.noResponseRetries === undefined || config.noResponseRetries === null
|
||||
? 2
|
||||
: config.noResponseRetries;
|
||||
config.retryDelayMultiplier = config.retryDelayMultiplier
|
||||
? config.retryDelayMultiplier
|
||||
: 2;
|
||||
config.timeOfFirstRequest = config.timeOfFirstRequest
|
||||
? config.timeOfFirstRequest
|
||||
: Date.now();
|
||||
config.totalTimeout = config.totalTimeout
|
||||
? config.totalTimeout
|
||||
: Number.MAX_SAFE_INTEGER;
|
||||
config.maxRetryDelay = config.maxRetryDelay
|
||||
? config.maxRetryDelay
|
||||
: Number.MAX_SAFE_INTEGER;
|
||||
// If this wasn't in the list of status codes where we want
|
||||
// to automatically retry, return.
|
||||
const retryRanges = [
|
||||
// https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
// 1xx - Retry (Informational, request still processing)
|
||||
// 2xx - Do not retry (Success)
|
||||
// 3xx - Do not retry (Redirect)
|
||||
// 4xx - Do not retry (Client errors)
|
||||
// 408 - Retry ("Request Timeout")
|
||||
// 429 - Retry ("Too Many Requests")
|
||||
// 5xx - Retry (Server errors)
|
||||
[100, 199],
|
||||
[408, 408],
|
||||
[429, 429],
|
||||
[500, 599],
|
||||
];
|
||||
config.statusCodesToRetry = config.statusCodesToRetry || retryRanges;
|
||||
// Put the config back into the err
|
||||
err.config.retryConfig = config;
|
||||
// Determine if we should retry the request
|
||||
const shouldRetryFn = config.shouldRetry || shouldRetryRequest;
|
||||
if (!(await shouldRetryFn(err))) {
|
||||
return { shouldRetry: false, config: err.config };
|
||||
}
|
||||
const delay = getNextRetryDelay(config);
|
||||
// We're going to retry! Incremenent the counter.
|
||||
err.config.retryConfig.currentRetryAttempt += 1;
|
||||
// Create a promise that invokes the retry after the backOffDelay
|
||||
const backoff = config.retryBackoff
|
||||
? config.retryBackoff(err, delay)
|
||||
: new Promise(resolve => {
|
||||
setTimeout(resolve, delay);
|
||||
});
|
||||
// Notify the user if they added an `onRetryAttempt` handler
|
||||
if (config.onRetryAttempt) {
|
||||
config.onRetryAttempt(err);
|
||||
}
|
||||
// Return the promise in which recalls Gaxios to retry the request
|
||||
await backoff;
|
||||
return { shouldRetry: true, config: err.config };
|
||||
}
|
||||
/**
|
||||
* Determine based on config if we should retry the request.
|
||||
* @param err The GaxiosError passed to the interceptor.
|
||||
*/
|
||||
function shouldRetryRequest(err) {
|
||||
var _a;
|
||||
const config = getConfig(err);
|
||||
// node-fetch raises an AbortError if signaled:
|
||||
// https://github.com/bitinn/node-fetch#request-cancellation-with-abortsignal
|
||||
if (err.name === 'AbortError' || ((_a = err.error) === null || _a === void 0 ? void 0 : _a.name) === 'AbortError') {
|
||||
return false;
|
||||
}
|
||||
// If there's no config, or retries are disabled, return.
|
||||
if (!config || config.retry === 0) {
|
||||
return false;
|
||||
}
|
||||
// Check if this error has no response (ETIMEDOUT, ENOTFOUND, etc)
|
||||
if (!err.response &&
|
||||
(config.currentRetryAttempt || 0) >= config.noResponseRetries) {
|
||||
return false;
|
||||
}
|
||||
// Only retry with configured HttpMethods.
|
||||
if (!err.config.method ||
|
||||
config.httpMethodsToRetry.indexOf(err.config.method.toUpperCase()) < 0) {
|
||||
return false;
|
||||
}
|
||||
// If this wasn't in the list of status codes where we want
|
||||
// to automatically retry, return.
|
||||
if (err.response && err.response.status) {
|
||||
let isInRange = false;
|
||||
for (const [min, max] of config.statusCodesToRetry) {
|
||||
const status = err.response.status;
|
||||
if (status >= min && status <= max) {
|
||||
isInRange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isInRange) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// If we are out of retry attempts, return
|
||||
config.currentRetryAttempt = config.currentRetryAttempt || 0;
|
||||
if (config.currentRetryAttempt >= config.retry) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Acquire the raxConfig object from an GaxiosError if available.
|
||||
* @param err The Gaxios error with a config object.
|
||||
*/
|
||||
function getConfig(err) {
|
||||
if (err && err.config && err.config.retryConfig) {
|
||||
return err.config.retryConfig;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Gets the delay to wait before the next retry.
|
||||
*
|
||||
* @param {RetryConfig} config The current set of retry options
|
||||
* @returns {number} the amount of ms to wait before the next retry attempt.
|
||||
*/
|
||||
function getNextRetryDelay(config) {
|
||||
var _a;
|
||||
// Calculate time to wait with exponential backoff.
|
||||
// If this is the first retry, look for a configured retryDelay.
|
||||
const retryDelay = config.currentRetryAttempt ? 0 : (_a = config.retryDelay) !== null && _a !== void 0 ? _a : 100;
|
||||
// Formula: retryDelay + ((retryDelayMultiplier^currentRetryAttempt - 1 / 2) * 1000)
|
||||
const calculatedDelay = retryDelay +
|
||||
((Math.pow(config.retryDelayMultiplier, config.currentRetryAttempt) - 1) /
|
||||
2) *
|
||||
1000;
|
||||
const maxAllowableDelay = config.totalTimeout - (Date.now() - config.timeOfFirstRequest);
|
||||
return Math.min(calculatedDelay, maxAllowableDelay, config.maxRetryDelay);
|
||||
}
|
||||
//# sourceMappingURL=retry.js.map
|
||||
17
extracted-source/node_modules/gaxios/build/src/util.js
generated
vendored
Normal file
17
extracted-source/node_modules/gaxios/build/src/util.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
// Copyright 2023 Google LLC
|
||||
// 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
|
||||
//
|
||||
// http://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.pkg = void 0;
|
||||
exports.pkg = require('../../package.json');
|
||||
//# sourceMappingURL=util.js.map
|
||||
28
extracted-source/node_modules/gaxios/node_modules/is-stream/index.js
generated
vendored
Normal file
28
extracted-source/node_modules/gaxios/node_modules/is-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const isStream = stream =>
|
||||
stream !== null &&
|
||||
typeof stream === 'object' &&
|
||||
typeof stream.pipe === 'function';
|
||||
|
||||
isStream.writable = stream =>
|
||||
isStream(stream) &&
|
||||
stream.writable !== false &&
|
||||
typeof stream._write === 'function' &&
|
||||
typeof stream._writableState === 'object';
|
||||
|
||||
isStream.readable = stream =>
|
||||
isStream(stream) &&
|
||||
stream.readable !== false &&
|
||||
typeof stream._read === 'function' &&
|
||||
typeof stream._readableState === 'object';
|
||||
|
||||
isStream.duplex = stream =>
|
||||
isStream.writable(stream) &&
|
||||
isStream.readable(stream);
|
||||
|
||||
isStream.transform = stream =>
|
||||
isStream.duplex(stream) &&
|
||||
typeof stream._transform === 'function';
|
||||
|
||||
module.exports = isStream;
|
||||
79
extracted-source/node_modules/gaxios/node_modules/uuid/dist/index.js
generated
vendored
Normal file
79
extracted-source/node_modules/gaxios/node_modules/uuid/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "NIL", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _nil.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "stringify", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _stringify.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "v1", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _v.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "v3", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _v2.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "v4", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _v3.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "v5", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _v4.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "validate", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _validate.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _version.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _v = _interopRequireDefault(require("./v1.js"));
|
||||
|
||||
var _v2 = _interopRequireDefault(require("./v3.js"));
|
||||
|
||||
var _v3 = _interopRequireDefault(require("./v4.js"));
|
||||
|
||||
var _v4 = _interopRequireDefault(require("./v5.js"));
|
||||
|
||||
var _nil = _interopRequireDefault(require("./nil.js"));
|
||||
|
||||
var _version = _interopRequireDefault(require("./version.js"));
|
||||
|
||||
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||
|
||||
var _stringify = _interopRequireDefault(require("./stringify.js"));
|
||||
|
||||
var _parse = _interopRequireDefault(require("./parse.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
23
extracted-source/node_modules/gaxios/node_modules/uuid/dist/md5.js
generated
vendored
Normal file
23
extracted-source/node_modules/gaxios/node_modules/uuid/dist/md5.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _crypto = _interopRequireDefault(require("crypto"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function md5(bytes) {
|
||||
if (Array.isArray(bytes)) {
|
||||
bytes = Buffer.from(bytes);
|
||||
} else if (typeof bytes === 'string') {
|
||||
bytes = Buffer.from(bytes, 'utf8');
|
||||
}
|
||||
|
||||
return _crypto.default.createHash('md5').update(bytes).digest();
|
||||
}
|
||||
|
||||
var _default = md5;
|
||||
exports.default = _default;
|
||||
15
extracted-source/node_modules/gaxios/node_modules/uuid/dist/native.js
generated
vendored
Normal file
15
extracted-source/node_modules/gaxios/node_modules/uuid/dist/native.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _crypto = _interopRequireDefault(require("crypto"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
randomUUID: _crypto.default.randomUUID
|
||||
};
|
||||
exports.default = _default;
|
||||
8
extracted-source/node_modules/gaxios/node_modules/uuid/dist/nil.js
generated
vendored
Normal file
8
extracted-source/node_modules/gaxios/node_modules/uuid/dist/nil.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = '00000000-0000-0000-0000-000000000000';
|
||||
exports.default = _default;
|
||||
45
extracted-source/node_modules/gaxios/node_modules/uuid/dist/parse.js
generated
vendored
Normal file
45
extracted-source/node_modules/gaxios/node_modules/uuid/dist/parse.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function parse(uuid) {
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Invalid UUID');
|
||||
}
|
||||
|
||||
let v;
|
||||
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
||||
|
||||
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
||||
arr[1] = v >>> 16 & 0xff;
|
||||
arr[2] = v >>> 8 & 0xff;
|
||||
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
||||
|
||||
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
||||
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
||||
|
||||
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
||||
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
||||
|
||||
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
||||
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
||||
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
||||
|
||||
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
||||
arr[11] = v / 0x100000000 & 0xff;
|
||||
arr[12] = v >>> 24 & 0xff;
|
||||
arr[13] = v >>> 16 & 0xff;
|
||||
arr[14] = v >>> 8 & 0xff;
|
||||
arr[15] = v & 0xff;
|
||||
return arr;
|
||||
}
|
||||
|
||||
var _default = parse;
|
||||
exports.default = _default;
|
||||
8
extracted-source/node_modules/gaxios/node_modules/uuid/dist/regex.js
generated
vendored
Normal file
8
extracted-source/node_modules/gaxios/node_modules/uuid/dist/regex.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
||||
exports.default = _default;
|
||||
24
extracted-source/node_modules/gaxios/node_modules/uuid/dist/rng.js
generated
vendored
Normal file
24
extracted-source/node_modules/gaxios/node_modules/uuid/dist/rng.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = rng;
|
||||
|
||||
var _crypto = _interopRequireDefault(require("crypto"));
|
||||
|
||||
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);
|
||||
}
|
||||
23
extracted-source/node_modules/gaxios/node_modules/uuid/dist/sha1.js
generated
vendored
Normal file
23
extracted-source/node_modules/gaxios/node_modules/uuid/dist/sha1.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _crypto = _interopRequireDefault(require("crypto"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function sha1(bytes) {
|
||||
if (Array.isArray(bytes)) {
|
||||
bytes = Buffer.from(bytes);
|
||||
} else if (typeof bytes === 'string') {
|
||||
bytes = Buffer.from(bytes, 'utf8');
|
||||
}
|
||||
|
||||
return _crypto.default.createHash('sha1').update(bytes).digest();
|
||||
}
|
||||
|
||||
var _default = sha1;
|
||||
exports.default = _default;
|
||||
44
extracted-source/node_modules/gaxios/node_modules/uuid/dist/stringify.js
generated
vendored
Normal file
44
extracted-source/node_modules/gaxios/node_modules/uuid/dist/stringify.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
exports.unsafeStringify = unsafeStringify;
|
||||
|
||||
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
const byteToHex = [];
|
||||
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
byteToHex.push((i + 0x100).toString(16).slice(1));
|
||||
}
|
||||
|
||||
function unsafeStringify(arr, offset = 0) {
|
||||
// Note: Be careful editing this code! It's been tuned for performance
|
||||
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
||||
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
||||
}
|
||||
|
||||
function stringify(arr, offset = 0) {
|
||||
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
|
||||
// of the following:
|
||||
// - One or more input array values don't map to a hex octet (leading to
|
||||
// "undefined" in the uuid)
|
||||
// - Invalid input values for the RFC `version` or `variant` fields
|
||||
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Stringified UUID is invalid');
|
||||
}
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
var _default = stringify;
|
||||
exports.default = _default;
|
||||
107
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v1.js
generated
vendored
Normal file
107
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v1.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _rng = _interopRequireDefault(require("./rng.js"));
|
||||
|
||||
var _stringify = require("./stringify.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// **`v1()` - Generate time-based UUID**
|
||||
//
|
||||
// Inspired by https://github.com/LiosK/UUID.js
|
||||
// and http://docs.python.org/library/uuid.html
|
||||
let _nodeId;
|
||||
|
||||
let _clockseq; // Previous uuid creation time
|
||||
|
||||
|
||||
let _lastMSecs = 0;
|
||||
let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
|
||||
|
||||
function v1(options, buf, offset) {
|
||||
let i = buf && offset || 0;
|
||||
const b = buf || new Array(16);
|
||||
options = options || {};
|
||||
let node = options.node || _nodeId;
|
||||
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
||||
// specified. We do this lazily to minimize issues related to insufficient
|
||||
// system entropy. See #189
|
||||
|
||||
if (node == null || clockseq == null) {
|
||||
const seedBytes = options.random || (options.rng || _rng.default)();
|
||||
|
||||
if (node == null) {
|
||||
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
||||
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
||||
}
|
||||
|
||||
if (clockseq == null) {
|
||||
// Per 4.2.2, randomize (14 bit) clockseq
|
||||
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
||||
}
|
||||
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
||||
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
||||
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
||||
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
||||
|
||||
|
||||
let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
|
||||
// cycle to simulate higher resolution clock
|
||||
|
||||
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
|
||||
|
||||
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
||||
|
||||
if (dt < 0 && options.clockseq === undefined) {
|
||||
clockseq = clockseq + 1 & 0x3fff;
|
||||
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
||||
// time interval
|
||||
|
||||
|
||||
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
||||
nsecs = 0;
|
||||
} // Per 4.2.1.2 Throw error if too many uuids are requested
|
||||
|
||||
|
||||
if (nsecs >= 10000) {
|
||||
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
||||
}
|
||||
|
||||
_lastMSecs = msecs;
|
||||
_lastNSecs = nsecs;
|
||||
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
||||
|
||||
msecs += 12219292800000; // `time_low`
|
||||
|
||||
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
||||
b[i++] = tl >>> 24 & 0xff;
|
||||
b[i++] = tl >>> 16 & 0xff;
|
||||
b[i++] = tl >>> 8 & 0xff;
|
||||
b[i++] = tl & 0xff; // `time_mid`
|
||||
|
||||
const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
||||
b[i++] = tmh >>> 8 & 0xff;
|
||||
b[i++] = tmh & 0xff; // `time_high_and_version`
|
||||
|
||||
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
||||
|
||||
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
||||
|
||||
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
|
||||
|
||||
b[i++] = clockseq & 0xff; // `node`
|
||||
|
||||
for (let n = 0; n < 6; ++n) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf || (0, _stringify.unsafeStringify)(b);
|
||||
}
|
||||
|
||||
var _default = v1;
|
||||
exports.default = _default;
|
||||
16
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v3.js
generated
vendored
Normal file
16
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v3.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _v = _interopRequireDefault(require("./v35.js"));
|
||||
|
||||
var _md = _interopRequireDefault(require("./md5.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
||||
var _default = v3;
|
||||
exports.default = _default;
|
||||
80
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v35.js
generated
vendored
Normal file
80
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v35.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.URL = exports.DNS = void 0;
|
||||
exports.default = v35;
|
||||
|
||||
var _stringify = require("./stringify.js");
|
||||
|
||||
var _parse = _interopRequireDefault(require("./parse.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function stringToBytes(str) {
|
||||
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
||||
|
||||
const bytes = [];
|
||||
|
||||
for (let i = 0; i < str.length; ++i) {
|
||||
bytes.push(str.charCodeAt(i));
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
||||
exports.DNS = DNS;
|
||||
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
||||
exports.URL = URL;
|
||||
|
||||
function v35(name, version, hashfunc) {
|
||||
function generateUUID(value, namespace, buf, offset) {
|
||||
var _namespace;
|
||||
|
||||
if (typeof value === 'string') {
|
||||
value = stringToBytes(value);
|
||||
}
|
||||
|
||||
if (typeof namespace === 'string') {
|
||||
namespace = (0, _parse.default)(namespace);
|
||||
}
|
||||
|
||||
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
||||
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
||||
} // Compute hash of namespace and value, Per 4.3
|
||||
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
||||
// hashfunc([...namespace, ... value])`
|
||||
|
||||
|
||||
let bytes = new Uint8Array(16 + value.length);
|
||||
bytes.set(namespace);
|
||||
bytes.set(value, namespace.length);
|
||||
bytes = hashfunc(bytes);
|
||||
bytes[6] = bytes[6] & 0x0f | version;
|
||||
bytes[8] = bytes[8] & 0x3f | 0x80;
|
||||
|
||||
if (buf) {
|
||||
offset = offset || 0;
|
||||
|
||||
for (let i = 0; i < 16; ++i) {
|
||||
buf[offset + i] = bytes[i];
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
return (0, _stringify.unsafeStringify)(bytes);
|
||||
} // Function#name is not settable on some platforms (#270)
|
||||
|
||||
|
||||
try {
|
||||
generateUUID.name = name; // eslint-disable-next-line no-empty
|
||||
} catch (err) {} // For CommonJS default export support
|
||||
|
||||
|
||||
generateUUID.DNS = DNS;
|
||||
generateUUID.URL = URL;
|
||||
return generateUUID;
|
||||
}
|
||||
43
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v4.js
generated
vendored
Normal file
43
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v4.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _native = _interopRequireDefault(require("./native.js"));
|
||||
|
||||
var _rng = _interopRequireDefault(require("./rng.js"));
|
||||
|
||||
var _stringify = require("./stringify.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function v4(options, buf, offset) {
|
||||
if (_native.default.randomUUID && !buf && !options) {
|
||||
return _native.default.randomUUID();
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
|
||||
const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||
|
||||
|
||||
rnds[6] = rnds[6] & 0x0f | 0x40;
|
||||
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
||||
|
||||
if (buf) {
|
||||
offset = offset || 0;
|
||||
|
||||
for (let i = 0; i < 16; ++i) {
|
||||
buf[offset + i] = rnds[i];
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
return (0, _stringify.unsafeStringify)(rnds);
|
||||
}
|
||||
|
||||
var _default = v4;
|
||||
exports.default = _default;
|
||||
16
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v5.js
generated
vendored
Normal file
16
extracted-source/node_modules/gaxios/node_modules/uuid/dist/v5.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _v = _interopRequireDefault(require("./v35.js"));
|
||||
|
||||
var _sha = _interopRequireDefault(require("./sha1.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
||||
var _default = v5;
|
||||
exports.default = _default;
|
||||
17
extracted-source/node_modules/gaxios/node_modules/uuid/dist/validate.js
generated
vendored
Normal file
17
extracted-source/node_modules/gaxios/node_modules/uuid/dist/validate.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _regex = _interopRequireDefault(require("./regex.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function validate(uuid) {
|
||||
return typeof uuid === 'string' && _regex.default.test(uuid);
|
||||
}
|
||||
|
||||
var _default = validate;
|
||||
exports.default = _default;
|
||||
21
extracted-source/node_modules/gaxios/node_modules/uuid/dist/version.js
generated
vendored
Normal file
21
extracted-source/node_modules/gaxios/node_modules/uuid/dist/version.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function version(uuid) {
|
||||
if (!(0, _validate.default)(uuid)) {
|
||||
throw TypeError('Invalid UUID');
|
||||
}
|
||||
|
||||
return parseInt(uuid.slice(14, 15), 16);
|
||||
}
|
||||
|
||||
var _default = version;
|
||||
exports.default = _default;
|
||||
Reference in New Issue
Block a user