@exabugs/dynamodb-client 1.8.0 → 1.10.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 +36 -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 +61 -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/server/handler.cjs +683 -499
- package/dist/server/handler.cjs.map +4 -4
- package/dist/server/media-handler.cjs +2 -2
- package/dist/server/media-process-handler-dlq.cjs +544 -344
- package/dist/server/media-process-handler-dlq.cjs.map +4 -4
- package/dist/server/media-process-handler.cjs +543 -343
- package/dist/server/media-process-handler.cjs.map +4 -4
- package/dist/server/operations/deleteMany.d.ts.map +1 -1
- package/dist/server/operations/deleteMany.js +15 -30
- package/dist/server/operations/deleteMany.js.map +1 -1
- package/dist/server/operations/deleteOne.d.ts.map +1 -1
- package/dist/server/operations/deleteOne.js +7 -4
- package/dist/server/operations/deleteOne.js.map +1 -1
- package/dist/server/operations/find/idQuery.d.ts.map +1 -1
- package/dist/server/operations/find/idQuery.js +23 -9
- package/dist/server/operations/find/idQuery.js.map +1 -1
- package/dist/server/operations/find/nearQuery.d.ts.map +1 -1
- package/dist/server/operations/find/nearQuery.js +41 -40
- package/dist/server/operations/find/nearQuery.js.map +1 -1
- package/dist/server/operations/find/shadowQuery.d.ts +7 -0
- package/dist/server/operations/find/shadowQuery.d.ts.map +1 -1
- package/dist/server/operations/find/shadowQuery.js +34 -42
- package/dist/server/operations/find/shadowQuery.js.map +1 -1
- package/dist/server/operations/findAll.d.ts +8 -0
- package/dist/server/operations/findAll.d.ts.map +1 -0
- package/dist/server/operations/findAll.js +46 -0
- package/dist/server/operations/findAll.js.map +1 -0
- package/dist/server/operations/findMany.d.ts.map +1 -1
- package/dist/server/operations/findMany.js +9 -26
- package/dist/server/operations/findMany.js.map +1 -1
- package/dist/server/operations/findManyReference.d.ts.map +1 -1
- package/dist/server/operations/findManyReference.js +4 -14
- package/dist/server/operations/findManyReference.js.map +1 -1
- package/dist/server/operations/parameterConverter.d.ts.map +1 -1
- package/dist/server/operations/parameterConverter.js +16 -8
- package/dist/server/operations/parameterConverter.js.map +1 -1
- package/dist/server/operations/updateMany.d.ts.map +1 -1
- package/dist/server/operations/updateMany.js +15 -30
- package/dist/server/operations/updateMany.js.map +1 -1
- package/dist/server/operations/updateOne.d.ts.map +1 -1
- package/dist/server/operations/updateOne.js +8 -6
- package/dist/server/operations/updateOne.js.map +1 -1
- package/dist/server/utils/batchGet.d.ts +21 -0
- package/dist/server/utils/batchGet.d.ts.map +1 -0
- package/dist/server/utils/batchGet.js +73 -0
- package/dist/server/utils/batchGet.js.map +1 -0
- 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/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/index.js.map +1 -1
- package/dist/shared/utils/scanSort.d.ts +16 -0
- package/dist/shared/utils/scanSort.d.ts.map +1 -0
- package/dist/shared/utils/scanSort.js +33 -0
- package/dist/shared/utils/scanSort.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-11T23:
|
|
1
|
+
// @exabugs/dynamodb-client v1.10.0
|
|
2
|
+
// Built: 2026-10-11T23:48:57.909Z
|
|
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 logger16;
|
|
2045
2045
|
let tryNextLink = true;
|
|
2046
2046
|
if (typeof options === "boolean") {
|
|
2047
|
-
|
|
2047
|
+
logger16 = void 0;
|
|
2048
2048
|
tryNextLink = options;
|
|
2049
2049
|
} else if (options != null && typeof options === "object") {
|
|
2050
|
-
|
|
2050
|
+
logger16 = 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
|
+
logger16?.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: logger16 } = configuration;
|
|
2490
|
+
const envOptions = { signingName, logger: logger16 };
|
|
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, logger16) {
|
|
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
|
+
logger16?.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, logger16) {
|
|
4212
4212
|
if (isReadableStream(upstream)) {
|
|
4213
|
-
return createBufferedReadableStream(upstream, size,
|
|
4213
|
+
return createBufferedReadableStream(upstream, size, logger16);
|
|
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
|
+
logger16?.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 logger16;
|
|
8285
8285
|
let tryNextLink = true;
|
|
8286
8286
|
if (typeof options === "boolean") {
|
|
8287
|
-
|
|
8287
|
+
logger16 = void 0;
|
|
8288
8288
|
tryNextLink = options;
|
|
8289
8289
|
} else if (options != null && typeof options === "object") {
|
|
8290
|
-
|
|
8290
|
+
logger16 = 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
|
+
logger16?.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: logger16 } = configuration;
|
|
11110
11110
|
const handlerExecutionContext = {
|
|
11111
|
-
logger:
|
|
11111
|
+
logger: logger16,
|
|
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, logger16) {
|
|
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
|
+
logger16?.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, logger16) {
|
|
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, logger16);
|
|
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
|
+
logger16?.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, logger16) => {
|
|
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
|
+
logger16?.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, logger16 = 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
|
+
logger16?.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: logger16 }) => {
|
|
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
|
+
logger16?.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: logger16, 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
|
+
logger16?.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: logger16, dynamoDbDocumentClientOptions = {} } = context;
|
|
18814
18814
|
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
18815
18815
|
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
18816
|
-
|
|
18816
|
+
logger16?.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: logger16 } = 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: logger16, 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 logger16 = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
|
|
20632
20632
|
if (typeof appId !== "string") {
|
|
20633
|
-
|
|
20633
|
+
logger16?.warn("userAgentAppId must be a string or undefined.");
|
|
20634
20634
|
} else if (appId.length > 50) {
|
|
20635
|
-
|
|
20635
|
+
logger16?.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: logger16 } = configuration;
|
|
21504
|
+
const envOptions = { signingName, logger: logger16 };
|
|
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: logger16 }) => {
|
|
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: logger16
|
|
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: logger16
|
|
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: logger16
|
|
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, logger16) => {
|
|
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
|
+
logger16.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 logger16 = 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, logger16);
|
|
23844
23844
|
}
|
|
23845
23845
|
} catch (e4) {
|
|
23846
23846
|
if (pastCredentials) {
|
|
23847
|
-
|
|
23848
|
-
credentials = getExtendedInstanceMetadataCredentials(pastCredentials,
|
|
23847
|
+
logger16.warn("Credential renew failed: ", e4);
|
|
23848
|
+
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger16);
|
|
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: logger16, 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
|
+
logger16?.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
|
+
logger16?.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, logger16) => {
|
|
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: logger16 });
|
|
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, logger16) {
|
|
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: logger16 });
|
|
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: logger16 }), {
|
|
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: logger16 });
|
|
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: logger16, signingName } = {}) => async () => {
|
|
25449
|
+
logger16?.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: logger16 });
|
|
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: logger16 });
|
|
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: logger16 }) => async () => {
|
|
25577
|
+
logger16?.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: logger16 }) => {
|
|
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: logger16
|
|
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: logger16
|
|
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: logger16
|
|
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: logger16
|
|
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: logger16
|
|
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, logger16) => {
|
|
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: logger16 });
|
|
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: logger16, 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: logger16,
|
|
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: logger16 = 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: logger16,
|
|
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: logger16
|
|
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: logger16 = 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: logger16,
|
|
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: logger16
|
|
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, logger16) => {
|
|
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: logger16 });
|
|
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: logger16 });
|
|
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: logger16
|
|
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, logger16) => {
|
|
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
|
+
logger16?.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
|
+
logger16?.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
|
+
logger16?.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: logger16 });
|
|
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: logger16 } = {}) => {
|
|
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: logger16 }) || isCredentialSourceProfile(arg, { profile, logger: logger16 }));
|
|
28654
28654
|
}, "isAssumeRoleProfile");
|
|
28655
|
-
var isAssumeRoleWithSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger:
|
|
28655
|
+
var isAssumeRoleWithSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger: logger16 }) => {
|
|
28656
28656
|
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
28657
28657
|
if (withSourceProfile) {
|
|
28658
|
-
|
|
28658
|
+
logger16?.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: logger16 }) => {
|
|
28663
28663
|
const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
|
28664
28664
|
if (withProviderProfile) {
|
|
28665
|
-
|
|
28665
|
+
logger16?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
|
|
28666
28666
|
}
|
|
28667
28667
|
return withProviderProfile;
|
|
28668
28668
|
}, "isCredentialSourceProfile");
|
|
@@ -29574,7 +29574,7 @@ var require_dist_cjs73 = __commonJS({
|
|
|
29574
29574
|
return value;
|
|
29575
29575
|
};
|
|
29576
29576
|
}, "getCircularReplacer");
|
|
29577
|
-
var
|
|
29577
|
+
var sleep2 = /* @__PURE__ */ __name((seconds) => {
|
|
29578
29578
|
return new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
|
|
29579
29579
|
}, "sleep");
|
|
29580
29580
|
var waiterServiceDefaults = {
|
|
@@ -29641,7 +29641,7 @@ var require_dist_cjs73 = __commonJS({
|
|
|
29641
29641
|
if (Date.now() + delay * 1e3 > waitUntil) {
|
|
29642
29642
|
return { state: exports2.WaiterState.TIMEOUT, observedResponses };
|
|
29643
29643
|
}
|
|
29644
|
-
await
|
|
29644
|
+
await sleep2(delay);
|
|
29645
29645
|
const { state: state3, reason: reason2 } = await acceptorChecks(client, input);
|
|
29646
29646
|
if (reason2) {
|
|
29647
29647
|
const message = createMessageFromResponse(reason2);
|
|
@@ -44060,7 +44060,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
44060
44060
|
return async () => handler2(this.clientCommand);
|
|
44061
44061
|
}
|
|
44062
44062
|
};
|
|
44063
|
-
var
|
|
44063
|
+
var BatchGetCommand2 = class extends DynamoDBDocumentClientCommand {
|
|
44064
44064
|
static {
|
|
44065
44065
|
__name(this, "BatchGetCommand");
|
|
44066
44066
|
}
|
|
@@ -44563,7 +44563,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
44563
44563
|
}
|
|
44564
44564
|
}
|
|
44565
44565
|
batchGet(args, optionsOrCb, cb) {
|
|
44566
|
-
const command = new
|
|
44566
|
+
const command = new BatchGetCommand2(args);
|
|
44567
44567
|
if (typeof optionsOrCb === "function") {
|
|
44568
44568
|
this.send(command, optionsOrCb);
|
|
44569
44569
|
} else if (typeof cb === "function") {
|
|
@@ -44740,7 +44740,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
44740
44740
|
}, "get")
|
|
44741
44741
|
});
|
|
44742
44742
|
exports2.BatchExecuteStatementCommand = BatchExecuteStatementCommand;
|
|
44743
|
-
exports2.BatchGetCommand =
|
|
44743
|
+
exports2.BatchGetCommand = BatchGetCommand2;
|
|
44744
44744
|
exports2.BatchWriteCommand = BatchWriteCommand;
|
|
44745
44745
|
exports2.DeleteCommand = DeleteCommand;
|
|
44746
44746
|
exports2.DynamoDBDocument = DynamoDBDocument;
|
|
@@ -44788,6 +44788,27 @@ var init_dynamodb = __esm({
|
|
|
44788
44788
|
}
|
|
44789
44789
|
});
|
|
44790
44790
|
|
|
44791
|
+
// src/shared/utils/scanSort.ts
|
|
44792
|
+
function chooseScanSortField(filter) {
|
|
44793
|
+
const keys = Object.keys(filter);
|
|
44794
|
+
if (keys.length !== 1) {
|
|
44795
|
+
return "id";
|
|
44796
|
+
}
|
|
44797
|
+
const [key] = keys;
|
|
44798
|
+
const value = filter[key];
|
|
44799
|
+
const isPlainField = !key.includes(":") && !key.includes(".") && key !== "id";
|
|
44800
|
+
const isSafeString = typeof value === "string" && value.length > 0 && new TextEncoder().encode(value).length <= 64 && // 空白や '#' はシャドーの SK でエスケープされ、'id' を含む値は SK の区切りと紛らわしくなる
|
|
44801
|
+
// (extractRecordIds は最後の '#id#' で分けるが、念のため避ける)
|
|
44802
|
+
!/[\s#]/.test(value) && value !== "id" && !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(value);
|
|
44803
|
+
return isPlainField && isSafeString ? key : "id";
|
|
44804
|
+
}
|
|
44805
|
+
var init_scanSort = __esm({
|
|
44806
|
+
"src/shared/utils/scanSort.ts"() {
|
|
44807
|
+
"use strict";
|
|
44808
|
+
__name(chooseScanSortField, "chooseScanSortField");
|
|
44809
|
+
}
|
|
44810
|
+
});
|
|
44811
|
+
|
|
44791
44812
|
// src/shared/utils/index.ts
|
|
44792
44813
|
var init_utils3 = __esm({
|
|
44793
44814
|
"src/shared/utils/index.ts"() {
|
|
@@ -44796,6 +44817,7 @@ var init_utils3 = __esm({
|
|
|
44796
44817
|
init_ulid();
|
|
44797
44818
|
init_validation();
|
|
44798
44819
|
init_dynamodb();
|
|
44820
|
+
init_scanSort();
|
|
44799
44821
|
}
|
|
44800
44822
|
});
|
|
44801
44823
|
|
|
@@ -45628,6 +45650,84 @@ var init_dynamodb3 = __esm({
|
|
|
45628
45650
|
}
|
|
45629
45651
|
});
|
|
45630
45652
|
|
|
45653
|
+
// src/server/utils/batchGet.ts
|
|
45654
|
+
function sleep(ms) {
|
|
45655
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
45656
|
+
}
|
|
45657
|
+
async function batchGetAll(keys, { consistentRead, costTracker, requestId, baseDelayMs = 50 }) {
|
|
45658
|
+
const unique = Array.from(new Map(keys.map((k4) => [`${k4.PK}\0${k4.SK}`, k4])).values());
|
|
45659
|
+
if (unique.length === 0) {
|
|
45660
|
+
return [];
|
|
45661
|
+
}
|
|
45662
|
+
const dbClient2 = getDBClient();
|
|
45663
|
+
const tableName = getTableName();
|
|
45664
|
+
const records = [];
|
|
45665
|
+
for (let i4 = 0; i4 < unique.length; i4 += BATCH_GET_MAX_KEYS) {
|
|
45666
|
+
let pending = unique.slice(i4, i4 + BATCH_GET_MAX_KEYS);
|
|
45667
|
+
for (let attempt = 0; pending.length > 0; attempt++) {
|
|
45668
|
+
if (attempt > BATCH_GET_MAX_RETRIES) {
|
|
45669
|
+
logger3.error("BatchGetItem \u306E UnprocessedKeys \u304C\u89E3\u6D88\u3057\u306A\u304B\u3063\u305F", {
|
|
45670
|
+
requestId,
|
|
45671
|
+
unprocessed: pending.length,
|
|
45672
|
+
attempts: attempt
|
|
45673
|
+
});
|
|
45674
|
+
throw new AppError(
|
|
45675
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
45676
|
+
"BatchGetItem still has unprocessed keys after retries",
|
|
45677
|
+
503,
|
|
45678
|
+
{ unprocessed: pending.length }
|
|
45679
|
+
);
|
|
45680
|
+
}
|
|
45681
|
+
if (attempt > 0) {
|
|
45682
|
+
await sleep(baseDelayMs * 2 ** (attempt - 1) * (0.5 + Math.random() / 2));
|
|
45683
|
+
}
|
|
45684
|
+
const keysToGet = pending;
|
|
45685
|
+
const result = await executeDynamoDBOperation(
|
|
45686
|
+
() => dbClient2.send(
|
|
45687
|
+
new import_lib_dynamodb2.BatchGetCommand({
|
|
45688
|
+
RequestItems: {
|
|
45689
|
+
[tableName]: {
|
|
45690
|
+
Keys: keysToGet,
|
|
45691
|
+
ConsistentRead: consistentRead
|
|
45692
|
+
}
|
|
45693
|
+
},
|
|
45694
|
+
ReturnConsumedCapacity: "TOTAL"
|
|
45695
|
+
})
|
|
45696
|
+
),
|
|
45697
|
+
"BatchGetItem"
|
|
45698
|
+
);
|
|
45699
|
+
if (costTracker) {
|
|
45700
|
+
const capacity = result.ConsumedCapacity;
|
|
45701
|
+
if (Array.isArray(capacity)) {
|
|
45702
|
+
capacity.forEach((c4) => costTracker.add(c4));
|
|
45703
|
+
} else {
|
|
45704
|
+
costTracker.add(capacity);
|
|
45705
|
+
}
|
|
45706
|
+
}
|
|
45707
|
+
records.push(...result.Responses?.[tableName] ?? []);
|
|
45708
|
+
pending = result.UnprocessedKeys?.[tableName]?.Keys ?? [];
|
|
45709
|
+
}
|
|
45710
|
+
}
|
|
45711
|
+
return records;
|
|
45712
|
+
}
|
|
45713
|
+
var import_lib_dynamodb2, logger3, BATCH_GET_MAX_KEYS, BATCH_GET_MAX_RETRIES;
|
|
45714
|
+
var init_batchGet = __esm({
|
|
45715
|
+
"src/server/utils/batchGet.ts"() {
|
|
45716
|
+
"use strict";
|
|
45717
|
+
import_lib_dynamodb2 = __toESM(require_dist_cjs80(), 1);
|
|
45718
|
+
init_shared();
|
|
45719
|
+
init_dynamodb3();
|
|
45720
|
+
logger3 = createLogger({
|
|
45721
|
+
service: "batch-get",
|
|
45722
|
+
level: process.env.LOG_LEVEL || "info"
|
|
45723
|
+
});
|
|
45724
|
+
BATCH_GET_MAX_KEYS = 100;
|
|
45725
|
+
BATCH_GET_MAX_RETRIES = 8;
|
|
45726
|
+
__name(sleep, "sleep");
|
|
45727
|
+
__name(batchGetAll, "batchGetAll");
|
|
45728
|
+
}
|
|
45729
|
+
});
|
|
45730
|
+
|
|
45631
45731
|
// src/server/utils/validation.ts
|
|
45632
45732
|
function validateSortField(_config, _resource, _sort) {
|
|
45633
45733
|
return;
|
|
@@ -46003,6 +46103,59 @@ var init_pagination = __esm({
|
|
|
46003
46103
|
}
|
|
46004
46104
|
});
|
|
46005
46105
|
|
|
46106
|
+
// src/server/utils/scanWarning.ts
|
|
46107
|
+
function getScanWarnThreshold() {
|
|
46108
|
+
const raw = process.env.SCAN_WARN_THRESHOLD;
|
|
46109
|
+
if (raw === void 0 || raw === "") {
|
|
46110
|
+
return DEFAULT_SCAN_WARN_THRESHOLD;
|
|
46111
|
+
}
|
|
46112
|
+
const value = Number(raw);
|
|
46113
|
+
return Number.isInteger(value) && value >= 1 ? value : DEFAULT_SCAN_WARN_THRESHOLD;
|
|
46114
|
+
}
|
|
46115
|
+
var logger4, SPARSE_SCAN_EVENT, DEFAULT_SCAN_WARN_THRESHOLD, ScanWatcher;
|
|
46116
|
+
var init_scanWarning = __esm({
|
|
46117
|
+
"src/server/utils/scanWarning.ts"() {
|
|
46118
|
+
"use strict";
|
|
46119
|
+
init_shared();
|
|
46120
|
+
logger4 = createLogger({ service: "scan-warning", level: "warn" });
|
|
46121
|
+
SPARSE_SCAN_EVENT = "SPARSE_SCAN";
|
|
46122
|
+
DEFAULT_SCAN_WARN_THRESHOLD = 5e3;
|
|
46123
|
+
__name(getScanWarnThreshold, "getScanWarnThreshold");
|
|
46124
|
+
ScanWatcher = class {
|
|
46125
|
+
constructor(context) {
|
|
46126
|
+
this.context = context;
|
|
46127
|
+
}
|
|
46128
|
+
static {
|
|
46129
|
+
__name(this, "ScanWatcher");
|
|
46130
|
+
}
|
|
46131
|
+
scanned = 0;
|
|
46132
|
+
warned = false;
|
|
46133
|
+
threshold = getScanWarnThreshold();
|
|
46134
|
+
/** 読んだ件数を加える */
|
|
46135
|
+
add(count) {
|
|
46136
|
+
this.scanned += count;
|
|
46137
|
+
if (!this.warned && this.scanned >= this.threshold) {
|
|
46138
|
+
this.warned = true;
|
|
46139
|
+
logger4.warn(
|
|
46140
|
+
`${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`,
|
|
46141
|
+
{
|
|
46142
|
+
event: SPARSE_SCAN_EVENT,
|
|
46143
|
+
...this.context,
|
|
46144
|
+
scanned: this.scanned,
|
|
46145
|
+
threshold: this.threshold,
|
|
46146
|
+
actions: [
|
|
46147
|
+
"\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",
|
|
46148
|
+
"\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",
|
|
46149
|
+
"\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"
|
|
46150
|
+
]
|
|
46151
|
+
}
|
|
46152
|
+
);
|
|
46153
|
+
}
|
|
46154
|
+
}
|
|
46155
|
+
};
|
|
46156
|
+
}
|
|
46157
|
+
});
|
|
46158
|
+
|
|
46006
46159
|
// src/server/utils/filter.ts
|
|
46007
46160
|
function parseFilterField(fieldKey) {
|
|
46008
46161
|
const parts = fieldKey.split(":");
|
|
@@ -46091,7 +46244,7 @@ function parseFilters(filter) {
|
|
|
46091
46244
|
parsedFilters.push({ parsed, value });
|
|
46092
46245
|
}
|
|
46093
46246
|
} catch (error2) {
|
|
46094
|
-
|
|
46247
|
+
logger5.error("Invalid filter field syntax", {
|
|
46095
46248
|
fieldKey,
|
|
46096
46249
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
46097
46250
|
});
|
|
@@ -46160,7 +46313,7 @@ function detectNearQuery(filter) {
|
|
|
46160
46313
|
}
|
|
46161
46314
|
return null;
|
|
46162
46315
|
}
|
|
46163
|
-
var
|
|
46316
|
+
var logger5;
|
|
46164
46317
|
var init_utils5 = __esm({
|
|
46165
46318
|
"src/server/operations/find/utils.ts"() {
|
|
46166
46319
|
"use strict";
|
|
@@ -46169,7 +46322,7 @@ var init_utils5 = __esm({
|
|
|
46169
46322
|
init_shadow();
|
|
46170
46323
|
init_filter();
|
|
46171
46324
|
init_validation2();
|
|
46172
|
-
|
|
46325
|
+
logger5 = createLogger({
|
|
46173
46326
|
service: "find-utils",
|
|
46174
46327
|
level: process.env.LOG_LEVEL || "info"
|
|
46175
46328
|
});
|
|
@@ -46186,7 +46339,7 @@ var init_utils5 = __esm({
|
|
|
46186
46339
|
async function executeIdQuery(resource, normalizedParams, requestId) {
|
|
46187
46340
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
46188
46341
|
const { perPage, nextToken } = pagination;
|
|
46189
|
-
|
|
46342
|
+
logger6.debug("Executing ID optimized query", {
|
|
46190
46343
|
requestId,
|
|
46191
46344
|
resource,
|
|
46192
46345
|
sort,
|
|
@@ -46207,7 +46360,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
46207
46360
|
const costTracker = new CostTracker();
|
|
46208
46361
|
const queryResult = await executeDynamoDBOperation(
|
|
46209
46362
|
() => dbClient2.send(
|
|
46210
|
-
new
|
|
46363
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46211
46364
|
TableName: tableName,
|
|
46212
46365
|
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
46213
46366
|
ExpressionAttributeValues: {
|
|
@@ -46223,7 +46376,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
46223
46376
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
46224
46377
|
const mainRecords = queryResult.Items || [];
|
|
46225
46378
|
const items = mainRecords.map((item) => extractCleanRecord(item));
|
|
46226
|
-
|
|
46379
|
+
logger6.info("ID specific query succeeded", {
|
|
46227
46380
|
requestId,
|
|
46228
46381
|
resource,
|
|
46229
46382
|
targetId,
|
|
@@ -46246,7 +46399,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
46246
46399
|
targetIds.map(
|
|
46247
46400
|
(id) => executeDynamoDBOperation(
|
|
46248
46401
|
() => dbClient2.send(
|
|
46249
|
-
new
|
|
46402
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46250
46403
|
TableName: tableName,
|
|
46251
46404
|
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
46252
46405
|
ExpressionAttributeValues: {
|
|
@@ -46270,7 +46423,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
46270
46423
|
const bVal = String(b4.id ?? "");
|
|
46271
46424
|
return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
46272
46425
|
});
|
|
46273
|
-
|
|
46426
|
+
logger6.info("ID $in query succeeded", {
|
|
46274
46427
|
requestId,
|
|
46275
46428
|
resource,
|
|
46276
46429
|
requestedCount: targetIds.length,
|
|
@@ -46309,7 +46462,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
46309
46462
|
}
|
|
46310
46463
|
const queryResult = await executeDynamoDBOperation(
|
|
46311
46464
|
() => dbClient2.send(
|
|
46312
|
-
new
|
|
46465
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46313
46466
|
TableName: tableName,
|
|
46314
46467
|
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
46315
46468
|
ExpressionAttributeValues: {
|
|
@@ -46346,7 +46499,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
46346
46499
|
queryResult.LastEvaluatedKey.PK,
|
|
46347
46500
|
queryResult.LastEvaluatedKey.SK
|
|
46348
46501
|
) : void 0;
|
|
46349
|
-
|
|
46502
|
+
logger6.info("ID all records query succeeded", {
|
|
46350
46503
|
requestId,
|
|
46351
46504
|
resource,
|
|
46352
46505
|
count: items.length,
|
|
@@ -46378,18 +46531,28 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46378
46531
|
let iterations = 0;
|
|
46379
46532
|
let previousKeySignature;
|
|
46380
46533
|
let chunkSize = SCAN_CHUNK_INITIAL;
|
|
46534
|
+
const watcher = new ScanWatcher({
|
|
46535
|
+
requestId,
|
|
46536
|
+
resource,
|
|
46537
|
+
path: "id-filtered-scan",
|
|
46538
|
+
sortField: sort.field,
|
|
46539
|
+
filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
|
|
46540
|
+
});
|
|
46381
46541
|
scan: while (true) {
|
|
46382
46542
|
if (++iterations > SCAN_MAX_ITERATIONS) {
|
|
46383
|
-
|
|
46543
|
+
logger6.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
46384
46544
|
requestId,
|
|
46385
46545
|
resource,
|
|
46386
46546
|
iterations
|
|
46387
46547
|
});
|
|
46388
|
-
|
|
46548
|
+
throw new AppError("INTERNAL_ERROR" /* INTERNAL_ERROR */, "ID scan exceeded the iteration limit", 500, {
|
|
46549
|
+
resource,
|
|
46550
|
+
iterations
|
|
46551
|
+
});
|
|
46389
46552
|
}
|
|
46390
46553
|
const queryResult = await executeDynamoDBOperation(
|
|
46391
46554
|
() => dbClient2.send(
|
|
46392
|
-
new
|
|
46555
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46393
46556
|
TableName: tableName,
|
|
46394
46557
|
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
46395
46558
|
ExpressionAttributeValues: {
|
|
@@ -46406,6 +46569,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46406
46569
|
"Query"
|
|
46407
46570
|
);
|
|
46408
46571
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
46572
|
+
watcher.add((queryResult.Items || []).length);
|
|
46409
46573
|
for (const row of queryResult.Items || []) {
|
|
46410
46574
|
scanned++;
|
|
46411
46575
|
if (!matchesAllFilters(extractCleanRecord(row), parsedFilters)) {
|
|
@@ -46424,19 +46588,24 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46424
46588
|
}
|
|
46425
46589
|
const nextKeySignature = `${nextKey.PK}#${nextKey.SK}`;
|
|
46426
46590
|
if (nextKeySignature === previousKeySignature) {
|
|
46427
|
-
|
|
46591
|
+
logger6.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
46428
46592
|
requestId,
|
|
46429
46593
|
resource,
|
|
46430
46594
|
iterations
|
|
46431
46595
|
});
|
|
46432
|
-
|
|
46596
|
+
throw new AppError(
|
|
46597
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
46598
|
+
"ID scan received the same LastEvaluatedKey repeatedly",
|
|
46599
|
+
500,
|
|
46600
|
+
{ resource, iterations }
|
|
46601
|
+
);
|
|
46433
46602
|
}
|
|
46434
46603
|
previousKeySignature = nextKeySignature;
|
|
46435
46604
|
exclusiveStartKey = nextKey;
|
|
46436
46605
|
chunkSize = Math.min(chunkSize * 2, SCAN_CHUNK_MAX);
|
|
46437
46606
|
}
|
|
46438
46607
|
const nextTokenValue = hasNextPage && lastReturned ? encodeNextToken(lastReturned.PK, lastReturned.SK) : void 0;
|
|
46439
|
-
|
|
46608
|
+
logger6.info("ID filtered scan query succeeded", {
|
|
46440
46609
|
requestId,
|
|
46441
46610
|
resource,
|
|
46442
46611
|
scanned,
|
|
@@ -46450,17 +46619,18 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46450
46619
|
consumedCapacity: costTracker.getAggregated()
|
|
46451
46620
|
};
|
|
46452
46621
|
}
|
|
46453
|
-
var
|
|
46622
|
+
var import_lib_dynamodb3, logger6, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
|
|
46454
46623
|
var init_idQuery = __esm({
|
|
46455
46624
|
"src/server/operations/find/idQuery.ts"() {
|
|
46456
46625
|
"use strict";
|
|
46457
|
-
|
|
46626
|
+
import_lib_dynamodb3 = __toESM(require_dist_cjs80(), 1);
|
|
46458
46627
|
init_shared();
|
|
46459
46628
|
init_cost_tracker();
|
|
46460
46629
|
init_dynamodb3();
|
|
46461
46630
|
init_pagination();
|
|
46631
|
+
init_scanWarning();
|
|
46462
46632
|
init_utils5();
|
|
46463
|
-
|
|
46633
|
+
logger6 = createLogger({
|
|
46464
46634
|
service: "id-query",
|
|
46465
46635
|
level: process.env.LOG_LEVEL || "info"
|
|
46466
46636
|
});
|
|
@@ -46477,7 +46647,7 @@ var init_idQuery = __esm({
|
|
|
46477
46647
|
|
|
46478
46648
|
// src/server/operations/find/nearQuery.ts
|
|
46479
46649
|
async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId) {
|
|
46480
|
-
|
|
46650
|
+
logger7.debug("Executing $near query", {
|
|
46481
46651
|
requestId,
|
|
46482
46652
|
resource,
|
|
46483
46653
|
fieldName,
|
|
@@ -46488,32 +46658,58 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46488
46658
|
const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
|
|
46489
46659
|
const dbClient2 = getDBClient();
|
|
46490
46660
|
const tableName = getTableName();
|
|
46491
|
-
|
|
46661
|
+
logger7.debug("Searching shadow records", {
|
|
46492
46662
|
requestId,
|
|
46493
46663
|
resource,
|
|
46494
46664
|
fieldName,
|
|
46495
46665
|
geohashPrefix,
|
|
46496
46666
|
skPrefix: `${fieldName}#${geohashPrefix}`
|
|
46497
46667
|
});
|
|
46498
|
-
const
|
|
46499
|
-
|
|
46500
|
-
|
|
46501
|
-
|
|
46502
|
-
|
|
46503
|
-
|
|
46504
|
-
|
|
46505
|
-
|
|
46506
|
-
|
|
46507
|
-
|
|
46508
|
-
|
|
46509
|
-
|
|
46510
|
-
|
|
46511
|
-
|
|
46512
|
-
|
|
46513
|
-
|
|
46514
|
-
|
|
46515
|
-
|
|
46516
|
-
|
|
46668
|
+
const shadowRecords = [];
|
|
46669
|
+
const watcher = new ScanWatcher({
|
|
46670
|
+
requestId,
|
|
46671
|
+
resource,
|
|
46672
|
+
path: "near-search",
|
|
46673
|
+
sortField: fieldName,
|
|
46674
|
+
filters: ["$near"]
|
|
46675
|
+
});
|
|
46676
|
+
let exclusiveStartKey;
|
|
46677
|
+
let previousKeySignature;
|
|
46678
|
+
do {
|
|
46679
|
+
const queryResult = await executeDynamoDBOperation(
|
|
46680
|
+
() => dbClient2.send(
|
|
46681
|
+
new import_lib_dynamodb4.QueryCommand({
|
|
46682
|
+
TableName: tableName,
|
|
46683
|
+
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
46684
|
+
ExpressionAttributeValues: {
|
|
46685
|
+
":pk": resource,
|
|
46686
|
+
":skPrefix": `${fieldName}#${geohashPrefix}`
|
|
46687
|
+
},
|
|
46688
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
46689
|
+
ConsistentRead: false,
|
|
46690
|
+
// シャドウレコードは結果整合性で十分
|
|
46691
|
+
ReturnConsumedCapacity: "TOTAL"
|
|
46692
|
+
})
|
|
46693
|
+
),
|
|
46694
|
+
"Query"
|
|
46695
|
+
);
|
|
46696
|
+
costTracker.add(queryResult.ConsumedCapacity);
|
|
46697
|
+
shadowRecords.push(...queryResult.Items || []);
|
|
46698
|
+
watcher.add((queryResult.Items || []).length);
|
|
46699
|
+
const nextKey = queryResult.LastEvaluatedKey;
|
|
46700
|
+
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
46701
|
+
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
46702
|
+
throw new AppError(
|
|
46703
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
46704
|
+
"Near search received the same LastEvaluatedKey repeatedly",
|
|
46705
|
+
500,
|
|
46706
|
+
{ resource, geohashPrefix }
|
|
46707
|
+
);
|
|
46708
|
+
}
|
|
46709
|
+
previousKeySignature = nextKeySignature;
|
|
46710
|
+
exclusiveStartKey = nextKey;
|
|
46711
|
+
} while (exclusiveStartKey);
|
|
46712
|
+
logger7.debug("Shadow records found", {
|
|
46517
46713
|
requestId,
|
|
46518
46714
|
resource,
|
|
46519
46715
|
geohashPrefix,
|
|
@@ -46524,48 +46720,24 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46524
46720
|
const parts = sk.split("#id#");
|
|
46525
46721
|
return parts.length === 2 ? parts[1] : null;
|
|
46526
46722
|
}).filter((id) => id !== null);
|
|
46527
|
-
|
|
46723
|
+
logger7.debug("Main record IDs extracted", {
|
|
46528
46724
|
requestId,
|
|
46529
46725
|
resource,
|
|
46530
46726
|
geohashPrefix,
|
|
46531
46727
|
ids: mainRecordIds
|
|
46532
46728
|
});
|
|
46533
|
-
const
|
|
46534
|
-
|
|
46535
|
-
|
|
46536
|
-
|
|
46537
|
-
|
|
46538
|
-
() => dbClient2.send(
|
|
46539
|
-
new import_lib_dynamodb3.BatchGetCommand({
|
|
46540
|
-
RequestItems: {
|
|
46541
|
-
[tableName]: {
|
|
46542
|
-
Keys: chunk.map((id) => ({
|
|
46543
|
-
PK: resource,
|
|
46544
|
-
SK: `id#${id}`
|
|
46545
|
-
})),
|
|
46546
|
-
ConsistentRead: false
|
|
46547
|
-
}
|
|
46548
|
-
},
|
|
46549
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
46550
|
-
})
|
|
46551
|
-
),
|
|
46552
|
-
"BatchGetItem"
|
|
46553
|
-
);
|
|
46554
|
-
if (batchGetResult.ConsumedCapacity) {
|
|
46555
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
46556
|
-
costTracker.add(capacity);
|
|
46557
|
-
}
|
|
46558
|
-
}
|
|
46559
|
-
validRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
46560
|
-
}
|
|
46561
|
-
logger5.debug("Main records retrieved", {
|
|
46729
|
+
const validRecords = await batchGetAll(
|
|
46730
|
+
mainRecordIds.map((id) => ({ PK: resource, SK: `id#${id}` })),
|
|
46731
|
+
{ consistentRead: false, costTracker, requestId }
|
|
46732
|
+
);
|
|
46733
|
+
logger7.debug("Main records retrieved", {
|
|
46562
46734
|
requestId,
|
|
46563
46735
|
resource,
|
|
46564
46736
|
geohashPrefix,
|
|
46565
46737
|
count: validRecords.length
|
|
46566
46738
|
});
|
|
46567
46739
|
const cleanRecords = validRecords.map((record) => extractCleanRecord(record));
|
|
46568
|
-
|
|
46740
|
+
logger7.debug("Clean records extracted", {
|
|
46569
46741
|
requestId,
|
|
46570
46742
|
resource,
|
|
46571
46743
|
geohashPrefix,
|
|
@@ -46584,7 +46756,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46584
46756
|
config
|
|
46585
46757
|
);
|
|
46586
46758
|
const items = result.documents;
|
|
46587
|
-
|
|
46759
|
+
logger7.info("$near query succeeded", {
|
|
46588
46760
|
requestId,
|
|
46589
46761
|
resource,
|
|
46590
46762
|
fieldName,
|
|
@@ -46602,17 +46774,19 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46602
46774
|
consumedCapacity: costTracker.getAggregated()
|
|
46603
46775
|
};
|
|
46604
46776
|
}
|
|
46605
|
-
var
|
|
46777
|
+
var import_lib_dynamodb4, logger7;
|
|
46606
46778
|
var init_nearQuery = __esm({
|
|
46607
46779
|
"src/server/operations/find/nearQuery.ts"() {
|
|
46608
46780
|
"use strict";
|
|
46609
|
-
|
|
46781
|
+
import_lib_dynamodb4 = __toESM(require_dist_cjs80(), 1);
|
|
46610
46782
|
init_geohash();
|
|
46611
46783
|
init_shared();
|
|
46612
46784
|
init_nearSearch();
|
|
46785
|
+
init_batchGet();
|
|
46613
46786
|
init_cost_tracker();
|
|
46614
46787
|
init_dynamodb3();
|
|
46615
|
-
|
|
46788
|
+
init_scanWarning();
|
|
46789
|
+
logger7 = createLogger({
|
|
46616
46790
|
service: "near-query",
|
|
46617
46791
|
level: process.env.LOG_LEVEL || "info"
|
|
46618
46792
|
});
|
|
@@ -46642,7 +46816,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46642
46816
|
(f4) => !(isKeyConditionOptimized && f4 === optimizableFilter)
|
|
46643
46817
|
);
|
|
46644
46818
|
if (residualFilters.length > 0) {
|
|
46645
|
-
|
|
46819
|
+
logger8.debug("Residual filters detected, falling back to full scan", {
|
|
46646
46820
|
requestId,
|
|
46647
46821
|
resource,
|
|
46648
46822
|
sortField: sort.field,
|
|
@@ -46650,7 +46824,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46650
46824
|
});
|
|
46651
46825
|
return executeFullScanQuery(resource, normalizedParams, costTracker, requestId);
|
|
46652
46826
|
}
|
|
46653
|
-
|
|
46827
|
+
logger8.debug("Executing shadow query", {
|
|
46654
46828
|
requestId,
|
|
46655
46829
|
resource,
|
|
46656
46830
|
sortField: sort.field,
|
|
@@ -46698,7 +46872,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46698
46872
|
shadowRecords.LastEvaluatedKey.PK,
|
|
46699
46873
|
shadowRecords.LastEvaluatedKey.SK
|
|
46700
46874
|
) : void 0;
|
|
46701
|
-
|
|
46875
|
+
logger8.info("Shadow query succeeded", {
|
|
46702
46876
|
requestId,
|
|
46703
46877
|
resource,
|
|
46704
46878
|
sortField: sort.field,
|
|
@@ -46723,7 +46897,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46723
46897
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
46724
46898
|
const filterSort = { field: filterCandidate.parsed.field, order: "ASC" };
|
|
46725
46899
|
const remainingFilters = parsedFilters.filter((f4) => f4 !== filterCandidate);
|
|
46726
|
-
|
|
46900
|
+
logger8.debug("Executing filter-first query", {
|
|
46727
46901
|
requestId,
|
|
46728
46902
|
resource,
|
|
46729
46903
|
filterField: filterCandidate.parsed.field,
|
|
@@ -46735,7 +46909,9 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46735
46909
|
filterSort,
|
|
46736
46910
|
filterCandidate,
|
|
46737
46911
|
costTracker,
|
|
46738
|
-
requestId
|
|
46912
|
+
requestId,
|
|
46913
|
+
"shadow-filter-first",
|
|
46914
|
+
parsedFilters
|
|
46739
46915
|
);
|
|
46740
46916
|
if (remainingFilters.length > 0) {
|
|
46741
46917
|
items = items.filter((r4) => matchesAllFilters(r4, remainingFilters));
|
|
@@ -46744,7 +46920,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46744
46920
|
const page = items.slice(offset, offset + perPage);
|
|
46745
46921
|
const hasNextPage = offset + perPage < items.length;
|
|
46746
46922
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46747
|
-
|
|
46923
|
+
logger8.info("Filter-first query succeeded", {
|
|
46748
46924
|
requestId,
|
|
46749
46925
|
resource,
|
|
46750
46926
|
filterField: filterCandidate.parsed.field,
|
|
@@ -46765,20 +46941,28 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
46765
46941
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
46766
46942
|
const { perPage, nextToken } = pagination;
|
|
46767
46943
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
46768
|
-
|
|
46944
|
+
logger8.debug("Executing full scan query", {
|
|
46769
46945
|
requestId,
|
|
46770
46946
|
resource,
|
|
46771
46947
|
sortField: sort.field,
|
|
46772
46948
|
offset
|
|
46773
46949
|
});
|
|
46774
|
-
let items = await fetchAllRecordsViaShadowIndex(
|
|
46950
|
+
let items = await fetchAllRecordsViaShadowIndex(
|
|
46951
|
+
resource,
|
|
46952
|
+
sort,
|
|
46953
|
+
void 0,
|
|
46954
|
+
costTracker,
|
|
46955
|
+
requestId,
|
|
46956
|
+
"shadow-full-scan",
|
|
46957
|
+
parsedFilters
|
|
46958
|
+
);
|
|
46775
46959
|
if (parsedFilters.length > 0) {
|
|
46776
46960
|
items = items.filter((r4) => matchesAllFilters(r4, parsedFilters));
|
|
46777
46961
|
}
|
|
46778
46962
|
const page = items.slice(offset, offset + perPage);
|
|
46779
46963
|
const hasNextPage = offset + perPage < items.length;
|
|
46780
46964
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46781
|
-
|
|
46965
|
+
logger8.info("Full scan query succeeded", {
|
|
46782
46966
|
requestId,
|
|
46783
46967
|
resource,
|
|
46784
46968
|
sortField: sort.field,
|
|
@@ -46794,20 +46978,35 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
46794
46978
|
consumedCapacity: costTracker.getAggregated()
|
|
46795
46979
|
};
|
|
46796
46980
|
}
|
|
46797
|
-
async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId) {
|
|
46981
|
+
async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId, scanPath, parsedFilters) {
|
|
46798
46982
|
const allShadowItems = [];
|
|
46983
|
+
const watcher = new ScanWatcher({
|
|
46984
|
+
requestId,
|
|
46985
|
+
resource,
|
|
46986
|
+
path: scanPath,
|
|
46987
|
+
sortField: indexSort.field,
|
|
46988
|
+
filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
|
|
46989
|
+
});
|
|
46799
46990
|
let lastKey;
|
|
46800
46991
|
let previousKeySignature;
|
|
46801
46992
|
const MAX_ITERATIONS = 1e4;
|
|
46802
46993
|
let iterations = 0;
|
|
46803
46994
|
do {
|
|
46804
46995
|
if (++iterations > MAX_ITERATIONS) {
|
|
46805
|
-
|
|
46996
|
+
logger8.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
46806
46997
|
requestId,
|
|
46807
46998
|
resource,
|
|
46808
46999
|
iterations
|
|
46809
47000
|
});
|
|
46810
|
-
|
|
47001
|
+
throw new AppError(
|
|
47002
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
47003
|
+
"Shadow index scan exceeded the iteration limit",
|
|
47004
|
+
500,
|
|
47005
|
+
{
|
|
47006
|
+
resource,
|
|
47007
|
+
iterations
|
|
47008
|
+
}
|
|
47009
|
+
);
|
|
46811
47010
|
}
|
|
46812
47011
|
const result = await executeShadowRecordQuery(
|
|
46813
47012
|
resource,
|
|
@@ -46820,15 +47019,21 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
46820
47019
|
requestId
|
|
46821
47020
|
);
|
|
46822
47021
|
allShadowItems.push(...result.Items || []);
|
|
47022
|
+
watcher.add((result.Items || []).length);
|
|
46823
47023
|
const nextKey = result.LastEvaluatedKey;
|
|
46824
47024
|
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
46825
47025
|
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
46826
|
-
|
|
47026
|
+
logger8.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
46827
47027
|
requestId,
|
|
46828
47028
|
resource,
|
|
46829
47029
|
iterations
|
|
46830
47030
|
});
|
|
46831
|
-
|
|
47031
|
+
throw new AppError(
|
|
47032
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
47033
|
+
"Shadow index scan received the same LastEvaluatedKey repeatedly",
|
|
47034
|
+
500,
|
|
47035
|
+
{ resource, iterations }
|
|
47036
|
+
);
|
|
46832
47037
|
}
|
|
46833
47038
|
previousKeySignature = nextKeySignature;
|
|
46834
47039
|
lastKey = nextKey;
|
|
@@ -46890,7 +47095,7 @@ async function executeShadowRecordQuery(resource, sort, perPage, nextToken, opti
|
|
|
46890
47095
|
);
|
|
46891
47096
|
const result = await executeDynamoDBOperation(
|
|
46892
47097
|
() => dbClient2.send(
|
|
46893
|
-
new
|
|
47098
|
+
new import_lib_dynamodb5.QueryCommand({
|
|
46894
47099
|
TableName: tableName,
|
|
46895
47100
|
KeyConditionExpression: keyConditionExpression,
|
|
46896
47101
|
ExpressionAttributeValues: expressionAttributeValues,
|
|
@@ -46998,62 +47203,37 @@ function encodeValueForShadowSK(value, type) {
|
|
|
46998
47203
|
function extractRecordIds(shadowRecords) {
|
|
46999
47204
|
return shadowRecords.map((record) => {
|
|
47000
47205
|
const sk = record.SK;
|
|
47001
|
-
const
|
|
47002
|
-
return
|
|
47206
|
+
const index = sk.lastIndexOf("#id#");
|
|
47207
|
+
return index >= 0 ? sk.slice(index + "#id#".length) : null;
|
|
47003
47208
|
}).filter((id) => id !== null);
|
|
47004
47209
|
}
|
|
47005
47210
|
async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
47006
|
-
const
|
|
47007
|
-
|
|
47008
|
-
|
|
47009
|
-
|
|
47010
|
-
|
|
47011
|
-
for (let i4 = 0; i4 < uniqueRecordIds.length; i4 += BATCH_SIZE) {
|
|
47012
|
-
const chunk = uniqueRecordIds.slice(i4, i4 + BATCH_SIZE);
|
|
47013
|
-
const batchGetResult = await executeDynamoDBOperation(
|
|
47014
|
-
() => dbClient2.send(
|
|
47015
|
-
new import_lib_dynamodb4.BatchGetCommand({
|
|
47016
|
-
RequestItems: {
|
|
47017
|
-
[tableName]: {
|
|
47018
|
-
Keys: chunk.map((id) => ({
|
|
47019
|
-
PK: resource,
|
|
47020
|
-
SK: `id#${id}`
|
|
47021
|
-
})),
|
|
47022
|
-
ConsistentRead: true
|
|
47023
|
-
}
|
|
47024
|
-
},
|
|
47025
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
47026
|
-
})
|
|
47027
|
-
),
|
|
47028
|
-
"BatchGetItem"
|
|
47029
|
-
);
|
|
47030
|
-
if (batchGetResult.ConsumedCapacity) {
|
|
47031
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
47032
|
-
costTracker.add(capacity);
|
|
47033
|
-
}
|
|
47034
|
-
}
|
|
47035
|
-
allRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
47036
|
-
}
|
|
47037
|
-
logger6.debug("Main records fetched", {
|
|
47211
|
+
const allRecords = await batchGetAll(
|
|
47212
|
+
recordIds.map((id) => ({ PK: resource, SK: `id#${id}` })),
|
|
47213
|
+
{ consistentRead: true, costTracker, requestId }
|
|
47214
|
+
);
|
|
47215
|
+
logger8.debug("Main records fetched", {
|
|
47038
47216
|
requestId,
|
|
47039
47217
|
resource,
|
|
47040
|
-
requestedCount:
|
|
47218
|
+
requestedCount: new Set(recordIds).size,
|
|
47041
47219
|
fetchedCount: allRecords.length
|
|
47042
47220
|
});
|
|
47043
47221
|
return allRecords;
|
|
47044
47222
|
}
|
|
47045
|
-
var
|
|
47223
|
+
var import_lib_dynamodb5, logger8, KEY_CONDITION_OPERATORS;
|
|
47046
47224
|
var init_shadowQuery = __esm({
|
|
47047
47225
|
"src/server/operations/find/shadowQuery.ts"() {
|
|
47048
47226
|
"use strict";
|
|
47049
|
-
|
|
47227
|
+
import_lib_dynamodb5 = __toESM(require_dist_cjs80(), 1);
|
|
47050
47228
|
init_formatting();
|
|
47051
47229
|
init_shared();
|
|
47230
|
+
init_batchGet();
|
|
47052
47231
|
init_cost_tracker();
|
|
47053
47232
|
init_dynamodb3();
|
|
47054
47233
|
init_pagination();
|
|
47234
|
+
init_scanWarning();
|
|
47055
47235
|
init_utils5();
|
|
47056
|
-
|
|
47236
|
+
logger8 = createLogger({
|
|
47057
47237
|
service: "shadow-query",
|
|
47058
47238
|
level: process.env.LOG_LEVEL || "info"
|
|
47059
47239
|
});
|
|
@@ -47074,14 +47254,14 @@ var init_shadowQuery = __esm({
|
|
|
47074
47254
|
|
|
47075
47255
|
// src/server/operations/find/handler.ts
|
|
47076
47256
|
async function handleFind(resource, params, requestId) {
|
|
47077
|
-
|
|
47257
|
+
logger9.debug("Executing find", {
|
|
47078
47258
|
requestId,
|
|
47079
47259
|
resource,
|
|
47080
47260
|
params
|
|
47081
47261
|
});
|
|
47082
47262
|
const nearDetection = detectNearQuery(params.filter);
|
|
47083
47263
|
if (nearDetection) {
|
|
47084
|
-
|
|
47264
|
+
logger9.debug("$near operator detected, executing near search", {
|
|
47085
47265
|
requestId,
|
|
47086
47266
|
resource,
|
|
47087
47267
|
fieldName: nearDetection.fieldName
|
|
@@ -47098,7 +47278,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
47098
47278
|
const config = initializeFindConfig();
|
|
47099
47279
|
const normalizedParams = normalizeFindParams(config, resource, params);
|
|
47100
47280
|
validateSortField(config, resource, normalizedParams.sort);
|
|
47101
|
-
|
|
47281
|
+
logger9.debug("Find parameters normalized", {
|
|
47102
47282
|
requestId,
|
|
47103
47283
|
resource,
|
|
47104
47284
|
sort: normalizedParams.sort,
|
|
@@ -47113,7 +47293,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
47113
47293
|
}
|
|
47114
47294
|
return executeShadowQuery(resource, normalizedParams, requestId);
|
|
47115
47295
|
}
|
|
47116
|
-
var
|
|
47296
|
+
var logger9;
|
|
47117
47297
|
var init_handler = __esm({
|
|
47118
47298
|
"src/server/operations/find/handler.ts"() {
|
|
47119
47299
|
"use strict";
|
|
@@ -47123,7 +47303,7 @@ var init_handler = __esm({
|
|
|
47123
47303
|
init_nearQuery();
|
|
47124
47304
|
init_shadowQuery();
|
|
47125
47305
|
init_utils5();
|
|
47126
|
-
|
|
47306
|
+
logger9 = createLogger({
|
|
47127
47307
|
service: "find-handler",
|
|
47128
47308
|
level: process.env.LOG_LEVEL || "info"
|
|
47129
47309
|
});
|
|
@@ -47132,10 +47312,6 @@ var init_handler = __esm({
|
|
|
47132
47312
|
});
|
|
47133
47313
|
|
|
47134
47314
|
// src/server/operations/find.ts
|
|
47135
|
-
var find_exports = {};
|
|
47136
|
-
__export(find_exports, {
|
|
47137
|
-
handleFind: () => handleFind
|
|
47138
|
-
});
|
|
47139
47315
|
var init_find = __esm({
|
|
47140
47316
|
"src/server/operations/find.ts"() {
|
|
47141
47317
|
"use strict";
|
|
@@ -47143,10 +47319,64 @@ var init_find = __esm({
|
|
|
47143
47319
|
}
|
|
47144
47320
|
});
|
|
47145
47321
|
|
|
47322
|
+
// src/server/operations/findAll.ts
|
|
47323
|
+
async function findAllByFilter(resource, filter, requestId) {
|
|
47324
|
+
const sortField = chooseScanSortField(filter);
|
|
47325
|
+
const items = [];
|
|
47326
|
+
let nextToken;
|
|
47327
|
+
let previousToken;
|
|
47328
|
+
for (; ; ) {
|
|
47329
|
+
const result = await handleFind(
|
|
47330
|
+
resource,
|
|
47331
|
+
{
|
|
47332
|
+
filter,
|
|
47333
|
+
sort: { field: sortField, order: "ASC" },
|
|
47334
|
+
pagination: { perPage: 50, nextToken }
|
|
47335
|
+
},
|
|
47336
|
+
requestId
|
|
47337
|
+
);
|
|
47338
|
+
items.push(...result.items);
|
|
47339
|
+
nextToken = result.pageInfo?.hasNextPage ? result.nextToken : void 0;
|
|
47340
|
+
if (!nextToken) {
|
|
47341
|
+
return items;
|
|
47342
|
+
}
|
|
47343
|
+
if (nextToken === previousToken) {
|
|
47344
|
+
throw new AppError(
|
|
47345
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
47346
|
+
"findAllByFilter received the same nextToken repeatedly",
|
|
47347
|
+
500,
|
|
47348
|
+
{ resource }
|
|
47349
|
+
);
|
|
47350
|
+
}
|
|
47351
|
+
previousToken = nextToken;
|
|
47352
|
+
}
|
|
47353
|
+
}
|
|
47354
|
+
async function findOneByFilter(resource, filter, requestId) {
|
|
47355
|
+
const result = await handleFind(
|
|
47356
|
+
resource,
|
|
47357
|
+
{
|
|
47358
|
+
filter,
|
|
47359
|
+
sort: { field: chooseScanSortField(filter), order: "ASC" },
|
|
47360
|
+
pagination: { perPage: 1 }
|
|
47361
|
+
},
|
|
47362
|
+
requestId
|
|
47363
|
+
);
|
|
47364
|
+
return result.items[0];
|
|
47365
|
+
}
|
|
47366
|
+
var init_findAll = __esm({
|
|
47367
|
+
"src/server/operations/findAll.ts"() {
|
|
47368
|
+
"use strict";
|
|
47369
|
+
init_shared();
|
|
47370
|
+
init_find();
|
|
47371
|
+
__name(findAllByFilter, "findAllByFilter");
|
|
47372
|
+
__name(findOneByFilter, "findOneByFilter");
|
|
47373
|
+
}
|
|
47374
|
+
});
|
|
47375
|
+
|
|
47146
47376
|
// src/server/utils/bulkOperations.ts
|
|
47147
47377
|
function logLargeBatchWarning(operation2, recordCount, requestId, resource) {
|
|
47148
47378
|
if (recordCount > LARGE_BATCH_WARNING_THRESHOLD) {
|
|
47149
|
-
|
|
47379
|
+
logger11.warn(`Large batch ${operation2} operation detected`, {
|
|
47150
47380
|
requestId,
|
|
47151
47381
|
resource,
|
|
47152
47382
|
recordCount,
|
|
@@ -47169,7 +47399,7 @@ function calculateTimeoutRisk(startTime) {
|
|
|
47169
47399
|
};
|
|
47170
47400
|
}
|
|
47171
47401
|
function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount, riskInfo) {
|
|
47172
|
-
|
|
47402
|
+
logger11.info("Records prepared for chunk execution", {
|
|
47173
47403
|
requestId,
|
|
47174
47404
|
resource,
|
|
47175
47405
|
totalRecords,
|
|
@@ -47179,7 +47409,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
47179
47409
|
timeoutRisk: riskInfo.risk
|
|
47180
47410
|
});
|
|
47181
47411
|
if (riskInfo.risk === "high") {
|
|
47182
|
-
|
|
47412
|
+
logger11.warn("High timeout risk detected during preparation phase", {
|
|
47183
47413
|
requestId,
|
|
47184
47414
|
resource,
|
|
47185
47415
|
preparationElapsedMs: riskInfo.elapsedMs,
|
|
@@ -47191,7 +47421,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
47191
47421
|
}
|
|
47192
47422
|
function logBulkOperationComplete(operation2, requestId, resource, requested, succeeded, failed, riskInfo, additionalInfo) {
|
|
47193
47423
|
const totalElapsedSeconds = Math.round(riskInfo.elapsedMs / 1e3);
|
|
47194
|
-
|
|
47424
|
+
logger11.info(`${operation2} completed`, {
|
|
47195
47425
|
requestId,
|
|
47196
47426
|
resource,
|
|
47197
47427
|
requested,
|
|
@@ -47206,7 +47436,7 @@ function logBulkOperationComplete(operation2, requestId, resource, requested, su
|
|
|
47206
47436
|
}
|
|
47207
47437
|
function logPartialFailure(operation2, requestId, resource, requested, succeeded, failed, errorCodes, additionalInfo) {
|
|
47208
47438
|
const failureRate = Math.round(failed / requested * 100);
|
|
47209
|
-
|
|
47439
|
+
logger11.warn(`Partial failure in ${operation2} operation`, {
|
|
47210
47440
|
requestId,
|
|
47211
47441
|
resource,
|
|
47212
47442
|
totalRequested: requested,
|
|
@@ -47217,12 +47447,12 @@ function logPartialFailure(operation2, requestId, resource, requested, succeeded
|
|
|
47217
47447
|
...additionalInfo
|
|
47218
47448
|
});
|
|
47219
47449
|
}
|
|
47220
|
-
var
|
|
47450
|
+
var logger11;
|
|
47221
47451
|
var init_bulkOperations = __esm({
|
|
47222
47452
|
"src/server/utils/bulkOperations.ts"() {
|
|
47223
47453
|
"use strict";
|
|
47224
47454
|
init_shared();
|
|
47225
|
-
|
|
47455
|
+
logger11 = createLogger({ service: "records-lambda" });
|
|
47226
47456
|
__name(logLargeBatchWarning, "logLargeBatchWarning");
|
|
47227
47457
|
__name(calculateTimeoutRisk, "calculateTimeoutRisk");
|
|
47228
47458
|
__name(logPreparationTimeoutRisk, "logPreparationTimeoutRisk");
|
|
@@ -47241,7 +47471,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
47241
47471
|
const itemCount = getItemCount(record);
|
|
47242
47472
|
if (itemCount > DYNAMODB_TRANSACT_WRITE_MAX_ITEMS) {
|
|
47243
47473
|
const errorMsg = `Single record exceeds ${DYNAMODB_TRANSACT_WRITE_MAX_ITEMS} items limit: ${itemCount} items`;
|
|
47244
|
-
|
|
47474
|
+
logger12.error("Chunk validation failed", {
|
|
47245
47475
|
itemCount,
|
|
47246
47476
|
limit: DYNAMODB_TRANSACT_WRITE_MAX_ITEMS
|
|
47247
47477
|
});
|
|
@@ -47263,7 +47493,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
47263
47493
|
chunks.push(currentChunk);
|
|
47264
47494
|
itemCounts.push(currentItemCount);
|
|
47265
47495
|
}
|
|
47266
|
-
|
|
47496
|
+
logger12.info("Chunk calculation completed", {
|
|
47267
47497
|
totalRecords: records.length,
|
|
47268
47498
|
chunkCount: chunks.length,
|
|
47269
47499
|
itemCounts,
|
|
@@ -47279,7 +47509,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47279
47509
|
const errors = [];
|
|
47280
47510
|
const totalRecords = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
47281
47511
|
const executionStartTime = Date.now();
|
|
47282
|
-
|
|
47512
|
+
logger12.info("Starting chunk execution", {
|
|
47283
47513
|
totalChunks: chunks.length,
|
|
47284
47514
|
totalRecords
|
|
47285
47515
|
});
|
|
@@ -47287,14 +47517,14 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47287
47517
|
const chunk = chunks[i4];
|
|
47288
47518
|
const chunkStartTime = Date.now();
|
|
47289
47519
|
try {
|
|
47290
|
-
|
|
47520
|
+
logger12.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
|
|
47291
47521
|
chunkIndex: i4,
|
|
47292
47522
|
recordCount: chunk.length
|
|
47293
47523
|
});
|
|
47294
47524
|
const successfulRecords = await executeChunk(chunk);
|
|
47295
47525
|
successRecords.push(...successfulRecords);
|
|
47296
47526
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
47297
|
-
|
|
47527
|
+
logger12.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
|
|
47298
47528
|
chunkIndex: i4,
|
|
47299
47529
|
recordCount: chunk.length,
|
|
47300
47530
|
durationMs: chunkDuration
|
|
@@ -47303,7 +47533,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47303
47533
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
47304
47534
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
|
|
47305
47535
|
const errorCode = getErrorCode(error2);
|
|
47306
|
-
|
|
47536
|
+
logger12.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
|
|
47307
47537
|
chunkIndex: i4,
|
|
47308
47538
|
recordCount: chunk.length,
|
|
47309
47539
|
durationMs: chunkDuration,
|
|
@@ -47322,7 +47552,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47322
47552
|
}
|
|
47323
47553
|
}
|
|
47324
47554
|
const totalExecutionTime = Date.now() - executionStartTime;
|
|
47325
|
-
|
|
47555
|
+
logger12.info("Chunk execution completed", {
|
|
47326
47556
|
totalChunks: chunks.length,
|
|
47327
47557
|
totalRecords,
|
|
47328
47558
|
successCount: successRecords.length,
|
|
@@ -47331,7 +47561,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47331
47561
|
avgTimePerChunkMs: chunks.length > 0 ? Math.round(totalExecutionTime / chunks.length) : 0
|
|
47332
47562
|
});
|
|
47333
47563
|
if (failedIds.length > 0) {
|
|
47334
|
-
|
|
47564
|
+
logger12.warn("Partial failure detected in chunk execution", {
|
|
47335
47565
|
totalRecords,
|
|
47336
47566
|
successCount: successRecords.length,
|
|
47337
47567
|
failedCount: failedIds.length,
|
|
@@ -47363,12 +47593,12 @@ function getErrorCode(error2) {
|
|
|
47363
47593
|
}
|
|
47364
47594
|
return "TRANSACTION_FAILED";
|
|
47365
47595
|
}
|
|
47366
|
-
var
|
|
47596
|
+
var logger12;
|
|
47367
47597
|
var init_chunking = __esm({
|
|
47368
47598
|
"src/server/utils/chunking.ts"() {
|
|
47369
47599
|
"use strict";
|
|
47370
47600
|
init_shared();
|
|
47371
|
-
|
|
47601
|
+
logger12 = createLogger({ service: "records-lambda" });
|
|
47372
47602
|
__name(calculateChunks, "calculateChunks");
|
|
47373
47603
|
__name(executeChunks, "executeChunks");
|
|
47374
47604
|
__name(getErrorCode, "getErrorCode");
|
|
@@ -47539,7 +47769,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47539
47769
|
const upsert = options?.upsert ?? false;
|
|
47540
47770
|
const startTime = Date.now();
|
|
47541
47771
|
const costTracker = new CostTracker();
|
|
47542
|
-
|
|
47772
|
+
logger13.debug("Executing updateMany", {
|
|
47543
47773
|
requestId,
|
|
47544
47774
|
resource,
|
|
47545
47775
|
upsert
|
|
@@ -47547,21 +47777,31 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47547
47777
|
let ids;
|
|
47548
47778
|
if ("ids" in params) {
|
|
47549
47779
|
ids = params.ids;
|
|
47550
|
-
|
|
47780
|
+
logger13.debug("Executing updateMany with ids", {
|
|
47551
47781
|
requestId,
|
|
47552
47782
|
resource,
|
|
47553
47783
|
count: ids.length
|
|
47554
47784
|
});
|
|
47555
47785
|
} else {
|
|
47556
|
-
|
|
47786
|
+
logger13.debug("Executing updateMany with filter", {
|
|
47557
47787
|
requestId,
|
|
47558
47788
|
resource,
|
|
47559
47789
|
filter: params.filter
|
|
47560
47790
|
});
|
|
47561
|
-
|
|
47562
|
-
|
|
47563
|
-
|
|
47564
|
-
|
|
47791
|
+
if (Object.keys(params.filter).length === 0) {
|
|
47792
|
+
throw new AppError(
|
|
47793
|
+
"VALIDATION_ERROR" /* VALIDATION_ERROR */,
|
|
47794
|
+
"updateMany requires a non-empty filter or ids",
|
|
47795
|
+
400
|
|
47796
|
+
);
|
|
47797
|
+
}
|
|
47798
|
+
const matched = await findAllByFilter(
|
|
47799
|
+
resource,
|
|
47800
|
+
params.filter,
|
|
47801
|
+
requestId
|
|
47802
|
+
);
|
|
47803
|
+
ids = matched.map((item) => item.id);
|
|
47804
|
+
logger13.debug("Found records with filter", {
|
|
47565
47805
|
requestId,
|
|
47566
47806
|
resource,
|
|
47567
47807
|
count: ids.length
|
|
@@ -47570,7 +47810,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47570
47810
|
if (upsert) {
|
|
47571
47811
|
const newId = ulid2();
|
|
47572
47812
|
ids = [newId];
|
|
47573
|
-
|
|
47813
|
+
logger13.info("Creating new record with filter (upsert: true)", {
|
|
47574
47814
|
requestId,
|
|
47575
47815
|
resource,
|
|
47576
47816
|
newId,
|
|
@@ -47600,32 +47840,10 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47600
47840
|
logLargeBatchWarning("updateMany", ids.length, requestId, resource);
|
|
47601
47841
|
const dbClient2 = getDBClient();
|
|
47602
47842
|
const tableName = getTableName();
|
|
47603
|
-
const
|
|
47604
|
-
PK: resource,
|
|
47605
|
-
|
|
47606
|
-
}));
|
|
47607
|
-
const batchGetResult = await executeDynamoDBOperation(
|
|
47608
|
-
() => dbClient2.send(
|
|
47609
|
-
new import_lib_dynamodb6.BatchGetCommand({
|
|
47610
|
-
RequestItems: {
|
|
47611
|
-
[tableName]: {
|
|
47612
|
-
Keys: keys,
|
|
47613
|
-
ConsistentRead: true
|
|
47614
|
-
}
|
|
47615
|
-
},
|
|
47616
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
47617
|
-
})
|
|
47618
|
-
),
|
|
47619
|
-
"BatchGetItem"
|
|
47843
|
+
const existingItems = await batchGetAll(
|
|
47844
|
+
ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
|
|
47845
|
+
{ consistentRead: true, costTracker, requestId }
|
|
47620
47846
|
);
|
|
47621
|
-
if (Array.isArray(batchGetResult.ConsumedCapacity)) {
|
|
47622
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
47623
|
-
costTracker.add(capacity);
|
|
47624
|
-
}
|
|
47625
|
-
} else {
|
|
47626
|
-
costTracker.add(batchGetResult.ConsumedCapacity);
|
|
47627
|
-
}
|
|
47628
|
-
const existingItems = batchGetResult.Responses?.[tableName] || [];
|
|
47629
47847
|
const existingIds = new Set(
|
|
47630
47848
|
existingItems.map((item) => {
|
|
47631
47849
|
const data = item.data;
|
|
@@ -47634,7 +47852,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47634
47852
|
);
|
|
47635
47853
|
const notFoundIds = ids.filter((id) => !existingIds.has(id));
|
|
47636
47854
|
if (!upsert && notFoundIds.length > 0) {
|
|
47637
|
-
|
|
47855
|
+
logger13.warn("Records not found (upsert: false)", {
|
|
47638
47856
|
requestId,
|
|
47639
47857
|
resource,
|
|
47640
47858
|
notFoundCount: notFoundIds.length,
|
|
@@ -47643,7 +47861,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47643
47861
|
});
|
|
47644
47862
|
}
|
|
47645
47863
|
if (upsert && notFoundIds.length > 0) {
|
|
47646
|
-
|
|
47864
|
+
logger13.info("Creating new records (upsert: true)", {
|
|
47647
47865
|
requestId,
|
|
47648
47866
|
resource,
|
|
47649
47867
|
notFoundCount: notFoundIds.length,
|
|
@@ -47679,7 +47897,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47679
47897
|
const failedId = existingData.id || "unknown-id";
|
|
47680
47898
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
47681
47899
|
const errorCode = getPreparationErrorCode(error2);
|
|
47682
|
-
|
|
47900
|
+
logger13.error("Failed to prepare record for update", {
|
|
47683
47901
|
requestId,
|
|
47684
47902
|
recordId: failedId,
|
|
47685
47903
|
error: errorMessage,
|
|
@@ -47719,7 +47937,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47719
47937
|
} catch (error2) {
|
|
47720
47938
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
47721
47939
|
const errorCode = getPreparationErrorCode(error2);
|
|
47722
|
-
|
|
47940
|
+
logger13.error("Failed to prepare new record for upsert", {
|
|
47723
47941
|
requestId,
|
|
47724
47942
|
recordId: id,
|
|
47725
47943
|
error: errorMessage,
|
|
@@ -47932,7 +48150,7 @@ function getPreparationErrorCode(error2) {
|
|
|
47932
48150
|
}
|
|
47933
48151
|
return "VALIDATION_ERROR" /* VALIDATION_ERROR */;
|
|
47934
48152
|
}
|
|
47935
|
-
var import_lib_dynamodb6,
|
|
48153
|
+
var import_lib_dynamodb6, logger13;
|
|
47936
48154
|
var init_updateMany = __esm({
|
|
47937
48155
|
"src/server/operations/updateMany.ts"() {
|
|
47938
48156
|
"use strict";
|
|
@@ -47940,13 +48158,15 @@ var init_updateMany = __esm({
|
|
|
47940
48158
|
init_shared();
|
|
47941
48159
|
init_shadow();
|
|
47942
48160
|
init_shadow();
|
|
48161
|
+
init_batchGet();
|
|
47943
48162
|
init_bulkOperations();
|
|
47944
48163
|
init_chunking();
|
|
47945
48164
|
init_cost_tracker();
|
|
47946
48165
|
init_dynamodb3();
|
|
47947
48166
|
init_mergePatch();
|
|
47948
48167
|
init_timestamps();
|
|
47949
|
-
|
|
48168
|
+
init_findAll();
|
|
48169
|
+
logger13 = createLogger({ service: "records-lambda" });
|
|
47950
48170
|
__name(handleUpdateMany, "handleUpdateMany");
|
|
47951
48171
|
__name(getPreparationErrorCode, "getPreparationErrorCode");
|
|
47952
48172
|
}
|
|
@@ -47984,16 +48204,16 @@ function decodeOriginalFilename(raw) {
|
|
|
47984
48204
|
__name(decodeOriginalFilename, "decodeOriginalFilename");
|
|
47985
48205
|
|
|
47986
48206
|
// src/server/operations/findMany.ts
|
|
47987
|
-
var import_lib_dynamodb5 = __toESM(require_dist_cjs80(), 1);
|
|
47988
48207
|
init_shared();
|
|
47989
48208
|
init_shadow();
|
|
48209
|
+
init_batchGet();
|
|
47990
48210
|
init_dynamodb3();
|
|
47991
|
-
|
|
47992
|
-
var
|
|
48211
|
+
init_findAll();
|
|
48212
|
+
var logger10 = createLogger({ service: "records-lambda" });
|
|
47993
48213
|
async function handleFindMany(resource, params, requestId) {
|
|
47994
48214
|
if ("ids" in params) {
|
|
47995
48215
|
const { ids } = params;
|
|
47996
|
-
|
|
48216
|
+
logger10.debug("Executing findMany by ids", {
|
|
47997
48217
|
requestId,
|
|
47998
48218
|
resource,
|
|
47999
48219
|
count: ids.length
|
|
@@ -48001,28 +48221,12 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48001
48221
|
if (ids.length === 0) {
|
|
48002
48222
|
return [];
|
|
48003
48223
|
}
|
|
48004
|
-
const
|
|
48005
|
-
|
|
48006
|
-
|
|
48007
|
-
PK: resource,
|
|
48008
|
-
SK: generateMainRecordSK2(id)
|
|
48009
|
-
}));
|
|
48010
|
-
const result = await executeDynamoDBOperation(
|
|
48011
|
-
() => dbClient2.send(
|
|
48012
|
-
new import_lib_dynamodb5.BatchGetCommand({
|
|
48013
|
-
RequestItems: {
|
|
48014
|
-
[tableName]: {
|
|
48015
|
-
Keys: keys,
|
|
48016
|
-
ConsistentRead: true
|
|
48017
|
-
}
|
|
48018
|
-
}
|
|
48019
|
-
})
|
|
48020
|
-
),
|
|
48021
|
-
"BatchGetItem"
|
|
48224
|
+
const items = await batchGetAll(
|
|
48225
|
+
ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
|
|
48226
|
+
{ consistentRead: true, requestId }
|
|
48022
48227
|
);
|
|
48023
|
-
const items = result.Responses?.[tableName] || [];
|
|
48024
48228
|
const records = items.map((item) => extractCleanRecord(item));
|
|
48025
|
-
|
|
48229
|
+
logger10.info("findMany by ids succeeded", {
|
|
48026
48230
|
requestId,
|
|
48027
48231
|
resource,
|
|
48028
48232
|
requested: ids.length,
|
|
@@ -48032,25 +48236,19 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48032
48236
|
}
|
|
48033
48237
|
if ("filter" in params) {
|
|
48034
48238
|
const { filter } = params;
|
|
48035
|
-
|
|
48239
|
+
logger10.debug("Executing findMany by filter", {
|
|
48036
48240
|
requestId,
|
|
48037
48241
|
resource,
|
|
48038
48242
|
filter
|
|
48039
48243
|
});
|
|
48040
|
-
const
|
|
48041
|
-
|
|
48042
|
-
{
|
|
48043
|
-
filter
|
|
48044
|
-
},
|
|
48045
|
-
requestId
|
|
48046
|
-
);
|
|
48047
|
-
logger8.info("findMany by filter succeeded", {
|
|
48244
|
+
const items = await findAllByFilter(resource, filter, requestId);
|
|
48245
|
+
logger10.info("findMany by filter succeeded", {
|
|
48048
48246
|
requestId,
|
|
48049
48247
|
resource,
|
|
48050
48248
|
filter,
|
|
48051
|
-
found:
|
|
48249
|
+
found: items.length
|
|
48052
48250
|
});
|
|
48053
|
-
return
|
|
48251
|
+
return items;
|
|
48054
48252
|
}
|
|
48055
48253
|
throw new Error("findMany requires either ids or filter");
|
|
48056
48254
|
}
|
|
@@ -48058,13 +48256,14 @@ __name(handleFindMany, "handleFindMany");
|
|
|
48058
48256
|
|
|
48059
48257
|
// src/server/operations/updateOne.ts
|
|
48060
48258
|
init_shared();
|
|
48061
|
-
|
|
48259
|
+
init_findAll();
|
|
48260
|
+
var logger14 = createLogger({ service: "records-lambda" });
|
|
48062
48261
|
async function handleUpdateOne(resource, params, requestId) {
|
|
48063
48262
|
const { data: patchData, options } = params;
|
|
48064
48263
|
const { handleUpdateMany: handleUpdateMany2 } = await Promise.resolve().then(() => (init_updateMany(), updateMany_exports));
|
|
48065
48264
|
if ("id" in params) {
|
|
48066
48265
|
const targetId = params.id;
|
|
48067
|
-
|
|
48266
|
+
logger14.debug("Executing updateOne with id", {
|
|
48068
48267
|
requestId,
|
|
48069
48268
|
resource,
|
|
48070
48269
|
id: targetId,
|
|
@@ -48106,19 +48305,20 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
48106
48305
|
consumedCapacity: updateManyResult.consumedCapacity
|
|
48107
48306
|
};
|
|
48108
48307
|
} else {
|
|
48109
|
-
|
|
48308
|
+
logger14.debug("Executing updateOne with filter", {
|
|
48110
48309
|
requestId,
|
|
48111
48310
|
resource,
|
|
48112
48311
|
filter: params.filter,
|
|
48113
48312
|
upsert: options?.upsert
|
|
48114
48313
|
});
|
|
48314
|
+
const target = await findOneByFilter(
|
|
48315
|
+
resource,
|
|
48316
|
+
params.filter,
|
|
48317
|
+
requestId
|
|
48318
|
+
);
|
|
48115
48319
|
const updateManyResult = await handleUpdateMany2(
|
|
48116
48320
|
resource,
|
|
48117
|
-
{
|
|
48118
|
-
filter: params.filter,
|
|
48119
|
-
data: patchData,
|
|
48120
|
-
options
|
|
48121
|
-
},
|
|
48321
|
+
target ? { ids: [target.id], data: patchData, options } : { filter: params.filter, data: patchData, options },
|
|
48122
48322
|
requestId
|
|
48123
48323
|
);
|
|
48124
48324
|
if (updateManyResult.count === 0) {
|
|
@@ -48156,7 +48356,7 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
48156
48356
|
__name(handleUpdateOne, "handleUpdateOne");
|
|
48157
48357
|
|
|
48158
48358
|
// src/server/media/process-handler-dlq.ts
|
|
48159
|
-
var
|
|
48359
|
+
var logger15 = createLogger({ service: "media-process-handler-dlq" });
|
|
48160
48360
|
var s3Client = new import_client_s3.S3Client({ region: process.env.AWS_REGION });
|
|
48161
48361
|
function extractS3Ref(envelope) {
|
|
48162
48362
|
const record = envelope.requestPayload?.Records?.[0];
|
|
@@ -48172,12 +48372,12 @@ async function processMessage(body) {
|
|
|
48172
48372
|
try {
|
|
48173
48373
|
envelope = JSON.parse(body);
|
|
48174
48374
|
} catch {
|
|
48175
|
-
|
|
48375
|
+
logger15.error("DLQ message is not valid JSON", { body });
|
|
48176
48376
|
return;
|
|
48177
48377
|
}
|
|
48178
48378
|
const ref = extractS3Ref(envelope);
|
|
48179
48379
|
if (!ref) {
|
|
48180
|
-
|
|
48380
|
+
logger15.error("Could not extract S3 reference from DLQ message", { envelope });
|
|
48181
48381
|
return;
|
|
48182
48382
|
}
|
|
48183
48383
|
const { bucket, key, fileId } = ref;
|
|
@@ -48185,7 +48385,7 @@ async function processMessage(body) {
|
|
|
48185
48385
|
const existing = await handleFindMany("media", { ids: [fileId] }, requestId);
|
|
48186
48386
|
const existingRecord = existing[0];
|
|
48187
48387
|
if (existingRecord?.status === "completed") {
|
|
48188
|
-
|
|
48388
|
+
logger15.info("Media already completed, skipping DLQ failure write", { requestId, fileId });
|
|
48189
48389
|
return;
|
|
48190
48390
|
}
|
|
48191
48391
|
let appMetadata = {};
|
|
@@ -48196,7 +48396,7 @@ async function processMessage(body) {
|
|
|
48196
48396
|
appMetadata = extractAppMetadata(metadata);
|
|
48197
48397
|
originalFilename = decodeOriginalFilename(metadata["original-filename"]);
|
|
48198
48398
|
} catch (error2) {
|
|
48199
|
-
|
|
48399
|
+
logger15.warn("Failed to re-fetch metadata for DLQ failure record", {
|
|
48200
48400
|
requestId,
|
|
48201
48401
|
fileId,
|
|
48202
48402
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
@@ -48221,7 +48421,7 @@ async function processMessage(body) {
|
|
|
48221
48421
|
},
|
|
48222
48422
|
requestId
|
|
48223
48423
|
);
|
|
48224
|
-
|
|
48424
|
+
logger15.warn("Media marked as failed via DLQ", { requestId, fileId });
|
|
48225
48425
|
}
|
|
48226
48426
|
__name(processMessage, "processMessage");
|
|
48227
48427
|
var handler = /* @__PURE__ */ __name(async (event) => {
|