@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");
|
|
@@ -46003,6 +46003,59 @@ var init_pagination = __esm({
|
|
|
46003
46003
|
}
|
|
46004
46004
|
});
|
|
46005
46005
|
|
|
46006
|
+
// src/server/utils/scanWarning.ts
|
|
46007
|
+
function getScanWarnThreshold() {
|
|
46008
|
+
const raw = process.env.SCAN_WARN_THRESHOLD;
|
|
46009
|
+
if (raw === void 0 || raw === "") {
|
|
46010
|
+
return DEFAULT_SCAN_WARN_THRESHOLD;
|
|
46011
|
+
}
|
|
46012
|
+
const value = Number(raw);
|
|
46013
|
+
return Number.isInteger(value) && value >= 1 ? value : DEFAULT_SCAN_WARN_THRESHOLD;
|
|
46014
|
+
}
|
|
46015
|
+
var logger3, SPARSE_SCAN_EVENT, DEFAULT_SCAN_WARN_THRESHOLD, ScanWatcher;
|
|
46016
|
+
var init_scanWarning = __esm({
|
|
46017
|
+
"src/server/utils/scanWarning.ts"() {
|
|
46018
|
+
"use strict";
|
|
46019
|
+
init_shared();
|
|
46020
|
+
logger3 = createLogger({ service: "scan-warning", level: "warn" });
|
|
46021
|
+
SPARSE_SCAN_EVENT = "SPARSE_SCAN";
|
|
46022
|
+
DEFAULT_SCAN_WARN_THRESHOLD = 5e3;
|
|
46023
|
+
__name(getScanWarnThreshold, "getScanWarnThreshold");
|
|
46024
|
+
ScanWatcher = class {
|
|
46025
|
+
constructor(context) {
|
|
46026
|
+
this.context = context;
|
|
46027
|
+
}
|
|
46028
|
+
static {
|
|
46029
|
+
__name(this, "ScanWatcher");
|
|
46030
|
+
}
|
|
46031
|
+
scanned = 0;
|
|
46032
|
+
warned = false;
|
|
46033
|
+
threshold = getScanWarnThreshold();
|
|
46034
|
+
/** 読んだ件数を加える */
|
|
46035
|
+
add(count) {
|
|
46036
|
+
this.scanned += count;
|
|
46037
|
+
if (!this.warned && this.scanned >= this.threshold) {
|
|
46038
|
+
this.warned = true;
|
|
46039
|
+
logger3.warn(
|
|
46040
|
+
`${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`,
|
|
46041
|
+
{
|
|
46042
|
+
event: SPARSE_SCAN_EVENT,
|
|
46043
|
+
...this.context,
|
|
46044
|
+
scanned: this.scanned,
|
|
46045
|
+
threshold: this.threshold,
|
|
46046
|
+
actions: [
|
|
46047
|
+
"\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",
|
|
46048
|
+
"\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",
|
|
46049
|
+
"\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"
|
|
46050
|
+
]
|
|
46051
|
+
}
|
|
46052
|
+
);
|
|
46053
|
+
}
|
|
46054
|
+
}
|
|
46055
|
+
};
|
|
46056
|
+
}
|
|
46057
|
+
});
|
|
46058
|
+
|
|
46006
46059
|
// src/server/utils/filter.ts
|
|
46007
46060
|
function parseFilterField(fieldKey) {
|
|
46008
46061
|
const parts = fieldKey.split(":");
|
|
@@ -46091,7 +46144,7 @@ function parseFilters(filter) {
|
|
|
46091
46144
|
parsedFilters.push({ parsed, value });
|
|
46092
46145
|
}
|
|
46093
46146
|
} catch (error2) {
|
|
46094
|
-
|
|
46147
|
+
logger4.error("Invalid filter field syntax", {
|
|
46095
46148
|
fieldKey,
|
|
46096
46149
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
46097
46150
|
});
|
|
@@ -46160,7 +46213,7 @@ function detectNearQuery(filter) {
|
|
|
46160
46213
|
}
|
|
46161
46214
|
return null;
|
|
46162
46215
|
}
|
|
46163
|
-
var
|
|
46216
|
+
var logger4;
|
|
46164
46217
|
var init_utils5 = __esm({
|
|
46165
46218
|
"src/server/operations/find/utils.ts"() {
|
|
46166
46219
|
"use strict";
|
|
@@ -46169,7 +46222,7 @@ var init_utils5 = __esm({
|
|
|
46169
46222
|
init_shadow();
|
|
46170
46223
|
init_filter();
|
|
46171
46224
|
init_validation2();
|
|
46172
|
-
|
|
46225
|
+
logger4 = createLogger({
|
|
46173
46226
|
service: "find-utils",
|
|
46174
46227
|
level: process.env.LOG_LEVEL || "info"
|
|
46175
46228
|
});
|
|
@@ -46186,7 +46239,7 @@ var init_utils5 = __esm({
|
|
|
46186
46239
|
async function executeIdQuery(resource, normalizedParams, requestId) {
|
|
46187
46240
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
46188
46241
|
const { perPage, nextToken } = pagination;
|
|
46189
|
-
|
|
46242
|
+
logger5.debug("Executing ID optimized query", {
|
|
46190
46243
|
requestId,
|
|
46191
46244
|
resource,
|
|
46192
46245
|
sort,
|
|
@@ -46223,7 +46276,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
46223
46276
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
46224
46277
|
const mainRecords = queryResult.Items || [];
|
|
46225
46278
|
const items = mainRecords.map((item) => extractCleanRecord(item));
|
|
46226
|
-
|
|
46279
|
+
logger5.info("ID specific query succeeded", {
|
|
46227
46280
|
requestId,
|
|
46228
46281
|
resource,
|
|
46229
46282
|
targetId,
|
|
@@ -46270,7 +46323,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
46270
46323
|
const bVal = String(b4.id ?? "");
|
|
46271
46324
|
return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
46272
46325
|
});
|
|
46273
|
-
|
|
46326
|
+
logger5.info("ID $in query succeeded", {
|
|
46274
46327
|
requestId,
|
|
46275
46328
|
resource,
|
|
46276
46329
|
requestedCount: targetIds.length,
|
|
@@ -46287,7 +46340,14 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
46287
46340
|
}
|
|
46288
46341
|
async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsedFilters, requestId) {
|
|
46289
46342
|
if (parsedFilters.length > 0) {
|
|
46290
|
-
return executeAllRecordsQueryFullScan(
|
|
46343
|
+
return executeAllRecordsQueryFullScan(
|
|
46344
|
+
resource,
|
|
46345
|
+
sort,
|
|
46346
|
+
perPage,
|
|
46347
|
+
nextToken,
|
|
46348
|
+
parsedFilters,
|
|
46349
|
+
requestId
|
|
46350
|
+
);
|
|
46291
46351
|
}
|
|
46292
46352
|
const dbClient2 = getDBClient();
|
|
46293
46353
|
const tableName = getTableName();
|
|
@@ -46339,7 +46399,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
46339
46399
|
queryResult.LastEvaluatedKey.PK,
|
|
46340
46400
|
queryResult.LastEvaluatedKey.SK
|
|
46341
46401
|
) : void 0;
|
|
46342
|
-
|
|
46402
|
+
logger5.info("ID all records query succeeded", {
|
|
46343
46403
|
requestId,
|
|
46344
46404
|
resource,
|
|
46345
46405
|
count: items.length,
|
|
@@ -46359,25 +46419,36 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46359
46419
|
const dbClient2 = getDBClient();
|
|
46360
46420
|
const tableName = getTableName();
|
|
46361
46421
|
const costTracker = new CostTracker();
|
|
46362
|
-
|
|
46363
|
-
|
|
46422
|
+
let exclusiveStartKey;
|
|
46423
|
+
if (nextToken) {
|
|
46424
|
+
const decoded = decodeNextToken(nextToken);
|
|
46425
|
+
exclusiveStartKey = { PK: decoded.PK, SK: decoded.SK };
|
|
46426
|
+
}
|
|
46427
|
+
const page = [];
|
|
46428
|
+
let lastReturned;
|
|
46429
|
+
let hasNextPage = false;
|
|
46430
|
+
let scanned = 0;
|
|
46431
|
+
let iterations = 0;
|
|
46432
|
+
let previousKeySignature;
|
|
46433
|
+
let chunkSize = SCAN_CHUNK_INITIAL;
|
|
46434
|
+
const watcher = new ScanWatcher({
|
|
46364
46435
|
requestId,
|
|
46365
46436
|
resource,
|
|
46366
|
-
|
|
46437
|
+
path: "id-filtered-scan",
|
|
46438
|
+
sortField: sort.field,
|
|
46439
|
+
filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
|
|
46367
46440
|
});
|
|
46368
|
-
|
|
46369
|
-
|
|
46370
|
-
|
|
46371
|
-
const MAX_ITERATIONS = 1e4;
|
|
46372
|
-
let iterations = 0;
|
|
46373
|
-
do {
|
|
46374
|
-
if (++iterations > MAX_ITERATIONS) {
|
|
46375
|
-
logger4.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E\u3057\u305F\u305F\u3081\u4E2D\u65AD", {
|
|
46441
|
+
scan: while (true) {
|
|
46442
|
+
if (++iterations > SCAN_MAX_ITERATIONS) {
|
|
46443
|
+
logger5.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
46376
46444
|
requestId,
|
|
46377
46445
|
resource,
|
|
46378
46446
|
iterations
|
|
46379
46447
|
});
|
|
46380
|
-
|
|
46448
|
+
throw new AppError("INTERNAL_ERROR" /* INTERNAL_ERROR */, "ID scan exceeded the iteration limit", 500, {
|
|
46449
|
+
resource,
|
|
46450
|
+
iterations
|
|
46451
|
+
});
|
|
46381
46452
|
}
|
|
46382
46453
|
const queryResult = await executeDynamoDBOperation(
|
|
46383
46454
|
() => dbClient2.send(
|
|
@@ -46389,8 +46460,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46389
46460
|
":skPrefix": "id#"
|
|
46390
46461
|
},
|
|
46391
46462
|
ScanIndexForward: sort.order === "ASC",
|
|
46392
|
-
Limit:
|
|
46393
|
-
// 大きめの Limit でループ回数を最小化
|
|
46463
|
+
Limit: chunkSize,
|
|
46394
46464
|
ExclusiveStartKey: exclusiveStartKey,
|
|
46395
46465
|
ConsistentRead: true,
|
|
46396
46466
|
ReturnConsumedCapacity: "TOTAL"
|
|
@@ -46399,41 +46469,57 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46399
46469
|
"Query"
|
|
46400
46470
|
);
|
|
46401
46471
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
46402
|
-
|
|
46472
|
+
watcher.add((queryResult.Items || []).length);
|
|
46473
|
+
for (const row of queryResult.Items || []) {
|
|
46474
|
+
scanned++;
|
|
46475
|
+
if (!matchesAllFilters(extractCleanRecord(row), parsedFilters)) {
|
|
46476
|
+
continue;
|
|
46477
|
+
}
|
|
46478
|
+
if (page.length >= perPage) {
|
|
46479
|
+
hasNextPage = true;
|
|
46480
|
+
break scan;
|
|
46481
|
+
}
|
|
46482
|
+
page.push(extractCleanRecord(row));
|
|
46483
|
+
lastReturned = { PK: row.PK, SK: row.SK };
|
|
46484
|
+
}
|
|
46403
46485
|
const nextKey = queryResult.LastEvaluatedKey;
|
|
46404
|
-
|
|
46405
|
-
|
|
46406
|
-
|
|
46486
|
+
if (!nextKey) {
|
|
46487
|
+
break;
|
|
46488
|
+
}
|
|
46489
|
+
const nextKeySignature = `${nextKey.PK}#${nextKey.SK}`;
|
|
46490
|
+
if (nextKeySignature === previousKeySignature) {
|
|
46491
|
+
logger5.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
46407
46492
|
requestId,
|
|
46408
46493
|
resource,
|
|
46409
46494
|
iterations
|
|
46410
46495
|
});
|
|
46411
|
-
|
|
46496
|
+
throw new AppError(
|
|
46497
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
46498
|
+
"ID scan received the same LastEvaluatedKey repeatedly",
|
|
46499
|
+
500,
|
|
46500
|
+
{ resource, iterations }
|
|
46501
|
+
);
|
|
46412
46502
|
}
|
|
46413
46503
|
previousKeySignature = nextKeySignature;
|
|
46414
46504
|
exclusiveStartKey = nextKey;
|
|
46415
|
-
|
|
46416
|
-
|
|
46417
|
-
|
|
46418
|
-
|
|
46419
|
-
const hasNextPage = offset + perPage < items.length;
|
|
46420
|
-
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46421
|
-
logger4.info("ID full scan query succeeded", {
|
|
46505
|
+
chunkSize = Math.min(chunkSize * 2, SCAN_CHUNK_MAX);
|
|
46506
|
+
}
|
|
46507
|
+
const nextTokenValue = hasNextPage && lastReturned ? encodeNextToken(lastReturned.PK, lastReturned.SK) : void 0;
|
|
46508
|
+
logger5.info("ID filtered scan query succeeded", {
|
|
46422
46509
|
requestId,
|
|
46423
46510
|
resource,
|
|
46424
|
-
|
|
46425
|
-
offset,
|
|
46511
|
+
scanned,
|
|
46426
46512
|
returned: page.length,
|
|
46427
46513
|
hasNextPage
|
|
46428
46514
|
});
|
|
46429
46515
|
return {
|
|
46430
46516
|
items: page,
|
|
46431
|
-
pageInfo: { hasNextPage, hasPreviousPage:
|
|
46517
|
+
pageInfo: { hasNextPage, hasPreviousPage: !!nextToken },
|
|
46432
46518
|
...nextTokenValue && { nextToken: nextTokenValue },
|
|
46433
46519
|
consumedCapacity: costTracker.getAggregated()
|
|
46434
46520
|
};
|
|
46435
46521
|
}
|
|
46436
|
-
var import_lib_dynamodb2,
|
|
46522
|
+
var import_lib_dynamodb2, logger5, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
|
|
46437
46523
|
var init_idQuery = __esm({
|
|
46438
46524
|
"src/server/operations/find/idQuery.ts"() {
|
|
46439
46525
|
"use strict";
|
|
@@ -46442,8 +46528,9 @@ var init_idQuery = __esm({
|
|
|
46442
46528
|
init_cost_tracker();
|
|
46443
46529
|
init_dynamodb3();
|
|
46444
46530
|
init_pagination();
|
|
46531
|
+
init_scanWarning();
|
|
46445
46532
|
init_utils5();
|
|
46446
|
-
|
|
46533
|
+
logger5 = createLogger({
|
|
46447
46534
|
service: "id-query",
|
|
46448
46535
|
level: process.env.LOG_LEVEL || "info"
|
|
46449
46536
|
});
|
|
@@ -46451,13 +46538,16 @@ var init_idQuery = __esm({
|
|
|
46451
46538
|
__name(executeSpecificIdQuery, "executeSpecificIdQuery");
|
|
46452
46539
|
__name(executeInQuery, "executeInQuery");
|
|
46453
46540
|
__name(executeAllRecordsQuery, "executeAllRecordsQuery");
|
|
46541
|
+
SCAN_CHUNK_INITIAL = 100;
|
|
46542
|
+
SCAN_CHUNK_MAX = 1e3;
|
|
46543
|
+
SCAN_MAX_ITERATIONS = 1e4;
|
|
46454
46544
|
__name(executeAllRecordsQueryFullScan, "executeAllRecordsQueryFullScan");
|
|
46455
46545
|
}
|
|
46456
46546
|
});
|
|
46457
46547
|
|
|
46458
46548
|
// src/server/operations/find/nearQuery.ts
|
|
46459
46549
|
async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId) {
|
|
46460
|
-
|
|
46550
|
+
logger6.debug("Executing $near query", {
|
|
46461
46551
|
requestId,
|
|
46462
46552
|
resource,
|
|
46463
46553
|
fieldName,
|
|
@@ -46468,7 +46558,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46468
46558
|
const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
|
|
46469
46559
|
const dbClient2 = getDBClient();
|
|
46470
46560
|
const tableName = getTableName();
|
|
46471
|
-
|
|
46561
|
+
logger6.debug("Searching shadow records", {
|
|
46472
46562
|
requestId,
|
|
46473
46563
|
resource,
|
|
46474
46564
|
fieldName,
|
|
@@ -46493,7 +46583,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46493
46583
|
);
|
|
46494
46584
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
46495
46585
|
const shadowRecords = queryResult.Items || [];
|
|
46496
|
-
|
|
46586
|
+
logger6.debug("Shadow records found", {
|
|
46497
46587
|
requestId,
|
|
46498
46588
|
resource,
|
|
46499
46589
|
geohashPrefix,
|
|
@@ -46504,7 +46594,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46504
46594
|
const parts = sk.split("#id#");
|
|
46505
46595
|
return parts.length === 2 ? parts[1] : null;
|
|
46506
46596
|
}).filter((id) => id !== null);
|
|
46507
|
-
|
|
46597
|
+
logger6.debug("Main record IDs extracted", {
|
|
46508
46598
|
requestId,
|
|
46509
46599
|
resource,
|
|
46510
46600
|
geohashPrefix,
|
|
@@ -46538,14 +46628,14 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46538
46628
|
}
|
|
46539
46629
|
validRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
46540
46630
|
}
|
|
46541
|
-
|
|
46631
|
+
logger6.debug("Main records retrieved", {
|
|
46542
46632
|
requestId,
|
|
46543
46633
|
resource,
|
|
46544
46634
|
geohashPrefix,
|
|
46545
46635
|
count: validRecords.length
|
|
46546
46636
|
});
|
|
46547
46637
|
const cleanRecords = validRecords.map((record) => extractCleanRecord(record));
|
|
46548
|
-
|
|
46638
|
+
logger6.debug("Clean records extracted", {
|
|
46549
46639
|
requestId,
|
|
46550
46640
|
resource,
|
|
46551
46641
|
geohashPrefix,
|
|
@@ -46564,7 +46654,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46564
46654
|
config
|
|
46565
46655
|
);
|
|
46566
46656
|
const items = result.documents;
|
|
46567
|
-
|
|
46657
|
+
logger6.info("$near query succeeded", {
|
|
46568
46658
|
requestId,
|
|
46569
46659
|
resource,
|
|
46570
46660
|
fieldName,
|
|
@@ -46582,7 +46672,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46582
46672
|
consumedCapacity: costTracker.getAggregated()
|
|
46583
46673
|
};
|
|
46584
46674
|
}
|
|
46585
|
-
var import_lib_dynamodb3,
|
|
46675
|
+
var import_lib_dynamodb3, logger6;
|
|
46586
46676
|
var init_nearQuery = __esm({
|
|
46587
46677
|
"src/server/operations/find/nearQuery.ts"() {
|
|
46588
46678
|
"use strict";
|
|
@@ -46592,7 +46682,7 @@ var init_nearQuery = __esm({
|
|
|
46592
46682
|
init_nearSearch();
|
|
46593
46683
|
init_cost_tracker();
|
|
46594
46684
|
init_dynamodb3();
|
|
46595
|
-
|
|
46685
|
+
logger6 = createLogger({
|
|
46596
46686
|
service: "near-query",
|
|
46597
46687
|
level: process.env.LOG_LEVEL || "info"
|
|
46598
46688
|
});
|
|
@@ -46622,7 +46712,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46622
46712
|
(f4) => !(isKeyConditionOptimized && f4 === optimizableFilter)
|
|
46623
46713
|
);
|
|
46624
46714
|
if (residualFilters.length > 0) {
|
|
46625
|
-
|
|
46715
|
+
logger7.debug("Residual filters detected, falling back to full scan", {
|
|
46626
46716
|
requestId,
|
|
46627
46717
|
resource,
|
|
46628
46718
|
sortField: sort.field,
|
|
@@ -46630,7 +46720,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46630
46720
|
});
|
|
46631
46721
|
return executeFullScanQuery(resource, normalizedParams, costTracker, requestId);
|
|
46632
46722
|
}
|
|
46633
|
-
|
|
46723
|
+
logger7.debug("Executing shadow query", {
|
|
46634
46724
|
requestId,
|
|
46635
46725
|
resource,
|
|
46636
46726
|
sortField: sort.field,
|
|
@@ -46678,7 +46768,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46678
46768
|
shadowRecords.LastEvaluatedKey.PK,
|
|
46679
46769
|
shadowRecords.LastEvaluatedKey.SK
|
|
46680
46770
|
) : void 0;
|
|
46681
|
-
|
|
46771
|
+
logger7.info("Shadow query succeeded", {
|
|
46682
46772
|
requestId,
|
|
46683
46773
|
resource,
|
|
46684
46774
|
sortField: sort.field,
|
|
@@ -46703,7 +46793,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46703
46793
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
46704
46794
|
const filterSort = { field: filterCandidate.parsed.field, order: "ASC" };
|
|
46705
46795
|
const remainingFilters = parsedFilters.filter((f4) => f4 !== filterCandidate);
|
|
46706
|
-
|
|
46796
|
+
logger7.debug("Executing filter-first query", {
|
|
46707
46797
|
requestId,
|
|
46708
46798
|
resource,
|
|
46709
46799
|
filterField: filterCandidate.parsed.field,
|
|
@@ -46715,7 +46805,9 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46715
46805
|
filterSort,
|
|
46716
46806
|
filterCandidate,
|
|
46717
46807
|
costTracker,
|
|
46718
|
-
requestId
|
|
46808
|
+
requestId,
|
|
46809
|
+
"shadow-filter-first",
|
|
46810
|
+
parsedFilters
|
|
46719
46811
|
);
|
|
46720
46812
|
if (remainingFilters.length > 0) {
|
|
46721
46813
|
items = items.filter((r4) => matchesAllFilters(r4, remainingFilters));
|
|
@@ -46724,7 +46816,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46724
46816
|
const page = items.slice(offset, offset + perPage);
|
|
46725
46817
|
const hasNextPage = offset + perPage < items.length;
|
|
46726
46818
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46727
|
-
|
|
46819
|
+
logger7.info("Filter-first query succeeded", {
|
|
46728
46820
|
requestId,
|
|
46729
46821
|
resource,
|
|
46730
46822
|
filterField: filterCandidate.parsed.field,
|
|
@@ -46745,20 +46837,28 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
46745
46837
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
46746
46838
|
const { perPage, nextToken } = pagination;
|
|
46747
46839
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
46748
|
-
|
|
46840
|
+
logger7.debug("Executing full scan query", {
|
|
46749
46841
|
requestId,
|
|
46750
46842
|
resource,
|
|
46751
46843
|
sortField: sort.field,
|
|
46752
46844
|
offset
|
|
46753
46845
|
});
|
|
46754
|
-
let items = await fetchAllRecordsViaShadowIndex(
|
|
46846
|
+
let items = await fetchAllRecordsViaShadowIndex(
|
|
46847
|
+
resource,
|
|
46848
|
+
sort,
|
|
46849
|
+
void 0,
|
|
46850
|
+
costTracker,
|
|
46851
|
+
requestId,
|
|
46852
|
+
"shadow-full-scan",
|
|
46853
|
+
parsedFilters
|
|
46854
|
+
);
|
|
46755
46855
|
if (parsedFilters.length > 0) {
|
|
46756
46856
|
items = items.filter((r4) => matchesAllFilters(r4, parsedFilters));
|
|
46757
46857
|
}
|
|
46758
46858
|
const page = items.slice(offset, offset + perPage);
|
|
46759
46859
|
const hasNextPage = offset + perPage < items.length;
|
|
46760
46860
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46761
|
-
|
|
46861
|
+
logger7.info("Full scan query succeeded", {
|
|
46762
46862
|
requestId,
|
|
46763
46863
|
resource,
|
|
46764
46864
|
sortField: sort.field,
|
|
@@ -46774,20 +46874,35 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
46774
46874
|
consumedCapacity: costTracker.getAggregated()
|
|
46775
46875
|
};
|
|
46776
46876
|
}
|
|
46777
|
-
async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId) {
|
|
46877
|
+
async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId, scanPath, parsedFilters) {
|
|
46778
46878
|
const allShadowItems = [];
|
|
46879
|
+
const watcher = new ScanWatcher({
|
|
46880
|
+
requestId,
|
|
46881
|
+
resource,
|
|
46882
|
+
path: scanPath,
|
|
46883
|
+
sortField: indexSort.field,
|
|
46884
|
+
filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
|
|
46885
|
+
});
|
|
46779
46886
|
let lastKey;
|
|
46780
46887
|
let previousKeySignature;
|
|
46781
46888
|
const MAX_ITERATIONS = 1e4;
|
|
46782
46889
|
let iterations = 0;
|
|
46783
46890
|
do {
|
|
46784
46891
|
if (++iterations > MAX_ITERATIONS) {
|
|
46785
|
-
|
|
46892
|
+
logger7.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
46786
46893
|
requestId,
|
|
46787
46894
|
resource,
|
|
46788
46895
|
iterations
|
|
46789
46896
|
});
|
|
46790
|
-
|
|
46897
|
+
throw new AppError(
|
|
46898
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
46899
|
+
"Shadow index scan exceeded the iteration limit",
|
|
46900
|
+
500,
|
|
46901
|
+
{
|
|
46902
|
+
resource,
|
|
46903
|
+
iterations
|
|
46904
|
+
}
|
|
46905
|
+
);
|
|
46791
46906
|
}
|
|
46792
46907
|
const result = await executeShadowRecordQuery(
|
|
46793
46908
|
resource,
|
|
@@ -46800,15 +46915,21 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
46800
46915
|
requestId
|
|
46801
46916
|
);
|
|
46802
46917
|
allShadowItems.push(...result.Items || []);
|
|
46918
|
+
watcher.add((result.Items || []).length);
|
|
46803
46919
|
const nextKey = result.LastEvaluatedKey;
|
|
46804
46920
|
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
46805
46921
|
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
46806
|
-
|
|
46922
|
+
logger7.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
46807
46923
|
requestId,
|
|
46808
46924
|
resource,
|
|
46809
46925
|
iterations
|
|
46810
46926
|
});
|
|
46811
|
-
|
|
46927
|
+
throw new AppError(
|
|
46928
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
46929
|
+
"Shadow index scan received the same LastEvaluatedKey repeatedly",
|
|
46930
|
+
500,
|
|
46931
|
+
{ resource, iterations }
|
|
46932
|
+
);
|
|
46812
46933
|
}
|
|
46813
46934
|
previousKeySignature = nextKeySignature;
|
|
46814
46935
|
lastKey = nextKey;
|
|
@@ -47014,7 +47135,7 @@ async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
|
47014
47135
|
}
|
|
47015
47136
|
allRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
47016
47137
|
}
|
|
47017
|
-
|
|
47138
|
+
logger7.debug("Main records fetched", {
|
|
47018
47139
|
requestId,
|
|
47019
47140
|
resource,
|
|
47020
47141
|
requestedCount: uniqueRecordIds.length,
|
|
@@ -47022,7 +47143,7 @@ async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
|
47022
47143
|
});
|
|
47023
47144
|
return allRecords;
|
|
47024
47145
|
}
|
|
47025
|
-
var import_lib_dynamodb4,
|
|
47146
|
+
var import_lib_dynamodb4, logger7, KEY_CONDITION_OPERATORS;
|
|
47026
47147
|
var init_shadowQuery = __esm({
|
|
47027
47148
|
"src/server/operations/find/shadowQuery.ts"() {
|
|
47028
47149
|
"use strict";
|
|
@@ -47032,8 +47153,9 @@ var init_shadowQuery = __esm({
|
|
|
47032
47153
|
init_cost_tracker();
|
|
47033
47154
|
init_dynamodb3();
|
|
47034
47155
|
init_pagination();
|
|
47156
|
+
init_scanWarning();
|
|
47035
47157
|
init_utils5();
|
|
47036
|
-
|
|
47158
|
+
logger7 = createLogger({
|
|
47037
47159
|
service: "shadow-query",
|
|
47038
47160
|
level: process.env.LOG_LEVEL || "info"
|
|
47039
47161
|
});
|
|
@@ -47054,14 +47176,14 @@ var init_shadowQuery = __esm({
|
|
|
47054
47176
|
|
|
47055
47177
|
// src/server/operations/find/handler.ts
|
|
47056
47178
|
async function handleFind(resource, params, requestId) {
|
|
47057
|
-
|
|
47179
|
+
logger8.debug("Executing find", {
|
|
47058
47180
|
requestId,
|
|
47059
47181
|
resource,
|
|
47060
47182
|
params
|
|
47061
47183
|
});
|
|
47062
47184
|
const nearDetection = detectNearQuery(params.filter);
|
|
47063
47185
|
if (nearDetection) {
|
|
47064
|
-
|
|
47186
|
+
logger8.debug("$near operator detected, executing near search", {
|
|
47065
47187
|
requestId,
|
|
47066
47188
|
resource,
|
|
47067
47189
|
fieldName: nearDetection.fieldName
|
|
@@ -47078,7 +47200,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
47078
47200
|
const config = initializeFindConfig();
|
|
47079
47201
|
const normalizedParams = normalizeFindParams(config, resource, params);
|
|
47080
47202
|
validateSortField(config, resource, normalizedParams.sort);
|
|
47081
|
-
|
|
47203
|
+
logger8.debug("Find parameters normalized", {
|
|
47082
47204
|
requestId,
|
|
47083
47205
|
resource,
|
|
47084
47206
|
sort: normalizedParams.sort,
|
|
@@ -47093,7 +47215,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
47093
47215
|
}
|
|
47094
47216
|
return executeShadowQuery(resource, normalizedParams, requestId);
|
|
47095
47217
|
}
|
|
47096
|
-
var
|
|
47218
|
+
var logger8;
|
|
47097
47219
|
var init_handler = __esm({
|
|
47098
47220
|
"src/server/operations/find/handler.ts"() {
|
|
47099
47221
|
"use strict";
|
|
@@ -47103,7 +47225,7 @@ var init_handler = __esm({
|
|
|
47103
47225
|
init_nearQuery();
|
|
47104
47226
|
init_shadowQuery();
|
|
47105
47227
|
init_utils5();
|
|
47106
|
-
|
|
47228
|
+
logger8 = createLogger({
|
|
47107
47229
|
service: "find-handler",
|
|
47108
47230
|
level: process.env.LOG_LEVEL || "info"
|
|
47109
47231
|
});
|
|
@@ -47126,7 +47248,7 @@ var init_find = __esm({
|
|
|
47126
47248
|
// src/server/utils/bulkOperations.ts
|
|
47127
47249
|
function logLargeBatchWarning(operation2, recordCount, requestId, resource) {
|
|
47128
47250
|
if (recordCount > LARGE_BATCH_WARNING_THRESHOLD) {
|
|
47129
|
-
|
|
47251
|
+
logger10.warn(`Large batch ${operation2} operation detected`, {
|
|
47130
47252
|
requestId,
|
|
47131
47253
|
resource,
|
|
47132
47254
|
recordCount,
|
|
@@ -47149,7 +47271,7 @@ function calculateTimeoutRisk(startTime) {
|
|
|
47149
47271
|
};
|
|
47150
47272
|
}
|
|
47151
47273
|
function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount, riskInfo) {
|
|
47152
|
-
|
|
47274
|
+
logger10.info("Records prepared for chunk execution", {
|
|
47153
47275
|
requestId,
|
|
47154
47276
|
resource,
|
|
47155
47277
|
totalRecords,
|
|
@@ -47159,7 +47281,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
47159
47281
|
timeoutRisk: riskInfo.risk
|
|
47160
47282
|
});
|
|
47161
47283
|
if (riskInfo.risk === "high") {
|
|
47162
|
-
|
|
47284
|
+
logger10.warn("High timeout risk detected during preparation phase", {
|
|
47163
47285
|
requestId,
|
|
47164
47286
|
resource,
|
|
47165
47287
|
preparationElapsedMs: riskInfo.elapsedMs,
|
|
@@ -47171,7 +47293,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
47171
47293
|
}
|
|
47172
47294
|
function logBulkOperationComplete(operation2, requestId, resource, requested, succeeded, failed, riskInfo, additionalInfo) {
|
|
47173
47295
|
const totalElapsedSeconds = Math.round(riskInfo.elapsedMs / 1e3);
|
|
47174
|
-
|
|
47296
|
+
logger10.info(`${operation2} completed`, {
|
|
47175
47297
|
requestId,
|
|
47176
47298
|
resource,
|
|
47177
47299
|
requested,
|
|
@@ -47186,7 +47308,7 @@ function logBulkOperationComplete(operation2, requestId, resource, requested, su
|
|
|
47186
47308
|
}
|
|
47187
47309
|
function logPartialFailure(operation2, requestId, resource, requested, succeeded, failed, errorCodes, additionalInfo) {
|
|
47188
47310
|
const failureRate = Math.round(failed / requested * 100);
|
|
47189
|
-
|
|
47311
|
+
logger10.warn(`Partial failure in ${operation2} operation`, {
|
|
47190
47312
|
requestId,
|
|
47191
47313
|
resource,
|
|
47192
47314
|
totalRequested: requested,
|
|
@@ -47197,12 +47319,12 @@ function logPartialFailure(operation2, requestId, resource, requested, succeeded
|
|
|
47197
47319
|
...additionalInfo
|
|
47198
47320
|
});
|
|
47199
47321
|
}
|
|
47200
|
-
var
|
|
47322
|
+
var logger10;
|
|
47201
47323
|
var init_bulkOperations = __esm({
|
|
47202
47324
|
"src/server/utils/bulkOperations.ts"() {
|
|
47203
47325
|
"use strict";
|
|
47204
47326
|
init_shared();
|
|
47205
|
-
|
|
47327
|
+
logger10 = createLogger({ service: "records-lambda" });
|
|
47206
47328
|
__name(logLargeBatchWarning, "logLargeBatchWarning");
|
|
47207
47329
|
__name(calculateTimeoutRisk, "calculateTimeoutRisk");
|
|
47208
47330
|
__name(logPreparationTimeoutRisk, "logPreparationTimeoutRisk");
|
|
@@ -47221,7 +47343,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
47221
47343
|
const itemCount = getItemCount(record);
|
|
47222
47344
|
if (itemCount > DYNAMODB_TRANSACT_WRITE_MAX_ITEMS) {
|
|
47223
47345
|
const errorMsg = `Single record exceeds ${DYNAMODB_TRANSACT_WRITE_MAX_ITEMS} items limit: ${itemCount} items`;
|
|
47224
|
-
|
|
47346
|
+
logger11.error("Chunk validation failed", {
|
|
47225
47347
|
itemCount,
|
|
47226
47348
|
limit: DYNAMODB_TRANSACT_WRITE_MAX_ITEMS
|
|
47227
47349
|
});
|
|
@@ -47243,7 +47365,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
47243
47365
|
chunks.push(currentChunk);
|
|
47244
47366
|
itemCounts.push(currentItemCount);
|
|
47245
47367
|
}
|
|
47246
|
-
|
|
47368
|
+
logger11.info("Chunk calculation completed", {
|
|
47247
47369
|
totalRecords: records.length,
|
|
47248
47370
|
chunkCount: chunks.length,
|
|
47249
47371
|
itemCounts,
|
|
@@ -47259,7 +47381,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47259
47381
|
const errors = [];
|
|
47260
47382
|
const totalRecords = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
47261
47383
|
const executionStartTime = Date.now();
|
|
47262
|
-
|
|
47384
|
+
logger11.info("Starting chunk execution", {
|
|
47263
47385
|
totalChunks: chunks.length,
|
|
47264
47386
|
totalRecords
|
|
47265
47387
|
});
|
|
@@ -47267,14 +47389,14 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47267
47389
|
const chunk = chunks[i4];
|
|
47268
47390
|
const chunkStartTime = Date.now();
|
|
47269
47391
|
try {
|
|
47270
|
-
|
|
47392
|
+
logger11.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
|
|
47271
47393
|
chunkIndex: i4,
|
|
47272
47394
|
recordCount: chunk.length
|
|
47273
47395
|
});
|
|
47274
47396
|
const successfulRecords = await executeChunk(chunk);
|
|
47275
47397
|
successRecords.push(...successfulRecords);
|
|
47276
47398
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
47277
|
-
|
|
47399
|
+
logger11.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
|
|
47278
47400
|
chunkIndex: i4,
|
|
47279
47401
|
recordCount: chunk.length,
|
|
47280
47402
|
durationMs: chunkDuration
|
|
@@ -47283,7 +47405,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47283
47405
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
47284
47406
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
|
|
47285
47407
|
const errorCode = getErrorCode(error2);
|
|
47286
|
-
|
|
47408
|
+
logger11.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
|
|
47287
47409
|
chunkIndex: i4,
|
|
47288
47410
|
recordCount: chunk.length,
|
|
47289
47411
|
durationMs: chunkDuration,
|
|
@@ -47302,7 +47424,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47302
47424
|
}
|
|
47303
47425
|
}
|
|
47304
47426
|
const totalExecutionTime = Date.now() - executionStartTime;
|
|
47305
|
-
|
|
47427
|
+
logger11.info("Chunk execution completed", {
|
|
47306
47428
|
totalChunks: chunks.length,
|
|
47307
47429
|
totalRecords,
|
|
47308
47430
|
successCount: successRecords.length,
|
|
@@ -47311,7 +47433,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47311
47433
|
avgTimePerChunkMs: chunks.length > 0 ? Math.round(totalExecutionTime / chunks.length) : 0
|
|
47312
47434
|
});
|
|
47313
47435
|
if (failedIds.length > 0) {
|
|
47314
|
-
|
|
47436
|
+
logger11.warn("Partial failure detected in chunk execution", {
|
|
47315
47437
|
totalRecords,
|
|
47316
47438
|
successCount: successRecords.length,
|
|
47317
47439
|
failedCount: failedIds.length,
|
|
@@ -47343,12 +47465,12 @@ function getErrorCode(error2) {
|
|
|
47343
47465
|
}
|
|
47344
47466
|
return "TRANSACTION_FAILED";
|
|
47345
47467
|
}
|
|
47346
|
-
var
|
|
47468
|
+
var logger11;
|
|
47347
47469
|
var init_chunking = __esm({
|
|
47348
47470
|
"src/server/utils/chunking.ts"() {
|
|
47349
47471
|
"use strict";
|
|
47350
47472
|
init_shared();
|
|
47351
|
-
|
|
47473
|
+
logger11 = createLogger({ service: "records-lambda" });
|
|
47352
47474
|
__name(calculateChunks, "calculateChunks");
|
|
47353
47475
|
__name(executeChunks, "executeChunks");
|
|
47354
47476
|
__name(getErrorCode, "getErrorCode");
|
|
@@ -47519,7 +47641,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47519
47641
|
const upsert = options?.upsert ?? false;
|
|
47520
47642
|
const startTime = Date.now();
|
|
47521
47643
|
const costTracker = new CostTracker();
|
|
47522
|
-
|
|
47644
|
+
logger12.debug("Executing updateMany", {
|
|
47523
47645
|
requestId,
|
|
47524
47646
|
resource,
|
|
47525
47647
|
upsert
|
|
@@ -47527,13 +47649,13 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47527
47649
|
let ids;
|
|
47528
47650
|
if ("ids" in params) {
|
|
47529
47651
|
ids = params.ids;
|
|
47530
|
-
|
|
47652
|
+
logger12.debug("Executing updateMany with ids", {
|
|
47531
47653
|
requestId,
|
|
47532
47654
|
resource,
|
|
47533
47655
|
count: ids.length
|
|
47534
47656
|
});
|
|
47535
47657
|
} else {
|
|
47536
|
-
|
|
47658
|
+
logger12.debug("Executing updateMany with filter", {
|
|
47537
47659
|
requestId,
|
|
47538
47660
|
resource,
|
|
47539
47661
|
filter: params.filter
|
|
@@ -47541,7 +47663,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47541
47663
|
const { handleFind: handleFind2 } = await Promise.resolve().then(() => (init_find(), find_exports));
|
|
47542
47664
|
const findResult = await handleFind2(resource, { filter: params.filter }, requestId);
|
|
47543
47665
|
ids = findResult.items.map((item) => item.id);
|
|
47544
|
-
|
|
47666
|
+
logger12.debug("Found records with filter", {
|
|
47545
47667
|
requestId,
|
|
47546
47668
|
resource,
|
|
47547
47669
|
count: ids.length
|
|
@@ -47550,7 +47672,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47550
47672
|
if (upsert) {
|
|
47551
47673
|
const newId = ulid2();
|
|
47552
47674
|
ids = [newId];
|
|
47553
|
-
|
|
47675
|
+
logger12.info("Creating new record with filter (upsert: true)", {
|
|
47554
47676
|
requestId,
|
|
47555
47677
|
resource,
|
|
47556
47678
|
newId,
|
|
@@ -47614,7 +47736,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47614
47736
|
);
|
|
47615
47737
|
const notFoundIds = ids.filter((id) => !existingIds.has(id));
|
|
47616
47738
|
if (!upsert && notFoundIds.length > 0) {
|
|
47617
|
-
|
|
47739
|
+
logger12.warn("Records not found (upsert: false)", {
|
|
47618
47740
|
requestId,
|
|
47619
47741
|
resource,
|
|
47620
47742
|
notFoundCount: notFoundIds.length,
|
|
@@ -47623,7 +47745,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47623
47745
|
});
|
|
47624
47746
|
}
|
|
47625
47747
|
if (upsert && notFoundIds.length > 0) {
|
|
47626
|
-
|
|
47748
|
+
logger12.info("Creating new records (upsert: true)", {
|
|
47627
47749
|
requestId,
|
|
47628
47750
|
resource,
|
|
47629
47751
|
notFoundCount: notFoundIds.length,
|
|
@@ -47659,7 +47781,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47659
47781
|
const failedId = existingData.id || "unknown-id";
|
|
47660
47782
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
47661
47783
|
const errorCode = getPreparationErrorCode(error2);
|
|
47662
|
-
|
|
47784
|
+
logger12.error("Failed to prepare record for update", {
|
|
47663
47785
|
requestId,
|
|
47664
47786
|
recordId: failedId,
|
|
47665
47787
|
error: errorMessage,
|
|
@@ -47699,7 +47821,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47699
47821
|
} catch (error2) {
|
|
47700
47822
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
47701
47823
|
const errorCode = getPreparationErrorCode(error2);
|
|
47702
|
-
|
|
47824
|
+
logger12.error("Failed to prepare new record for upsert", {
|
|
47703
47825
|
requestId,
|
|
47704
47826
|
recordId: id,
|
|
47705
47827
|
error: errorMessage,
|
|
@@ -47912,7 +48034,7 @@ function getPreparationErrorCode(error2) {
|
|
|
47912
48034
|
}
|
|
47913
48035
|
return "VALIDATION_ERROR" /* VALIDATION_ERROR */;
|
|
47914
48036
|
}
|
|
47915
|
-
var import_lib_dynamodb6,
|
|
48037
|
+
var import_lib_dynamodb6, logger12;
|
|
47916
48038
|
var init_updateMany = __esm({
|
|
47917
48039
|
"src/server/operations/updateMany.ts"() {
|
|
47918
48040
|
"use strict";
|
|
@@ -47926,7 +48048,7 @@ var init_updateMany = __esm({
|
|
|
47926
48048
|
init_dynamodb3();
|
|
47927
48049
|
init_mergePatch();
|
|
47928
48050
|
init_timestamps();
|
|
47929
|
-
|
|
48051
|
+
logger12 = createLogger({ service: "records-lambda" });
|
|
47930
48052
|
__name(handleUpdateMany, "handleUpdateMany");
|
|
47931
48053
|
__name(getPreparationErrorCode, "getPreparationErrorCode");
|
|
47932
48054
|
}
|
|
@@ -47969,11 +48091,11 @@ init_shared();
|
|
|
47969
48091
|
init_shadow();
|
|
47970
48092
|
init_dynamodb3();
|
|
47971
48093
|
init_find();
|
|
47972
|
-
var
|
|
48094
|
+
var logger9 = createLogger({ service: "records-lambda" });
|
|
47973
48095
|
async function handleFindMany(resource, params, requestId) {
|
|
47974
48096
|
if ("ids" in params) {
|
|
47975
48097
|
const { ids } = params;
|
|
47976
|
-
|
|
48098
|
+
logger9.debug("Executing findMany by ids", {
|
|
47977
48099
|
requestId,
|
|
47978
48100
|
resource,
|
|
47979
48101
|
count: ids.length
|
|
@@ -48002,7 +48124,7 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48002
48124
|
);
|
|
48003
48125
|
const items = result.Responses?.[tableName] || [];
|
|
48004
48126
|
const records = items.map((item) => extractCleanRecord(item));
|
|
48005
|
-
|
|
48127
|
+
logger9.info("findMany by ids succeeded", {
|
|
48006
48128
|
requestId,
|
|
48007
48129
|
resource,
|
|
48008
48130
|
requested: ids.length,
|
|
@@ -48012,7 +48134,7 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48012
48134
|
}
|
|
48013
48135
|
if ("filter" in params) {
|
|
48014
48136
|
const { filter } = params;
|
|
48015
|
-
|
|
48137
|
+
logger9.debug("Executing findMany by filter", {
|
|
48016
48138
|
requestId,
|
|
48017
48139
|
resource,
|
|
48018
48140
|
filter
|
|
@@ -48024,7 +48146,7 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48024
48146
|
},
|
|
48025
48147
|
requestId
|
|
48026
48148
|
);
|
|
48027
|
-
|
|
48149
|
+
logger9.info("findMany by filter succeeded", {
|
|
48028
48150
|
requestId,
|
|
48029
48151
|
resource,
|
|
48030
48152
|
filter,
|
|
@@ -48038,13 +48160,13 @@ __name(handleFindMany, "handleFindMany");
|
|
|
48038
48160
|
|
|
48039
48161
|
// src/server/operations/updateOne.ts
|
|
48040
48162
|
init_shared();
|
|
48041
|
-
var
|
|
48163
|
+
var logger13 = createLogger({ service: "records-lambda" });
|
|
48042
48164
|
async function handleUpdateOne(resource, params, requestId) {
|
|
48043
48165
|
const { data: patchData, options } = params;
|
|
48044
48166
|
const { handleUpdateMany: handleUpdateMany2 } = await Promise.resolve().then(() => (init_updateMany(), updateMany_exports));
|
|
48045
48167
|
if ("id" in params) {
|
|
48046
48168
|
const targetId = params.id;
|
|
48047
|
-
|
|
48169
|
+
logger13.debug("Executing updateOne with id", {
|
|
48048
48170
|
requestId,
|
|
48049
48171
|
resource,
|
|
48050
48172
|
id: targetId,
|
|
@@ -48086,7 +48208,7 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
48086
48208
|
consumedCapacity: updateManyResult.consumedCapacity
|
|
48087
48209
|
};
|
|
48088
48210
|
} else {
|
|
48089
|
-
|
|
48211
|
+
logger13.debug("Executing updateOne with filter", {
|
|
48090
48212
|
requestId,
|
|
48091
48213
|
resource,
|
|
48092
48214
|
filter: params.filter,
|
|
@@ -48136,7 +48258,7 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
48136
48258
|
__name(handleUpdateOne, "handleUpdateOne");
|
|
48137
48259
|
|
|
48138
48260
|
// src/server/media/process-handler-dlq.ts
|
|
48139
|
-
var
|
|
48261
|
+
var logger14 = createLogger({ service: "media-process-handler-dlq" });
|
|
48140
48262
|
var s3Client = new import_client_s3.S3Client({ region: process.env.AWS_REGION });
|
|
48141
48263
|
function extractS3Ref(envelope) {
|
|
48142
48264
|
const record = envelope.requestPayload?.Records?.[0];
|
|
@@ -48152,12 +48274,12 @@ async function processMessage(body) {
|
|
|
48152
48274
|
try {
|
|
48153
48275
|
envelope = JSON.parse(body);
|
|
48154
48276
|
} catch {
|
|
48155
|
-
|
|
48277
|
+
logger14.error("DLQ message is not valid JSON", { body });
|
|
48156
48278
|
return;
|
|
48157
48279
|
}
|
|
48158
48280
|
const ref = extractS3Ref(envelope);
|
|
48159
48281
|
if (!ref) {
|
|
48160
|
-
|
|
48282
|
+
logger14.error("Could not extract S3 reference from DLQ message", { envelope });
|
|
48161
48283
|
return;
|
|
48162
48284
|
}
|
|
48163
48285
|
const { bucket, key, fileId } = ref;
|
|
@@ -48165,7 +48287,7 @@ async function processMessage(body) {
|
|
|
48165
48287
|
const existing = await handleFindMany("media", { ids: [fileId] }, requestId);
|
|
48166
48288
|
const existingRecord = existing[0];
|
|
48167
48289
|
if (existingRecord?.status === "completed") {
|
|
48168
|
-
|
|
48290
|
+
logger14.info("Media already completed, skipping DLQ failure write", { requestId, fileId });
|
|
48169
48291
|
return;
|
|
48170
48292
|
}
|
|
48171
48293
|
let appMetadata = {};
|
|
@@ -48176,7 +48298,7 @@ async function processMessage(body) {
|
|
|
48176
48298
|
appMetadata = extractAppMetadata(metadata);
|
|
48177
48299
|
originalFilename = decodeOriginalFilename(metadata["original-filename"]);
|
|
48178
48300
|
} catch (error2) {
|
|
48179
|
-
|
|
48301
|
+
logger14.warn("Failed to re-fetch metadata for DLQ failure record", {
|
|
48180
48302
|
requestId,
|
|
48181
48303
|
fileId,
|
|
48182
48304
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
@@ -48201,7 +48323,7 @@ async function processMessage(body) {
|
|
|
48201
48323
|
},
|
|
48202
48324
|
requestId
|
|
48203
48325
|
);
|
|
48204
|
-
|
|
48326
|
+
logger14.warn("Media marked as failed via DLQ", { requestId, fileId });
|
|
48205
48327
|
}
|
|
48206
48328
|
__name(processMessage, "processMessage");
|
|
48207
48329
|
var handler = /* @__PURE__ */ __name(async (event) => {
|