@probelabs/probe
Version:
Node.js wrapper for the probe code search tool
1,344 lines (1,326 loc) • 6.19 MB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name14 in all)
__defProp(target, name14, { get: all[name14], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/dotenv/package.json
var require_package = __commonJS({
"node_modules/dotenv/package.json"(exports2, module2) {
module2.exports = {
name: "dotenv",
version: "16.6.1",
description: "Loads environment variables from .env file",
main: "lib/main.js",
types: "lib/main.d.ts",
exports: {
".": {
types: "./lib/main.d.ts",
require: "./lib/main.js",
default: "./lib/main.js"
},
"./config": "./config.js",
"./config.js": "./config.js",
"./lib/env-options": "./lib/env-options.js",
"./lib/env-options.js": "./lib/env-options.js",
"./lib/cli-options": "./lib/cli-options.js",
"./lib/cli-options.js": "./lib/cli-options.js",
"./package.json": "./package.json"
},
scripts: {
"dts-check": "tsc --project tests/types/tsconfig.json",
lint: "standard",
pretest: "npm run lint && npm run dts-check",
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
prerelease: "npm test",
release: "standard-version"
},
repository: {
type: "git",
url: "git://github.com/motdotla/dotenv.git"
},
homepage: "https://github.com/motdotla/dotenv#readme",
funding: "https://dotenvx.com",
keywords: [
"dotenv",
"env",
".env",
"environment",
"variables",
"config",
"settings"
],
readmeFilename: "README.md",
license: "BSD-2-Clause",
devDependencies: {
"@types/node": "^18.11.3",
decache: "^4.6.2",
sinon: "^14.0.1",
standard: "^17.0.0",
"standard-version": "^9.5.0",
tap: "^19.2.0",
typescript: "^4.8.4"
},
engines: {
node: ">=12"
},
browser: {
fs: false
}
};
}
});
// node_modules/dotenv/lib/main.js
var require_main = __commonJS({
"node_modules/dotenv/lib/main.js"(exports2, module2) {
var fs7 = require("fs");
var path7 = require("path");
var os3 = require("os");
var crypto2 = require("crypto");
var packageJson = require_package();
var version = packageJson.version;
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
function parse6(src) {
const obj = {};
let lines = src.toString();
lines = lines.replace(/\r\n?/mg, "\n");
let match2;
while ((match2 = LINE.exec(lines)) != null) {
const key = match2[1];
let value = match2[2] || "";
value = value.trim();
const maybeQuote = value[0];
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
if (maybeQuote === '"') {
value = value.replace(/\\n/g, "\n");
value = value.replace(/\\r/g, "\r");
}
obj[key] = value;
}
return obj;
}
function _parseVault(options) {
options = options || {};
const vaultPath = _vaultPath(options);
options.path = vaultPath;
const result = DotenvModule.configDotenv(options);
if (!result.parsed) {
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
err.code = "MISSING_DATA";
throw err;
}
const keys2 = _dotenvKey(options).split(",");
const length = keys2.length;
let decrypted;
for (let i3 = 0; i3 < length; i3++) {
try {
const key = keys2[i3].trim();
const attrs = _instructions(result, key);
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
break;
} catch (error2) {
if (i3 + 1 >= length) {
throw error2;
}
}
}
return DotenvModule.parse(decrypted);
}
function _warn(message) {
console.log(`[dotenv@${version}][WARN] ${message}`);
}
function _debug(message) {
console.log(`[dotenv@${version}][DEBUG] ${message}`);
}
function _log(message) {
console.log(`[dotenv@${version}] ${message}`);
}
function _dotenvKey(options) {
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
return options.DOTENV_KEY;
}
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
return process.env.DOTENV_KEY;
}
return "";
}
function _instructions(result, dotenvKey) {
let uri;
try {
uri = new URL(dotenvKey);
} catch (error2) {
if (error2.code === "ERR_INVALID_URL") {
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
err.code = "INVALID_DOTENV_KEY";
throw err;
}
throw error2;
}
const key = uri.password;
if (!key) {
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
err.code = "INVALID_DOTENV_KEY";
throw err;
}
const environment = uri.searchParams.get("environment");
if (!environment) {
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
err.code = "INVALID_DOTENV_KEY";
throw err;
}
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
const ciphertext = result.parsed[environmentKey];
if (!ciphertext) {
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
throw err;
}
return { ciphertext, key };
}
function _vaultPath(options) {
let possibleVaultPath = null;
if (options && options.path && options.path.length > 0) {
if (Array.isArray(options.path)) {
for (const filepath of options.path) {
if (fs7.existsSync(filepath)) {
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
}
}
} else {
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
}
} else {
possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
}
if (fs7.existsSync(possibleVaultPath)) {
return possibleVaultPath;
}
return null;
}
function _resolveHome(envPath) {
return envPath[0] === "~" ? path7.join(os3.homedir(), envPath.slice(1)) : envPath;
}
function _configVault(options) {
const debug = Boolean(options && options.debug);
const quiet = options && "quiet" in options ? options.quiet : true;
if (debug || !quiet) {
_log("Loading env from encrypted .env.vault");
}
const parsed = DotenvModule._parseVault(options);
let processEnv = process.env;
if (options && options.processEnv != null) {
processEnv = options.processEnv;
}
DotenvModule.populate(processEnv, parsed, options);
return { parsed };
}
function configDotenv(options) {
const dotenvPath = path7.resolve(process.cwd(), ".env");
let encoding = "utf8";
const debug = Boolean(options && options.debug);
const quiet = options && "quiet" in options ? options.quiet : true;
if (options && options.encoding) {
encoding = options.encoding;
} else {
if (debug) {
_debug("No encoding is specified. UTF-8 is used by default");
}
}
let optionPaths = [dotenvPath];
if (options && options.path) {
if (!Array.isArray(options.path)) {
optionPaths = [_resolveHome(options.path)];
} else {
optionPaths = [];
for (const filepath of options.path) {
optionPaths.push(_resolveHome(filepath));
}
}
}
let lastError;
const parsedAll = {};
for (const path8 of optionPaths) {
try {
const parsed = DotenvModule.parse(fs7.readFileSync(path8, { encoding }));
DotenvModule.populate(parsedAll, parsed, options);
} catch (e3) {
if (debug) {
_debug(`Failed to load ${path8} ${e3.message}`);
}
lastError = e3;
}
}
let processEnv = process.env;
if (options && options.processEnv != null) {
processEnv = options.processEnv;
}
DotenvModule.populate(processEnv, parsedAll, options);
if (debug || !quiet) {
const keysCount = Object.keys(parsedAll).length;
const shortPaths = [];
for (const filePath of optionPaths) {
try {
const relative = path7.relative(process.cwd(), filePath);
shortPaths.push(relative);
} catch (e3) {
if (debug) {
_debug(`Failed to load ${filePath} ${e3.message}`);
}
lastError = e3;
}
}
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
}
if (lastError) {
return { parsed: parsedAll, error: lastError };
} else {
return { parsed: parsedAll };
}
}
function config(options) {
if (_dotenvKey(options).length === 0) {
return DotenvModule.configDotenv(options);
}
const vaultPath = _vaultPath(options);
if (!vaultPath) {
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
return DotenvModule.configDotenv(options);
}
return DotenvModule._configVault(options);
}
function decrypt(encrypted, keyStr) {
const key = Buffer.from(keyStr.slice(-64), "hex");
let ciphertext = Buffer.from(encrypted, "base64");
const nonce = ciphertext.subarray(0, 12);
const authTag = ciphertext.subarray(-16);
ciphertext = ciphertext.subarray(12, -16);
try {
const aesgcm = crypto2.createDecipheriv("aes-256-gcm", key, nonce);
aesgcm.setAuthTag(authTag);
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
} catch (error2) {
const isRange = error2 instanceof RangeError;
const invalidKeyLength = error2.message === "Invalid key length";
const decryptionFailed = error2.message === "Unsupported state or unable to authenticate data";
if (isRange || invalidKeyLength) {
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
err.code = "INVALID_DOTENV_KEY";
throw err;
} else if (decryptionFailed) {
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
err.code = "DECRYPTION_FAILED";
throw err;
} else {
throw error2;
}
}
}
function populate(processEnv, parsed, options = {}) {
const debug = Boolean(options && options.debug);
const override = Boolean(options && options.override);
if (typeof parsed !== "object") {
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
err.code = "OBJECT_REQUIRED";
throw err;
}
for (const key of Object.keys(parsed)) {
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
if (override === true) {
processEnv[key] = parsed[key];
}
if (debug) {
if (override === true) {
_debug(`"${key}" is already defined and WAS overwritten`);
} else {
_debug(`"${key}" is already defined and was NOT overwritten`);
}
}
} else {
processEnv[key] = parsed[key];
}
}
}
var DotenvModule = {
configDotenv,
_configVault,
_parseVault,
config,
decrypt,
parse: parse6,
populate
};
module2.exports.configDotenv = DotenvModule.configDotenv;
module2.exports._configVault = DotenvModule._configVault;
module2.exports._parseVault = DotenvModule._parseVault;
module2.exports.config = DotenvModule.config;
module2.exports.decrypt = DotenvModule.decrypt;
module2.exports.parse = DotenvModule.parse;
module2.exports.populate = DotenvModule.populate;
module2.exports = DotenvModule;
}
});
// node_modules/@ai-sdk/provider/dist/index.mjs
var marker, symbol, _a, _AISDKError, AISDKError, name, marker2, symbol2, _a2, name2, marker3, symbol3, _a3, name3, marker4, symbol4, _a4, InvalidArgumentError, name4, marker5, symbol5, _a5, name5, marker6, symbol6, _a6, name6, marker7, symbol7, _a7, name7, marker8, symbol8, _a8, name8, marker9, symbol9, _a9, LoadSettingError, name9, marker10, symbol10, _a10, name10, marker11, symbol11, _a11, name11, marker12, symbol12, _a12, name12, marker13, symbol13, _a13, name13, marker14, symbol14, _a14, UnsupportedFunctionalityError;
var init_dist = __esm({
"node_modules/@ai-sdk/provider/dist/index.mjs"() {
marker = "vercel.ai.error";
symbol = Symbol.for(marker);
_AISDKError = class _AISDKError2 extends Error {
/**
* Creates an AI SDK Error.
*
* @param {Object} params - The parameters for creating the error.
* @param {string} params.name - The name of the error.
* @param {string} params.message - The error message.
* @param {unknown} [params.cause] - The underlying cause of the error.
*/
constructor({
name: name14,
message,
cause
}) {
super(message);
this[_a] = true;
this.name = name14;
this.cause = cause;
}
/**
* Checks if the given error is an AI SDK Error.
* @param {unknown} error - The error to check.
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
*/
static isInstance(error2) {
return _AISDKError2.hasMarker(error2, marker);
}
static hasMarker(error2, marker15) {
const markerSymbol = Symbol.for(marker15);
return error2 != null && typeof error2 === "object" && markerSymbol in error2 && typeof error2[markerSymbol] === "boolean" && error2[markerSymbol] === true;
}
};
_a = symbol;
AISDKError = _AISDKError;
name = "AI_APICallError";
marker2 = `vercel.ai.error.${name}`;
symbol2 = Symbol.for(marker2);
_a2 = symbol2;
name2 = "AI_EmptyResponseBodyError";
marker3 = `vercel.ai.error.${name2}`;
symbol3 = Symbol.for(marker3);
_a3 = symbol3;
name3 = "AI_InvalidArgumentError";
marker4 = `vercel.ai.error.${name3}`;
symbol4 = Symbol.for(marker4);
InvalidArgumentError = class extends AISDKError {
constructor({
message,
cause,
argument
}) {
super({ name: name3, message, cause });
this[_a4] = true;
this.argument = argument;
}
static isInstance(error2) {
return AISDKError.hasMarker(error2, marker4);
}
};
_a4 = symbol4;
name4 = "AI_InvalidPromptError";
marker5 = `vercel.ai.error.${name4}`;
symbol5 = Symbol.for(marker5);
_a5 = symbol5;
name5 = "AI_InvalidResponseDataError";
marker6 = `vercel.ai.error.${name5}`;
symbol6 = Symbol.for(marker6);
_a6 = symbol6;
name6 = "AI_JSONParseError";
marker7 = `vercel.ai.error.${name6}`;
symbol7 = Symbol.for(marker7);
_a7 = symbol7;
name7 = "AI_LoadAPIKeyError";
marker8 = `vercel.ai.error.${name7}`;
symbol8 = Symbol.for(marker8);
_a8 = symbol8;
name8 = "AI_LoadSettingError";
marker9 = `vercel.ai.error.${name8}`;
symbol9 = Symbol.for(marker9);
LoadSettingError = class extends AISDKError {
// used in isInstance
constructor({ message }) {
super({ name: name8, message });
this[_a9] = true;
}
static isInstance(error2) {
return AISDKError.hasMarker(error2, marker9);
}
};
_a9 = symbol9;
name9 = "AI_NoContentGeneratedError";
marker10 = `vercel.ai.error.${name9}`;
symbol10 = Symbol.for(marker10);
_a10 = symbol10;
name10 = "AI_NoSuchModelError";
marker11 = `vercel.ai.error.${name10}`;
symbol11 = Symbol.for(marker11);
_a11 = symbol11;
name11 = "AI_TooManyEmbeddingValuesForCallError";
marker12 = `vercel.ai.error.${name11}`;
symbol12 = Symbol.for(marker12);
_a12 = symbol12;
name12 = "AI_TypeValidationError";
marker13 = `vercel.ai.error.${name12}`;
symbol13 = Symbol.for(marker13);
_a13 = symbol13;
name13 = "AI_UnsupportedFunctionalityError";
marker14 = `vercel.ai.error.${name13}`;
symbol14 = Symbol.for(marker14);
UnsupportedFunctionalityError = class extends AISDKError {
constructor({
functionality,
message = `'${functionality}' functionality not supported.`
}) {
super({ name: name13, message });
this[_a14] = true;
this.functionality = functionality;
}
static isInstance(error2) {
return AISDKError.hasMarker(error2, marker14);
}
};
_a14 = symbol14;
}
});
// node_modules/nanoid/non-secure/index.js
var customAlphabet;
var init_non_secure = __esm({
"node_modules/nanoid/non-secure/index.js"() {
customAlphabet = (alphabet, defaultSize = 21) => {
return (size = defaultSize) => {
let id = "";
let i3 = size | 0;
while (i3--) {
id += alphabet[Math.random() * alphabet.length | 0];
}
return id;
};
};
}
});
// node_modules/secure-json-parse/index.js
var require_secure_json_parse = __commonJS({
"node_modules/secure-json-parse/index.js"(exports2, module2) {
"use strict";
var hasBuffer = typeof Buffer !== "undefined";
var suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
function _parse(text, reviver, options) {
if (options == null) {
if (reviver !== null && typeof reviver === "object") {
options = reviver;
reviver = void 0;
}
}
if (hasBuffer && Buffer.isBuffer(text)) {
text = text.toString();
}
if (text && text.charCodeAt(0) === 65279) {
text = text.slice(1);
}
const obj = JSON.parse(text, reviver);
if (obj === null || typeof obj !== "object") {
return obj;
}
const protoAction = options && options.protoAction || "error";
const constructorAction = options && options.constructorAction || "error";
if (protoAction === "ignore" && constructorAction === "ignore") {
return obj;
}
if (protoAction !== "ignore" && constructorAction !== "ignore") {
if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
return obj;
}
} else if (protoAction !== "ignore" && constructorAction === "ignore") {
if (suspectProtoRx.test(text) === false) {
return obj;
}
} else {
if (suspectConstructorRx.test(text) === false) {
return obj;
}
}
return filter3(obj, { protoAction, constructorAction, safe: options && options.safe });
}
function filter3(obj, { protoAction = "error", constructorAction = "error", safe } = {}) {
let next = [obj];
while (next.length) {
const nodes = next;
next = [];
for (const node of nodes) {
if (protoAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "__proto__")) {
if (safe === true) {
return null;
} else if (protoAction === "error") {
throw new SyntaxError("Object contains forbidden prototype property");
}
delete node.__proto__;
}
if (constructorAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
if (safe === true) {
return null;
} else if (constructorAction === "error") {
throw new SyntaxError("Object contains forbidden prototype property");
}
delete node.constructor;
}
for (const key in node) {
const value = node[key];
if (value && typeof value === "object") {
next.push(value);
}
}
}
}
return obj;
}
function parse6(text, reviver, options) {
const stackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
return _parse(text, reviver, options);
} finally {
Error.stackTraceLimit = stackTraceLimit;
}
}
function safeParse(text, reviver) {
const stackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
return _parse(text, reviver, { safe: true });
} catch (_e) {
return null;
} finally {
Error.stackTraceLimit = stackTraceLimit;
}
}
module2.exports = parse6;
module2.exports.default = parse6;
module2.exports.parse = parse6;
module2.exports.safeParse = safeParse;
module2.exports.scan = filter3;
}
});
// node_modules/@ai-sdk/provider-utils/dist/index.mjs
function loadOptionalSetting({
settingValue,
environmentVariableName
}) {
if (typeof settingValue === "string") {
return settingValue;
}
if (settingValue != null || typeof process === "undefined") {
return void 0;
}
settingValue = process.env[environmentVariableName];
if (settingValue == null || typeof settingValue !== "string") {
return void 0;
}
return settingValue;
}
function loadSetting({
settingValue,
environmentVariableName,
settingName,
description
}) {
if (typeof settingValue === "string") {
return settingValue;
}
if (settingValue != null) {
throw new LoadSettingError({
message: `${description} setting must be a string.`
});
}
if (typeof process === "undefined") {
throw new LoadSettingError({
message: `${description} setting is missing. Pass it using the '${settingName}' parameter. Environment variables is not supported in this environment.`
});
}
settingValue = process.env[environmentVariableName];
if (settingValue == null) {
throw new LoadSettingError({
message: `${description} setting is missing. Pass it using the '${settingName}' parameter or the ${environmentVariableName} environment variable.`
});
}
if (typeof settingValue !== "string") {
throw new LoadSettingError({
message: `${description} setting must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
});
}
return settingValue;
}
var import_secure_json_parse, createIdGenerator, generateId, validatorSymbol, btoa, atob2;
var init_dist2 = __esm({
"node_modules/@ai-sdk/provider-utils/dist/index.mjs"() {
init_dist();
init_non_secure();
init_dist();
import_secure_json_parse = __toESM(require_secure_json_parse(), 1);
createIdGenerator = ({
prefix,
size: defaultSize = 16,
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
separator = "-"
} = {}) => {
const generator = customAlphabet(alphabet, defaultSize);
if (prefix == null) {
return generator;
}
if (alphabet.includes(separator)) {
throw new InvalidArgumentError({
argument: "separator",
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
});
}
return (size) => `${prefix}${separator}${generator(size)}`;
};
generateId = createIdGenerator();
validatorSymbol = Symbol.for("vercel.ai.validator");
({ btoa, atob: atob2 } = globalThis);
}
});
// node_modules/@smithy/types/dist-cjs/index.js
var require_dist_cjs = __commonJS({
"node_modules/@smithy/types/dist-cjs/index.js"(exports2) {
"use strict";
exports2.HttpAuthLocation = void 0;
(function(HttpAuthLocation) {
HttpAuthLocation["HEADER"] = "header";
HttpAuthLocation["QUERY"] = "query";
})(exports2.HttpAuthLocation || (exports2.HttpAuthLocation = {}));
exports2.HttpApiKeyAuthLocation = void 0;
(function(HttpApiKeyAuthLocation2) {
HttpApiKeyAuthLocation2["HEADER"] = "header";
HttpApiKeyAuthLocation2["QUERY"] = "query";
})(exports2.HttpApiKeyAuthLocation || (exports2.HttpApiKeyAuthLocation = {}));
exports2.EndpointURLScheme = void 0;
(function(EndpointURLScheme) {
EndpointURLScheme["HTTP"] = "http";
EndpointURLScheme["HTTPS"] = "https";
})(exports2.EndpointURLScheme || (exports2.EndpointURLScheme = {}));
exports2.AlgorithmId = void 0;
(function(AlgorithmId) {
AlgorithmId["MD5"] = "md5";
AlgorithmId["CRC32"] = "crc32";
AlgorithmId["CRC32C"] = "crc32c";
AlgorithmId["SHA1"] = "sha1";
AlgorithmId["SHA256"] = "sha256";
})(exports2.AlgorithmId || (exports2.AlgorithmId = {}));
var getChecksumConfiguration = (runtimeConfig) => {
const checksumAlgorithms = [];
if (runtimeConfig.sha256 !== void 0) {
checksumAlgorithms.push({
algorithmId: () => exports2.AlgorithmId.SHA256,
checksumConstructor: () => runtimeConfig.sha256
});
}
if (runtimeConfig.md5 != void 0) {
checksumAlgorithms.push({
algorithmId: () => exports2.AlgorithmId.MD5,
checksumConstructor: () => runtimeConfig.md5
});
}
return {
addChecksumAlgorithm(algo) {
checksumAlgorithms.push(algo);
},
checksumAlgorithms() {
return checksumAlgorithms;
}
};
};
var resolveChecksumRuntimeConfig = (clientConfig) => {
const runtimeConfig = {};
clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
});
return runtimeConfig;
};
var getDefaultClientConfiguration = (runtimeConfig) => {
return getChecksumConfiguration(runtimeConfig);
};
var resolveDefaultRuntimeConfig3 = (config) => {
return resolveChecksumRuntimeConfig(config);
};
exports2.FieldPosition = void 0;
(function(FieldPosition) {
FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER";
FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER";
})(exports2.FieldPosition || (exports2.FieldPosition = {}));
var SMITHY_CONTEXT_KEY2 = "__smithy_context";
exports2.IniSectionType = void 0;
(function(IniSectionType) {
IniSectionType["PROFILE"] = "profile";
IniSectionType["SSO_SESSION"] = "sso-session";
IniSectionType["SERVICES"] = "services";
})(exports2.IniSectionType || (exports2.IniSectionType = {}));
exports2.RequestHandlerProtocol = void 0;
(function(RequestHandlerProtocol) {
RequestHandlerProtocol["HTTP_0_9"] = "http/0.9";
RequestHandlerProtocol["HTTP_1_0"] = "http/1.0";
RequestHandlerProtocol["TDS_8_0"] = "tds/8.0";
})(exports2.RequestHandlerProtocol || (exports2.RequestHandlerProtocol = {}));
exports2.SMITHY_CONTEXT_KEY = SMITHY_CONTEXT_KEY2;
exports2.getDefaultClientConfiguration = getDefaultClientConfiguration;
exports2.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig3;
}
});
// node_modules/@smithy/protocol-http/dist-cjs/index.js
var require_dist_cjs2 = __commonJS({
"node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2) {
"use strict";
var types2 = require_dist_cjs();
var getHttpHandlerExtensionConfiguration3 = (runtimeConfig) => {
return {
setHttpHandler(handler) {
runtimeConfig.httpHandler = handler;
},
httpHandler() {
return runtimeConfig.httpHandler;
},
updateHttpClientConfig(key, value) {
runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);
},
httpHandlerConfigs() {
return runtimeConfig.httpHandler.httpHandlerConfigs();
}
};
};
var resolveHttpHandlerRuntimeConfig3 = (httpHandlerExtensionConfiguration) => {
return {
httpHandler: httpHandlerExtensionConfiguration.httpHandler()
};
};
var Field = class {
name;
kind;
values;
constructor({ name: name14, kind = types2.FieldPosition.HEADER, values: values2 = [] }) {
this.name = name14;
this.kind = kind;
this.values = values2;
}
add(value) {
this.values.push(value);
}
set(values2) {
this.values = values2;
}
remove(value) {
this.values = this.values.filter((v3) => v3 !== value);
}
toString() {
return this.values.map((v3) => v3.includes(",") || v3.includes(" ") ? `"${v3}"` : v3).join(", ");
}
get() {
return this.values;
}
};
var Fields = class {
entries = {};
encoding;
constructor({ fields = [], encoding = "utf-8" }) {
fields.forEach(this.setField.bind(this));
this.encoding = encoding;
}
setField(field) {
this.entries[field.name.toLowerCase()] = field;
}
getField(name14) {
return this.entries[name14.toLowerCase()];
}
removeField(name14) {
delete this.entries[name14.toLowerCase()];
}
getByType(kind) {
return Object.values(this.entries).filter((field) => field.kind === kind);
}
};
var HttpRequest10 = class _HttpRequest {
method;
protocol;
hostname;
port;
path;
query;
headers;
username;
password;
fragment;
body;
constructor(options) {
this.method = options.method || "GET";
this.hostname = options.hostname || "localhost";
this.port = options.port;
this.query = options.query || {};
this.headers = options.headers || {};
this.body = options.body;
this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
this.username = options.username;
this.password = options.password;
this.fragment = options.fragment;
}
static clone(request) {
const cloned = new _HttpRequest({
...request,
headers: { ...request.headers }
});
if (cloned.query) {
cloned.query = cloneQuery(cloned.query);
}
return cloned;
}
static isInstance(request) {
if (!request) {
return false;
}
const req = request;
return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
}
clone() {
return _HttpRequest.clone(this);
}
};
function cloneQuery(query2) {
return Object.keys(query2).reduce((carry, paramName) => {
const param = query2[paramName];
return {
...carry,
[paramName]: Array.isArray(param) ? [...param] : param
};
}, {});
}
var HttpResponse4 = class {
statusCode;
reason;
headers;
body;
constructor(options) {
this.statusCode = options.statusCode;
this.reason = options.reason;
this.headers = options.headers || {};
this.body = options.body;
}
static isInstance(response) {
if (!response)
return false;
const resp = response;
return typeof resp.statusCode === "number" && typeof resp.headers === "object";
}
};
function isValidHostname(hostname) {
const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;
return hostPattern.test(hostname);
}
exports2.Field = Field;
exports2.Fields = Fields;
exports2.HttpRequest = HttpRequest10;
exports2.HttpResponse = HttpResponse4;
exports2.getHttpHandlerExtensionConfiguration = getHttpHandlerExtensionConfiguration3;
exports2.isValidHostname = isValidHostname;
exports2.resolveHttpHandlerRuntimeConfig = resolveHttpHandlerRuntimeConfig3;
}
});
// node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js
var require_dist_cjs3 = __commonJS({
"node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js"(exports2) {
"use strict";
var protocolHttp = require_dist_cjs2();
function resolveEventStreamConfig(input) {
const eventSigner = input.signer;
const messageSigner = input.signer;
const newInput = Object.assign(input, {
eventSigner,
messageSigner
});
const eventStreamPayloadHandler = newInput.eventStreamPayloadHandlerProvider(newInput);
return Object.assign(newInput, {
eventStreamPayloadHandler
});
}
var eventStreamHandlingMiddleware = (options) => (next, context) => async (args) => {
const { request } = args;
if (!protocolHttp.HttpRequest.isInstance(request))
return next(args);
return options.eventStreamPayloadHandler.handle(next, args, context);
};
var eventStreamHandlingMiddlewareOptions = {
tags: ["EVENT_STREAM", "SIGNATURE", "HANDLE"],
name: "eventStreamHandlingMiddleware",
relation: "after",
toMiddleware: "awsAuthMiddleware",
override: true
};
var eventStreamHeaderMiddleware = (next) => async (args) => {
const { request } = args;
if (!protocolHttp.HttpRequest.isInstance(request))
return next(args);
request.headers = {
...request.headers,
"content-type": "application/vnd.amazon.eventstream",
"x-amz-content-sha256": "STREAMING-AWS4-HMAC-SHA256-EVENTS"
};
return next({
...args,
request
});
};
var eventStreamHeaderMiddlewareOptions = {
step: "build",
tags: ["EVENT_STREAM", "HEADER", "CONTENT_TYPE", "CONTENT_SHA256"],
name: "eventStreamHeaderMiddleware",
override: true
};
var getEventStreamPlugin = (options) => ({
applyToStack: (clientStack) => {
clientStack.addRelativeTo(eventStreamHandlingMiddleware(options), eventStreamHandlingMiddlewareOptions);
clientStack.add(eventStreamHeaderMiddleware, eventStreamHeaderMiddlewareOptions);
}
});
exports2.eventStreamHandlingMiddleware = eventStreamHandlingMiddleware;
exports2.eventStreamHandlingMiddlewareOptions = eventStreamHandlingMiddlewareOptions;
exports2.eventStreamHeaderMiddleware = eventStreamHeaderMiddleware;
exports2.eventStreamHeaderMiddlewareOptions = eventStreamHeaderMiddlewareOptions;
exports2.getEventStreamPlugin = getEventStreamPlugin;
exports2.resolveEventStreamConfig = resolveEventStreamConfig;
}
});
// node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js
var require_dist_cjs4 = __commonJS({
"node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js"(exports2) {
"use strict";
var protocolHttp = require_dist_cjs2();
function resolveHostHeaderConfig3(input) {
return input;
}
var hostHeaderMiddleware = (options) => (next) => async (args) => {
if (!protocolHttp.HttpRequest.isInstance(args.request))
return next(args);
const { request } = args;
const { handlerProtocol = "" } = options.requestHandler.metadata || {};
if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
delete request.headers["host"];
request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : "");
} else if (!request.headers["host"]) {
let host = request.hostname;
if (request.port != null)
host += `:${request.port}`;
request.headers["host"] = host;
}
return next(args);
};
var hostHeaderMiddlewareOptions = {
name: "hostHeaderMiddleware",
step: "build",
priority: "low",
tags: ["HOST"],
override: true
};
var getHostHeaderPlugin3 = (options) => ({
applyToStack: (clientStack) => {
clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
}
});
exports2.getHostHeaderPlugin = getHostHeaderPlugin3;
exports2.hostHeaderMiddleware = hostHeaderMiddleware;
exports2.hostHeaderMiddlewareOptions = hostHeaderMiddlewareOptions;
exports2.resolveHostHeaderConfig = resolveHostHeaderConfig3;
}
});
// node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js
var require_dist_cjs5 = __commonJS({
"node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js"(exports2) {
"use strict";
var loggerMiddleware = () => (next, context) => async (args) => {
try {
const response = await next(args);
const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context;
const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
const { $metadata, ...outputWithoutMetadata } = response.output;
logger2?.info?.({
clientName,
commandName,
input: inputFilterSensitiveLog(args.input),
output: outputFilterSensitiveLog(outputWithoutMetadata),
metadata: $metadata
});
return response;
} catch (error2) {
const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context;
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
logger2?.error?.({
clientName,
commandName,
input: inputFilterSensitiveLog(args.input),
error: error2,
metadata: error2.$metadata
});
throw error2;
}
};
var loggerMiddlewareOptions = {
name: "loggerMiddleware",
tags: ["LOGGER"],
step: "initialize",
override: true
};
var getLoggerPlugin3 = (options) => ({
applyToStack: (clientStack) => {
clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);
}
});
exports2.getLoggerPlugin = getLoggerPlugin3;
exports2.loggerMiddleware = loggerMiddleware;
exports2.loggerMiddlewareOptions = loggerMiddlewareOptions;
}
});
// node_modules/@aws/lambda-invoke-store/dist-es/invoke-store.js
var invoke_store_exports = {};
__export(invoke_store_exports, {
InvokeStore: () => InvokeStore
});
var import_async_hooks, noGlobalAwsLambda, PROTECTED_KEYS, InvokeStoreImpl, instance, InvokeStore;
var init_invoke_store = __esm({
"node_modules/@aws/lambda-invoke-store/dist-es/invoke-store.js"() {
import_async_hooks = require("async_hooks");
noGlobalAwsLambda = process.env["AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA"] === "1" || process.env["AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA"] === "true";
if (!noGlobalAwsLambda) {
globalThis.awslambda = globalThis.awslambda || {};
}
PROTECTED_KEYS = {
REQUEST_ID: Symbol("_AWS_LAMBDA_REQUEST_ID"),
X_RAY_TRACE_ID: Symbol("_AWS_LAMBDA_X_RAY_TRACE_ID"),
TENANT_ID: Symbol("_AWS_LAMBDA_TENANT_ID")
};
InvokeStoreImpl = class {
static storage = new import_async_hooks.AsyncLocalStorage();
static PROTECTED_KEYS = PROTECTED_KEYS;
static run(context, fn) {
return this.storage.run({ ...context }, fn);
}
static getContext() {
return this.storage.getStore();
}
static get(key) {
const context = this.storage.getStore();
return context?.[key];
}
static set(key, value) {
if (this.isProtectedKey(key)) {
throw new Error(`Cannot modify protected Lambda context field`);
}
const context = this.storage.getStore();
if (context) {
context[key] = value;
}
}
static getRequestId() {
return this.get(this.PROTECTED_KEYS.REQUEST_ID) ?? "-";
}
static getXRayTraceId() {
return this.get(this.PROTECTED_KEYS.X_RAY_TRACE_ID);
}
static getTenantId() {
return this.get(this.PROTECTED_KEYS.TENANT_ID);
}
static hasContext() {
return this.storage.getStore() !== void 0;
}
static isProtectedKey(key) {
return key === this.PROTECTED_KEYS.REQUEST_ID || key === this.PROTECTED_KEYS.X_RAY_TRACE_ID;
}
};
if (!noGlobalAwsLambda && globalThis.awslambda?.InvokeStore) {
instance = globalThis.awslambda.InvokeStore;
} else {
instance = InvokeStoreImpl;
if (!noGlobalAwsLambda && globalThis.awslambda) {
globalThis.awslambda.InvokeStore = instance;
}
}
InvokeStore = instance;
}
});
// node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/recursionDetectionMiddleware.js
var require_recursionDetectionMiddleware = __commonJS({
"node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/recursionDetectionMiddleware.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.recursionDetectionMiddleware = void 0;
var lambda_invoke_store_1 = (init_invoke_store(), __toCommonJS(invoke_store_exports));
var protocol_http_1 = require_dist_cjs2();
var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
var recursionDetectionMiddleware = () => (next) => async (args) => {
const { request } = args;
if (!protocol_http_1.HttpRequest.isInstance(request)) {
return next(args);
}
const traceIdHeader = Object.keys(request.headers ?? {}).find((h3) => h3.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ?? TRACE_ID_HEADER_NAME;
if (request.headers.hasOwnProperty(traceIdHeader)) {
return next(args);
}
const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
const traceIdFromEnv = process.env[ENV_TRACE_ID];
const traceIdFromInvokeStore = lambda_invoke_store_1.InvokeStore.getXRayTraceId();
const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
request.headers[TRACE_ID_HEADER_NAME] = traceId;
}
return next({
...args,
request
});
};
exports2.recursionDetectionMiddleware = recursionDetectionMiddleware;
}
});
// node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js
var require_dist_cjs6 = __commonJS({
"node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js"(exports2) {
"use strict";
var recursionDetectionMiddleware = require_recursionDetectionMiddleware();
var recursionDetectionMiddlewareOptions = {
step: "build",
tags: ["RECURSION_DETECTION"],
name: "recursionDetectionMiddleware",
override: true,
priority: "low"
};
var getRecursionDetectionPlugin3 = (options) => ({
applyToStack: (clientStack) => {
clientStack.add(recursionDetectionMiddleware.recursionDetectionMiddleware(), recursionDetectionMiddlewareOptions);
}
});
exports2.getRecursionDetectionPlugin = getRecursionDetectionPlugin3;
Object.keys(recursionDetectionMiddleware).forEach(function(k3) {
if (k3 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, k3)) Object.defineProperty(exports2, k3, {
enumerable: true,
get: function() {
return recursionDetectionMiddleware[k3];
}
});
});
}
});
// node_modules/@smithy/core/dist-es/getSmithyContext.js
var import_types, getSmithyContext;
var init_getSmithyContext = __esm({
"node_modules/@smithy/core/dist-es/getSmithyContext.js"() {
import_types = __toESM(require_dist_cjs());
getSmithyContext = (context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {});
}
});
// node_modules/@smithy/util-middleware/dist-cjs/index.js
var require_dist_cjs7 = __commonJS({
"node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2) {
"use strict";
var types2 = require_dist_cjs();
var getSmithyContext9 = (context) => context[types2.SMITHY_CONTEXT_KEY] || (context[types2.SMITHY_CONTEXT_KEY] = {});
var normalizeProvider4 = (input) => {
if (typeof input === "function")
return input;
const promisified = Promise.resolve(input);
return () => promisified;
};
exports2.getSmithyContext = getSmithyContext9;
exports2.normalizeProvider = normalizeProvider4;
}
});
// node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/resolveAuthOptions.js
var resolveAuthOptions;
var init_resolveAuthOptions = __esm({
"node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/resolveAuthOptions.js"() {
resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
if (!authSchemePreference || authSchemePreference.length === 0) {
return candidateAuthOptions;
}
const preferredAuthOptions = [];
for (const preferredSchemeName of authSchemePreference) {
for (const candidateAuthOption of candidateAuthOptions) {
const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
if (candidateAuthSchemeName === preferredSchemeName) {
preferredAuthOptions.push(candidateAuthOption);
}
}
}
for (const candidateAuthOption of candidateAuthOptions) {
if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
preferredAuthOptions.push(candidateAuthOption);
}
}
return preferredAuthOptions;
};
}
});
// node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js
function convertHttpAuthSchemesToMap(httpAuthSchemes) {
const map4 = /* @__PURE__ */ new Map();
for (const scheme of httpAuthSchemes) {
map4.set(scheme.schemeId, scheme);
}
return map4;
}
var import_util_middleware, httpAuthSchemeMiddleware;
var init_httpAuthSchemeMiddleware = __esm({
"node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js"() {
import_util_middleware = __toESM(require_dist_cjs7());
init_resolveAuthOptions();
httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
const smithyContext = (0, import_util_middleware.getSmithyContext)(context);
const failureReasons = [];
for (const option of resolvedOptions) {
const scheme = authSchemes.get(option.schemeId);
if (!scheme) {
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
continue;
}
const identityProvider = scheme.identityProvider