@exabugs/dynamodb-client 1.7.0 → 1.9.0
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/CHANGELOG.md +28 -0
- package/README.md +1 -0
- package/dist/client/FindCursor.d.ts +11 -6
- package/dist/client/FindCursor.d.ts.map +1 -1
- package/dist/client/FindCursor.js +30 -11
- package/dist/client/FindCursor.js.map +1 -1
- package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyField.d.ts.map +1 -1
- package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyField.js +5 -4
- package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyField.js.map +1 -1
- package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyInput.d.ts.map +1 -1
- package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyInput.js +5 -4
- package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyInput.js.map +1 -1
- package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.d.ts +19 -0
- package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.d.ts.map +1 -0
- package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.js +36 -0
- package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.js.map +1 -0
- package/dist/integrations/react-admin/dataProvider.d.ts +15 -1
- package/dist/integrations/react-admin/dataProvider.d.ts.map +1 -1
- package/dist/integrations/react-admin/dataProvider.js +84 -4
- package/dist/integrations/react-admin/dataProvider.js.map +1 -1
- package/dist/integrations/react-admin/index.d.ts +1 -0
- package/dist/integrations/react-admin/index.d.ts.map +1 -1
- package/dist/integrations/react-admin/index.js.map +1 -1
- package/dist/scripts/operations/bulkRecordRepair.js +2 -1
- package/dist/scripts/operations/bulkRecordRepair.js.map +1 -1
- package/dist/server/handler.cjs +359 -237
- package/dist/server/handler.cjs.map +4 -4
- package/dist/server/media-handler.cjs +2 -2
- package/dist/server/media-process-handler-dlq.cjs +331 -209
- package/dist/server/media-process-handler-dlq.cjs.map +4 -4
- package/dist/server/media-process-handler.cjs +330 -208
- package/dist/server/media-process-handler.cjs.map +4 -4
- package/dist/server/operations/find/idQuery.d.ts.map +1 -1
- package/dist/server/operations/find/idQuery.js +75 -43
- package/dist/server/operations/find/idQuery.js.map +1 -1
- package/dist/server/operations/find/shadowQuery.d.ts.map +1 -1
- package/dist/server/operations/find/shadowQuery.js +24 -8
- package/dist/server/operations/find/shadowQuery.js.map +1 -1
- package/dist/server/utils/scanWarning.d.ts +30 -0
- package/dist/server/utils/scanWarning.d.ts.map +1 -0
- package/dist/server/utils/scanWarning.js +63 -0
- package/dist/server/utils/scanWarning.js.map +1 -0
- package/dist/sharp-layer.zip +0 -0
- package/docs/README.md +286 -0
- package/docs/SCAN_WARNING.md +81 -0
- package/package.json +2 -1
- package/terraform/README.md +8 -6
- package/terraform/main.tf +40 -1
- package/terraform/outputs.tf +13 -0
- package/terraform/variables.tf +17 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @exabugs/dynamodb-client v1.
|
|
2
|
-
// Built: 2026-10-
|
|
1
|
+
// @exabugs/dynamodb-client v1.9.0
|
|
2
|
+
// Built: 2026-10-11T23:33:20.708Z
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -2041,19 +2041,19 @@ var init_ProviderError = __esm({
|
|
|
2041
2041
|
name = "ProviderError";
|
|
2042
2042
|
tryNextLink;
|
|
2043
2043
|
constructor(message, options = true) {
|
|
2044
|
-
let
|
|
2044
|
+
let logger15;
|
|
2045
2045
|
let tryNextLink = true;
|
|
2046
2046
|
if (typeof options === "boolean") {
|
|
2047
|
-
|
|
2047
|
+
logger15 = void 0;
|
|
2048
2048
|
tryNextLink = options;
|
|
2049
2049
|
} else if (options != null && typeof options === "object") {
|
|
2050
|
-
|
|
2050
|
+
logger15 = options.logger;
|
|
2051
2051
|
tryNextLink = options.tryNextLink ?? true;
|
|
2052
2052
|
}
|
|
2053
2053
|
super(message);
|
|
2054
2054
|
this.tryNextLink = tryNextLink;
|
|
2055
2055
|
Object.setPrototypeOf(this, _ProviderError.prototype);
|
|
2056
|
-
|
|
2056
|
+
logger15?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
|
|
2057
2057
|
}
|
|
2058
2058
|
static from(error2, options = true) {
|
|
2059
2059
|
return Object.assign(new this(error2.message, options), error2);
|
|
@@ -2486,8 +2486,8 @@ var init_configLoader = __esm({
|
|
|
2486
2486
|
init_fromSharedConfigFiles();
|
|
2487
2487
|
init_fromStatic();
|
|
2488
2488
|
loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
|
|
2489
|
-
const { signingName, logger:
|
|
2490
|
-
const envOptions = { signingName, logger:
|
|
2489
|
+
const { signingName, logger: logger15 } = configuration;
|
|
2490
|
+
const envOptions = { signingName, logger: logger15 };
|
|
2491
2491
|
return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
|
|
2492
2492
|
}, "loadConfig");
|
|
2493
2493
|
}
|
|
@@ -4106,7 +4106,7 @@ var init_ByteArrayCollector = __esm({
|
|
|
4106
4106
|
});
|
|
4107
4107
|
|
|
4108
4108
|
// node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.browser.js
|
|
4109
|
-
function createBufferedReadableStream(upstream, size,
|
|
4109
|
+
function createBufferedReadableStream(upstream, size, logger15) {
|
|
4110
4110
|
const reader = upstream.getReader();
|
|
4111
4111
|
let streamBufferingLoggedWarning = false;
|
|
4112
4112
|
let bytesSeen = 0;
|
|
@@ -4144,7 +4144,7 @@ function createBufferedReadableStream(upstream, size, logger14) {
|
|
|
4144
4144
|
const newSize = merge(buffers, mode, chunk);
|
|
4145
4145
|
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
4146
4146
|
streamBufferingLoggedWarning = true;
|
|
4147
|
-
|
|
4147
|
+
logger15?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
4148
4148
|
}
|
|
4149
4149
|
if (newSize >= size) {
|
|
4150
4150
|
controller.enqueue(flush(buffers, mode));
|
|
@@ -4208,9 +4208,9 @@ var init_createBufferedReadable_browser = __esm({
|
|
|
4208
4208
|
});
|
|
4209
4209
|
|
|
4210
4210
|
// node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.js
|
|
4211
|
-
function createBufferedReadable(upstream, size,
|
|
4211
|
+
function createBufferedReadable(upstream, size, logger15) {
|
|
4212
4212
|
if (isReadableStream(upstream)) {
|
|
4213
|
-
return createBufferedReadableStream(upstream, size,
|
|
4213
|
+
return createBufferedReadableStream(upstream, size, logger15);
|
|
4214
4214
|
}
|
|
4215
4215
|
const downstream = new import_node_stream2.Readable({ read() {
|
|
4216
4216
|
} });
|
|
@@ -4243,7 +4243,7 @@ function createBufferedReadable(upstream, size, logger14) {
|
|
|
4243
4243
|
const newSize = merge(buffers, mode, chunk);
|
|
4244
4244
|
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
4245
4245
|
streamBufferingLoggedWarning = true;
|
|
4246
|
-
|
|
4246
|
+
logger15?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
4247
4247
|
}
|
|
4248
4248
|
if (newSize >= size) {
|
|
4249
4249
|
downstream.push(flush(buffers, mode));
|
|
@@ -8281,19 +8281,19 @@ var require_dist_cjs4 = __commonJS({
|
|
|
8281
8281
|
name = "ProviderError";
|
|
8282
8282
|
tryNextLink;
|
|
8283
8283
|
constructor(message, options = true) {
|
|
8284
|
-
let
|
|
8284
|
+
let logger15;
|
|
8285
8285
|
let tryNextLink = true;
|
|
8286
8286
|
if (typeof options === "boolean") {
|
|
8287
|
-
|
|
8287
|
+
logger15 = void 0;
|
|
8288
8288
|
tryNextLink = options;
|
|
8289
8289
|
} else if (options != null && typeof options === "object") {
|
|
8290
|
-
|
|
8290
|
+
logger15 = options.logger;
|
|
8291
8291
|
tryNextLink = options.tryNextLink ?? true;
|
|
8292
8292
|
}
|
|
8293
8293
|
super(message);
|
|
8294
8294
|
this.tryNextLink = tryNextLink;
|
|
8295
8295
|
Object.setPrototypeOf(this, _ProviderError.prototype);
|
|
8296
|
-
|
|
8296
|
+
logger15?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
|
|
8297
8297
|
}
|
|
8298
8298
|
static from(error2, options = true) {
|
|
8299
8299
|
return Object.assign(new this(error2.message, options), error2);
|
|
@@ -11106,9 +11106,9 @@ var require_dist_cjs13 = __commonJS({
|
|
|
11106
11106
|
this.middlewareStack.use(mw);
|
|
11107
11107
|
}
|
|
11108
11108
|
const stack = clientStack.concat(this.middlewareStack);
|
|
11109
|
-
const { logger:
|
|
11109
|
+
const { logger: logger15 } = configuration;
|
|
11110
11110
|
const handlerExecutionContext = {
|
|
11111
|
-
logger:
|
|
11111
|
+
logger: logger15,
|
|
11112
11112
|
clientName,
|
|
11113
11113
|
commandName,
|
|
11114
11114
|
inputFilterSensitiveLog,
|
|
@@ -14922,7 +14922,7 @@ var require_createBufferedReadableStream = __commonJS({
|
|
|
14922
14922
|
exports2.sizeOf = sizeOf2;
|
|
14923
14923
|
exports2.modeOf = modeOf2;
|
|
14924
14924
|
var ByteArrayCollector_1 = require_ByteArrayCollector();
|
|
14925
|
-
function createBufferedReadableStream2(upstream, size,
|
|
14925
|
+
function createBufferedReadableStream2(upstream, size, logger15) {
|
|
14926
14926
|
const reader = upstream.getReader();
|
|
14927
14927
|
let streamBufferingLoggedWarning = false;
|
|
14928
14928
|
let bytesSeen = 0;
|
|
@@ -14960,7 +14960,7 @@ var require_createBufferedReadableStream = __commonJS({
|
|
|
14960
14960
|
const newSize = merge2(buffers, mode, chunk);
|
|
14961
14961
|
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
14962
14962
|
streamBufferingLoggedWarning = true;
|
|
14963
|
-
|
|
14963
|
+
logger15?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
14964
14964
|
}
|
|
14965
14965
|
if (newSize >= size) {
|
|
14966
14966
|
controller.enqueue(flush2(buffers, mode));
|
|
@@ -15031,9 +15031,9 @@ var require_createBufferedReadable = __commonJS({
|
|
|
15031
15031
|
var ByteArrayCollector_1 = require_ByteArrayCollector();
|
|
15032
15032
|
var createBufferedReadableStream_1 = require_createBufferedReadableStream();
|
|
15033
15033
|
var stream_type_check_1 = require_stream_type_check();
|
|
15034
|
-
function createBufferedReadable2(upstream, size,
|
|
15034
|
+
function createBufferedReadable2(upstream, size, logger15) {
|
|
15035
15035
|
if ((0, stream_type_check_1.isReadableStream)(upstream)) {
|
|
15036
|
-
return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size,
|
|
15036
|
+
return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size, logger15);
|
|
15037
15037
|
}
|
|
15038
15038
|
const downstream = new node_stream_1.Readable({ read() {
|
|
15039
15039
|
} });
|
|
@@ -15066,7 +15066,7 @@ var require_createBufferedReadable = __commonJS({
|
|
|
15066
15066
|
const newSize = (0, createBufferedReadableStream_1.merge)(buffers, mode, chunk);
|
|
15067
15067
|
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
15068
15068
|
streamBufferingLoggedWarning = true;
|
|
15069
|
-
|
|
15069
|
+
logger15?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
15070
15070
|
}
|
|
15071
15071
|
if (newSize >= size) {
|
|
15072
15072
|
downstream.push((0, createBufferedReadableStream_1.flush)(buffers, mode));
|
|
@@ -15474,7 +15474,7 @@ var require_dist_cjs18 = __commonJS({
|
|
|
15474
15474
|
}
|
|
15475
15475
|
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME$2), DEFER_EVENT_LISTENER_TIME$2);
|
|
15476
15476
|
}, "setConnectionTimeout");
|
|
15477
|
-
var setRequestTimeout = /* @__PURE__ */ __name((req, reject, timeoutInMs = 0, throwOnRequestTimeout,
|
|
15477
|
+
var setRequestTimeout = /* @__PURE__ */ __name((req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger15) => {
|
|
15478
15478
|
if (timeoutInMs) {
|
|
15479
15479
|
return timing.setTimeout(() => {
|
|
15480
15480
|
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
@@ -15487,7 +15487,7 @@ var require_dist_cjs18 = __commonJS({
|
|
|
15487
15487
|
reject(error2);
|
|
15488
15488
|
} else {
|
|
15489
15489
|
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
15490
|
-
|
|
15490
|
+
logger15?.warn?.(msg);
|
|
15491
15491
|
}
|
|
15492
15492
|
}, timeoutInMs);
|
|
15493
15493
|
}
|
|
@@ -15603,7 +15603,7 @@ var require_dist_cjs18 = __commonJS({
|
|
|
15603
15603
|
}
|
|
15604
15604
|
return new _NodeHttpHandler(instanceOrOptions);
|
|
15605
15605
|
}
|
|
15606
|
-
static checkSocketUsage(agent, socketWarningTimestamp,
|
|
15606
|
+
static checkSocketUsage(agent, socketWarningTimestamp, logger15 = console) {
|
|
15607
15607
|
const { sockets, requests, maxSockets } = agent;
|
|
15608
15608
|
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
15609
15609
|
return socketWarningTimestamp;
|
|
@@ -15617,7 +15617,7 @@ var require_dist_cjs18 = __commonJS({
|
|
|
15617
15617
|
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
15618
15618
|
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
15619
15619
|
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
15620
|
-
|
|
15620
|
+
logger15?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
15621
15621
|
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
15622
15622
|
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
|
|
15623
15623
|
return Date.now();
|
|
@@ -18642,7 +18642,7 @@ For more information please go to https://github.com/aws/aws-sdk-js-v3#functiona
|
|
|
18642
18642
|
return false;
|
|
18643
18643
|
}, "isChecksumWithPartNumber");
|
|
18644
18644
|
var getChecksum = /* @__PURE__ */ __name(async (body, { checksumAlgorithmFn, base64Encoder }) => base64Encoder(await stringHasher(checksumAlgorithmFn, body)), "getChecksum");
|
|
18645
|
-
var validateChecksumFromResponse = /* @__PURE__ */ __name(async (response, { config, responseAlgorithms, logger:
|
|
18645
|
+
var validateChecksumFromResponse = /* @__PURE__ */ __name(async (response, { config, responseAlgorithms, logger: logger15 }) => {
|
|
18646
18646
|
const checksumAlgorithms = getChecksumAlgorithmListForResponse(responseAlgorithms);
|
|
18647
18647
|
const { body: responseBody, headers: responseHeaders } = response;
|
|
18648
18648
|
for (const algorithm of checksumAlgorithms) {
|
|
@@ -18654,7 +18654,7 @@ For more information please go to https://github.com/aws/aws-sdk-js-v3#functiona
|
|
|
18654
18654
|
checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config);
|
|
18655
18655
|
} catch (error2) {
|
|
18656
18656
|
if (algorithm === exports2.ChecksumAlgorithm.CRC64NVME) {
|
|
18657
|
-
|
|
18657
|
+
logger15?.warn(`Skipping ${exports2.ChecksumAlgorithm.CRC64NVME} checksum validation: ${error2.message}`);
|
|
18658
18658
|
continue;
|
|
18659
18659
|
}
|
|
18660
18660
|
throw error2;
|
|
@@ -18796,12 +18796,12 @@ var require_dist_cjs27 = __commonJS({
|
|
|
18796
18796
|
var loggerMiddleware = /* @__PURE__ */ __name(() => (next, context) => async (args) => {
|
|
18797
18797
|
try {
|
|
18798
18798
|
const response = await next(args);
|
|
18799
|
-
const { clientName, commandName, logger:
|
|
18799
|
+
const { clientName, commandName, logger: logger15, dynamoDbDocumentClientOptions = {} } = context;
|
|
18800
18800
|
const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
18801
18801
|
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
18802
18802
|
const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
|
|
18803
18803
|
const { $metadata, ...outputWithoutMetadata } = response.output;
|
|
18804
|
-
|
|
18804
|
+
logger15?.info?.({
|
|
18805
18805
|
clientName,
|
|
18806
18806
|
commandName,
|
|
18807
18807
|
input: inputFilterSensitiveLog(args.input),
|
|
@@ -18810,10 +18810,10 @@ var require_dist_cjs27 = __commonJS({
|
|
|
18810
18810
|
});
|
|
18811
18811
|
return response;
|
|
18812
18812
|
} catch (error2) {
|
|
18813
|
-
const { clientName, commandName, logger:
|
|
18813
|
+
const { clientName, commandName, logger: logger15, dynamoDbDocumentClientOptions = {} } = context;
|
|
18814
18814
|
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
18815
18815
|
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
18816
|
-
|
|
18816
|
+
logger15?.error?.({
|
|
18817
18817
|
clientName,
|
|
18818
18818
|
commandName,
|
|
18819
18819
|
input: inputFilterSensitiveLog(args.input),
|
|
@@ -20104,7 +20104,7 @@ var require_dist_cjs32 = __commonJS({
|
|
|
20104
20104
|
evaluateTreeRule
|
|
20105
20105
|
};
|
|
20106
20106
|
var resolveEndpoint4 = /* @__PURE__ */ __name((ruleSetObject, options) => {
|
|
20107
|
-
const { endpointParams, logger:
|
|
20107
|
+
const { endpointParams, logger: logger15 } = options;
|
|
20108
20108
|
const { parameters, rules } = ruleSetObject;
|
|
20109
20109
|
options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
|
|
20110
20110
|
const paramsWithDefault = Object.entries(parameters).filter(([, v5]) => v5.default != null).map(([k4, v5]) => [k4, v5.default]);
|
|
@@ -20119,7 +20119,7 @@ var require_dist_cjs32 = __commonJS({
|
|
|
20119
20119
|
throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
|
|
20120
20120
|
}
|
|
20121
20121
|
}
|
|
20122
|
-
const endpoint = evaluateRules(rules, { endpointParams, logger:
|
|
20122
|
+
const endpoint = evaluateRules(rules, { endpointParams, logger: logger15, referenceRecord: {} });
|
|
20123
20123
|
options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
|
|
20124
20124
|
return endpoint;
|
|
20125
20125
|
}, "resolveEndpoint");
|
|
@@ -20628,11 +20628,11 @@ var require_dist_cjs36 = __commonJS({
|
|
|
20628
20628
|
userAgentAppId: /* @__PURE__ */ __name(async () => {
|
|
20629
20629
|
const appId = await normalizedAppIdProvider();
|
|
20630
20630
|
if (!isValidUserAgentAppId(appId)) {
|
|
20631
|
-
const
|
|
20631
|
+
const logger15 = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
|
|
20632
20632
|
if (typeof appId !== "string") {
|
|
20633
|
-
|
|
20633
|
+
logger15?.warn("userAgentAppId must be a string or undefined.");
|
|
20634
20634
|
} else if (appId.length > 50) {
|
|
20635
|
-
|
|
20635
|
+
logger15?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
|
|
20636
20636
|
}
|
|
20637
20637
|
}
|
|
20638
20638
|
return appId;
|
|
@@ -21500,8 +21500,8 @@ var require_dist_cjs42 = __commonJS({
|
|
|
21500
21500
|
var isFunction2 = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction");
|
|
21501
21501
|
var fromStatic2 = /* @__PURE__ */ __name((defaultValue) => isFunction2(defaultValue) ? async () => await defaultValue() : propertyProvider.fromStatic(defaultValue), "fromStatic");
|
|
21502
21502
|
var loadConfig2 = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
|
|
21503
|
-
const { signingName, logger:
|
|
21504
|
-
const envOptions = { signingName, logger:
|
|
21503
|
+
const { signingName, logger: logger15 } = configuration;
|
|
21504
|
+
const envOptions = { signingName, logger: logger15 };
|
|
21505
21505
|
return propertyProvider.memoize(propertyProvider.chain(fromEnv2(environmentVariableSelector, envOptions), fromSharedConfigFiles2(configFileSelector, configuration), fromStatic2(defaultValue)));
|
|
21506
21506
|
}, "loadConfig");
|
|
21507
21507
|
exports2.loadConfig = loadConfig2;
|
|
@@ -23737,7 +23737,7 @@ var require_dist_cjs53 = __commonJS({
|
|
|
23737
23737
|
"http:": true,
|
|
23738
23738
|
"https:": true
|
|
23739
23739
|
};
|
|
23740
|
-
var getCmdsUri = /* @__PURE__ */ __name(async ({ logger:
|
|
23740
|
+
var getCmdsUri = /* @__PURE__ */ __name(async ({ logger: logger15 }) => {
|
|
23741
23741
|
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
|
23742
23742
|
return {
|
|
23743
23743
|
hostname: CMDS_IP,
|
|
@@ -23749,13 +23749,13 @@ var require_dist_cjs53 = __commonJS({
|
|
|
23749
23749
|
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
|
23750
23750
|
throw new propertyProvider.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
23751
23751
|
tryNextLink: false,
|
|
23752
|
-
logger:
|
|
23752
|
+
logger: logger15
|
|
23753
23753
|
});
|
|
23754
23754
|
}
|
|
23755
23755
|
if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
|
|
23756
23756
|
throw new propertyProvider.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
23757
23757
|
tryNextLink: false,
|
|
23758
|
-
logger:
|
|
23758
|
+
logger: logger15
|
|
23759
23759
|
});
|
|
23760
23760
|
}
|
|
23761
23761
|
return {
|
|
@@ -23765,7 +23765,7 @@ var require_dist_cjs53 = __commonJS({
|
|
|
23765
23765
|
}
|
|
23766
23766
|
throw new propertyProvider.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, {
|
|
23767
23767
|
tryNextLink: false,
|
|
23768
|
-
logger:
|
|
23768
|
+
logger: logger15
|
|
23769
23769
|
});
|
|
23770
23770
|
}, "getCmdsUri");
|
|
23771
23771
|
var InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError extends propertyProvider.CredentialsProviderError {
|
|
@@ -23820,10 +23820,10 @@ var require_dist_cjs53 = __commonJS({
|
|
|
23820
23820
|
var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
|
23821
23821
|
var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
|
23822
23822
|
var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
|
23823
|
-
var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials,
|
|
23823
|
+
var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger15) => {
|
|
23824
23824
|
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
|
23825
23825
|
const newExpiration = new Date(Date.now() + refreshInterval * 1e3);
|
|
23826
|
-
|
|
23826
|
+
logger15.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}.
|
|
23827
23827
|
For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
23828
23828
|
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
|
23829
23829
|
return {
|
|
@@ -23833,19 +23833,19 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
23833
23833
|
};
|
|
23834
23834
|
}, "getExtendedInstanceMetadataCredentials");
|
|
23835
23835
|
var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => {
|
|
23836
|
-
const
|
|
23836
|
+
const logger15 = options?.logger || console;
|
|
23837
23837
|
let pastCredentials;
|
|
23838
23838
|
return async () => {
|
|
23839
23839
|
let credentials;
|
|
23840
23840
|
try {
|
|
23841
23841
|
credentials = await provider();
|
|
23842
23842
|
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
|
23843
|
-
credentials = getExtendedInstanceMetadataCredentials(credentials,
|
|
23843
|
+
credentials = getExtendedInstanceMetadataCredentials(credentials, logger15);
|
|
23844
23844
|
}
|
|
23845
23845
|
} catch (e4) {
|
|
23846
23846
|
if (pastCredentials) {
|
|
23847
|
-
|
|
23848
|
-
credentials = getExtendedInstanceMetadataCredentials(pastCredentials,
|
|
23847
|
+
logger15.warn("Credential renew failed: ", e4);
|
|
23848
|
+
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger15);
|
|
23849
23849
|
} else {
|
|
23850
23850
|
throw e4;
|
|
23851
23851
|
}
|
|
@@ -23862,7 +23862,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
23862
23862
|
var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), "fromInstanceMetadata");
|
|
23863
23863
|
var getInstanceMetadataProvider = /* @__PURE__ */ __name((init = {}) => {
|
|
23864
23864
|
let disableFetchToken = false;
|
|
23865
|
-
const { logger:
|
|
23865
|
+
const { logger: logger15, profile } = init;
|
|
23866
23866
|
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
23867
23867
|
const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => {
|
|
23868
23868
|
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
|
@@ -23926,7 +23926,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
23926
23926
|
return async () => {
|
|
23927
23927
|
const endpoint = await getInstanceMetadataEndpoint();
|
|
23928
23928
|
if (disableFetchToken) {
|
|
23929
|
-
|
|
23929
|
+
logger15?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
|
23930
23930
|
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
23931
23931
|
} else {
|
|
23932
23932
|
let token;
|
|
@@ -23940,7 +23940,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
23940
23940
|
} else if (error2.message === "TimeoutError" || [403, 404, 405].includes(error2.statusCode)) {
|
|
23941
23941
|
disableFetchToken = true;
|
|
23942
23942
|
}
|
|
23943
|
-
|
|
23943
|
+
logger15?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
23944
23944
|
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
23945
23945
|
}
|
|
23946
23946
|
return getCredentials(maxRetries, {
|
|
@@ -23997,7 +23997,7 @@ var require_checkUrl = __commonJS({
|
|
|
23997
23997
|
var ECS_CONTAINER_HOST = "169.254.170.2";
|
|
23998
23998
|
var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
|
23999
23999
|
var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
|
24000
|
-
var checkUrl = /* @__PURE__ */ __name((url,
|
|
24000
|
+
var checkUrl = /* @__PURE__ */ __name((url, logger15) => {
|
|
24001
24001
|
if (url.protocol === "https:") {
|
|
24002
24002
|
return;
|
|
24003
24003
|
}
|
|
@@ -24024,7 +24024,7 @@ var require_checkUrl = __commonJS({
|
|
|
24024
24024
|
throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
24025
24025
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
24026
24026
|
- ECS container host 169.254.170.2
|
|
24027
|
-
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger:
|
|
24027
|
+
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger: logger15 });
|
|
24028
24028
|
}, "checkUrl");
|
|
24029
24029
|
exports2.checkUrl = checkUrl;
|
|
24030
24030
|
}
|
|
@@ -24055,13 +24055,13 @@ var require_requestHelpers = __commonJS({
|
|
|
24055
24055
|
});
|
|
24056
24056
|
}
|
|
24057
24057
|
__name(createGetRequest, "createGetRequest");
|
|
24058
|
-
async function getCredentials(response,
|
|
24058
|
+
async function getCredentials(response, logger15) {
|
|
24059
24059
|
const stream = (0, util_stream_1.sdkStreamMixin)(response.body);
|
|
24060
24060
|
const str = await stream.transformToString();
|
|
24061
24061
|
if (response.statusCode === 200) {
|
|
24062
24062
|
const parsed = JSON.parse(str);
|
|
24063
24063
|
if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
|
|
24064
|
-
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger:
|
|
24064
|
+
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger: logger15 });
|
|
24065
24065
|
}
|
|
24066
24066
|
return {
|
|
24067
24067
|
accessKeyId: parsed.AccessKeyId,
|
|
@@ -24076,12 +24076,12 @@ var require_requestHelpers = __commonJS({
|
|
|
24076
24076
|
parsedBody = JSON.parse(str);
|
|
24077
24077
|
} catch (e4) {
|
|
24078
24078
|
}
|
|
24079
|
-
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger:
|
|
24079
|
+
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger: logger15 }), {
|
|
24080
24080
|
Code: parsedBody.Code,
|
|
24081
24081
|
Message: parsedBody.Message
|
|
24082
24082
|
});
|
|
24083
24083
|
}
|
|
24084
|
-
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger:
|
|
24084
|
+
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger: logger15 });
|
|
24085
24085
|
}
|
|
24086
24086
|
__name(getCredentials, "getCredentials");
|
|
24087
24087
|
}
|
|
@@ -25445,14 +25445,14 @@ var require_dist_cjs60 = __commonJS({
|
|
|
25445
25445
|
var propertyProvider = require_dist_cjs4();
|
|
25446
25446
|
var sharedIniFileLoader = require_dist_cjs41();
|
|
25447
25447
|
var fs = require("fs");
|
|
25448
|
-
var fromEnvSigningName = /* @__PURE__ */ __name(({ logger:
|
|
25449
|
-
|
|
25448
|
+
var fromEnvSigningName = /* @__PURE__ */ __name(({ logger: logger15, signingName } = {}) => async () => {
|
|
25449
|
+
logger15?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
25450
25450
|
if (!signingName) {
|
|
25451
|
-
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger:
|
|
25451
|
+
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger: logger15 });
|
|
25452
25452
|
}
|
|
25453
25453
|
const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
|
|
25454
25454
|
if (!(bearerTokenKey in process.env)) {
|
|
25455
|
-
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger:
|
|
25455
|
+
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger: logger15 });
|
|
25456
25456
|
}
|
|
25457
25457
|
const token = { token: process.env[bearerTokenKey] };
|
|
25458
25458
|
client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
@@ -25573,8 +25573,8 @@ var require_dist_cjs60 = __commonJS({
|
|
|
25573
25573
|
return existingToken;
|
|
25574
25574
|
}
|
|
25575
25575
|
}, "fromSso");
|
|
25576
|
-
var fromStatic2 = /* @__PURE__ */ __name(({ token, logger:
|
|
25577
|
-
|
|
25576
|
+
var fromStatic2 = /* @__PURE__ */ __name(({ token, logger: logger15 }) => async () => {
|
|
25577
|
+
logger15?.debug("@aws-sdk/token-providers - fromStatic");
|
|
25578
25578
|
if (!token || !token.token) {
|
|
25579
25579
|
throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
25580
25580
|
}
|
|
@@ -26363,7 +26363,7 @@ var require_dist_cjs62 = __commonJS({
|
|
|
26363
26363
|
var tokenProviders = require_dist_cjs60();
|
|
26364
26364
|
var isSsoProfile = /* @__PURE__ */ __name((arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"), "isSsoProfile");
|
|
26365
26365
|
var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
|
|
26366
|
-
var resolveSSOCredentials = /* @__PURE__ */ __name(async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, profile, filepath, configFilepath, ignoreCache, logger:
|
|
26366
|
+
var resolveSSOCredentials = /* @__PURE__ */ __name(async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, profile, filepath, configFilepath, ignoreCache, logger: logger15 }) => {
|
|
26367
26367
|
let token;
|
|
26368
26368
|
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
26369
26369
|
if (ssoSession) {
|
|
@@ -26381,7 +26381,7 @@ var require_dist_cjs62 = __commonJS({
|
|
|
26381
26381
|
} catch (e4) {
|
|
26382
26382
|
throw new propertyProvider.CredentialsProviderError(e4.message, {
|
|
26383
26383
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
26384
|
-
logger:
|
|
26384
|
+
logger: logger15
|
|
26385
26385
|
});
|
|
26386
26386
|
}
|
|
26387
26387
|
} else {
|
|
@@ -26390,14 +26390,14 @@ var require_dist_cjs62 = __commonJS({
|
|
|
26390
26390
|
} catch (e4) {
|
|
26391
26391
|
throw new propertyProvider.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
|
|
26392
26392
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
26393
|
-
logger:
|
|
26393
|
+
logger: logger15
|
|
26394
26394
|
});
|
|
26395
26395
|
}
|
|
26396
26396
|
}
|
|
26397
26397
|
if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
|
|
26398
26398
|
throw new propertyProvider.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
|
|
26399
26399
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
26400
|
-
logger:
|
|
26400
|
+
logger: logger15
|
|
26401
26401
|
});
|
|
26402
26402
|
}
|
|
26403
26403
|
const { accessToken } = token;
|
|
@@ -26419,14 +26419,14 @@ var require_dist_cjs62 = __commonJS({
|
|
|
26419
26419
|
} catch (e4) {
|
|
26420
26420
|
throw new propertyProvider.CredentialsProviderError(e4, {
|
|
26421
26421
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
26422
|
-
logger:
|
|
26422
|
+
logger: logger15
|
|
26423
26423
|
});
|
|
26424
26424
|
}
|
|
26425
26425
|
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
|
|
26426
26426
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
26427
26427
|
throw new propertyProvider.CredentialsProviderError("SSO returns an invalid temporary credential.", {
|
|
26428
26428
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
26429
|
-
logger:
|
|
26429
|
+
logger: logger15
|
|
26430
26430
|
});
|
|
26431
26431
|
}
|
|
26432
26432
|
const credentials = {
|
|
@@ -26444,11 +26444,11 @@ var require_dist_cjs62 = __commonJS({
|
|
|
26444
26444
|
}
|
|
26445
26445
|
return credentials;
|
|
26446
26446
|
}, "resolveSSOCredentials");
|
|
26447
|
-
var validateSsoProfile = /* @__PURE__ */ __name((profile,
|
|
26447
|
+
var validateSsoProfile = /* @__PURE__ */ __name((profile, logger15) => {
|
|
26448
26448
|
const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
|
|
26449
26449
|
if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
|
|
26450
26450
|
throw new propertyProvider.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
|
|
26451
|
-
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger:
|
|
26451
|
+
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger: logger15 });
|
|
26452
26452
|
}
|
|
26453
26453
|
return profile;
|
|
26454
26454
|
}, "validateSsoProfile");
|
|
@@ -27231,7 +27231,7 @@ var require_dist_cjs63 = __commonJS({
|
|
|
27231
27231
|
}
|
|
27232
27232
|
async refresh(token) {
|
|
27233
27233
|
const { SigninClient: SigninClient2, CreateOAuth2TokenCommand: CreateOAuth2TokenCommand2 } = await Promise.resolve().then(() => (init_signin(), signin_exports));
|
|
27234
|
-
const { logger:
|
|
27234
|
+
const { logger: logger15, userAgentAppId } = this.callerClientConfig ?? {};
|
|
27235
27235
|
const isH22 = /* @__PURE__ */ __name((requestHandler2) => {
|
|
27236
27236
|
return requestHandler2?.metadata?.handlerProtocol === "h2";
|
|
27237
27237
|
}, "isH2");
|
|
@@ -27244,7 +27244,7 @@ var require_dist_cjs63 = __commonJS({
|
|
|
27244
27244
|
},
|
|
27245
27245
|
region,
|
|
27246
27246
|
requestHandler,
|
|
27247
|
-
logger:
|
|
27247
|
+
logger: logger15,
|
|
27248
27248
|
userAgentAppId,
|
|
27249
27249
|
...this.init?.clientConfig
|
|
27250
27250
|
});
|
|
@@ -28262,9 +28262,9 @@ var init_defaultStsRoleAssumers = __esm({
|
|
|
28262
28262
|
return async (sourceCreds, params) => {
|
|
28263
28263
|
closureSourceCreds = sourceCreds;
|
|
28264
28264
|
if (!stsClient) {
|
|
28265
|
-
const { logger:
|
|
28265
|
+
const { logger: logger15 = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
|
|
28266
28266
|
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
|
28267
|
-
logger:
|
|
28267
|
+
logger: logger15,
|
|
28268
28268
|
profile
|
|
28269
28269
|
});
|
|
28270
28270
|
const isCompatibleRequestHandler = !isH2(requestHandler);
|
|
@@ -28275,7 +28275,7 @@ var init_defaultStsRoleAssumers = __esm({
|
|
|
28275
28275
|
credentialDefaultProvider: /* @__PURE__ */ __name(() => async () => closureSourceCreds, "credentialDefaultProvider"),
|
|
28276
28276
|
region: resolvedRegion,
|
|
28277
28277
|
requestHandler: isCompatibleRequestHandler ? requestHandler : void 0,
|
|
28278
|
-
logger:
|
|
28278
|
+
logger: logger15
|
|
28279
28279
|
});
|
|
28280
28280
|
}
|
|
28281
28281
|
const { Credentials: Credentials2, AssumedRoleUser: AssumedRoleUser2 } = await stsClient.send(new AssumeRoleCommand(params));
|
|
@@ -28299,9 +28299,9 @@ var init_defaultStsRoleAssumers = __esm({
|
|
|
28299
28299
|
let stsClient;
|
|
28300
28300
|
return async (params) => {
|
|
28301
28301
|
if (!stsClient) {
|
|
28302
|
-
const { logger:
|
|
28302
|
+
const { logger: logger15 = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
|
|
28303
28303
|
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
|
28304
|
-
logger:
|
|
28304
|
+
logger: logger15,
|
|
28305
28305
|
profile
|
|
28306
28306
|
});
|
|
28307
28307
|
const isCompatibleRequestHandler = !isH2(requestHandler);
|
|
@@ -28311,7 +28311,7 @@ var init_defaultStsRoleAssumers = __esm({
|
|
|
28311
28311
|
profile,
|
|
28312
28312
|
region: resolvedRegion,
|
|
28313
28313
|
requestHandler: isCompatibleRequestHandler ? requestHandler : void 0,
|
|
28314
|
-
logger:
|
|
28314
|
+
logger: logger15
|
|
28315
28315
|
});
|
|
28316
28316
|
}
|
|
28317
28317
|
const { Credentials: Credentials2, AssumedRoleUser: AssumedRoleUser2 } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
|
|
@@ -28441,7 +28441,7 @@ var require_dist_cjs64 = __commonJS({
|
|
|
28441
28441
|
client.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
|
|
28442
28442
|
return credentials;
|
|
28443
28443
|
}, "getValidatedProcessCredentials");
|
|
28444
|
-
var resolveProcessCredentials = /* @__PURE__ */ __name(async (profileName, profiles,
|
|
28444
|
+
var resolveProcessCredentials = /* @__PURE__ */ __name(async (profileName, profiles, logger15) => {
|
|
28445
28445
|
const profile = profiles[profileName];
|
|
28446
28446
|
if (profiles[profileName]) {
|
|
28447
28447
|
const credentialProcess = profile["credential_process"];
|
|
@@ -28457,14 +28457,14 @@ var require_dist_cjs64 = __commonJS({
|
|
|
28457
28457
|
}
|
|
28458
28458
|
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
28459
28459
|
} catch (error2) {
|
|
28460
|
-
throw new propertyProvider.CredentialsProviderError(error2.message, { logger:
|
|
28460
|
+
throw new propertyProvider.CredentialsProviderError(error2.message, { logger: logger15 });
|
|
28461
28461
|
}
|
|
28462
28462
|
} else {
|
|
28463
|
-
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger:
|
|
28463
|
+
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger: logger15 });
|
|
28464
28464
|
}
|
|
28465
28465
|
} else {
|
|
28466
28466
|
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
|
|
28467
|
-
logger:
|
|
28467
|
+
logger: logger15
|
|
28468
28468
|
});
|
|
28469
28469
|
}
|
|
28470
28470
|
}, "resolveProcessCredentials");
|
|
@@ -28623,21 +28623,21 @@ var require_dist_cjs66 = __commonJS({
|
|
|
28623
28623
|
var propertyProvider = require_dist_cjs4();
|
|
28624
28624
|
var client = (init_client(), __toCommonJS(client_exports));
|
|
28625
28625
|
var credentialProviderLogin = require_dist_cjs63();
|
|
28626
|
-
var resolveCredentialSource = /* @__PURE__ */ __name((credentialSource, profileName,
|
|
28626
|
+
var resolveCredentialSource = /* @__PURE__ */ __name((credentialSource, profileName, logger15) => {
|
|
28627
28627
|
const sourceProvidersMap = {
|
|
28628
28628
|
EcsContainer: /* @__PURE__ */ __name(async (options) => {
|
|
28629
28629
|
const { fromHttp } = await Promise.resolve().then(() => __toESM(require_dist_cjs54()));
|
|
28630
28630
|
const { fromContainerMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs53()));
|
|
28631
|
-
|
|
28631
|
+
logger15?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
28632
28632
|
return async () => propertyProvider.chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
|
|
28633
28633
|
}, "EcsContainer"),
|
|
28634
28634
|
Ec2InstanceMetadata: /* @__PURE__ */ __name(async (options) => {
|
|
28635
|
-
|
|
28635
|
+
logger15?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
28636
28636
|
const { fromInstanceMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs53()));
|
|
28637
28637
|
return async () => fromInstanceMetadata(options)().then(setNamedProvider);
|
|
28638
28638
|
}, "Ec2InstanceMetadata"),
|
|
28639
28639
|
Environment: /* @__PURE__ */ __name(async (options) => {
|
|
28640
|
-
|
|
28640
|
+
logger15?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
|
28641
28641
|
const { fromEnv: fromEnv2 } = await Promise.resolve().then(() => __toESM(require_dist_cjs52()));
|
|
28642
28642
|
return async () => fromEnv2(options)().then(setNamedProvider);
|
|
28643
28643
|
}, "Environment")
|
|
@@ -28645,24 +28645,24 @@ var require_dist_cjs66 = __commonJS({
|
|
|
28645
28645
|
if (credentialSource in sourceProvidersMap) {
|
|
28646
28646
|
return sourceProvidersMap[credentialSource];
|
|
28647
28647
|
} else {
|
|
28648
|
-
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger:
|
|
28648
|
+
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger: logger15 });
|
|
28649
28649
|
}
|
|
28650
28650
|
}, "resolveCredentialSource");
|
|
28651
28651
|
var setNamedProvider = /* @__PURE__ */ __name((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p"), "setNamedProvider");
|
|
28652
|
-
var isAssumeRoleProfile = /* @__PURE__ */ __name((arg, { profile = "default", logger:
|
|
28653
|
-
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger:
|
|
28652
|
+
var isAssumeRoleProfile = /* @__PURE__ */ __name((arg, { profile = "default", logger: logger15 } = {}) => {
|
|
28653
|
+
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger: logger15 }) || isCredentialSourceProfile(arg, { profile, logger: logger15 }));
|
|
28654
28654
|
}, "isAssumeRoleProfile");
|
|
28655
|
-
var isAssumeRoleWithSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger:
|
|
28655
|
+
var isAssumeRoleWithSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger: logger15 }) => {
|
|
28656
28656
|
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
28657
28657
|
if (withSourceProfile) {
|
|
28658
|
-
|
|
28658
|
+
logger15?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
|
|
28659
28659
|
}
|
|
28660
28660
|
return withSourceProfile;
|
|
28661
28661
|
}, "isAssumeRoleWithSourceProfile");
|
|
28662
|
-
var isCredentialSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger:
|
|
28662
|
+
var isCredentialSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger: logger15 }) => {
|
|
28663
28663
|
const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
|
28664
28664
|
if (withProviderProfile) {
|
|
28665
|
-
|
|
28665
|
+
logger15?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
|
|
28666
28666
|
}
|
|
28667
28667
|
return withProviderProfile;
|
|
28668
28668
|
}, "isCredentialSourceProfile");
|
|
@@ -58394,6 +58394,59 @@ var init_pagination = __esm({
|
|
|
58394
58394
|
}
|
|
58395
58395
|
});
|
|
58396
58396
|
|
|
58397
|
+
// src/server/utils/scanWarning.ts
|
|
58398
|
+
function getScanWarnThreshold() {
|
|
58399
|
+
const raw = process.env.SCAN_WARN_THRESHOLD;
|
|
58400
|
+
if (raw === void 0 || raw === "") {
|
|
58401
|
+
return DEFAULT_SCAN_WARN_THRESHOLD;
|
|
58402
|
+
}
|
|
58403
|
+
const value = Number(raw);
|
|
58404
|
+
return Number.isInteger(value) && value >= 1 ? value : DEFAULT_SCAN_WARN_THRESHOLD;
|
|
58405
|
+
}
|
|
58406
|
+
var logger3, SPARSE_SCAN_EVENT, DEFAULT_SCAN_WARN_THRESHOLD, ScanWatcher;
|
|
58407
|
+
var init_scanWarning = __esm({
|
|
58408
|
+
"src/server/utils/scanWarning.ts"() {
|
|
58409
|
+
"use strict";
|
|
58410
|
+
init_shared();
|
|
58411
|
+
logger3 = createLogger({ service: "scan-warning", level: "warn" });
|
|
58412
|
+
SPARSE_SCAN_EVENT = "SPARSE_SCAN";
|
|
58413
|
+
DEFAULT_SCAN_WARN_THRESHOLD = 5e3;
|
|
58414
|
+
__name(getScanWarnThreshold, "getScanWarnThreshold");
|
|
58415
|
+
ScanWatcher = class {
|
|
58416
|
+
constructor(context) {
|
|
58417
|
+
this.context = context;
|
|
58418
|
+
}
|
|
58419
|
+
static {
|
|
58420
|
+
__name(this, "ScanWatcher");
|
|
58421
|
+
}
|
|
58422
|
+
scanned = 0;
|
|
58423
|
+
warned = false;
|
|
58424
|
+
threshold = getScanWarnThreshold();
|
|
58425
|
+
/** 読んだ件数を加える */
|
|
58426
|
+
add(count) {
|
|
58427
|
+
this.scanned += count;
|
|
58428
|
+
if (!this.warned && this.scanned >= this.threshold) {
|
|
58429
|
+
this.warned = true;
|
|
58430
|
+
logger3.warn(
|
|
58431
|
+
`${SPARSE_SCAN_EVENT}: 1\u30EA\u30AF\u30A8\u30B9\u30C8\u3067 ${this.scanned} \u4EF6\u4EE5\u4E0A\u3092\u8AAD\u307F\u307E\u3057\u305F\u3002\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30FB\u30B9\u30AD\u30FC\u30DE\u30FB\u30ED\u30B8\u30C3\u30AF\u306E\u898B\u76F4\u3057\u3092\u691C\u8A0E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08docs/SCAN_WARNING.md\uFF09`,
|
|
58432
|
+
{
|
|
58433
|
+
event: SPARSE_SCAN_EVENT,
|
|
58434
|
+
...this.context,
|
|
58435
|
+
scanned: this.scanned,
|
|
58436
|
+
threshold: this.threshold,
|
|
58437
|
+
actions: [
|
|
58438
|
+
"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9: \u7D5E\u308A\u8FBC\u307F\u306B\u4F7F\u3046\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30B7\u30E3\u30C9\u30FC\u8A2D\u5B9A\u306B\u8FFD\u52A0\u3057\u3001$eq \u306A\u3069\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3067\u89E3\u6C7A\u3067\u304D\u308B\u6761\u4EF6\u306B\u3059\u308B",
|
|
58439
|
+
"\u30B9\u30AD\u30FC\u30DE: \u7D5E\u308A\u8FBC\u307F\u6761\u4EF6\u3092\u30AD\u30FC\u306B\u3067\u304D\u308B\u3088\u3046\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u5206\u5272\u30FB\u975E\u6B63\u898F\u5316\u3092\u691C\u8A0E\u3059\u308B",
|
|
58440
|
+
"\u30ED\u30B8\u30C3\u30AF: \u7D5E\u308A\u8FBC\u307F\u3092\u6BCE\u56DE\u884C\u3046\u5FC5\u8981\u304C\u3042\u308B\u304B\u3001\u6761\u4EF6\u3092\u5909\u3048\u3089\u308C\u306A\u3044\u304B\u3001\u7D50\u679C\u3092\u30AD\u30E3\u30C3\u30B7\u30E5\u3067\u304D\u306A\u3044\u304B\u3092\u898B\u76F4\u3059"
|
|
58441
|
+
]
|
|
58442
|
+
}
|
|
58443
|
+
);
|
|
58444
|
+
}
|
|
58445
|
+
}
|
|
58446
|
+
};
|
|
58447
|
+
}
|
|
58448
|
+
});
|
|
58449
|
+
|
|
58397
58450
|
// src/server/utils/filter.ts
|
|
58398
58451
|
function parseFilterField(fieldKey) {
|
|
58399
58452
|
const parts = fieldKey.split(":");
|
|
@@ -58482,7 +58535,7 @@ function parseFilters(filter) {
|
|
|
58482
58535
|
parsedFilters.push({ parsed, value });
|
|
58483
58536
|
}
|
|
58484
58537
|
} catch (error2) {
|
|
58485
|
-
|
|
58538
|
+
logger4.error("Invalid filter field syntax", {
|
|
58486
58539
|
fieldKey,
|
|
58487
58540
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
58488
58541
|
});
|
|
@@ -58551,7 +58604,7 @@ function detectNearQuery(filter) {
|
|
|
58551
58604
|
}
|
|
58552
58605
|
return null;
|
|
58553
58606
|
}
|
|
58554
|
-
var
|
|
58607
|
+
var logger4;
|
|
58555
58608
|
var init_utils5 = __esm({
|
|
58556
58609
|
"src/server/operations/find/utils.ts"() {
|
|
58557
58610
|
"use strict";
|
|
@@ -58560,7 +58613,7 @@ var init_utils5 = __esm({
|
|
|
58560
58613
|
init_shadow();
|
|
58561
58614
|
init_filter();
|
|
58562
58615
|
init_validation2();
|
|
58563
|
-
|
|
58616
|
+
logger4 = createLogger({
|
|
58564
58617
|
service: "find-utils",
|
|
58565
58618
|
level: process.env.LOG_LEVEL || "info"
|
|
58566
58619
|
});
|
|
@@ -58577,7 +58630,7 @@ var init_utils5 = __esm({
|
|
|
58577
58630
|
async function executeIdQuery(resource, normalizedParams, requestId) {
|
|
58578
58631
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
58579
58632
|
const { perPage, nextToken } = pagination;
|
|
58580
|
-
|
|
58633
|
+
logger5.debug("Executing ID optimized query", {
|
|
58581
58634
|
requestId,
|
|
58582
58635
|
resource,
|
|
58583
58636
|
sort,
|
|
@@ -58614,7 +58667,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
58614
58667
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
58615
58668
|
const mainRecords = queryResult.Items || [];
|
|
58616
58669
|
const items = mainRecords.map((item) => extractCleanRecord(item));
|
|
58617
|
-
|
|
58670
|
+
logger5.info("ID specific query succeeded", {
|
|
58618
58671
|
requestId,
|
|
58619
58672
|
resource,
|
|
58620
58673
|
targetId,
|
|
@@ -58661,7 +58714,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
58661
58714
|
const bVal = String(b4.id ?? "");
|
|
58662
58715
|
return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
58663
58716
|
});
|
|
58664
|
-
|
|
58717
|
+
logger5.info("ID $in query succeeded", {
|
|
58665
58718
|
requestId,
|
|
58666
58719
|
resource,
|
|
58667
58720
|
requestedCount: targetIds.length,
|
|
@@ -58678,7 +58731,14 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
58678
58731
|
}
|
|
58679
58732
|
async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsedFilters, requestId) {
|
|
58680
58733
|
if (parsedFilters.length > 0) {
|
|
58681
|
-
return executeAllRecordsQueryFullScan(
|
|
58734
|
+
return executeAllRecordsQueryFullScan(
|
|
58735
|
+
resource,
|
|
58736
|
+
sort,
|
|
58737
|
+
perPage,
|
|
58738
|
+
nextToken,
|
|
58739
|
+
parsedFilters,
|
|
58740
|
+
requestId
|
|
58741
|
+
);
|
|
58682
58742
|
}
|
|
58683
58743
|
const dbClient2 = getDBClient();
|
|
58684
58744
|
const tableName = getTableName();
|
|
@@ -58730,7 +58790,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
58730
58790
|
queryResult.LastEvaluatedKey.PK,
|
|
58731
58791
|
queryResult.LastEvaluatedKey.SK
|
|
58732
58792
|
) : void 0;
|
|
58733
|
-
|
|
58793
|
+
logger5.info("ID all records query succeeded", {
|
|
58734
58794
|
requestId,
|
|
58735
58795
|
resource,
|
|
58736
58796
|
count: items.length,
|
|
@@ -58750,25 +58810,36 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58750
58810
|
const dbClient2 = getDBClient();
|
|
58751
58811
|
const tableName = getTableName();
|
|
58752
58812
|
const costTracker = new CostTracker();
|
|
58753
|
-
|
|
58754
|
-
|
|
58813
|
+
let exclusiveStartKey;
|
|
58814
|
+
if (nextToken) {
|
|
58815
|
+
const decoded = decodeNextToken(nextToken);
|
|
58816
|
+
exclusiveStartKey = { PK: decoded.PK, SK: decoded.SK };
|
|
58817
|
+
}
|
|
58818
|
+
const page = [];
|
|
58819
|
+
let lastReturned;
|
|
58820
|
+
let hasNextPage = false;
|
|
58821
|
+
let scanned = 0;
|
|
58822
|
+
let iterations = 0;
|
|
58823
|
+
let previousKeySignature;
|
|
58824
|
+
let chunkSize = SCAN_CHUNK_INITIAL;
|
|
58825
|
+
const watcher = new ScanWatcher({
|
|
58755
58826
|
requestId,
|
|
58756
58827
|
resource,
|
|
58757
|
-
|
|
58828
|
+
path: "id-filtered-scan",
|
|
58829
|
+
sortField: sort.field,
|
|
58830
|
+
filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
|
|
58758
58831
|
});
|
|
58759
|
-
|
|
58760
|
-
|
|
58761
|
-
|
|
58762
|
-
const MAX_ITERATIONS = 1e4;
|
|
58763
|
-
let iterations = 0;
|
|
58764
|
-
do {
|
|
58765
|
-
if (++iterations > MAX_ITERATIONS) {
|
|
58766
|
-
logger4.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E\u3057\u305F\u305F\u3081\u4E2D\u65AD", {
|
|
58832
|
+
scan: while (true) {
|
|
58833
|
+
if (++iterations > SCAN_MAX_ITERATIONS) {
|
|
58834
|
+
logger5.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
58767
58835
|
requestId,
|
|
58768
58836
|
resource,
|
|
58769
58837
|
iterations
|
|
58770
58838
|
});
|
|
58771
|
-
|
|
58839
|
+
throw new AppError("INTERNAL_ERROR" /* INTERNAL_ERROR */, "ID scan exceeded the iteration limit", 500, {
|
|
58840
|
+
resource,
|
|
58841
|
+
iterations
|
|
58842
|
+
});
|
|
58772
58843
|
}
|
|
58773
58844
|
const queryResult = await executeDynamoDBOperation(
|
|
58774
58845
|
() => dbClient2.send(
|
|
@@ -58780,8 +58851,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58780
58851
|
":skPrefix": "id#"
|
|
58781
58852
|
},
|
|
58782
58853
|
ScanIndexForward: sort.order === "ASC",
|
|
58783
|
-
Limit:
|
|
58784
|
-
// 大きめの Limit でループ回数を最小化
|
|
58854
|
+
Limit: chunkSize,
|
|
58785
58855
|
ExclusiveStartKey: exclusiveStartKey,
|
|
58786
58856
|
ConsistentRead: true,
|
|
58787
58857
|
ReturnConsumedCapacity: "TOTAL"
|
|
@@ -58790,41 +58860,57 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58790
58860
|
"Query"
|
|
58791
58861
|
);
|
|
58792
58862
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
58793
|
-
|
|
58863
|
+
watcher.add((queryResult.Items || []).length);
|
|
58864
|
+
for (const row of queryResult.Items || []) {
|
|
58865
|
+
scanned++;
|
|
58866
|
+
if (!matchesAllFilters(extractCleanRecord(row), parsedFilters)) {
|
|
58867
|
+
continue;
|
|
58868
|
+
}
|
|
58869
|
+
if (page.length >= perPage) {
|
|
58870
|
+
hasNextPage = true;
|
|
58871
|
+
break scan;
|
|
58872
|
+
}
|
|
58873
|
+
page.push(extractCleanRecord(row));
|
|
58874
|
+
lastReturned = { PK: row.PK, SK: row.SK };
|
|
58875
|
+
}
|
|
58794
58876
|
const nextKey = queryResult.LastEvaluatedKey;
|
|
58795
|
-
|
|
58796
|
-
|
|
58797
|
-
|
|
58877
|
+
if (!nextKey) {
|
|
58878
|
+
break;
|
|
58879
|
+
}
|
|
58880
|
+
const nextKeySignature = `${nextKey.PK}#${nextKey.SK}`;
|
|
58881
|
+
if (nextKeySignature === previousKeySignature) {
|
|
58882
|
+
logger5.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
58798
58883
|
requestId,
|
|
58799
58884
|
resource,
|
|
58800
58885
|
iterations
|
|
58801
58886
|
});
|
|
58802
|
-
|
|
58887
|
+
throw new AppError(
|
|
58888
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
58889
|
+
"ID scan received the same LastEvaluatedKey repeatedly",
|
|
58890
|
+
500,
|
|
58891
|
+
{ resource, iterations }
|
|
58892
|
+
);
|
|
58803
58893
|
}
|
|
58804
58894
|
previousKeySignature = nextKeySignature;
|
|
58805
58895
|
exclusiveStartKey = nextKey;
|
|
58806
|
-
|
|
58807
|
-
|
|
58808
|
-
|
|
58809
|
-
|
|
58810
|
-
const hasNextPage = offset + perPage < items.length;
|
|
58811
|
-
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
58812
|
-
logger4.info("ID full scan query succeeded", {
|
|
58896
|
+
chunkSize = Math.min(chunkSize * 2, SCAN_CHUNK_MAX);
|
|
58897
|
+
}
|
|
58898
|
+
const nextTokenValue = hasNextPage && lastReturned ? encodeNextToken(lastReturned.PK, lastReturned.SK) : void 0;
|
|
58899
|
+
logger5.info("ID filtered scan query succeeded", {
|
|
58813
58900
|
requestId,
|
|
58814
58901
|
resource,
|
|
58815
|
-
|
|
58816
|
-
offset,
|
|
58902
|
+
scanned,
|
|
58817
58903
|
returned: page.length,
|
|
58818
58904
|
hasNextPage
|
|
58819
58905
|
});
|
|
58820
58906
|
return {
|
|
58821
58907
|
items: page,
|
|
58822
|
-
pageInfo: { hasNextPage, hasPreviousPage:
|
|
58908
|
+
pageInfo: { hasNextPage, hasPreviousPage: !!nextToken },
|
|
58823
58909
|
...nextTokenValue && { nextToken: nextTokenValue },
|
|
58824
58910
|
consumedCapacity: costTracker.getAggregated()
|
|
58825
58911
|
};
|
|
58826
58912
|
}
|
|
58827
|
-
var import_lib_dynamodb2,
|
|
58913
|
+
var import_lib_dynamodb2, logger5, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
|
|
58828
58914
|
var init_idQuery = __esm({
|
|
58829
58915
|
"src/server/operations/find/idQuery.ts"() {
|
|
58830
58916
|
"use strict";
|
|
@@ -58833,8 +58919,9 @@ var init_idQuery = __esm({
|
|
|
58833
58919
|
init_cost_tracker();
|
|
58834
58920
|
init_dynamodb3();
|
|
58835
58921
|
init_pagination();
|
|
58922
|
+
init_scanWarning();
|
|
58836
58923
|
init_utils5();
|
|
58837
|
-
|
|
58924
|
+
logger5 = createLogger({
|
|
58838
58925
|
service: "id-query",
|
|
58839
58926
|
level: process.env.LOG_LEVEL || "info"
|
|
58840
58927
|
});
|
|
@@ -58842,13 +58929,16 @@ var init_idQuery = __esm({
|
|
|
58842
58929
|
__name(executeSpecificIdQuery, "executeSpecificIdQuery");
|
|
58843
58930
|
__name(executeInQuery, "executeInQuery");
|
|
58844
58931
|
__name(executeAllRecordsQuery, "executeAllRecordsQuery");
|
|
58932
|
+
SCAN_CHUNK_INITIAL = 100;
|
|
58933
|
+
SCAN_CHUNK_MAX = 1e3;
|
|
58934
|
+
SCAN_MAX_ITERATIONS = 1e4;
|
|
58845
58935
|
__name(executeAllRecordsQueryFullScan, "executeAllRecordsQueryFullScan");
|
|
58846
58936
|
}
|
|
58847
58937
|
});
|
|
58848
58938
|
|
|
58849
58939
|
// src/server/operations/find/nearQuery.ts
|
|
58850
58940
|
async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId) {
|
|
58851
|
-
|
|
58941
|
+
logger6.debug("Executing $near query", {
|
|
58852
58942
|
requestId,
|
|
58853
58943
|
resource,
|
|
58854
58944
|
fieldName,
|
|
@@ -58859,7 +58949,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58859
58949
|
const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
|
|
58860
58950
|
const dbClient2 = getDBClient();
|
|
58861
58951
|
const tableName = getTableName();
|
|
58862
|
-
|
|
58952
|
+
logger6.debug("Searching shadow records", {
|
|
58863
58953
|
requestId,
|
|
58864
58954
|
resource,
|
|
58865
58955
|
fieldName,
|
|
@@ -58884,7 +58974,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58884
58974
|
);
|
|
58885
58975
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
58886
58976
|
const shadowRecords = queryResult.Items || [];
|
|
58887
|
-
|
|
58977
|
+
logger6.debug("Shadow records found", {
|
|
58888
58978
|
requestId,
|
|
58889
58979
|
resource,
|
|
58890
58980
|
geohashPrefix,
|
|
@@ -58895,7 +58985,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58895
58985
|
const parts = sk.split("#id#");
|
|
58896
58986
|
return parts.length === 2 ? parts[1] : null;
|
|
58897
58987
|
}).filter((id) => id !== null);
|
|
58898
|
-
|
|
58988
|
+
logger6.debug("Main record IDs extracted", {
|
|
58899
58989
|
requestId,
|
|
58900
58990
|
resource,
|
|
58901
58991
|
geohashPrefix,
|
|
@@ -58929,14 +59019,14 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58929
59019
|
}
|
|
58930
59020
|
validRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
58931
59021
|
}
|
|
58932
|
-
|
|
59022
|
+
logger6.debug("Main records retrieved", {
|
|
58933
59023
|
requestId,
|
|
58934
59024
|
resource,
|
|
58935
59025
|
geohashPrefix,
|
|
58936
59026
|
count: validRecords.length
|
|
58937
59027
|
});
|
|
58938
59028
|
const cleanRecords = validRecords.map((record) => extractCleanRecord(record));
|
|
58939
|
-
|
|
59029
|
+
logger6.debug("Clean records extracted", {
|
|
58940
59030
|
requestId,
|
|
58941
59031
|
resource,
|
|
58942
59032
|
geohashPrefix,
|
|
@@ -58955,7 +59045,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58955
59045
|
config
|
|
58956
59046
|
);
|
|
58957
59047
|
const items = result.documents;
|
|
58958
|
-
|
|
59048
|
+
logger6.info("$near query succeeded", {
|
|
58959
59049
|
requestId,
|
|
58960
59050
|
resource,
|
|
58961
59051
|
fieldName,
|
|
@@ -58973,7 +59063,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58973
59063
|
consumedCapacity: costTracker.getAggregated()
|
|
58974
59064
|
};
|
|
58975
59065
|
}
|
|
58976
|
-
var import_lib_dynamodb3,
|
|
59066
|
+
var import_lib_dynamodb3, logger6;
|
|
58977
59067
|
var init_nearQuery = __esm({
|
|
58978
59068
|
"src/server/operations/find/nearQuery.ts"() {
|
|
58979
59069
|
"use strict";
|
|
@@ -58983,7 +59073,7 @@ var init_nearQuery = __esm({
|
|
|
58983
59073
|
init_nearSearch();
|
|
58984
59074
|
init_cost_tracker();
|
|
58985
59075
|
init_dynamodb3();
|
|
58986
|
-
|
|
59076
|
+
logger6 = createLogger({
|
|
58987
59077
|
service: "near-query",
|
|
58988
59078
|
level: process.env.LOG_LEVEL || "info"
|
|
58989
59079
|
});
|
|
@@ -59013,7 +59103,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
59013
59103
|
(f4) => !(isKeyConditionOptimized && f4 === optimizableFilter)
|
|
59014
59104
|
);
|
|
59015
59105
|
if (residualFilters.length > 0) {
|
|
59016
|
-
|
|
59106
|
+
logger7.debug("Residual filters detected, falling back to full scan", {
|
|
59017
59107
|
requestId,
|
|
59018
59108
|
resource,
|
|
59019
59109
|
sortField: sort.field,
|
|
@@ -59021,7 +59111,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
59021
59111
|
});
|
|
59022
59112
|
return executeFullScanQuery(resource, normalizedParams, costTracker, requestId);
|
|
59023
59113
|
}
|
|
59024
|
-
|
|
59114
|
+
logger7.debug("Executing shadow query", {
|
|
59025
59115
|
requestId,
|
|
59026
59116
|
resource,
|
|
59027
59117
|
sortField: sort.field,
|
|
@@ -59069,7 +59159,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
59069
59159
|
shadowRecords.LastEvaluatedKey.PK,
|
|
59070
59160
|
shadowRecords.LastEvaluatedKey.SK
|
|
59071
59161
|
) : void 0;
|
|
59072
|
-
|
|
59162
|
+
logger7.info("Shadow query succeeded", {
|
|
59073
59163
|
requestId,
|
|
59074
59164
|
resource,
|
|
59075
59165
|
sortField: sort.field,
|
|
@@ -59094,7 +59184,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
59094
59184
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
59095
59185
|
const filterSort = { field: filterCandidate.parsed.field, order: "ASC" };
|
|
59096
59186
|
const remainingFilters = parsedFilters.filter((f4) => f4 !== filterCandidate);
|
|
59097
|
-
|
|
59187
|
+
logger7.debug("Executing filter-first query", {
|
|
59098
59188
|
requestId,
|
|
59099
59189
|
resource,
|
|
59100
59190
|
filterField: filterCandidate.parsed.field,
|
|
@@ -59106,7 +59196,9 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
59106
59196
|
filterSort,
|
|
59107
59197
|
filterCandidate,
|
|
59108
59198
|
costTracker,
|
|
59109
|
-
requestId
|
|
59199
|
+
requestId,
|
|
59200
|
+
"shadow-filter-first",
|
|
59201
|
+
parsedFilters
|
|
59110
59202
|
);
|
|
59111
59203
|
if (remainingFilters.length > 0) {
|
|
59112
59204
|
items = items.filter((r4) => matchesAllFilters(r4, remainingFilters));
|
|
@@ -59115,7 +59207,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
59115
59207
|
const page = items.slice(offset, offset + perPage);
|
|
59116
59208
|
const hasNextPage = offset + perPage < items.length;
|
|
59117
59209
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
59118
|
-
|
|
59210
|
+
logger7.info("Filter-first query succeeded", {
|
|
59119
59211
|
requestId,
|
|
59120
59212
|
resource,
|
|
59121
59213
|
filterField: filterCandidate.parsed.field,
|
|
@@ -59136,20 +59228,28 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
59136
59228
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
59137
59229
|
const { perPage, nextToken } = pagination;
|
|
59138
59230
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
59139
|
-
|
|
59231
|
+
logger7.debug("Executing full scan query", {
|
|
59140
59232
|
requestId,
|
|
59141
59233
|
resource,
|
|
59142
59234
|
sortField: sort.field,
|
|
59143
59235
|
offset
|
|
59144
59236
|
});
|
|
59145
|
-
let items = await fetchAllRecordsViaShadowIndex(
|
|
59237
|
+
let items = await fetchAllRecordsViaShadowIndex(
|
|
59238
|
+
resource,
|
|
59239
|
+
sort,
|
|
59240
|
+
void 0,
|
|
59241
|
+
costTracker,
|
|
59242
|
+
requestId,
|
|
59243
|
+
"shadow-full-scan",
|
|
59244
|
+
parsedFilters
|
|
59245
|
+
);
|
|
59146
59246
|
if (parsedFilters.length > 0) {
|
|
59147
59247
|
items = items.filter((r4) => matchesAllFilters(r4, parsedFilters));
|
|
59148
59248
|
}
|
|
59149
59249
|
const page = items.slice(offset, offset + perPage);
|
|
59150
59250
|
const hasNextPage = offset + perPage < items.length;
|
|
59151
59251
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
59152
|
-
|
|
59252
|
+
logger7.info("Full scan query succeeded", {
|
|
59153
59253
|
requestId,
|
|
59154
59254
|
resource,
|
|
59155
59255
|
sortField: sort.field,
|
|
@@ -59165,20 +59265,35 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
59165
59265
|
consumedCapacity: costTracker.getAggregated()
|
|
59166
59266
|
};
|
|
59167
59267
|
}
|
|
59168
|
-
async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId) {
|
|
59268
|
+
async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId, scanPath, parsedFilters) {
|
|
59169
59269
|
const allShadowItems = [];
|
|
59270
|
+
const watcher = new ScanWatcher({
|
|
59271
|
+
requestId,
|
|
59272
|
+
resource,
|
|
59273
|
+
path: scanPath,
|
|
59274
|
+
sortField: indexSort.field,
|
|
59275
|
+
filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
|
|
59276
|
+
});
|
|
59170
59277
|
let lastKey;
|
|
59171
59278
|
let previousKeySignature;
|
|
59172
59279
|
const MAX_ITERATIONS = 1e4;
|
|
59173
59280
|
let iterations = 0;
|
|
59174
59281
|
do {
|
|
59175
59282
|
if (++iterations > MAX_ITERATIONS) {
|
|
59176
|
-
|
|
59283
|
+
logger7.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
59177
59284
|
requestId,
|
|
59178
59285
|
resource,
|
|
59179
59286
|
iterations
|
|
59180
59287
|
});
|
|
59181
|
-
|
|
59288
|
+
throw new AppError(
|
|
59289
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
59290
|
+
"Shadow index scan exceeded the iteration limit",
|
|
59291
|
+
500,
|
|
59292
|
+
{
|
|
59293
|
+
resource,
|
|
59294
|
+
iterations
|
|
59295
|
+
}
|
|
59296
|
+
);
|
|
59182
59297
|
}
|
|
59183
59298
|
const result = await executeShadowRecordQuery(
|
|
59184
59299
|
resource,
|
|
@@ -59191,15 +59306,21 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
59191
59306
|
requestId
|
|
59192
59307
|
);
|
|
59193
59308
|
allShadowItems.push(...result.Items || []);
|
|
59309
|
+
watcher.add((result.Items || []).length);
|
|
59194
59310
|
const nextKey = result.LastEvaluatedKey;
|
|
59195
59311
|
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
59196
59312
|
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
59197
|
-
|
|
59313
|
+
logger7.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
59198
59314
|
requestId,
|
|
59199
59315
|
resource,
|
|
59200
59316
|
iterations
|
|
59201
59317
|
});
|
|
59202
|
-
|
|
59318
|
+
throw new AppError(
|
|
59319
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
59320
|
+
"Shadow index scan received the same LastEvaluatedKey repeatedly",
|
|
59321
|
+
500,
|
|
59322
|
+
{ resource, iterations }
|
|
59323
|
+
);
|
|
59203
59324
|
}
|
|
59204
59325
|
previousKeySignature = nextKeySignature;
|
|
59205
59326
|
lastKey = nextKey;
|
|
@@ -59405,7 +59526,7 @@ async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
|
59405
59526
|
}
|
|
59406
59527
|
allRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
59407
59528
|
}
|
|
59408
|
-
|
|
59529
|
+
logger7.debug("Main records fetched", {
|
|
59409
59530
|
requestId,
|
|
59410
59531
|
resource,
|
|
59411
59532
|
requestedCount: uniqueRecordIds.length,
|
|
@@ -59413,7 +59534,7 @@ async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
|
59413
59534
|
});
|
|
59414
59535
|
return allRecords;
|
|
59415
59536
|
}
|
|
59416
|
-
var import_lib_dynamodb4,
|
|
59537
|
+
var import_lib_dynamodb4, logger7, KEY_CONDITION_OPERATORS;
|
|
59417
59538
|
var init_shadowQuery = __esm({
|
|
59418
59539
|
"src/server/operations/find/shadowQuery.ts"() {
|
|
59419
59540
|
"use strict";
|
|
@@ -59423,8 +59544,9 @@ var init_shadowQuery = __esm({
|
|
|
59423
59544
|
init_cost_tracker();
|
|
59424
59545
|
init_dynamodb3();
|
|
59425
59546
|
init_pagination();
|
|
59547
|
+
init_scanWarning();
|
|
59426
59548
|
init_utils5();
|
|
59427
|
-
|
|
59549
|
+
logger7 = createLogger({
|
|
59428
59550
|
service: "shadow-query",
|
|
59429
59551
|
level: process.env.LOG_LEVEL || "info"
|
|
59430
59552
|
});
|
|
@@ -59445,14 +59567,14 @@ var init_shadowQuery = __esm({
|
|
|
59445
59567
|
|
|
59446
59568
|
// src/server/operations/find/handler.ts
|
|
59447
59569
|
async function handleFind(resource, params, requestId) {
|
|
59448
|
-
|
|
59570
|
+
logger8.debug("Executing find", {
|
|
59449
59571
|
requestId,
|
|
59450
59572
|
resource,
|
|
59451
59573
|
params
|
|
59452
59574
|
});
|
|
59453
59575
|
const nearDetection = detectNearQuery(params.filter);
|
|
59454
59576
|
if (nearDetection) {
|
|
59455
|
-
|
|
59577
|
+
logger8.debug("$near operator detected, executing near search", {
|
|
59456
59578
|
requestId,
|
|
59457
59579
|
resource,
|
|
59458
59580
|
fieldName: nearDetection.fieldName
|
|
@@ -59469,7 +59591,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
59469
59591
|
const config = initializeFindConfig();
|
|
59470
59592
|
const normalizedParams = normalizeFindParams(config, resource, params);
|
|
59471
59593
|
validateSortField(config, resource, normalizedParams.sort);
|
|
59472
|
-
|
|
59594
|
+
logger8.debug("Find parameters normalized", {
|
|
59473
59595
|
requestId,
|
|
59474
59596
|
resource,
|
|
59475
59597
|
sort: normalizedParams.sort,
|
|
@@ -59484,7 +59606,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
59484
59606
|
}
|
|
59485
59607
|
return executeShadowQuery(resource, normalizedParams, requestId);
|
|
59486
59608
|
}
|
|
59487
|
-
var
|
|
59609
|
+
var logger8;
|
|
59488
59610
|
var init_handler = __esm({
|
|
59489
59611
|
"src/server/operations/find/handler.ts"() {
|
|
59490
59612
|
"use strict";
|
|
@@ -59494,7 +59616,7 @@ var init_handler = __esm({
|
|
|
59494
59616
|
init_nearQuery();
|
|
59495
59617
|
init_shadowQuery();
|
|
59496
59618
|
init_utils5();
|
|
59497
|
-
|
|
59619
|
+
logger8 = createLogger({
|
|
59498
59620
|
service: "find-handler",
|
|
59499
59621
|
level: process.env.LOG_LEVEL || "info"
|
|
59500
59622
|
});
|
|
@@ -59517,7 +59639,7 @@ var init_find = __esm({
|
|
|
59517
59639
|
// src/server/utils/bulkOperations.ts
|
|
59518
59640
|
function logLargeBatchWarning(operation2, recordCount, requestId, resource) {
|
|
59519
59641
|
if (recordCount > LARGE_BATCH_WARNING_THRESHOLD) {
|
|
59520
|
-
|
|
59642
|
+
logger10.warn(`Large batch ${operation2} operation detected`, {
|
|
59521
59643
|
requestId,
|
|
59522
59644
|
resource,
|
|
59523
59645
|
recordCount,
|
|
@@ -59540,7 +59662,7 @@ function calculateTimeoutRisk(startTime) {
|
|
|
59540
59662
|
};
|
|
59541
59663
|
}
|
|
59542
59664
|
function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount, riskInfo) {
|
|
59543
|
-
|
|
59665
|
+
logger10.info("Records prepared for chunk execution", {
|
|
59544
59666
|
requestId,
|
|
59545
59667
|
resource,
|
|
59546
59668
|
totalRecords,
|
|
@@ -59550,7 +59672,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
59550
59672
|
timeoutRisk: riskInfo.risk
|
|
59551
59673
|
});
|
|
59552
59674
|
if (riskInfo.risk === "high") {
|
|
59553
|
-
|
|
59675
|
+
logger10.warn("High timeout risk detected during preparation phase", {
|
|
59554
59676
|
requestId,
|
|
59555
59677
|
resource,
|
|
59556
59678
|
preparationElapsedMs: riskInfo.elapsedMs,
|
|
@@ -59562,7 +59684,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
59562
59684
|
}
|
|
59563
59685
|
function logBulkOperationComplete(operation2, requestId, resource, requested, succeeded, failed, riskInfo, additionalInfo) {
|
|
59564
59686
|
const totalElapsedSeconds = Math.round(riskInfo.elapsedMs / 1e3);
|
|
59565
|
-
|
|
59687
|
+
logger10.info(`${operation2} completed`, {
|
|
59566
59688
|
requestId,
|
|
59567
59689
|
resource,
|
|
59568
59690
|
requested,
|
|
@@ -59577,7 +59699,7 @@ function logBulkOperationComplete(operation2, requestId, resource, requested, su
|
|
|
59577
59699
|
}
|
|
59578
59700
|
function logPartialFailure(operation2, requestId, resource, requested, succeeded, failed, errorCodes, additionalInfo) {
|
|
59579
59701
|
const failureRate = Math.round(failed / requested * 100);
|
|
59580
|
-
|
|
59702
|
+
logger10.warn(`Partial failure in ${operation2} operation`, {
|
|
59581
59703
|
requestId,
|
|
59582
59704
|
resource,
|
|
59583
59705
|
totalRequested: requested,
|
|
@@ -59588,12 +59710,12 @@ function logPartialFailure(operation2, requestId, resource, requested, succeeded
|
|
|
59588
59710
|
...additionalInfo
|
|
59589
59711
|
});
|
|
59590
59712
|
}
|
|
59591
|
-
var
|
|
59713
|
+
var logger10;
|
|
59592
59714
|
var init_bulkOperations = __esm({
|
|
59593
59715
|
"src/server/utils/bulkOperations.ts"() {
|
|
59594
59716
|
"use strict";
|
|
59595
59717
|
init_shared();
|
|
59596
|
-
|
|
59718
|
+
logger10 = createLogger({ service: "records-lambda" });
|
|
59597
59719
|
__name(logLargeBatchWarning, "logLargeBatchWarning");
|
|
59598
59720
|
__name(calculateTimeoutRisk, "calculateTimeoutRisk");
|
|
59599
59721
|
__name(logPreparationTimeoutRisk, "logPreparationTimeoutRisk");
|
|
@@ -59612,7 +59734,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
59612
59734
|
const itemCount = getItemCount(record);
|
|
59613
59735
|
if (itemCount > DYNAMODB_TRANSACT_WRITE_MAX_ITEMS) {
|
|
59614
59736
|
const errorMsg = `Single record exceeds ${DYNAMODB_TRANSACT_WRITE_MAX_ITEMS} items limit: ${itemCount} items`;
|
|
59615
|
-
|
|
59737
|
+
logger11.error("Chunk validation failed", {
|
|
59616
59738
|
itemCount,
|
|
59617
59739
|
limit: DYNAMODB_TRANSACT_WRITE_MAX_ITEMS
|
|
59618
59740
|
});
|
|
@@ -59634,7 +59756,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
59634
59756
|
chunks.push(currentChunk);
|
|
59635
59757
|
itemCounts.push(currentItemCount);
|
|
59636
59758
|
}
|
|
59637
|
-
|
|
59759
|
+
logger11.info("Chunk calculation completed", {
|
|
59638
59760
|
totalRecords: records.length,
|
|
59639
59761
|
chunkCount: chunks.length,
|
|
59640
59762
|
itemCounts,
|
|
@@ -59650,7 +59772,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59650
59772
|
const errors = [];
|
|
59651
59773
|
const totalRecords = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
59652
59774
|
const executionStartTime = Date.now();
|
|
59653
|
-
|
|
59775
|
+
logger11.info("Starting chunk execution", {
|
|
59654
59776
|
totalChunks: chunks.length,
|
|
59655
59777
|
totalRecords
|
|
59656
59778
|
});
|
|
@@ -59658,14 +59780,14 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59658
59780
|
const chunk = chunks[i4];
|
|
59659
59781
|
const chunkStartTime = Date.now();
|
|
59660
59782
|
try {
|
|
59661
|
-
|
|
59783
|
+
logger11.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
|
|
59662
59784
|
chunkIndex: i4,
|
|
59663
59785
|
recordCount: chunk.length
|
|
59664
59786
|
});
|
|
59665
59787
|
const successfulRecords = await executeChunk(chunk);
|
|
59666
59788
|
successRecords.push(...successfulRecords);
|
|
59667
59789
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
59668
|
-
|
|
59790
|
+
logger11.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
|
|
59669
59791
|
chunkIndex: i4,
|
|
59670
59792
|
recordCount: chunk.length,
|
|
59671
59793
|
durationMs: chunkDuration
|
|
@@ -59674,7 +59796,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59674
59796
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
59675
59797
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
|
|
59676
59798
|
const errorCode = getErrorCode(error2);
|
|
59677
|
-
|
|
59799
|
+
logger11.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
|
|
59678
59800
|
chunkIndex: i4,
|
|
59679
59801
|
recordCount: chunk.length,
|
|
59680
59802
|
durationMs: chunkDuration,
|
|
@@ -59693,7 +59815,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59693
59815
|
}
|
|
59694
59816
|
}
|
|
59695
59817
|
const totalExecutionTime = Date.now() - executionStartTime;
|
|
59696
|
-
|
|
59818
|
+
logger11.info("Chunk execution completed", {
|
|
59697
59819
|
totalChunks: chunks.length,
|
|
59698
59820
|
totalRecords,
|
|
59699
59821
|
successCount: successRecords.length,
|
|
@@ -59702,7 +59824,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59702
59824
|
avgTimePerChunkMs: chunks.length > 0 ? Math.round(totalExecutionTime / chunks.length) : 0
|
|
59703
59825
|
});
|
|
59704
59826
|
if (failedIds.length > 0) {
|
|
59705
|
-
|
|
59827
|
+
logger11.warn("Partial failure detected in chunk execution", {
|
|
59706
59828
|
totalRecords,
|
|
59707
59829
|
successCount: successRecords.length,
|
|
59708
59830
|
failedCount: failedIds.length,
|
|
@@ -59734,12 +59856,12 @@ function getErrorCode(error2) {
|
|
|
59734
59856
|
}
|
|
59735
59857
|
return "TRANSACTION_FAILED";
|
|
59736
59858
|
}
|
|
59737
|
-
var
|
|
59859
|
+
var logger11;
|
|
59738
59860
|
var init_chunking = __esm({
|
|
59739
59861
|
"src/server/utils/chunking.ts"() {
|
|
59740
59862
|
"use strict";
|
|
59741
59863
|
init_shared();
|
|
59742
|
-
|
|
59864
|
+
logger11 = createLogger({ service: "records-lambda" });
|
|
59743
59865
|
__name(calculateChunks, "calculateChunks");
|
|
59744
59866
|
__name(executeChunks, "executeChunks");
|
|
59745
59867
|
__name(getErrorCode, "getErrorCode");
|
|
@@ -59910,7 +60032,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
59910
60032
|
const upsert = options?.upsert ?? false;
|
|
59911
60033
|
const startTime = Date.now();
|
|
59912
60034
|
const costTracker = new CostTracker();
|
|
59913
|
-
|
|
60035
|
+
logger12.debug("Executing updateMany", {
|
|
59914
60036
|
requestId,
|
|
59915
60037
|
resource,
|
|
59916
60038
|
upsert
|
|
@@ -59918,13 +60040,13 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
59918
60040
|
let ids;
|
|
59919
60041
|
if ("ids" in params) {
|
|
59920
60042
|
ids = params.ids;
|
|
59921
|
-
|
|
60043
|
+
logger12.debug("Executing updateMany with ids", {
|
|
59922
60044
|
requestId,
|
|
59923
60045
|
resource,
|
|
59924
60046
|
count: ids.length
|
|
59925
60047
|
});
|
|
59926
60048
|
} else {
|
|
59927
|
-
|
|
60049
|
+
logger12.debug("Executing updateMany with filter", {
|
|
59928
60050
|
requestId,
|
|
59929
60051
|
resource,
|
|
59930
60052
|
filter: params.filter
|
|
@@ -59932,7 +60054,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
59932
60054
|
const { handleFind: handleFind2 } = await Promise.resolve().then(() => (init_find(), find_exports));
|
|
59933
60055
|
const findResult = await handleFind2(resource, { filter: params.filter }, requestId);
|
|
59934
60056
|
ids = findResult.items.map((item) => item.id);
|
|
59935
|
-
|
|
60057
|
+
logger12.debug("Found records with filter", {
|
|
59936
60058
|
requestId,
|
|
59937
60059
|
resource,
|
|
59938
60060
|
count: ids.length
|
|
@@ -59941,7 +60063,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
59941
60063
|
if (upsert) {
|
|
59942
60064
|
const newId = ulid2();
|
|
59943
60065
|
ids = [newId];
|
|
59944
|
-
|
|
60066
|
+
logger12.info("Creating new record with filter (upsert: true)", {
|
|
59945
60067
|
requestId,
|
|
59946
60068
|
resource,
|
|
59947
60069
|
newId,
|
|
@@ -60005,7 +60127,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60005
60127
|
);
|
|
60006
60128
|
const notFoundIds = ids.filter((id) => !existingIds.has(id));
|
|
60007
60129
|
if (!upsert && notFoundIds.length > 0) {
|
|
60008
|
-
|
|
60130
|
+
logger12.warn("Records not found (upsert: false)", {
|
|
60009
60131
|
requestId,
|
|
60010
60132
|
resource,
|
|
60011
60133
|
notFoundCount: notFoundIds.length,
|
|
@@ -60014,7 +60136,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60014
60136
|
});
|
|
60015
60137
|
}
|
|
60016
60138
|
if (upsert && notFoundIds.length > 0) {
|
|
60017
|
-
|
|
60139
|
+
logger12.info("Creating new records (upsert: true)", {
|
|
60018
60140
|
requestId,
|
|
60019
60141
|
resource,
|
|
60020
60142
|
notFoundCount: notFoundIds.length,
|
|
@@ -60050,7 +60172,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60050
60172
|
const failedId = existingData.id || "unknown-id";
|
|
60051
60173
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
60052
60174
|
const errorCode = getPreparationErrorCode(error2);
|
|
60053
|
-
|
|
60175
|
+
logger12.error("Failed to prepare record for update", {
|
|
60054
60176
|
requestId,
|
|
60055
60177
|
recordId: failedId,
|
|
60056
60178
|
error: errorMessage,
|
|
@@ -60090,7 +60212,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60090
60212
|
} catch (error2) {
|
|
60091
60213
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
60092
60214
|
const errorCode = getPreparationErrorCode(error2);
|
|
60093
|
-
|
|
60215
|
+
logger12.error("Failed to prepare new record for upsert", {
|
|
60094
60216
|
requestId,
|
|
60095
60217
|
recordId: id,
|
|
60096
60218
|
error: errorMessage,
|
|
@@ -60303,7 +60425,7 @@ function getPreparationErrorCode(error2) {
|
|
|
60303
60425
|
}
|
|
60304
60426
|
return "VALIDATION_ERROR" /* VALIDATION_ERROR */;
|
|
60305
60427
|
}
|
|
60306
|
-
var import_lib_dynamodb6,
|
|
60428
|
+
var import_lib_dynamodb6, logger12;
|
|
60307
60429
|
var init_updateMany = __esm({
|
|
60308
60430
|
"src/server/operations/updateMany.ts"() {
|
|
60309
60431
|
"use strict";
|
|
@@ -60317,7 +60439,7 @@ var init_updateMany = __esm({
|
|
|
60317
60439
|
init_dynamodb3();
|
|
60318
60440
|
init_mergePatch();
|
|
60319
60441
|
init_timestamps();
|
|
60320
|
-
|
|
60442
|
+
logger12 = createLogger({ service: "records-lambda" });
|
|
60321
60443
|
__name(handleUpdateMany, "handleUpdateMany");
|
|
60322
60444
|
__name(getPreparationErrorCode, "getPreparationErrorCode");
|
|
60323
60445
|
}
|
|
@@ -60340,11 +60462,11 @@ init_shared();
|
|
|
60340
60462
|
init_shadow();
|
|
60341
60463
|
init_dynamodb3();
|
|
60342
60464
|
init_find();
|
|
60343
|
-
var
|
|
60465
|
+
var logger9 = createLogger({ service: "records-lambda" });
|
|
60344
60466
|
async function handleFindMany(resource, params, requestId) {
|
|
60345
60467
|
if ("ids" in params) {
|
|
60346
60468
|
const { ids } = params;
|
|
60347
|
-
|
|
60469
|
+
logger9.debug("Executing findMany by ids", {
|
|
60348
60470
|
requestId,
|
|
60349
60471
|
resource,
|
|
60350
60472
|
count: ids.length
|
|
@@ -60373,7 +60495,7 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
60373
60495
|
);
|
|
60374
60496
|
const items = result.Responses?.[tableName] || [];
|
|
60375
60497
|
const records = items.map((item) => extractCleanRecord(item));
|
|
60376
|
-
|
|
60498
|
+
logger9.info("findMany by ids succeeded", {
|
|
60377
60499
|
requestId,
|
|
60378
60500
|
resource,
|
|
60379
60501
|
requested: ids.length,
|
|
@@ -60383,7 +60505,7 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
60383
60505
|
}
|
|
60384
60506
|
if ("filter" in params) {
|
|
60385
60507
|
const { filter } = params;
|
|
60386
|
-
|
|
60508
|
+
logger9.debug("Executing findMany by filter", {
|
|
60387
60509
|
requestId,
|
|
60388
60510
|
resource,
|
|
60389
60511
|
filter
|
|
@@ -60395,7 +60517,7 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
60395
60517
|
},
|
|
60396
60518
|
requestId
|
|
60397
60519
|
);
|
|
60398
|
-
|
|
60520
|
+
logger9.info("findMany by filter succeeded", {
|
|
60399
60521
|
requestId,
|
|
60400
60522
|
resource,
|
|
60401
60523
|
filter,
|
|
@@ -60409,13 +60531,13 @@ __name(handleFindMany, "handleFindMany");
|
|
|
60409
60531
|
|
|
60410
60532
|
// src/server/operations/updateOne.ts
|
|
60411
60533
|
init_shared();
|
|
60412
|
-
var
|
|
60534
|
+
var logger13 = createLogger({ service: "records-lambda" });
|
|
60413
60535
|
async function handleUpdateOne(resource, params, requestId) {
|
|
60414
60536
|
const { data: patchData, options } = params;
|
|
60415
60537
|
const { handleUpdateMany: handleUpdateMany2 } = await Promise.resolve().then(() => (init_updateMany(), updateMany_exports));
|
|
60416
60538
|
if ("id" in params) {
|
|
60417
60539
|
const targetId = params.id;
|
|
60418
|
-
|
|
60540
|
+
logger13.debug("Executing updateOne with id", {
|
|
60419
60541
|
requestId,
|
|
60420
60542
|
resource,
|
|
60421
60543
|
id: targetId,
|
|
@@ -60457,7 +60579,7 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
60457
60579
|
consumedCapacity: updateManyResult.consumedCapacity
|
|
60458
60580
|
};
|
|
60459
60581
|
} else {
|
|
60460
|
-
|
|
60582
|
+
logger13.debug("Executing updateOne with filter", {
|
|
60461
60583
|
requestId,
|
|
60462
60584
|
resource,
|
|
60463
60585
|
filter: params.filter,
|
|
@@ -60605,7 +60727,7 @@ async function getImagePolicy(ssmClient2, paramName) {
|
|
|
60605
60727
|
__name(getImagePolicy, "getImagePolicy");
|
|
60606
60728
|
|
|
60607
60729
|
// src/server/media/process-handler.ts
|
|
60608
|
-
var
|
|
60730
|
+
var logger14 = createLogger({ service: "media-process-handler" });
|
|
60609
60731
|
var s3Client = new import_client_s3.S3Client({ region: process.env.AWS_REGION });
|
|
60610
60732
|
var ssmClient = new import_client_ssm2.SSMClient({ region: process.env.AWS_REGION });
|
|
60611
60733
|
var MAX_INPUT_PIXELS = 1e8;
|
|
@@ -60645,7 +60767,7 @@ async function processRecord(bucket, rawKey) {
|
|
|
60645
60767
|
const existing = await handleFindMany("media", { ids: [fileId] }, requestId);
|
|
60646
60768
|
const existingRecord = existing[0];
|
|
60647
60769
|
if (existingRecord?.status === "completed") {
|
|
60648
|
-
|
|
60770
|
+
logger14.warn("Media already completed, ignoring re-upload to the same fileId", {
|
|
60649
60771
|
requestId,
|
|
60650
60772
|
fileId
|
|
60651
60773
|
});
|
|
@@ -60657,7 +60779,7 @@ async function processRecord(bucket, rawKey) {
|
|
|
60657
60779
|
const originalFilename = decodeOriginalFilename(metadata["original-filename"]);
|
|
60658
60780
|
const headBytes = await getHeadBytes(bucket, key);
|
|
60659
60781
|
if (!verifyMagicBytes(contentType, headBytes)) {
|
|
60660
|
-
|
|
60782
|
+
logger14.warn("Content type does not match file signature", { requestId, fileId, contentType });
|
|
60661
60783
|
await writeMediaRecord(
|
|
60662
60784
|
fileId,
|
|
60663
60785
|
{
|
|
@@ -60732,7 +60854,7 @@ async function processRecord(bucket, rawKey) {
|
|
|
60732
60854
|
requestId
|
|
60733
60855
|
);
|
|
60734
60856
|
}
|
|
60735
|
-
|
|
60857
|
+
logger14.info("Media processed", { requestId, fileId, contentType });
|
|
60736
60858
|
}
|
|
60737
60859
|
__name(processRecord, "processRecord");
|
|
60738
60860
|
var handler = /* @__PURE__ */ __name(async (event) => {
|
|
@@ -60742,7 +60864,7 @@ var handler = /* @__PURE__ */ __name(async (event) => {
|
|
|
60742
60864
|
try {
|
|
60743
60865
|
await processRecord(bucket, key);
|
|
60744
60866
|
} catch (error2) {
|
|
60745
|
-
|
|
60867
|
+
logger14.error("Failed to process media", {
|
|
60746
60868
|
bucket,
|
|
60747
60869
|
key,
|
|
60748
60870
|
error: error2 instanceof Error ? error2.message : String(error2)
|