@probelabs/probe 0.6.0-rc137 → 0.6.0-rc139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/agent/ProbeAgent.js +5 -2
- package/build/agent/index.js +103 -48
- package/build/extract.js +142 -59
- package/cjs/agent/ProbeAgent.cjs +377 -316
- package/cjs/index.cjs +377 -316
- package/index.d.ts +10 -2
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +5 -2
- package/src/extract.js +142 -59
package/cjs/index.cjs
CHANGED
|
@@ -1038,15 +1038,20 @@ async function extract(options) {
|
|
|
1038
1038
|
if (!options) {
|
|
1039
1039
|
throw new Error("Options object is required");
|
|
1040
1040
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1041
|
+
const hasFiles = options.files && Array.isArray(options.files) && options.files.length > 0;
|
|
1042
|
+
const hasInputFile = !!options.inputFile;
|
|
1043
|
+
const hasContent = options.content !== void 0 && options.content !== null;
|
|
1044
|
+
if (!hasFiles && !hasInputFile && !hasContent) {
|
|
1045
|
+
throw new Error("Either files array, inputFile, or content must be provided");
|
|
1043
1046
|
}
|
|
1044
1047
|
const binaryPath = await getBinaryPath(options.binaryOptions || {});
|
|
1045
|
-
const
|
|
1048
|
+
const filteredOptions = { ...options };
|
|
1049
|
+
delete filteredOptions.content;
|
|
1050
|
+
const cliArgs = buildCliArgs(filteredOptions, EXTRACT_FLAG_MAP);
|
|
1046
1051
|
if (options.json && !options.format) {
|
|
1047
1052
|
cliArgs.push("--format", "json");
|
|
1048
1053
|
}
|
|
1049
|
-
if (
|
|
1054
|
+
if (hasFiles) {
|
|
1050
1055
|
for (const file of options.files) {
|
|
1051
1056
|
cliArgs.push(escapeString(file));
|
|
1052
1057
|
}
|
|
@@ -1058,66 +1063,115 @@ Extract:`;
|
|
|
1058
1063
|
logMessage += ` files="${options.files.join(", ")}"`;
|
|
1059
1064
|
}
|
|
1060
1065
|
if (options.inputFile) logMessage += ` inputFile="${options.inputFile}"`;
|
|
1066
|
+
if (options.content) logMessage += ` content=(${typeof options.content === "string" ? options.content.length : options.content.byteLength} bytes)`;
|
|
1061
1067
|
if (options.allowTests) logMessage += " allowTests=true";
|
|
1062
1068
|
if (options.contextLines) logMessage += ` contextLines=${options.contextLines}`;
|
|
1063
1069
|
if (options.format) logMessage += ` format=${options.format}`;
|
|
1064
1070
|
if (options.json) logMessage += " json=true";
|
|
1065
1071
|
console.error(logMessage);
|
|
1066
1072
|
}
|
|
1073
|
+
if (hasContent) {
|
|
1074
|
+
return extractWithStdin(binaryPath, cliArgs, options.content, options);
|
|
1075
|
+
}
|
|
1067
1076
|
const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
|
|
1068
1077
|
try {
|
|
1069
1078
|
const { stdout, stderr } = await execAsync3(command);
|
|
1070
1079
|
if (stderr) {
|
|
1071
1080
|
console.error(`stderr: ${stderr}`);
|
|
1072
1081
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1082
|
+
return processExtractOutput(stdout, options);
|
|
1083
|
+
} catch (error2) {
|
|
1084
|
+
const errorMessage = `Error executing extract command: ${error2.message}
|
|
1085
|
+
Command: ${command}`;
|
|
1086
|
+
throw new Error(errorMessage);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
function extractWithStdin(binaryPath, cliArgs, content, options) {
|
|
1090
|
+
return new Promise((resolve4, reject2) => {
|
|
1091
|
+
const process2 = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
|
|
1092
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1093
|
+
});
|
|
1094
|
+
let stdout = "";
|
|
1095
|
+
let stderr = "";
|
|
1096
|
+
process2.stdout.on("data", (data2) => {
|
|
1097
|
+
stdout += data2.toString();
|
|
1098
|
+
});
|
|
1099
|
+
process2.stderr.on("data", (data2) => {
|
|
1100
|
+
stderr += data2.toString();
|
|
1101
|
+
});
|
|
1102
|
+
process2.on("close", (code) => {
|
|
1103
|
+
if (stderr && process2.env.DEBUG === "1") {
|
|
1104
|
+
console.error(`stderr: ${stderr}`);
|
|
1105
|
+
}
|
|
1106
|
+
if (code !== 0) {
|
|
1107
|
+
reject2(new Error(`Extract command failed with exit code ${code}: ${stderr}`));
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
try {
|
|
1111
|
+
const result = processExtractOutput(stdout, options);
|
|
1112
|
+
resolve4(result);
|
|
1113
|
+
} catch (error2) {
|
|
1114
|
+
reject2(error2);
|
|
1088
1115
|
}
|
|
1116
|
+
});
|
|
1117
|
+
process2.on("error", (error2) => {
|
|
1118
|
+
reject2(new Error(`Failed to spawn extract process: ${error2.message}`));
|
|
1119
|
+
});
|
|
1120
|
+
if (typeof content === "string") {
|
|
1121
|
+
process2.stdin.write(content);
|
|
1122
|
+
} else {
|
|
1123
|
+
process2.stdin.write(content);
|
|
1089
1124
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1125
|
+
process2.stdin.end();
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
function processExtractOutput(stdout, options) {
|
|
1129
|
+
let tokenUsage = {
|
|
1130
|
+
requestTokens: 0,
|
|
1131
|
+
responseTokens: 0,
|
|
1132
|
+
totalTokens: 0
|
|
1133
|
+
};
|
|
1134
|
+
if (options.files && Array.isArray(options.files)) {
|
|
1135
|
+
tokenUsage.requestTokens = options.files.join(" ").length / 4;
|
|
1136
|
+
} else if (options.inputFile) {
|
|
1137
|
+
tokenUsage.requestTokens = options.inputFile.length / 4;
|
|
1138
|
+
} else if (options.content) {
|
|
1139
|
+
const contentLength = typeof options.content === "string" ? options.content.length : options.content.byteLength;
|
|
1140
|
+
tokenUsage.requestTokens = contentLength / 4;
|
|
1141
|
+
}
|
|
1142
|
+
if (stdout.includes("Total tokens returned:")) {
|
|
1143
|
+
const tokenMatch = stdout.match(/Total tokens returned: (\d+)/);
|
|
1144
|
+
if (tokenMatch && tokenMatch[1]) {
|
|
1145
|
+
tokenUsage.responseTokens = parseInt(tokenMatch[1], 10);
|
|
1146
|
+
tokenUsage.totalTokens = tokenUsage.requestTokens + tokenUsage.responseTokens;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
let output = stdout;
|
|
1150
|
+
if (!output.includes("Token Usage:")) {
|
|
1151
|
+
output += `
|
|
1093
1152
|
Token Usage:
|
|
1094
1153
|
Request tokens: ${tokenUsage.requestTokens}
|
|
1095
1154
|
Response tokens: ${tokenUsage.responseTokens}
|
|
1096
1155
|
Total tokens: ${tokenUsage.totalTokens}
|
|
1097
1156
|
`;
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
return jsonOutput;
|
|
1110
|
-
} catch (error2) {
|
|
1111
|
-
console.error("Error parsing JSON output:", error2);
|
|
1112
|
-
return output;
|
|
1157
|
+
}
|
|
1158
|
+
if (options.json || options.format === "json") {
|
|
1159
|
+
try {
|
|
1160
|
+
const jsonOutput = JSON.parse(stdout);
|
|
1161
|
+
if (!jsonOutput.token_usage) {
|
|
1162
|
+
jsonOutput.token_usage = {
|
|
1163
|
+
request_tokens: tokenUsage.requestTokens,
|
|
1164
|
+
response_tokens: tokenUsage.responseTokens,
|
|
1165
|
+
total_tokens: tokenUsage.totalTokens
|
|
1166
|
+
};
|
|
1113
1167
|
}
|
|
1168
|
+
return jsonOutput;
|
|
1169
|
+
} catch (error2) {
|
|
1170
|
+
console.error("Error parsing JSON output:", error2);
|
|
1171
|
+
return output;
|
|
1114
1172
|
}
|
|
1115
|
-
return output;
|
|
1116
|
-
} catch (error2) {
|
|
1117
|
-
const errorMessage = `Error executing extract command: ${error2.message}
|
|
1118
|
-
Command: ${command}`;
|
|
1119
|
-
throw new Error(errorMessage);
|
|
1120
1173
|
}
|
|
1174
|
+
return output;
|
|
1121
1175
|
}
|
|
1122
1176
|
var import_child_process4, import_util4, execAsync3, EXTRACT_FLAG_MAP;
|
|
1123
1177
|
var init_extract = __esm({
|
|
@@ -10788,22 +10842,13 @@ var require_dist_cjs18 = __commonJS({
|
|
|
10788
10842
|
var sdkStreamMixin2 = require_sdk_stream_mixin();
|
|
10789
10843
|
var splitStream = require_splitStream();
|
|
10790
10844
|
var streamTypeCheck = require_stream_type_check();
|
|
10791
|
-
function transformToString(payload2, encoding = "utf-8") {
|
|
10792
|
-
if (encoding === "base64") {
|
|
10793
|
-
return utilBase64.toBase64(payload2);
|
|
10794
|
-
}
|
|
10795
|
-
return utilUtf8.toUtf8(payload2);
|
|
10796
|
-
}
|
|
10797
|
-
function transformFromString(str, encoding) {
|
|
10798
|
-
if (encoding === "base64") {
|
|
10799
|
-
return Uint8ArrayBlobAdapter2.mutate(utilBase64.fromBase64(str));
|
|
10800
|
-
}
|
|
10801
|
-
return Uint8ArrayBlobAdapter2.mutate(utilUtf8.fromUtf8(str));
|
|
10802
|
-
}
|
|
10803
10845
|
var Uint8ArrayBlobAdapter2 = class _Uint8ArrayBlobAdapter extends Uint8Array {
|
|
10804
10846
|
static fromString(source, encoding = "utf-8") {
|
|
10805
10847
|
if (typeof source === "string") {
|
|
10806
|
-
|
|
10848
|
+
if (encoding === "base64") {
|
|
10849
|
+
return _Uint8ArrayBlobAdapter.mutate(utilBase64.fromBase64(source));
|
|
10850
|
+
}
|
|
10851
|
+
return _Uint8ArrayBlobAdapter.mutate(utilUtf8.fromUtf8(source));
|
|
10807
10852
|
}
|
|
10808
10853
|
throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
|
|
10809
10854
|
}
|
|
@@ -10812,7 +10857,10 @@ var require_dist_cjs18 = __commonJS({
|
|
|
10812
10857
|
return source;
|
|
10813
10858
|
}
|
|
10814
10859
|
transformToString(encoding = "utf-8") {
|
|
10815
|
-
|
|
10860
|
+
if (encoding === "base64") {
|
|
10861
|
+
return utilBase64.toBase64(this);
|
|
10862
|
+
}
|
|
10863
|
+
return utilUtf8.toUtf8(this);
|
|
10816
10864
|
}
|
|
10817
10865
|
};
|
|
10818
10866
|
exports2.Uint8ArrayBlobAdapter = Uint8ArrayBlobAdapter2;
|
|
@@ -10925,6 +10973,138 @@ var init_deref = __esm({
|
|
|
10925
10973
|
}
|
|
10926
10974
|
});
|
|
10927
10975
|
|
|
10976
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/operation.js
|
|
10977
|
+
var operation;
|
|
10978
|
+
var init_operation = __esm({
|
|
10979
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/operation.js"() {
|
|
10980
|
+
operation = (namespace, name14, traits, input, output) => ({
|
|
10981
|
+
name: name14,
|
|
10982
|
+
namespace,
|
|
10983
|
+
traits,
|
|
10984
|
+
input,
|
|
10985
|
+
output
|
|
10986
|
+
});
|
|
10987
|
+
}
|
|
10988
|
+
});
|
|
10989
|
+
|
|
10990
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js
|
|
10991
|
+
var import_protocol_http2, import_util_middleware3, schemaDeserializationMiddleware, findHeader;
|
|
10992
|
+
var init_schemaDeserializationMiddleware = __esm({
|
|
10993
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js"() {
|
|
10994
|
+
import_protocol_http2 = __toESM(require_dist_cjs2());
|
|
10995
|
+
import_util_middleware3 = __toESM(require_dist_cjs7());
|
|
10996
|
+
init_operation();
|
|
10997
|
+
schemaDeserializationMiddleware = (config) => (next, context3) => async (args) => {
|
|
10998
|
+
const { response } = await next(args);
|
|
10999
|
+
const { operationSchema } = (0, import_util_middleware3.getSmithyContext)(context3);
|
|
11000
|
+
const [, ns, n3, t3, i3, o3] = operationSchema ?? [];
|
|
11001
|
+
try {
|
|
11002
|
+
const parsed = await config.protocol.deserializeResponse(operation(ns, n3, t3, i3, o3), {
|
|
11003
|
+
...config,
|
|
11004
|
+
...context3
|
|
11005
|
+
}, response);
|
|
11006
|
+
return {
|
|
11007
|
+
response,
|
|
11008
|
+
output: parsed
|
|
11009
|
+
};
|
|
11010
|
+
} catch (error2) {
|
|
11011
|
+
Object.defineProperty(error2, "$response", {
|
|
11012
|
+
value: response
|
|
11013
|
+
});
|
|
11014
|
+
if (!("$metadata" in error2)) {
|
|
11015
|
+
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
11016
|
+
try {
|
|
11017
|
+
error2.message += "\n " + hint;
|
|
11018
|
+
} catch (e3) {
|
|
11019
|
+
if (!context3.logger || context3.logger?.constructor?.name === "NoOpLogger") {
|
|
11020
|
+
console.warn(hint);
|
|
11021
|
+
} else {
|
|
11022
|
+
context3.logger?.warn?.(hint);
|
|
11023
|
+
}
|
|
11024
|
+
}
|
|
11025
|
+
if (typeof error2.$responseBodyText !== "undefined") {
|
|
11026
|
+
if (error2.$response) {
|
|
11027
|
+
error2.$response.body = error2.$responseBodyText;
|
|
11028
|
+
}
|
|
11029
|
+
}
|
|
11030
|
+
try {
|
|
11031
|
+
if (import_protocol_http2.HttpResponse.isInstance(response)) {
|
|
11032
|
+
const { headers = {} } = response;
|
|
11033
|
+
const headerEntries = Object.entries(headers);
|
|
11034
|
+
error2.$metadata = {
|
|
11035
|
+
httpStatusCode: response.statusCode,
|
|
11036
|
+
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
11037
|
+
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
11038
|
+
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
|
|
11039
|
+
};
|
|
11040
|
+
}
|
|
11041
|
+
} catch (e3) {
|
|
11042
|
+
}
|
|
11043
|
+
}
|
|
11044
|
+
throw error2;
|
|
11045
|
+
}
|
|
11046
|
+
};
|
|
11047
|
+
findHeader = (pattern, headers) => {
|
|
11048
|
+
return (headers.find(([k3]) => {
|
|
11049
|
+
return k3.match(pattern);
|
|
11050
|
+
}) || [void 0, void 0])[1];
|
|
11051
|
+
};
|
|
11052
|
+
}
|
|
11053
|
+
});
|
|
11054
|
+
|
|
11055
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js
|
|
11056
|
+
var import_util_middleware4, schemaSerializationMiddleware;
|
|
11057
|
+
var init_schemaSerializationMiddleware = __esm({
|
|
11058
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js"() {
|
|
11059
|
+
import_util_middleware4 = __toESM(require_dist_cjs7());
|
|
11060
|
+
init_operation();
|
|
11061
|
+
schemaSerializationMiddleware = (config) => (next, context3) => async (args) => {
|
|
11062
|
+
const { operationSchema } = (0, import_util_middleware4.getSmithyContext)(context3);
|
|
11063
|
+
const [, ns, n3, t3, i3, o3] = operationSchema ?? [];
|
|
11064
|
+
const endpoint = context3.endpointV2?.url && config.urlParser ? async () => config.urlParser(context3.endpointV2.url) : config.endpoint;
|
|
11065
|
+
const request = await config.protocol.serializeRequest(operation(ns, n3, t3, i3, o3), args.input, {
|
|
11066
|
+
...config,
|
|
11067
|
+
...context3,
|
|
11068
|
+
endpoint
|
|
11069
|
+
});
|
|
11070
|
+
return next({
|
|
11071
|
+
...args,
|
|
11072
|
+
request
|
|
11073
|
+
});
|
|
11074
|
+
};
|
|
11075
|
+
}
|
|
11076
|
+
});
|
|
11077
|
+
|
|
11078
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js
|
|
11079
|
+
function getSchemaSerdePlugin(config) {
|
|
11080
|
+
return {
|
|
11081
|
+
applyToStack: (commandStack) => {
|
|
11082
|
+
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption2);
|
|
11083
|
+
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
|
11084
|
+
config.protocol.setSerdeContext(config);
|
|
11085
|
+
}
|
|
11086
|
+
};
|
|
11087
|
+
}
|
|
11088
|
+
var deserializerMiddlewareOption, serializerMiddlewareOption2;
|
|
11089
|
+
var init_getSchemaSerdePlugin = __esm({
|
|
11090
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js"() {
|
|
11091
|
+
init_schemaDeserializationMiddleware();
|
|
11092
|
+
init_schemaSerializationMiddleware();
|
|
11093
|
+
deserializerMiddlewareOption = {
|
|
11094
|
+
name: "deserializerMiddleware",
|
|
11095
|
+
step: "deserialize",
|
|
11096
|
+
tags: ["DESERIALIZER"],
|
|
11097
|
+
override: true
|
|
11098
|
+
};
|
|
11099
|
+
serializerMiddlewareOption2 = {
|
|
11100
|
+
name: "serializerMiddleware",
|
|
11101
|
+
step: "serialize",
|
|
11102
|
+
tags: ["SERIALIZER"],
|
|
11103
|
+
override: true
|
|
11104
|
+
};
|
|
11105
|
+
}
|
|
11106
|
+
});
|
|
11107
|
+
|
|
10928
11108
|
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/Schema.js
|
|
10929
11109
|
var Schema;
|
|
10930
11110
|
var init_Schema = __esm({
|
|
@@ -10952,51 +11132,6 @@ var init_Schema = __esm({
|
|
|
10952
11132
|
}
|
|
10953
11133
|
});
|
|
10954
11134
|
|
|
10955
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js
|
|
10956
|
-
var StructureSchema, struct;
|
|
10957
|
-
var init_StructureSchema = __esm({
|
|
10958
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js"() {
|
|
10959
|
-
init_Schema();
|
|
10960
|
-
StructureSchema = class _StructureSchema extends Schema {
|
|
10961
|
-
static symbol = Symbol.for("@smithy/str");
|
|
10962
|
-
name;
|
|
10963
|
-
traits;
|
|
10964
|
-
memberNames;
|
|
10965
|
-
memberList;
|
|
10966
|
-
symbol = _StructureSchema.symbol;
|
|
10967
|
-
};
|
|
10968
|
-
struct = (namespace, name14, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
|
10969
|
-
name: name14,
|
|
10970
|
-
namespace,
|
|
10971
|
-
traits,
|
|
10972
|
-
memberNames,
|
|
10973
|
-
memberList
|
|
10974
|
-
});
|
|
10975
|
-
}
|
|
10976
|
-
});
|
|
10977
|
-
|
|
10978
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js
|
|
10979
|
-
var ErrorSchema, error;
|
|
10980
|
-
var init_ErrorSchema = __esm({
|
|
10981
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js"() {
|
|
10982
|
-
init_Schema();
|
|
10983
|
-
init_StructureSchema();
|
|
10984
|
-
ErrorSchema = class _ErrorSchema extends StructureSchema {
|
|
10985
|
-
static symbol = Symbol.for("@smithy/err");
|
|
10986
|
-
ctor;
|
|
10987
|
-
symbol = _ErrorSchema.symbol;
|
|
10988
|
-
};
|
|
10989
|
-
error = (namespace, name14, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
|
10990
|
-
name: name14,
|
|
10991
|
-
namespace,
|
|
10992
|
-
traits,
|
|
10993
|
-
memberNames,
|
|
10994
|
-
memberList,
|
|
10995
|
-
ctor: null
|
|
10996
|
-
});
|
|
10997
|
-
}
|
|
10998
|
-
});
|
|
10999
|
-
|
|
11000
11135
|
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js
|
|
11001
11136
|
var ListSchema, list;
|
|
11002
11137
|
var init_ListSchema = __esm({
|
|
@@ -11064,29 +11199,47 @@ var init_OperationSchema = __esm({
|
|
|
11064
11199
|
}
|
|
11065
11200
|
});
|
|
11066
11201
|
|
|
11067
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/
|
|
11068
|
-
var
|
|
11069
|
-
var
|
|
11070
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/
|
|
11202
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js
|
|
11203
|
+
var StructureSchema, struct;
|
|
11204
|
+
var init_StructureSchema = __esm({
|
|
11205
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js"() {
|
|
11071
11206
|
init_Schema();
|
|
11072
|
-
|
|
11073
|
-
static symbol = Symbol.for("@smithy/
|
|
11207
|
+
StructureSchema = class _StructureSchema extends Schema {
|
|
11208
|
+
static symbol = Symbol.for("@smithy/str");
|
|
11074
11209
|
name;
|
|
11075
|
-
schemaRef;
|
|
11076
11210
|
traits;
|
|
11077
|
-
|
|
11211
|
+
memberNames;
|
|
11212
|
+
memberList;
|
|
11213
|
+
symbol = _StructureSchema.symbol;
|
|
11078
11214
|
};
|
|
11079
|
-
|
|
11215
|
+
struct = (namespace, name14, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
|
11080
11216
|
name: name14,
|
|
11081
11217
|
namespace,
|
|
11082
11218
|
traits,
|
|
11083
|
-
|
|
11219
|
+
memberNames,
|
|
11220
|
+
memberList
|
|
11084
11221
|
});
|
|
11085
|
-
|
|
11222
|
+
}
|
|
11223
|
+
});
|
|
11224
|
+
|
|
11225
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js
|
|
11226
|
+
var ErrorSchema, error;
|
|
11227
|
+
var init_ErrorSchema = __esm({
|
|
11228
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js"() {
|
|
11229
|
+
init_Schema();
|
|
11230
|
+
init_StructureSchema();
|
|
11231
|
+
ErrorSchema = class _ErrorSchema extends StructureSchema {
|
|
11232
|
+
static symbol = Symbol.for("@smithy/err");
|
|
11233
|
+
ctor;
|
|
11234
|
+
symbol = _ErrorSchema.symbol;
|
|
11235
|
+
};
|
|
11236
|
+
error = (namespace, name14, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
|
11086
11237
|
name: name14,
|
|
11087
11238
|
namespace,
|
|
11088
11239
|
traits,
|
|
11089
|
-
|
|
11240
|
+
memberNames,
|
|
11241
|
+
memberList,
|
|
11242
|
+
ctor: null
|
|
11090
11243
|
});
|
|
11091
11244
|
}
|
|
11092
11245
|
});
|
|
@@ -11130,28 +11283,10 @@ function member(memberSchema, memberName) {
|
|
|
11130
11283
|
const internalCtorAccess = NormalizedSchema;
|
|
11131
11284
|
return new internalCtorAccess(memberSchema, memberName);
|
|
11132
11285
|
}
|
|
11133
|
-
function hydrate(ss) {
|
|
11134
|
-
const [id, ...rest] = ss;
|
|
11135
|
-
return {
|
|
11136
|
-
[0]: simAdapter,
|
|
11137
|
-
[1]: list,
|
|
11138
|
-
[2]: map,
|
|
11139
|
-
[3]: struct,
|
|
11140
|
-
[-3]: error,
|
|
11141
|
-
[9]: op
|
|
11142
|
-
}[id].call(null, ...rest);
|
|
11143
|
-
}
|
|
11144
11286
|
var NormalizedSchema, isMemberSchema, isStaticSchema;
|
|
11145
11287
|
var init_NormalizedSchema = __esm({
|
|
11146
11288
|
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js"() {
|
|
11147
11289
|
init_deref();
|
|
11148
|
-
init_ErrorSchema();
|
|
11149
|
-
init_ListSchema();
|
|
11150
|
-
init_MapSchema();
|
|
11151
|
-
init_OperationSchema();
|
|
11152
|
-
init_Schema();
|
|
11153
|
-
init_SimpleSchema();
|
|
11154
|
-
init_StructureSchema();
|
|
11155
11290
|
init_translateTraits();
|
|
11156
11291
|
NormalizedSchema = class _NormalizedSchema {
|
|
11157
11292
|
ref;
|
|
@@ -11177,8 +11312,6 @@ var init_NormalizedSchema = __esm({
|
|
|
11177
11312
|
schema = deref(_ref);
|
|
11178
11313
|
this._isMemberSchema = true;
|
|
11179
11314
|
}
|
|
11180
|
-
if (isStaticSchema(schema))
|
|
11181
|
-
schema = hydrate(schema);
|
|
11182
11315
|
if (traitStack.length > 0) {
|
|
11183
11316
|
this.memberTraits = {};
|
|
11184
11317
|
for (let i3 = traitStack.length - 1; i3 >= 0; --i3) {
|
|
@@ -11197,18 +11330,24 @@ var init_NormalizedSchema = __esm({
|
|
|
11197
11330
|
return;
|
|
11198
11331
|
}
|
|
11199
11332
|
this.schema = deref(schema);
|
|
11200
|
-
if (this.schema
|
|
11201
|
-
this.
|
|
11333
|
+
if (isStaticSchema(this.schema)) {
|
|
11334
|
+
this.name = `${this.schema[1]}#${this.schema[2]}`;
|
|
11335
|
+
this.traits = this.schema[3];
|
|
11202
11336
|
} else {
|
|
11337
|
+
this.name = this.memberName ?? String(schema);
|
|
11203
11338
|
this.traits = 0;
|
|
11204
11339
|
}
|
|
11205
|
-
this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
|
|
11206
11340
|
if (this._isMemberSchema && !memberName) {
|
|
11207
11341
|
throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
|
|
11208
11342
|
}
|
|
11209
11343
|
}
|
|
11210
11344
|
static [Symbol.hasInstance](lhs) {
|
|
11211
|
-
|
|
11345
|
+
const isPrototype2 = this.prototype.isPrototypeOf(lhs);
|
|
11346
|
+
if (!isPrototype2 && typeof lhs === "object" && lhs !== null) {
|
|
11347
|
+
const ns = lhs;
|
|
11348
|
+
return ns.symbol === this.symbol;
|
|
11349
|
+
}
|
|
11350
|
+
return isPrototype2;
|
|
11212
11351
|
}
|
|
11213
11352
|
static of(ref) {
|
|
11214
11353
|
const sc = deref(ref);
|
|
@@ -11226,7 +11365,11 @@ var init_NormalizedSchema = __esm({
|
|
|
11226
11365
|
return new _NormalizedSchema(sc);
|
|
11227
11366
|
}
|
|
11228
11367
|
getSchema() {
|
|
11229
|
-
|
|
11368
|
+
const sc = this.schema;
|
|
11369
|
+
if (sc[0] === 0) {
|
|
11370
|
+
return sc[4];
|
|
11371
|
+
}
|
|
11372
|
+
return sc;
|
|
11230
11373
|
}
|
|
11231
11374
|
getName(withNamespace = false) {
|
|
11232
11375
|
const { name: name14 } = this;
|
|
@@ -11241,15 +11384,15 @@ var init_NormalizedSchema = __esm({
|
|
|
11241
11384
|
}
|
|
11242
11385
|
isListSchema() {
|
|
11243
11386
|
const sc = this.getSchema();
|
|
11244
|
-
return typeof sc === "number" ? sc >= 64 && sc < 128 : sc
|
|
11387
|
+
return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
|
|
11245
11388
|
}
|
|
11246
11389
|
isMapSchema() {
|
|
11247
11390
|
const sc = this.getSchema();
|
|
11248
|
-
return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc
|
|
11391
|
+
return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
|
|
11249
11392
|
}
|
|
11250
11393
|
isStructSchema() {
|
|
11251
11394
|
const sc = this.getSchema();
|
|
11252
|
-
return sc
|
|
11395
|
+
return sc[0] === 3 || sc[0] === -3;
|
|
11253
11396
|
}
|
|
11254
11397
|
isBlobSchema() {
|
|
11255
11398
|
const sc = this.getSchema();
|
|
@@ -11307,13 +11450,13 @@ var init_NormalizedSchema = __esm({
|
|
|
11307
11450
|
throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
|
|
11308
11451
|
}
|
|
11309
11452
|
const schema = this.getSchema();
|
|
11310
|
-
const memberSchema = isDoc ? 15 : schema
|
|
11453
|
+
const memberSchema = isDoc ? 15 : schema[4] ?? 0;
|
|
11311
11454
|
return member([memberSchema, 0], "key");
|
|
11312
11455
|
}
|
|
11313
11456
|
getValueSchema() {
|
|
11314
11457
|
const sc = this.getSchema();
|
|
11315
11458
|
const [isDoc, isMap2, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
|
|
11316
|
-
const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap2 || isList) ? sc
|
|
11459
|
+
const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap2 || isList) ? sc[3 + sc[0]] : isDoc ? 15 : void 0;
|
|
11317
11460
|
if (memberSchema != null) {
|
|
11318
11461
|
return member([memberSchema, 0], isMap2 ? "value" : "member");
|
|
11319
11462
|
}
|
|
@@ -11321,9 +11464,9 @@ var init_NormalizedSchema = __esm({
|
|
|
11321
11464
|
}
|
|
11322
11465
|
getMemberSchema(memberName) {
|
|
11323
11466
|
const struct2 = this.getSchema();
|
|
11324
|
-
if (this.isStructSchema() && struct2.
|
|
11325
|
-
const i3 = struct2.
|
|
11326
|
-
const memberSchema = struct2
|
|
11467
|
+
if (this.isStructSchema() && struct2[4].includes(memberName)) {
|
|
11468
|
+
const i3 = struct2[4].indexOf(memberName);
|
|
11469
|
+
const memberSchema = struct2[5][i3];
|
|
11327
11470
|
return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
|
|
11328
11471
|
}
|
|
11329
11472
|
if (this.isDocumentSchema()) {
|
|
@@ -11359,8 +11502,8 @@ var init_NormalizedSchema = __esm({
|
|
|
11359
11502
|
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
|
11360
11503
|
}
|
|
11361
11504
|
const struct2 = this.getSchema();
|
|
11362
|
-
for (let i3 = 0; i3 < struct2.
|
|
11363
|
-
yield [struct2
|
|
11505
|
+
for (let i3 = 0; i3 < struct2[4].length; ++i3) {
|
|
11506
|
+
yield [struct2[4][i3], member([struct2[5][i3], 0], struct2[4][i3])];
|
|
11364
11507
|
}
|
|
11365
11508
|
}
|
|
11366
11509
|
};
|
|
@@ -11369,125 +11512,30 @@ var init_NormalizedSchema = __esm({
|
|
|
11369
11512
|
}
|
|
11370
11513
|
});
|
|
11371
11514
|
|
|
11372
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/
|
|
11373
|
-
var
|
|
11374
|
-
var
|
|
11375
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
operationSchema = hydrate(operationSchema);
|
|
11384
|
-
}
|
|
11385
|
-
try {
|
|
11386
|
-
const parsed = await config.protocol.deserializeResponse(operationSchema, {
|
|
11387
|
-
...config,
|
|
11388
|
-
...context3
|
|
11389
|
-
}, response);
|
|
11390
|
-
return {
|
|
11391
|
-
response,
|
|
11392
|
-
output: parsed
|
|
11393
|
-
};
|
|
11394
|
-
} catch (error2) {
|
|
11395
|
-
Object.defineProperty(error2, "$response", {
|
|
11396
|
-
value: response
|
|
11397
|
-
});
|
|
11398
|
-
if (!("$metadata" in error2)) {
|
|
11399
|
-
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
11400
|
-
try {
|
|
11401
|
-
error2.message += "\n " + hint;
|
|
11402
|
-
} catch (e3) {
|
|
11403
|
-
if (!context3.logger || context3.logger?.constructor?.name === "NoOpLogger") {
|
|
11404
|
-
console.warn(hint);
|
|
11405
|
-
} else {
|
|
11406
|
-
context3.logger?.warn?.(hint);
|
|
11407
|
-
}
|
|
11408
|
-
}
|
|
11409
|
-
if (typeof error2.$responseBodyText !== "undefined") {
|
|
11410
|
-
if (error2.$response) {
|
|
11411
|
-
error2.$response.body = error2.$responseBodyText;
|
|
11412
|
-
}
|
|
11413
|
-
}
|
|
11414
|
-
try {
|
|
11415
|
-
if (import_protocol_http2.HttpResponse.isInstance(response)) {
|
|
11416
|
-
const { headers = {} } = response;
|
|
11417
|
-
const headerEntries = Object.entries(headers);
|
|
11418
|
-
error2.$metadata = {
|
|
11419
|
-
httpStatusCode: response.statusCode,
|
|
11420
|
-
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
11421
|
-
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
11422
|
-
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
|
|
11423
|
-
};
|
|
11424
|
-
}
|
|
11425
|
-
} catch (e3) {
|
|
11426
|
-
}
|
|
11427
|
-
}
|
|
11428
|
-
throw error2;
|
|
11429
|
-
}
|
|
11430
|
-
};
|
|
11431
|
-
findHeader = (pattern, headers) => {
|
|
11432
|
-
return (headers.find(([k3]) => {
|
|
11433
|
-
return k3.match(pattern);
|
|
11434
|
-
}) || [void 0, void 0])[1];
|
|
11435
|
-
};
|
|
11436
|
-
}
|
|
11437
|
-
});
|
|
11438
|
-
|
|
11439
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js
|
|
11440
|
-
var import_util_middleware4, schemaSerializationMiddleware;
|
|
11441
|
-
var init_schemaSerializationMiddleware = __esm({
|
|
11442
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js"() {
|
|
11443
|
-
import_util_middleware4 = __toESM(require_dist_cjs7());
|
|
11444
|
-
init_NormalizedSchema();
|
|
11445
|
-
schemaSerializationMiddleware = (config) => (next, context3) => async (args) => {
|
|
11446
|
-
let { operationSchema } = (0, import_util_middleware4.getSmithyContext)(context3);
|
|
11447
|
-
if (isStaticSchema(operationSchema)) {
|
|
11448
|
-
operationSchema = hydrate(operationSchema);
|
|
11449
|
-
}
|
|
11450
|
-
const endpoint = context3.endpointV2?.url && config.urlParser ? async () => config.urlParser(context3.endpointV2.url) : config.endpoint;
|
|
11451
|
-
const request = await config.protocol.serializeRequest(operationSchema, args.input, {
|
|
11452
|
-
...config,
|
|
11453
|
-
...context3,
|
|
11454
|
-
endpoint
|
|
11455
|
-
});
|
|
11456
|
-
return next({
|
|
11457
|
-
...args,
|
|
11458
|
-
request
|
|
11459
|
-
});
|
|
11460
|
-
};
|
|
11461
|
-
}
|
|
11462
|
-
});
|
|
11463
|
-
|
|
11464
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js
|
|
11465
|
-
function getSchemaSerdePlugin(config) {
|
|
11466
|
-
return {
|
|
11467
|
-
applyToStack: (commandStack) => {
|
|
11468
|
-
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption2);
|
|
11469
|
-
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
|
11470
|
-
config.protocol.setSerdeContext(config);
|
|
11471
|
-
}
|
|
11472
|
-
};
|
|
11473
|
-
}
|
|
11474
|
-
var deserializerMiddlewareOption, serializerMiddlewareOption2;
|
|
11475
|
-
var init_getSchemaSerdePlugin = __esm({
|
|
11476
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js"() {
|
|
11477
|
-
init_schemaDeserializationMiddleware();
|
|
11478
|
-
init_schemaSerializationMiddleware();
|
|
11479
|
-
deserializerMiddlewareOption = {
|
|
11480
|
-
name: "deserializerMiddleware",
|
|
11481
|
-
step: "deserialize",
|
|
11482
|
-
tags: ["DESERIALIZER"],
|
|
11483
|
-
override: true
|
|
11484
|
-
};
|
|
11485
|
-
serializerMiddlewareOption2 = {
|
|
11486
|
-
name: "serializerMiddleware",
|
|
11487
|
-
step: "serialize",
|
|
11488
|
-
tags: ["SERIALIZER"],
|
|
11489
|
-
override: true
|
|
11515
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js
|
|
11516
|
+
var SimpleSchema, sim, simAdapter;
|
|
11517
|
+
var init_SimpleSchema = __esm({
|
|
11518
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js"() {
|
|
11519
|
+
init_Schema();
|
|
11520
|
+
SimpleSchema = class _SimpleSchema extends Schema {
|
|
11521
|
+
static symbol = Symbol.for("@smithy/sim");
|
|
11522
|
+
name;
|
|
11523
|
+
schemaRef;
|
|
11524
|
+
traits;
|
|
11525
|
+
symbol = _SimpleSchema.symbol;
|
|
11490
11526
|
};
|
|
11527
|
+
sim = (namespace, name14, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
|
|
11528
|
+
name: name14,
|
|
11529
|
+
namespace,
|
|
11530
|
+
traits,
|
|
11531
|
+
schemaRef
|
|
11532
|
+
});
|
|
11533
|
+
simAdapter = (namespace, name14, traits, schemaRef) => Schema.assign(new SimpleSchema(), {
|
|
11534
|
+
name: name14,
|
|
11535
|
+
namespace,
|
|
11536
|
+
traits,
|
|
11537
|
+
schemaRef
|
|
11538
|
+
});
|
|
11491
11539
|
}
|
|
11492
11540
|
});
|
|
11493
11541
|
|
|
@@ -11555,7 +11603,7 @@ var init_TypeRegistry = __esm({
|
|
|
11555
11603
|
getErrorCtor(es) {
|
|
11556
11604
|
const $error = es;
|
|
11557
11605
|
const registry = _TypeRegistry.for($error[1]);
|
|
11558
|
-
return registry.exceptions.get(
|
|
11606
|
+
return registry.exceptions.get($error);
|
|
11559
11607
|
}
|
|
11560
11608
|
getBaseException() {
|
|
11561
11609
|
for (const exceptionKey of this.exceptions.keys()) {
|
|
@@ -11603,11 +11651,11 @@ __export(schema_exports, {
|
|
|
11603
11651
|
deserializerMiddlewareOption: () => deserializerMiddlewareOption,
|
|
11604
11652
|
error: () => error,
|
|
11605
11653
|
getSchemaSerdePlugin: () => getSchemaSerdePlugin,
|
|
11606
|
-
hydrate: () => hydrate,
|
|
11607
11654
|
isStaticSchema: () => isStaticSchema,
|
|
11608
11655
|
list: () => list,
|
|
11609
11656
|
map: () => map,
|
|
11610
11657
|
op: () => op,
|
|
11658
|
+
operation: () => operation,
|
|
11611
11659
|
serializerMiddlewareOption: () => serializerMiddlewareOption2,
|
|
11612
11660
|
sim: () => sim,
|
|
11613
11661
|
simAdapter: () => simAdapter,
|
|
@@ -11621,6 +11669,7 @@ var init_schema = __esm({
|
|
|
11621
11669
|
init_ListSchema();
|
|
11622
11670
|
init_MapSchema();
|
|
11623
11671
|
init_OperationSchema();
|
|
11672
|
+
init_operation();
|
|
11624
11673
|
init_ErrorSchema();
|
|
11625
11674
|
init_NormalizedSchema();
|
|
11626
11675
|
init_Schema();
|
|
@@ -12987,7 +13036,6 @@ var init_EventStreamSerde = __esm({
|
|
|
12987
13036
|
const marshaller = this.marshaller;
|
|
12988
13037
|
const eventStreamMember = requestSchema.getEventStreamMember();
|
|
12989
13038
|
const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
|
|
12990
|
-
const memberSchemas = unionSchema.getMemberSchemas();
|
|
12991
13039
|
const serializer = this.serializer;
|
|
12992
13040
|
const defaultContentType = this.defaultContentType;
|
|
12993
13041
|
const initialRequestMarker = Symbol("initialRequestMarker");
|
|
@@ -13098,7 +13146,7 @@ var init_EventStreamSerde = __esm({
|
|
|
13098
13146
|
let explicitPayloadContentType;
|
|
13099
13147
|
const isKnownSchema = (() => {
|
|
13100
13148
|
const struct2 = unionSchema.getSchema();
|
|
13101
|
-
return struct2.
|
|
13149
|
+
return struct2[4].includes(unionMember);
|
|
13102
13150
|
})();
|
|
13103
13151
|
const additionalHeaders = {};
|
|
13104
13152
|
if (!isKnownSchema) {
|
|
@@ -13232,10 +13280,10 @@ var init_HttpProtocol = __esm({
|
|
|
13232
13280
|
}
|
|
13233
13281
|
}
|
|
13234
13282
|
setHostPrefix(request, operationSchema, input) {
|
|
13235
|
-
const operationNs = NormalizedSchema.of(operationSchema);
|
|
13236
13283
|
const inputNs = NormalizedSchema.of(operationSchema.input);
|
|
13237
|
-
|
|
13238
|
-
|
|
13284
|
+
const opTraits = translateTraits(operationSchema.traits ?? {});
|
|
13285
|
+
if (opTraits.endpoint) {
|
|
13286
|
+
let hostPrefix = opTraits.endpoint?.[0];
|
|
13239
13287
|
if (typeof hostPrefix === "string") {
|
|
13240
13288
|
const hostLabelInputs = [...inputNs.structIterator()].filter(([, member2]) => member2.getMergedTraits().hostLabel);
|
|
13241
13289
|
for (const [name14] of hostLabelInputs) {
|
|
@@ -14514,20 +14562,24 @@ var require_dist_cjs20 = __commonJS({
|
|
|
14514
14562
|
if (typeof obj === "string") {
|
|
14515
14563
|
return evaluateTemplate(obj, options);
|
|
14516
14564
|
} else if (obj["fn"]) {
|
|
14517
|
-
return callFunction(obj, options);
|
|
14565
|
+
return group$2.callFunction(obj, options);
|
|
14518
14566
|
} else if (obj["ref"]) {
|
|
14519
14567
|
return getReferenceValue(obj, options);
|
|
14520
14568
|
}
|
|
14521
14569
|
throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
|
|
14522
14570
|
};
|
|
14523
14571
|
var callFunction = ({ fn, argv }, options) => {
|
|
14524
|
-
const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options));
|
|
14572
|
+
const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : group$2.evaluateExpression(arg, "arg", options));
|
|
14525
14573
|
const fnSegments = fn.split(".");
|
|
14526
14574
|
if (fnSegments[0] in customEndpointFunctions3 && fnSegments[1] != null) {
|
|
14527
14575
|
return customEndpointFunctions3[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
|
|
14528
14576
|
}
|
|
14529
14577
|
return endpointFunctions[fn](...evaluatedArgs);
|
|
14530
14578
|
};
|
|
14579
|
+
var group$2 = {
|
|
14580
|
+
evaluateExpression,
|
|
14581
|
+
callFunction
|
|
14582
|
+
};
|
|
14531
14583
|
var evaluateCondition = ({ assign: assign2, ...fnArgs }, options) => {
|
|
14532
14584
|
if (assign2 && assign2 in options.referenceRecord) {
|
|
14533
14585
|
throw new EndpointError(`'${assign2}' is already defined in Reference Record.`);
|
|
@@ -14569,6 +14621,10 @@ var require_dist_cjs20 = __commonJS({
|
|
|
14569
14621
|
return processedExpr;
|
|
14570
14622
|
})
|
|
14571
14623
|
}), {});
|
|
14624
|
+
var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
|
|
14625
|
+
...acc,
|
|
14626
|
+
[propertyKey]: group$1.getEndpointProperty(propertyVal, options)
|
|
14627
|
+
}), {});
|
|
14572
14628
|
var getEndpointProperty = (property2, options) => {
|
|
14573
14629
|
if (Array.isArray(property2)) {
|
|
14574
14630
|
return property2.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
|
|
@@ -14580,17 +14636,17 @@ var require_dist_cjs20 = __commonJS({
|
|
|
14580
14636
|
if (property2 === null) {
|
|
14581
14637
|
throw new EndpointError(`Unexpected endpoint property: ${property2}`);
|
|
14582
14638
|
}
|
|
14583
|
-
return getEndpointProperties(property2, options);
|
|
14639
|
+
return group$1.getEndpointProperties(property2, options);
|
|
14584
14640
|
case "boolean":
|
|
14585
14641
|
return property2;
|
|
14586
14642
|
default:
|
|
14587
14643
|
throw new EndpointError(`Unexpected endpoint property type: ${typeof property2}`);
|
|
14588
14644
|
}
|
|
14589
14645
|
};
|
|
14590
|
-
var
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
}
|
|
14646
|
+
var group$1 = {
|
|
14647
|
+
getEndpointProperty,
|
|
14648
|
+
getEndpointProperties
|
|
14649
|
+
};
|
|
14594
14650
|
var getEndpointUrl = (endpointUrl, options) => {
|
|
14595
14651
|
const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
|
|
14596
14652
|
if (typeof expression === "string") {
|
|
@@ -14636,17 +14692,6 @@ var require_dist_cjs20 = __commonJS({
|
|
|
14636
14692
|
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
14637
14693
|
}));
|
|
14638
14694
|
};
|
|
14639
|
-
var evaluateTreeRule = (treeRule, options) => {
|
|
14640
|
-
const { conditions, rules } = treeRule;
|
|
14641
|
-
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
14642
|
-
if (!result) {
|
|
14643
|
-
return;
|
|
14644
|
-
}
|
|
14645
|
-
return evaluateRules(rules, {
|
|
14646
|
-
...options,
|
|
14647
|
-
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
14648
|
-
});
|
|
14649
|
-
};
|
|
14650
14695
|
var evaluateRules = (rules, options) => {
|
|
14651
14696
|
for (const rule of rules) {
|
|
14652
14697
|
if (rule.type === "endpoint") {
|
|
@@ -14657,7 +14702,7 @@ var require_dist_cjs20 = __commonJS({
|
|
|
14657
14702
|
} else if (rule.type === "error") {
|
|
14658
14703
|
evaluateErrorRule(rule, options);
|
|
14659
14704
|
} else if (rule.type === "tree") {
|
|
14660
|
-
const endpointOrUndefined = evaluateTreeRule(rule, options);
|
|
14705
|
+
const endpointOrUndefined = group.evaluateTreeRule(rule, options);
|
|
14661
14706
|
if (endpointOrUndefined) {
|
|
14662
14707
|
return endpointOrUndefined;
|
|
14663
14708
|
}
|
|
@@ -14667,6 +14712,21 @@ var require_dist_cjs20 = __commonJS({
|
|
|
14667
14712
|
}
|
|
14668
14713
|
throw new EndpointError(`Rules evaluation failed`);
|
|
14669
14714
|
};
|
|
14715
|
+
var evaluateTreeRule = (treeRule, options) => {
|
|
14716
|
+
const { conditions, rules } = treeRule;
|
|
14717
|
+
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
14718
|
+
if (!result) {
|
|
14719
|
+
return;
|
|
14720
|
+
}
|
|
14721
|
+
return group.evaluateRules(rules, {
|
|
14722
|
+
...options,
|
|
14723
|
+
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
14724
|
+
});
|
|
14725
|
+
};
|
|
14726
|
+
var group = {
|
|
14727
|
+
evaluateRules,
|
|
14728
|
+
evaluateTreeRule
|
|
14729
|
+
};
|
|
14670
14730
|
var resolveEndpoint3 = (ruleSetObject, options) => {
|
|
14671
14731
|
const { endpointParams, logger: logger2 } = options;
|
|
14672
14732
|
const { parameters, rules } = ruleSetObject;
|
|
@@ -17189,8 +17249,8 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
17189
17249
|
} catch (e3) {
|
|
17190
17250
|
}
|
|
17191
17251
|
}
|
|
17192
|
-
const { service, operation } = (0, import_util_middleware5.getSmithyContext)(context3);
|
|
17193
|
-
const path7 = `/service/${service}/operation/${
|
|
17252
|
+
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context3);
|
|
17253
|
+
const path7 = `/service/${service}/operation/${operation2}`;
|
|
17194
17254
|
if (request.path.endsWith("/")) {
|
|
17195
17255
|
request.path += path7.slice(1);
|
|
17196
17256
|
} else {
|
|
@@ -17895,10 +17955,10 @@ var require_dist_cjs27 = __commonJS({
|
|
|
17895
17955
|
this._middlewareFn = middlewareSupplier;
|
|
17896
17956
|
return this;
|
|
17897
17957
|
}
|
|
17898
|
-
s(service,
|
|
17958
|
+
s(service, operation2, smithyContext = {}) {
|
|
17899
17959
|
this._smithyContext = {
|
|
17900
17960
|
service,
|
|
17901
|
-
operation,
|
|
17961
|
+
operation: operation2,
|
|
17902
17962
|
...smithyContext
|
|
17903
17963
|
};
|
|
17904
17964
|
return this;
|
|
@@ -17925,9 +17985,9 @@ var require_dist_cjs27 = __commonJS({
|
|
|
17925
17985
|
this._deserializer = deserializer;
|
|
17926
17986
|
return this;
|
|
17927
17987
|
}
|
|
17928
|
-
sc(
|
|
17929
|
-
this._operationSchema =
|
|
17930
|
-
this._smithyContext.operationSchema =
|
|
17988
|
+
sc(operation2) {
|
|
17989
|
+
this._operationSchema = operation2;
|
|
17990
|
+
this._smithyContext.operationSchema = operation2;
|
|
17931
17991
|
return this;
|
|
17932
17992
|
}
|
|
17933
17993
|
build() {
|
|
@@ -18779,7 +18839,7 @@ var init_AwsJsonRpcProtocol = __esm({
|
|
|
18779
18839
|
}
|
|
18780
18840
|
Object.assign(request.headers, {
|
|
18781
18841
|
"content-type": `application/x-amz-json-${this.getJsonRpcVersion()}`,
|
|
18782
|
-
"x-amz-target": `${this.serviceTarget}.${
|
|
18842
|
+
"x-amz-target": `${this.serviceTarget}.${operationSchema.name}`
|
|
18783
18843
|
});
|
|
18784
18844
|
if (this.awsQueryCompatible) {
|
|
18785
18845
|
request.headers["x-amzn-query-mode"] = "true";
|
|
@@ -22902,6 +22962,7 @@ var require_dist_cjs42 = __commonJS({
|
|
|
22902
22962
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
22903
22963
|
var DEFAULT_PROFILE = "default";
|
|
22904
22964
|
var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
|
|
22965
|
+
var CONFIG_PREFIX_SEPARATOR = ".";
|
|
22905
22966
|
var getConfigData = (data2) => Object.entries(data2).filter(([key]) => {
|
|
22906
22967
|
const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
|
|
22907
22968
|
if (indexOfSeparator === -1) {
|
|
@@ -22968,7 +23029,6 @@ var require_dist_cjs42 = __commonJS({
|
|
|
22968
23029
|
return map4;
|
|
22969
23030
|
};
|
|
22970
23031
|
var swallowError$1 = () => ({});
|
|
22971
|
-
var CONFIG_PREFIX_SEPARATOR = ".";
|
|
22972
23032
|
var loadSharedConfigFiles = async (init = {}) => {
|
|
22973
23033
|
const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
|
|
22974
23034
|
const homeDir = getHomeDir.getHomeDir();
|
|
@@ -24173,7 +24233,7 @@ var require_package = __commonJS({
|
|
|
24173
24233
|
module2.exports = {
|
|
24174
24234
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
24175
24235
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
24176
|
-
version: "3.
|
|
24236
|
+
version: "3.911.0",
|
|
24177
24237
|
scripts: {
|
|
24178
24238
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
24179
24239
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -24192,21 +24252,21 @@ var require_package = __commonJS({
|
|
|
24192
24252
|
dependencies: {
|
|
24193
24253
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
24194
24254
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
24195
|
-
"@aws-sdk/core": "3.
|
|
24196
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
24255
|
+
"@aws-sdk/core": "3.911.0",
|
|
24256
|
+
"@aws-sdk/credential-provider-node": "3.911.0",
|
|
24197
24257
|
"@aws-sdk/eventstream-handler-node": "3.910.0",
|
|
24198
24258
|
"@aws-sdk/middleware-eventstream": "3.910.0",
|
|
24199
24259
|
"@aws-sdk/middleware-host-header": "3.910.0",
|
|
24200
24260
|
"@aws-sdk/middleware-logger": "3.910.0",
|
|
24201
24261
|
"@aws-sdk/middleware-recursion-detection": "3.910.0",
|
|
24202
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
24262
|
+
"@aws-sdk/middleware-user-agent": "3.911.0",
|
|
24203
24263
|
"@aws-sdk/middleware-websocket": "3.910.0",
|
|
24204
24264
|
"@aws-sdk/region-config-resolver": "3.910.0",
|
|
24205
|
-
"@aws-sdk/token-providers": "3.
|
|
24265
|
+
"@aws-sdk/token-providers": "3.911.0",
|
|
24206
24266
|
"@aws-sdk/types": "3.910.0",
|
|
24207
24267
|
"@aws-sdk/util-endpoints": "3.910.0",
|
|
24208
24268
|
"@aws-sdk/util-user-agent-browser": "3.910.0",
|
|
24209
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
24269
|
+
"@aws-sdk/util-user-agent-node": "3.911.0",
|
|
24210
24270
|
"@smithy/config-resolver": "^4.3.2",
|
|
24211
24271
|
"@smithy/core": "^3.16.1",
|
|
24212
24272
|
"@smithy/eventstream-serde-browser": "^4.2.2",
|
|
@@ -24954,7 +25014,7 @@ var init_package = __esm({
|
|
|
24954
25014
|
"node_modules/@aws-sdk/nested-clients/package.json"() {
|
|
24955
25015
|
package_default = {
|
|
24956
25016
|
name: "@aws-sdk/nested-clients",
|
|
24957
|
-
version: "3.
|
|
25017
|
+
version: "3.911.0",
|
|
24958
25018
|
description: "Nested clients for AWS SDK packages.",
|
|
24959
25019
|
main: "./dist-cjs/index.js",
|
|
24960
25020
|
module: "./dist-es/index.js",
|
|
@@ -24983,16 +25043,16 @@ var init_package = __esm({
|
|
|
24983
25043
|
dependencies: {
|
|
24984
25044
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
24985
25045
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
24986
|
-
"@aws-sdk/core": "3.
|
|
25046
|
+
"@aws-sdk/core": "3.911.0",
|
|
24987
25047
|
"@aws-sdk/middleware-host-header": "3.910.0",
|
|
24988
25048
|
"@aws-sdk/middleware-logger": "3.910.0",
|
|
24989
25049
|
"@aws-sdk/middleware-recursion-detection": "3.910.0",
|
|
24990
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
25050
|
+
"@aws-sdk/middleware-user-agent": "3.911.0",
|
|
24991
25051
|
"@aws-sdk/region-config-resolver": "3.910.0",
|
|
24992
25052
|
"@aws-sdk/types": "3.910.0",
|
|
24993
25053
|
"@aws-sdk/util-endpoints": "3.910.0",
|
|
24994
25054
|
"@aws-sdk/util-user-agent-browser": "3.910.0",
|
|
24995
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
25055
|
+
"@aws-sdk/util-user-agent-node": "3.911.0",
|
|
24996
25056
|
"@smithy/config-resolver": "^4.3.2",
|
|
24997
25057
|
"@smithy/core": "^3.16.1",
|
|
24998
25058
|
"@smithy/fetch-http-handler": "^5.3.3",
|
|
@@ -26407,7 +26467,7 @@ var require_package2 = __commonJS({
|
|
|
26407
26467
|
module2.exports = {
|
|
26408
26468
|
name: "@aws-sdk/client-sso",
|
|
26409
26469
|
description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
|
|
26410
|
-
version: "3.
|
|
26470
|
+
version: "3.911.0",
|
|
26411
26471
|
scripts: {
|
|
26412
26472
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
26413
26473
|
"build:cjs": "node ../../scripts/compilation/inline client-sso",
|
|
@@ -26426,16 +26486,16 @@ var require_package2 = __commonJS({
|
|
|
26426
26486
|
dependencies: {
|
|
26427
26487
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
26428
26488
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
26429
|
-
"@aws-sdk/core": "3.
|
|
26489
|
+
"@aws-sdk/core": "3.911.0",
|
|
26430
26490
|
"@aws-sdk/middleware-host-header": "3.910.0",
|
|
26431
26491
|
"@aws-sdk/middleware-logger": "3.910.0",
|
|
26432
26492
|
"@aws-sdk/middleware-recursion-detection": "3.910.0",
|
|
26433
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
26493
|
+
"@aws-sdk/middleware-user-agent": "3.911.0",
|
|
26434
26494
|
"@aws-sdk/region-config-resolver": "3.910.0",
|
|
26435
26495
|
"@aws-sdk/types": "3.910.0",
|
|
26436
26496
|
"@aws-sdk/util-endpoints": "3.910.0",
|
|
26437
26497
|
"@aws-sdk/util-user-agent-browser": "3.910.0",
|
|
26438
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
26498
|
+
"@aws-sdk/util-user-agent-node": "3.911.0",
|
|
26439
26499
|
"@smithy/config-resolver": "^4.3.2",
|
|
26440
26500
|
"@smithy/core": "^3.16.1",
|
|
26441
26501
|
"@smithy/fetch-http-handler": "^5.3.3",
|
|
@@ -74729,13 +74789,14 @@ You are working with a repository located at: ${searchDirectory}
|
|
|
74729
74789
|
maxTokens: maxResponseTokens,
|
|
74730
74790
|
temperature: 0.3
|
|
74731
74791
|
});
|
|
74792
|
+
const usagePromise = result.usage;
|
|
74732
74793
|
for await (const delta of result.textStream) {
|
|
74733
74794
|
assistantResponseContent += delta;
|
|
74734
74795
|
if (options.onStream) {
|
|
74735
74796
|
options.onStream(delta);
|
|
74736
74797
|
}
|
|
74737
74798
|
}
|
|
74738
|
-
const usage = await
|
|
74799
|
+
const usage = await usagePromise;
|
|
74739
74800
|
if (usage) {
|
|
74740
74801
|
this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
|
|
74741
74802
|
}
|