@exabugs/dynamodb-client 1.9.0 → 1.11.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 +26 -0
- package/README.md +1 -0
- package/dist/integrations/react-admin/dataProvider.d.ts.map +1 -1
- package/dist/integrations/react-admin/dataProvider.js +3 -26
- package/dist/integrations/react-admin/dataProvider.js.map +1 -1
- package/dist/notify/channels/email.d.ts +32 -0
- package/dist/notify/channels/email.d.ts.map +1 -0
- package/dist/notify/channels/email.js +67 -0
- package/dist/notify/channels/email.js.map +1 -0
- package/dist/notify/channels/slack.d.ts +12 -0
- package/dist/notify/channels/slack.d.ts.map +1 -0
- package/dist/notify/channels/slack.js +46 -0
- package/dist/notify/channels/slack.js.map +1 -0
- package/dist/notify/format.d.ts +7 -0
- package/dist/notify/format.d.ts.map +1 -0
- package/dist/notify/format.js +29 -0
- package/dist/notify/format.js.map +1 -0
- package/dist/notify/handler.d.ts +42 -0
- package/dist/notify/handler.d.ts.map +1 -0
- package/dist/notify/handler.js +175 -0
- package/dist/notify/handler.js.map +1 -0
- package/dist/notify/index.d.ts +18 -0
- package/dist/notify/index.d.ts.map +1 -0
- package/dist/notify/index.js +14 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/logger.d.ts +6 -0
- package/dist/notify/logger.d.ts.map +1 -0
- package/dist/notify/logger.js +11 -0
- package/dist/notify/logger.js.map +1 -0
- package/dist/notify/normalize.d.ts +11 -0
- package/dist/notify/normalize.d.ts.map +1 -0
- package/dist/notify/normalize.js +245 -0
- package/dist/notify/normalize.js.map +1 -0
- package/dist/notify/policy.d.ts +15 -0
- package/dist/notify/policy.d.ts.map +1 -0
- package/dist/notify/policy.js +36 -0
- package/dist/notify/policy.js.map +1 -0
- package/dist/notify/store.d.ts +22 -0
- package/dist/notify/store.d.ts.map +1 -0
- package/dist/notify/store.js +119 -0
- package/dist/notify/store.js.map +1 -0
- package/dist/notify/types.d.ts +63 -0
- package/dist/notify/types.d.ts.map +1 -0
- package/dist/notify/types.js +8 -0
- package/dist/notify/types.js.map +1 -0
- package/dist/server/handler.cjs +577 -495
- package/dist/server/handler.cjs.map +4 -4
- package/dist/server/media-handler.cjs +2 -2
- package/dist/server/media-process-handler-dlq.cjs +438 -340
- package/dist/server/media-process-handler-dlq.cjs.map +4 -4
- package/dist/server/media-process-handler.cjs +437 -339
- 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/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 +10 -34
- 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 +1 -1
- package/dist/server/utils/scanWarning.d.ts.map +1 -1
- 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/NOTIFY.md +103 -0
- package/package.json +8 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @exabugs/dynamodb-client v1.
|
|
2
|
-
// Built: 2026-10-
|
|
1
|
+
// @exabugs/dynamodb-client v1.11.0
|
|
2
|
+
// Built: 2026-10-12T06:23:05.041Z
|
|
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, logger15) {
|
|
|
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, logger15) {
|
|
|
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;
|
|
@@ -46012,12 +46112,12 @@ function getScanWarnThreshold() {
|
|
|
46012
46112
|
const value = Number(raw);
|
|
46013
46113
|
return Number.isInteger(value) && value >= 1 ? value : DEFAULT_SCAN_WARN_THRESHOLD;
|
|
46014
46114
|
}
|
|
46015
|
-
var
|
|
46115
|
+
var logger4, SPARSE_SCAN_EVENT, DEFAULT_SCAN_WARN_THRESHOLD, ScanWatcher;
|
|
46016
46116
|
var init_scanWarning = __esm({
|
|
46017
46117
|
"src/server/utils/scanWarning.ts"() {
|
|
46018
46118
|
"use strict";
|
|
46019
46119
|
init_shared();
|
|
46020
|
-
|
|
46120
|
+
logger4 = createLogger({ service: "scan-warning", level: "warn" });
|
|
46021
46121
|
SPARSE_SCAN_EVENT = "SPARSE_SCAN";
|
|
46022
46122
|
DEFAULT_SCAN_WARN_THRESHOLD = 5e3;
|
|
46023
46123
|
__name(getScanWarnThreshold, "getScanWarnThreshold");
|
|
@@ -46036,7 +46136,7 @@ var init_scanWarning = __esm({
|
|
|
46036
46136
|
this.scanned += count;
|
|
46037
46137
|
if (!this.warned && this.scanned >= this.threshold) {
|
|
46038
46138
|
this.warned = true;
|
|
46039
|
-
|
|
46139
|
+
logger4.warn(
|
|
46040
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`,
|
|
46041
46141
|
{
|
|
46042
46142
|
event: SPARSE_SCAN_EVENT,
|
|
@@ -46144,7 +46244,7 @@ function parseFilters(filter) {
|
|
|
46144
46244
|
parsedFilters.push({ parsed, value });
|
|
46145
46245
|
}
|
|
46146
46246
|
} catch (error2) {
|
|
46147
|
-
|
|
46247
|
+
logger5.error("Invalid filter field syntax", {
|
|
46148
46248
|
fieldKey,
|
|
46149
46249
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
46150
46250
|
});
|
|
@@ -46213,7 +46313,7 @@ function detectNearQuery(filter) {
|
|
|
46213
46313
|
}
|
|
46214
46314
|
return null;
|
|
46215
46315
|
}
|
|
46216
|
-
var
|
|
46316
|
+
var logger5;
|
|
46217
46317
|
var init_utils5 = __esm({
|
|
46218
46318
|
"src/server/operations/find/utils.ts"() {
|
|
46219
46319
|
"use strict";
|
|
@@ -46222,7 +46322,7 @@ var init_utils5 = __esm({
|
|
|
46222
46322
|
init_shadow();
|
|
46223
46323
|
init_filter();
|
|
46224
46324
|
init_validation2();
|
|
46225
|
-
|
|
46325
|
+
logger5 = createLogger({
|
|
46226
46326
|
service: "find-utils",
|
|
46227
46327
|
level: process.env.LOG_LEVEL || "info"
|
|
46228
46328
|
});
|
|
@@ -46239,7 +46339,7 @@ var init_utils5 = __esm({
|
|
|
46239
46339
|
async function executeIdQuery(resource, normalizedParams, requestId) {
|
|
46240
46340
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
46241
46341
|
const { perPage, nextToken } = pagination;
|
|
46242
|
-
|
|
46342
|
+
logger6.debug("Executing ID optimized query", {
|
|
46243
46343
|
requestId,
|
|
46244
46344
|
resource,
|
|
46245
46345
|
sort,
|
|
@@ -46260,7 +46360,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
46260
46360
|
const costTracker = new CostTracker();
|
|
46261
46361
|
const queryResult = await executeDynamoDBOperation(
|
|
46262
46362
|
() => dbClient2.send(
|
|
46263
|
-
new
|
|
46363
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46264
46364
|
TableName: tableName,
|
|
46265
46365
|
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
46266
46366
|
ExpressionAttributeValues: {
|
|
@@ -46276,7 +46376,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
46276
46376
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
46277
46377
|
const mainRecords = queryResult.Items || [];
|
|
46278
46378
|
const items = mainRecords.map((item) => extractCleanRecord(item));
|
|
46279
|
-
|
|
46379
|
+
logger6.info("ID specific query succeeded", {
|
|
46280
46380
|
requestId,
|
|
46281
46381
|
resource,
|
|
46282
46382
|
targetId,
|
|
@@ -46299,7 +46399,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
46299
46399
|
targetIds.map(
|
|
46300
46400
|
(id) => executeDynamoDBOperation(
|
|
46301
46401
|
() => dbClient2.send(
|
|
46302
|
-
new
|
|
46402
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46303
46403
|
TableName: tableName,
|
|
46304
46404
|
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
46305
46405
|
ExpressionAttributeValues: {
|
|
@@ -46323,7 +46423,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
46323
46423
|
const bVal = String(b4.id ?? "");
|
|
46324
46424
|
return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
46325
46425
|
});
|
|
46326
|
-
|
|
46426
|
+
logger6.info("ID $in query succeeded", {
|
|
46327
46427
|
requestId,
|
|
46328
46428
|
resource,
|
|
46329
46429
|
requestedCount: targetIds.length,
|
|
@@ -46362,7 +46462,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
46362
46462
|
}
|
|
46363
46463
|
const queryResult = await executeDynamoDBOperation(
|
|
46364
46464
|
() => dbClient2.send(
|
|
46365
|
-
new
|
|
46465
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46366
46466
|
TableName: tableName,
|
|
46367
46467
|
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
46368
46468
|
ExpressionAttributeValues: {
|
|
@@ -46399,7 +46499,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
46399
46499
|
queryResult.LastEvaluatedKey.PK,
|
|
46400
46500
|
queryResult.LastEvaluatedKey.SK
|
|
46401
46501
|
) : void 0;
|
|
46402
|
-
|
|
46502
|
+
logger6.info("ID all records query succeeded", {
|
|
46403
46503
|
requestId,
|
|
46404
46504
|
resource,
|
|
46405
46505
|
count: items.length,
|
|
@@ -46440,7 +46540,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46440
46540
|
});
|
|
46441
46541
|
scan: while (true) {
|
|
46442
46542
|
if (++iterations > SCAN_MAX_ITERATIONS) {
|
|
46443
|
-
|
|
46543
|
+
logger6.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
46444
46544
|
requestId,
|
|
46445
46545
|
resource,
|
|
46446
46546
|
iterations
|
|
@@ -46452,7 +46552,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46452
46552
|
}
|
|
46453
46553
|
const queryResult = await executeDynamoDBOperation(
|
|
46454
46554
|
() => dbClient2.send(
|
|
46455
|
-
new
|
|
46555
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
46456
46556
|
TableName: tableName,
|
|
46457
46557
|
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
46458
46558
|
ExpressionAttributeValues: {
|
|
@@ -46488,7 +46588,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46488
46588
|
}
|
|
46489
46589
|
const nextKeySignature = `${nextKey.PK}#${nextKey.SK}`;
|
|
46490
46590
|
if (nextKeySignature === previousKeySignature) {
|
|
46491
|
-
|
|
46591
|
+
logger6.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
46492
46592
|
requestId,
|
|
46493
46593
|
resource,
|
|
46494
46594
|
iterations
|
|
@@ -46505,7 +46605,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46505
46605
|
chunkSize = Math.min(chunkSize * 2, SCAN_CHUNK_MAX);
|
|
46506
46606
|
}
|
|
46507
46607
|
const nextTokenValue = hasNextPage && lastReturned ? encodeNextToken(lastReturned.PK, lastReturned.SK) : void 0;
|
|
46508
|
-
|
|
46608
|
+
logger6.info("ID filtered scan query succeeded", {
|
|
46509
46609
|
requestId,
|
|
46510
46610
|
resource,
|
|
46511
46611
|
scanned,
|
|
@@ -46519,18 +46619,18 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
46519
46619
|
consumedCapacity: costTracker.getAggregated()
|
|
46520
46620
|
};
|
|
46521
46621
|
}
|
|
46522
|
-
var
|
|
46622
|
+
var import_lib_dynamodb3, logger6, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
|
|
46523
46623
|
var init_idQuery = __esm({
|
|
46524
46624
|
"src/server/operations/find/idQuery.ts"() {
|
|
46525
46625
|
"use strict";
|
|
46526
|
-
|
|
46626
|
+
import_lib_dynamodb3 = __toESM(require_dist_cjs80(), 1);
|
|
46527
46627
|
init_shared();
|
|
46528
46628
|
init_cost_tracker();
|
|
46529
46629
|
init_dynamodb3();
|
|
46530
46630
|
init_pagination();
|
|
46531
46631
|
init_scanWarning();
|
|
46532
46632
|
init_utils5();
|
|
46533
|
-
|
|
46633
|
+
logger6 = createLogger({
|
|
46534
46634
|
service: "id-query",
|
|
46535
46635
|
level: process.env.LOG_LEVEL || "info"
|
|
46536
46636
|
});
|
|
@@ -46547,7 +46647,7 @@ var init_idQuery = __esm({
|
|
|
46547
46647
|
|
|
46548
46648
|
// src/server/operations/find/nearQuery.ts
|
|
46549
46649
|
async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId) {
|
|
46550
|
-
|
|
46650
|
+
logger7.debug("Executing $near query", {
|
|
46551
46651
|
requestId,
|
|
46552
46652
|
resource,
|
|
46553
46653
|
fieldName,
|
|
@@ -46558,32 +46658,58 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46558
46658
|
const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
|
|
46559
46659
|
const dbClient2 = getDBClient();
|
|
46560
46660
|
const tableName = getTableName();
|
|
46561
|
-
|
|
46661
|
+
logger7.debug("Searching shadow records", {
|
|
46562
46662
|
requestId,
|
|
46563
46663
|
resource,
|
|
46564
46664
|
fieldName,
|
|
46565
46665
|
geohashPrefix,
|
|
46566
46666
|
skPrefix: `${fieldName}#${geohashPrefix}`
|
|
46567
46667
|
});
|
|
46568
|
-
const
|
|
46569
|
-
|
|
46570
|
-
|
|
46571
|
-
|
|
46572
|
-
|
|
46573
|
-
|
|
46574
|
-
|
|
46575
|
-
|
|
46576
|
-
|
|
46577
|
-
|
|
46578
|
-
|
|
46579
|
-
|
|
46580
|
-
|
|
46581
|
-
|
|
46582
|
-
|
|
46583
|
-
|
|
46584
|
-
|
|
46585
|
-
|
|
46586
|
-
|
|
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", {
|
|
46587
46713
|
requestId,
|
|
46588
46714
|
resource,
|
|
46589
46715
|
geohashPrefix,
|
|
@@ -46594,48 +46720,24 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46594
46720
|
const parts = sk.split("#id#");
|
|
46595
46721
|
return parts.length === 2 ? parts[1] : null;
|
|
46596
46722
|
}).filter((id) => id !== null);
|
|
46597
|
-
|
|
46723
|
+
logger7.debug("Main record IDs extracted", {
|
|
46598
46724
|
requestId,
|
|
46599
46725
|
resource,
|
|
46600
46726
|
geohashPrefix,
|
|
46601
46727
|
ids: mainRecordIds
|
|
46602
46728
|
});
|
|
46603
|
-
const
|
|
46604
|
-
|
|
46605
|
-
|
|
46606
|
-
|
|
46607
|
-
|
|
46608
|
-
() => dbClient2.send(
|
|
46609
|
-
new import_lib_dynamodb3.BatchGetCommand({
|
|
46610
|
-
RequestItems: {
|
|
46611
|
-
[tableName]: {
|
|
46612
|
-
Keys: chunk.map((id) => ({
|
|
46613
|
-
PK: resource,
|
|
46614
|
-
SK: `id#${id}`
|
|
46615
|
-
})),
|
|
46616
|
-
ConsistentRead: false
|
|
46617
|
-
}
|
|
46618
|
-
},
|
|
46619
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
46620
|
-
})
|
|
46621
|
-
),
|
|
46622
|
-
"BatchGetItem"
|
|
46623
|
-
);
|
|
46624
|
-
if (batchGetResult.ConsumedCapacity) {
|
|
46625
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
46626
|
-
costTracker.add(capacity);
|
|
46627
|
-
}
|
|
46628
|
-
}
|
|
46629
|
-
validRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
46630
|
-
}
|
|
46631
|
-
logger6.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", {
|
|
46632
46734
|
requestId,
|
|
46633
46735
|
resource,
|
|
46634
46736
|
geohashPrefix,
|
|
46635
46737
|
count: validRecords.length
|
|
46636
46738
|
});
|
|
46637
46739
|
const cleanRecords = validRecords.map((record) => extractCleanRecord(record));
|
|
46638
|
-
|
|
46740
|
+
logger7.debug("Clean records extracted", {
|
|
46639
46741
|
requestId,
|
|
46640
46742
|
resource,
|
|
46641
46743
|
geohashPrefix,
|
|
@@ -46654,7 +46756,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46654
46756
|
config
|
|
46655
46757
|
);
|
|
46656
46758
|
const items = result.documents;
|
|
46657
|
-
|
|
46759
|
+
logger7.info("$near query succeeded", {
|
|
46658
46760
|
requestId,
|
|
46659
46761
|
resource,
|
|
46660
46762
|
fieldName,
|
|
@@ -46672,17 +46774,19 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
46672
46774
|
consumedCapacity: costTracker.getAggregated()
|
|
46673
46775
|
};
|
|
46674
46776
|
}
|
|
46675
|
-
var
|
|
46777
|
+
var import_lib_dynamodb4, logger7;
|
|
46676
46778
|
var init_nearQuery = __esm({
|
|
46677
46779
|
"src/server/operations/find/nearQuery.ts"() {
|
|
46678
46780
|
"use strict";
|
|
46679
|
-
|
|
46781
|
+
import_lib_dynamodb4 = __toESM(require_dist_cjs80(), 1);
|
|
46680
46782
|
init_geohash();
|
|
46681
46783
|
init_shared();
|
|
46682
46784
|
init_nearSearch();
|
|
46785
|
+
init_batchGet();
|
|
46683
46786
|
init_cost_tracker();
|
|
46684
46787
|
init_dynamodb3();
|
|
46685
|
-
|
|
46788
|
+
init_scanWarning();
|
|
46789
|
+
logger7 = createLogger({
|
|
46686
46790
|
service: "near-query",
|
|
46687
46791
|
level: process.env.LOG_LEVEL || "info"
|
|
46688
46792
|
});
|
|
@@ -46712,7 +46816,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46712
46816
|
(f4) => !(isKeyConditionOptimized && f4 === optimizableFilter)
|
|
46713
46817
|
);
|
|
46714
46818
|
if (residualFilters.length > 0) {
|
|
46715
|
-
|
|
46819
|
+
logger8.debug("Residual filters detected, falling back to full scan", {
|
|
46716
46820
|
requestId,
|
|
46717
46821
|
resource,
|
|
46718
46822
|
sortField: sort.field,
|
|
@@ -46720,7 +46824,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46720
46824
|
});
|
|
46721
46825
|
return executeFullScanQuery(resource, normalizedParams, costTracker, requestId);
|
|
46722
46826
|
}
|
|
46723
|
-
|
|
46827
|
+
logger8.debug("Executing shadow query", {
|
|
46724
46828
|
requestId,
|
|
46725
46829
|
resource,
|
|
46726
46830
|
sortField: sort.field,
|
|
@@ -46768,7 +46872,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
46768
46872
|
shadowRecords.LastEvaluatedKey.PK,
|
|
46769
46873
|
shadowRecords.LastEvaluatedKey.SK
|
|
46770
46874
|
) : void 0;
|
|
46771
|
-
|
|
46875
|
+
logger8.info("Shadow query succeeded", {
|
|
46772
46876
|
requestId,
|
|
46773
46877
|
resource,
|
|
46774
46878
|
sortField: sort.field,
|
|
@@ -46793,7 +46897,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46793
46897
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
46794
46898
|
const filterSort = { field: filterCandidate.parsed.field, order: "ASC" };
|
|
46795
46899
|
const remainingFilters = parsedFilters.filter((f4) => f4 !== filterCandidate);
|
|
46796
|
-
|
|
46900
|
+
logger8.debug("Executing filter-first query", {
|
|
46797
46901
|
requestId,
|
|
46798
46902
|
resource,
|
|
46799
46903
|
filterField: filterCandidate.parsed.field,
|
|
@@ -46816,7 +46920,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
46816
46920
|
const page = items.slice(offset, offset + perPage);
|
|
46817
46921
|
const hasNextPage = offset + perPage < items.length;
|
|
46818
46922
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46819
|
-
|
|
46923
|
+
logger8.info("Filter-first query succeeded", {
|
|
46820
46924
|
requestId,
|
|
46821
46925
|
resource,
|
|
46822
46926
|
filterField: filterCandidate.parsed.field,
|
|
@@ -46837,7 +46941,7 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
46837
46941
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
46838
46942
|
const { perPage, nextToken } = pagination;
|
|
46839
46943
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
46840
|
-
|
|
46944
|
+
logger8.debug("Executing full scan query", {
|
|
46841
46945
|
requestId,
|
|
46842
46946
|
resource,
|
|
46843
46947
|
sortField: sort.field,
|
|
@@ -46858,7 +46962,7 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
46858
46962
|
const page = items.slice(offset, offset + perPage);
|
|
46859
46963
|
const hasNextPage = offset + perPage < items.length;
|
|
46860
46964
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
46861
|
-
|
|
46965
|
+
logger8.info("Full scan query succeeded", {
|
|
46862
46966
|
requestId,
|
|
46863
46967
|
resource,
|
|
46864
46968
|
sortField: sort.field,
|
|
@@ -46889,7 +46993,7 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
46889
46993
|
let iterations = 0;
|
|
46890
46994
|
do {
|
|
46891
46995
|
if (++iterations > MAX_ITERATIONS) {
|
|
46892
|
-
|
|
46996
|
+
logger8.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
46893
46997
|
requestId,
|
|
46894
46998
|
resource,
|
|
46895
46999
|
iterations
|
|
@@ -46919,7 +47023,7 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
46919
47023
|
const nextKey = result.LastEvaluatedKey;
|
|
46920
47024
|
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
46921
47025
|
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
46922
|
-
|
|
47026
|
+
logger8.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
46923
47027
|
requestId,
|
|
46924
47028
|
resource,
|
|
46925
47029
|
iterations
|
|
@@ -46991,7 +47095,7 @@ async function executeShadowRecordQuery(resource, sort, perPage, nextToken, opti
|
|
|
46991
47095
|
);
|
|
46992
47096
|
const result = await executeDynamoDBOperation(
|
|
46993
47097
|
() => dbClient2.send(
|
|
46994
|
-
new
|
|
47098
|
+
new import_lib_dynamodb5.QueryCommand({
|
|
46995
47099
|
TableName: tableName,
|
|
46996
47100
|
KeyConditionExpression: keyConditionExpression,
|
|
46997
47101
|
ExpressionAttributeValues: expressionAttributeValues,
|
|
@@ -47099,63 +47203,37 @@ function encodeValueForShadowSK(value, type) {
|
|
|
47099
47203
|
function extractRecordIds(shadowRecords) {
|
|
47100
47204
|
return shadowRecords.map((record) => {
|
|
47101
47205
|
const sk = record.SK;
|
|
47102
|
-
const
|
|
47103
|
-
return
|
|
47206
|
+
const index = sk.lastIndexOf("#id#");
|
|
47207
|
+
return index >= 0 ? sk.slice(index + "#id#".length) : null;
|
|
47104
47208
|
}).filter((id) => id !== null);
|
|
47105
47209
|
}
|
|
47106
47210
|
async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
47107
|
-
const
|
|
47108
|
-
|
|
47109
|
-
|
|
47110
|
-
|
|
47111
|
-
|
|
47112
|
-
for (let i4 = 0; i4 < uniqueRecordIds.length; i4 += BATCH_SIZE) {
|
|
47113
|
-
const chunk = uniqueRecordIds.slice(i4, i4 + BATCH_SIZE);
|
|
47114
|
-
const batchGetResult = await executeDynamoDBOperation(
|
|
47115
|
-
() => dbClient2.send(
|
|
47116
|
-
new import_lib_dynamodb4.BatchGetCommand({
|
|
47117
|
-
RequestItems: {
|
|
47118
|
-
[tableName]: {
|
|
47119
|
-
Keys: chunk.map((id) => ({
|
|
47120
|
-
PK: resource,
|
|
47121
|
-
SK: `id#${id}`
|
|
47122
|
-
})),
|
|
47123
|
-
ConsistentRead: true
|
|
47124
|
-
}
|
|
47125
|
-
},
|
|
47126
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
47127
|
-
})
|
|
47128
|
-
),
|
|
47129
|
-
"BatchGetItem"
|
|
47130
|
-
);
|
|
47131
|
-
if (batchGetResult.ConsumedCapacity) {
|
|
47132
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
47133
|
-
costTracker.add(capacity);
|
|
47134
|
-
}
|
|
47135
|
-
}
|
|
47136
|
-
allRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
47137
|
-
}
|
|
47138
|
-
logger7.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", {
|
|
47139
47216
|
requestId,
|
|
47140
47217
|
resource,
|
|
47141
|
-
requestedCount:
|
|
47218
|
+
requestedCount: new Set(recordIds).size,
|
|
47142
47219
|
fetchedCount: allRecords.length
|
|
47143
47220
|
});
|
|
47144
47221
|
return allRecords;
|
|
47145
47222
|
}
|
|
47146
|
-
var
|
|
47223
|
+
var import_lib_dynamodb5, logger8, KEY_CONDITION_OPERATORS;
|
|
47147
47224
|
var init_shadowQuery = __esm({
|
|
47148
47225
|
"src/server/operations/find/shadowQuery.ts"() {
|
|
47149
47226
|
"use strict";
|
|
47150
|
-
|
|
47227
|
+
import_lib_dynamodb5 = __toESM(require_dist_cjs80(), 1);
|
|
47151
47228
|
init_formatting();
|
|
47152
47229
|
init_shared();
|
|
47230
|
+
init_batchGet();
|
|
47153
47231
|
init_cost_tracker();
|
|
47154
47232
|
init_dynamodb3();
|
|
47155
47233
|
init_pagination();
|
|
47156
47234
|
init_scanWarning();
|
|
47157
47235
|
init_utils5();
|
|
47158
|
-
|
|
47236
|
+
logger8 = createLogger({
|
|
47159
47237
|
service: "shadow-query",
|
|
47160
47238
|
level: process.env.LOG_LEVEL || "info"
|
|
47161
47239
|
});
|
|
@@ -47176,14 +47254,14 @@ var init_shadowQuery = __esm({
|
|
|
47176
47254
|
|
|
47177
47255
|
// src/server/operations/find/handler.ts
|
|
47178
47256
|
async function handleFind(resource, params, requestId) {
|
|
47179
|
-
|
|
47257
|
+
logger9.debug("Executing find", {
|
|
47180
47258
|
requestId,
|
|
47181
47259
|
resource,
|
|
47182
47260
|
params
|
|
47183
47261
|
});
|
|
47184
47262
|
const nearDetection = detectNearQuery(params.filter);
|
|
47185
47263
|
if (nearDetection) {
|
|
47186
|
-
|
|
47264
|
+
logger9.debug("$near operator detected, executing near search", {
|
|
47187
47265
|
requestId,
|
|
47188
47266
|
resource,
|
|
47189
47267
|
fieldName: nearDetection.fieldName
|
|
@@ -47200,7 +47278,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
47200
47278
|
const config = initializeFindConfig();
|
|
47201
47279
|
const normalizedParams = normalizeFindParams(config, resource, params);
|
|
47202
47280
|
validateSortField(config, resource, normalizedParams.sort);
|
|
47203
|
-
|
|
47281
|
+
logger9.debug("Find parameters normalized", {
|
|
47204
47282
|
requestId,
|
|
47205
47283
|
resource,
|
|
47206
47284
|
sort: normalizedParams.sort,
|
|
@@ -47215,7 +47293,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
47215
47293
|
}
|
|
47216
47294
|
return executeShadowQuery(resource, normalizedParams, requestId);
|
|
47217
47295
|
}
|
|
47218
|
-
var
|
|
47296
|
+
var logger9;
|
|
47219
47297
|
var init_handler = __esm({
|
|
47220
47298
|
"src/server/operations/find/handler.ts"() {
|
|
47221
47299
|
"use strict";
|
|
@@ -47225,7 +47303,7 @@ var init_handler = __esm({
|
|
|
47225
47303
|
init_nearQuery();
|
|
47226
47304
|
init_shadowQuery();
|
|
47227
47305
|
init_utils5();
|
|
47228
|
-
|
|
47306
|
+
logger9 = createLogger({
|
|
47229
47307
|
service: "find-handler",
|
|
47230
47308
|
level: process.env.LOG_LEVEL || "info"
|
|
47231
47309
|
});
|
|
@@ -47234,10 +47312,6 @@ var init_handler = __esm({
|
|
|
47234
47312
|
});
|
|
47235
47313
|
|
|
47236
47314
|
// src/server/operations/find.ts
|
|
47237
|
-
var find_exports = {};
|
|
47238
|
-
__export(find_exports, {
|
|
47239
|
-
handleFind: () => handleFind
|
|
47240
|
-
});
|
|
47241
47315
|
var init_find = __esm({
|
|
47242
47316
|
"src/server/operations/find.ts"() {
|
|
47243
47317
|
"use strict";
|
|
@@ -47245,10 +47319,64 @@ var init_find = __esm({
|
|
|
47245
47319
|
}
|
|
47246
47320
|
});
|
|
47247
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
|
+
|
|
47248
47376
|
// src/server/utils/bulkOperations.ts
|
|
47249
47377
|
function logLargeBatchWarning(operation2, recordCount, requestId, resource) {
|
|
47250
47378
|
if (recordCount > LARGE_BATCH_WARNING_THRESHOLD) {
|
|
47251
|
-
|
|
47379
|
+
logger11.warn(`Large batch ${operation2} operation detected`, {
|
|
47252
47380
|
requestId,
|
|
47253
47381
|
resource,
|
|
47254
47382
|
recordCount,
|
|
@@ -47271,7 +47399,7 @@ function calculateTimeoutRisk(startTime) {
|
|
|
47271
47399
|
};
|
|
47272
47400
|
}
|
|
47273
47401
|
function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount, riskInfo) {
|
|
47274
|
-
|
|
47402
|
+
logger11.info("Records prepared for chunk execution", {
|
|
47275
47403
|
requestId,
|
|
47276
47404
|
resource,
|
|
47277
47405
|
totalRecords,
|
|
@@ -47281,7 +47409,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
47281
47409
|
timeoutRisk: riskInfo.risk
|
|
47282
47410
|
});
|
|
47283
47411
|
if (riskInfo.risk === "high") {
|
|
47284
|
-
|
|
47412
|
+
logger11.warn("High timeout risk detected during preparation phase", {
|
|
47285
47413
|
requestId,
|
|
47286
47414
|
resource,
|
|
47287
47415
|
preparationElapsedMs: riskInfo.elapsedMs,
|
|
@@ -47293,7 +47421,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
47293
47421
|
}
|
|
47294
47422
|
function logBulkOperationComplete(operation2, requestId, resource, requested, succeeded, failed, riskInfo, additionalInfo) {
|
|
47295
47423
|
const totalElapsedSeconds = Math.round(riskInfo.elapsedMs / 1e3);
|
|
47296
|
-
|
|
47424
|
+
logger11.info(`${operation2} completed`, {
|
|
47297
47425
|
requestId,
|
|
47298
47426
|
resource,
|
|
47299
47427
|
requested,
|
|
@@ -47308,7 +47436,7 @@ function logBulkOperationComplete(operation2, requestId, resource, requested, su
|
|
|
47308
47436
|
}
|
|
47309
47437
|
function logPartialFailure(operation2, requestId, resource, requested, succeeded, failed, errorCodes, additionalInfo) {
|
|
47310
47438
|
const failureRate = Math.round(failed / requested * 100);
|
|
47311
|
-
|
|
47439
|
+
logger11.warn(`Partial failure in ${operation2} operation`, {
|
|
47312
47440
|
requestId,
|
|
47313
47441
|
resource,
|
|
47314
47442
|
totalRequested: requested,
|
|
@@ -47319,12 +47447,12 @@ function logPartialFailure(operation2, requestId, resource, requested, succeeded
|
|
|
47319
47447
|
...additionalInfo
|
|
47320
47448
|
});
|
|
47321
47449
|
}
|
|
47322
|
-
var
|
|
47450
|
+
var logger11;
|
|
47323
47451
|
var init_bulkOperations = __esm({
|
|
47324
47452
|
"src/server/utils/bulkOperations.ts"() {
|
|
47325
47453
|
"use strict";
|
|
47326
47454
|
init_shared();
|
|
47327
|
-
|
|
47455
|
+
logger11 = createLogger({ service: "records-lambda" });
|
|
47328
47456
|
__name(logLargeBatchWarning, "logLargeBatchWarning");
|
|
47329
47457
|
__name(calculateTimeoutRisk, "calculateTimeoutRisk");
|
|
47330
47458
|
__name(logPreparationTimeoutRisk, "logPreparationTimeoutRisk");
|
|
@@ -47343,7 +47471,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
47343
47471
|
const itemCount = getItemCount(record);
|
|
47344
47472
|
if (itemCount > DYNAMODB_TRANSACT_WRITE_MAX_ITEMS) {
|
|
47345
47473
|
const errorMsg = `Single record exceeds ${DYNAMODB_TRANSACT_WRITE_MAX_ITEMS} items limit: ${itemCount} items`;
|
|
47346
|
-
|
|
47474
|
+
logger12.error("Chunk validation failed", {
|
|
47347
47475
|
itemCount,
|
|
47348
47476
|
limit: DYNAMODB_TRANSACT_WRITE_MAX_ITEMS
|
|
47349
47477
|
});
|
|
@@ -47365,7 +47493,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
47365
47493
|
chunks.push(currentChunk);
|
|
47366
47494
|
itemCounts.push(currentItemCount);
|
|
47367
47495
|
}
|
|
47368
|
-
|
|
47496
|
+
logger12.info("Chunk calculation completed", {
|
|
47369
47497
|
totalRecords: records.length,
|
|
47370
47498
|
chunkCount: chunks.length,
|
|
47371
47499
|
itemCounts,
|
|
@@ -47381,7 +47509,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47381
47509
|
const errors = [];
|
|
47382
47510
|
const totalRecords = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
47383
47511
|
const executionStartTime = Date.now();
|
|
47384
|
-
|
|
47512
|
+
logger12.info("Starting chunk execution", {
|
|
47385
47513
|
totalChunks: chunks.length,
|
|
47386
47514
|
totalRecords
|
|
47387
47515
|
});
|
|
@@ -47389,14 +47517,14 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47389
47517
|
const chunk = chunks[i4];
|
|
47390
47518
|
const chunkStartTime = Date.now();
|
|
47391
47519
|
try {
|
|
47392
|
-
|
|
47520
|
+
logger12.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
|
|
47393
47521
|
chunkIndex: i4,
|
|
47394
47522
|
recordCount: chunk.length
|
|
47395
47523
|
});
|
|
47396
47524
|
const successfulRecords = await executeChunk(chunk);
|
|
47397
47525
|
successRecords.push(...successfulRecords);
|
|
47398
47526
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
47399
|
-
|
|
47527
|
+
logger12.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
|
|
47400
47528
|
chunkIndex: i4,
|
|
47401
47529
|
recordCount: chunk.length,
|
|
47402
47530
|
durationMs: chunkDuration
|
|
@@ -47405,7 +47533,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47405
47533
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
47406
47534
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
|
|
47407
47535
|
const errorCode = getErrorCode(error2);
|
|
47408
|
-
|
|
47536
|
+
logger12.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
|
|
47409
47537
|
chunkIndex: i4,
|
|
47410
47538
|
recordCount: chunk.length,
|
|
47411
47539
|
durationMs: chunkDuration,
|
|
@@ -47424,7 +47552,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47424
47552
|
}
|
|
47425
47553
|
}
|
|
47426
47554
|
const totalExecutionTime = Date.now() - executionStartTime;
|
|
47427
|
-
|
|
47555
|
+
logger12.info("Chunk execution completed", {
|
|
47428
47556
|
totalChunks: chunks.length,
|
|
47429
47557
|
totalRecords,
|
|
47430
47558
|
successCount: successRecords.length,
|
|
@@ -47433,7 +47561,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
47433
47561
|
avgTimePerChunkMs: chunks.length > 0 ? Math.round(totalExecutionTime / chunks.length) : 0
|
|
47434
47562
|
});
|
|
47435
47563
|
if (failedIds.length > 0) {
|
|
47436
|
-
|
|
47564
|
+
logger12.warn("Partial failure detected in chunk execution", {
|
|
47437
47565
|
totalRecords,
|
|
47438
47566
|
successCount: successRecords.length,
|
|
47439
47567
|
failedCount: failedIds.length,
|
|
@@ -47465,12 +47593,12 @@ function getErrorCode(error2) {
|
|
|
47465
47593
|
}
|
|
47466
47594
|
return "TRANSACTION_FAILED";
|
|
47467
47595
|
}
|
|
47468
|
-
var
|
|
47596
|
+
var logger12;
|
|
47469
47597
|
var init_chunking = __esm({
|
|
47470
47598
|
"src/server/utils/chunking.ts"() {
|
|
47471
47599
|
"use strict";
|
|
47472
47600
|
init_shared();
|
|
47473
|
-
|
|
47601
|
+
logger12 = createLogger({ service: "records-lambda" });
|
|
47474
47602
|
__name(calculateChunks, "calculateChunks");
|
|
47475
47603
|
__name(executeChunks, "executeChunks");
|
|
47476
47604
|
__name(getErrorCode, "getErrorCode");
|
|
@@ -47641,7 +47769,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47641
47769
|
const upsert = options?.upsert ?? false;
|
|
47642
47770
|
const startTime = Date.now();
|
|
47643
47771
|
const costTracker = new CostTracker();
|
|
47644
|
-
|
|
47772
|
+
logger13.debug("Executing updateMany", {
|
|
47645
47773
|
requestId,
|
|
47646
47774
|
resource,
|
|
47647
47775
|
upsert
|
|
@@ -47649,21 +47777,31 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47649
47777
|
let ids;
|
|
47650
47778
|
if ("ids" in params) {
|
|
47651
47779
|
ids = params.ids;
|
|
47652
|
-
|
|
47780
|
+
logger13.debug("Executing updateMany with ids", {
|
|
47653
47781
|
requestId,
|
|
47654
47782
|
resource,
|
|
47655
47783
|
count: ids.length
|
|
47656
47784
|
});
|
|
47657
47785
|
} else {
|
|
47658
|
-
|
|
47786
|
+
logger13.debug("Executing updateMany with filter", {
|
|
47659
47787
|
requestId,
|
|
47660
47788
|
resource,
|
|
47661
47789
|
filter: params.filter
|
|
47662
47790
|
});
|
|
47663
|
-
|
|
47664
|
-
|
|
47665
|
-
|
|
47666
|
-
|
|
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", {
|
|
47667
47805
|
requestId,
|
|
47668
47806
|
resource,
|
|
47669
47807
|
count: ids.length
|
|
@@ -47672,7 +47810,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47672
47810
|
if (upsert) {
|
|
47673
47811
|
const newId = ulid2();
|
|
47674
47812
|
ids = [newId];
|
|
47675
|
-
|
|
47813
|
+
logger13.info("Creating new record with filter (upsert: true)", {
|
|
47676
47814
|
requestId,
|
|
47677
47815
|
resource,
|
|
47678
47816
|
newId,
|
|
@@ -47702,32 +47840,10 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47702
47840
|
logLargeBatchWarning("updateMany", ids.length, requestId, resource);
|
|
47703
47841
|
const dbClient2 = getDBClient();
|
|
47704
47842
|
const tableName = getTableName();
|
|
47705
|
-
const
|
|
47706
|
-
PK: resource,
|
|
47707
|
-
|
|
47708
|
-
}));
|
|
47709
|
-
const batchGetResult = await executeDynamoDBOperation(
|
|
47710
|
-
() => dbClient2.send(
|
|
47711
|
-
new import_lib_dynamodb6.BatchGetCommand({
|
|
47712
|
-
RequestItems: {
|
|
47713
|
-
[tableName]: {
|
|
47714
|
-
Keys: keys,
|
|
47715
|
-
ConsistentRead: true
|
|
47716
|
-
}
|
|
47717
|
-
},
|
|
47718
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
47719
|
-
})
|
|
47720
|
-
),
|
|
47721
|
-
"BatchGetItem"
|
|
47843
|
+
const existingItems = await batchGetAll(
|
|
47844
|
+
ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
|
|
47845
|
+
{ consistentRead: true, costTracker, requestId }
|
|
47722
47846
|
);
|
|
47723
|
-
if (Array.isArray(batchGetResult.ConsumedCapacity)) {
|
|
47724
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
47725
|
-
costTracker.add(capacity);
|
|
47726
|
-
}
|
|
47727
|
-
} else {
|
|
47728
|
-
costTracker.add(batchGetResult.ConsumedCapacity);
|
|
47729
|
-
}
|
|
47730
|
-
const existingItems = batchGetResult.Responses?.[tableName] || [];
|
|
47731
47847
|
const existingIds = new Set(
|
|
47732
47848
|
existingItems.map((item) => {
|
|
47733
47849
|
const data = item.data;
|
|
@@ -47736,7 +47852,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47736
47852
|
);
|
|
47737
47853
|
const notFoundIds = ids.filter((id) => !existingIds.has(id));
|
|
47738
47854
|
if (!upsert && notFoundIds.length > 0) {
|
|
47739
|
-
|
|
47855
|
+
logger13.warn("Records not found (upsert: false)", {
|
|
47740
47856
|
requestId,
|
|
47741
47857
|
resource,
|
|
47742
47858
|
notFoundCount: notFoundIds.length,
|
|
@@ -47745,7 +47861,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47745
47861
|
});
|
|
47746
47862
|
}
|
|
47747
47863
|
if (upsert && notFoundIds.length > 0) {
|
|
47748
|
-
|
|
47864
|
+
logger13.info("Creating new records (upsert: true)", {
|
|
47749
47865
|
requestId,
|
|
47750
47866
|
resource,
|
|
47751
47867
|
notFoundCount: notFoundIds.length,
|
|
@@ -47781,7 +47897,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47781
47897
|
const failedId = existingData.id || "unknown-id";
|
|
47782
47898
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
47783
47899
|
const errorCode = getPreparationErrorCode(error2);
|
|
47784
|
-
|
|
47900
|
+
logger13.error("Failed to prepare record for update", {
|
|
47785
47901
|
requestId,
|
|
47786
47902
|
recordId: failedId,
|
|
47787
47903
|
error: errorMessage,
|
|
@@ -47821,7 +47937,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
47821
47937
|
} catch (error2) {
|
|
47822
47938
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
47823
47939
|
const errorCode = getPreparationErrorCode(error2);
|
|
47824
|
-
|
|
47940
|
+
logger13.error("Failed to prepare new record for upsert", {
|
|
47825
47941
|
requestId,
|
|
47826
47942
|
recordId: id,
|
|
47827
47943
|
error: errorMessage,
|
|
@@ -48034,7 +48150,7 @@ function getPreparationErrorCode(error2) {
|
|
|
48034
48150
|
}
|
|
48035
48151
|
return "VALIDATION_ERROR" /* VALIDATION_ERROR */;
|
|
48036
48152
|
}
|
|
48037
|
-
var import_lib_dynamodb6,
|
|
48153
|
+
var import_lib_dynamodb6, logger13;
|
|
48038
48154
|
var init_updateMany = __esm({
|
|
48039
48155
|
"src/server/operations/updateMany.ts"() {
|
|
48040
48156
|
"use strict";
|
|
@@ -48042,13 +48158,15 @@ var init_updateMany = __esm({
|
|
|
48042
48158
|
init_shared();
|
|
48043
48159
|
init_shadow();
|
|
48044
48160
|
init_shadow();
|
|
48161
|
+
init_batchGet();
|
|
48045
48162
|
init_bulkOperations();
|
|
48046
48163
|
init_chunking();
|
|
48047
48164
|
init_cost_tracker();
|
|
48048
48165
|
init_dynamodb3();
|
|
48049
48166
|
init_mergePatch();
|
|
48050
48167
|
init_timestamps();
|
|
48051
|
-
|
|
48168
|
+
init_findAll();
|
|
48169
|
+
logger13 = createLogger({ service: "records-lambda" });
|
|
48052
48170
|
__name(handleUpdateMany, "handleUpdateMany");
|
|
48053
48171
|
__name(getPreparationErrorCode, "getPreparationErrorCode");
|
|
48054
48172
|
}
|
|
@@ -48086,16 +48204,16 @@ function decodeOriginalFilename(raw) {
|
|
|
48086
48204
|
__name(decodeOriginalFilename, "decodeOriginalFilename");
|
|
48087
48205
|
|
|
48088
48206
|
// src/server/operations/findMany.ts
|
|
48089
|
-
var import_lib_dynamodb5 = __toESM(require_dist_cjs80(), 1);
|
|
48090
48207
|
init_shared();
|
|
48091
48208
|
init_shadow();
|
|
48209
|
+
init_batchGet();
|
|
48092
48210
|
init_dynamodb3();
|
|
48093
|
-
|
|
48094
|
-
var
|
|
48211
|
+
init_findAll();
|
|
48212
|
+
var logger10 = createLogger({ service: "records-lambda" });
|
|
48095
48213
|
async function handleFindMany(resource, params, requestId) {
|
|
48096
48214
|
if ("ids" in params) {
|
|
48097
48215
|
const { ids } = params;
|
|
48098
|
-
|
|
48216
|
+
logger10.debug("Executing findMany by ids", {
|
|
48099
48217
|
requestId,
|
|
48100
48218
|
resource,
|
|
48101
48219
|
count: ids.length
|
|
@@ -48103,28 +48221,12 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48103
48221
|
if (ids.length === 0) {
|
|
48104
48222
|
return [];
|
|
48105
48223
|
}
|
|
48106
|
-
const
|
|
48107
|
-
|
|
48108
|
-
|
|
48109
|
-
PK: resource,
|
|
48110
|
-
SK: generateMainRecordSK2(id)
|
|
48111
|
-
}));
|
|
48112
|
-
const result = await executeDynamoDBOperation(
|
|
48113
|
-
() => dbClient2.send(
|
|
48114
|
-
new import_lib_dynamodb5.BatchGetCommand({
|
|
48115
|
-
RequestItems: {
|
|
48116
|
-
[tableName]: {
|
|
48117
|
-
Keys: keys,
|
|
48118
|
-
ConsistentRead: true
|
|
48119
|
-
}
|
|
48120
|
-
}
|
|
48121
|
-
})
|
|
48122
|
-
),
|
|
48123
|
-
"BatchGetItem"
|
|
48224
|
+
const items = await batchGetAll(
|
|
48225
|
+
ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
|
|
48226
|
+
{ consistentRead: true, requestId }
|
|
48124
48227
|
);
|
|
48125
|
-
const items = result.Responses?.[tableName] || [];
|
|
48126
48228
|
const records = items.map((item) => extractCleanRecord(item));
|
|
48127
|
-
|
|
48229
|
+
logger10.info("findMany by ids succeeded", {
|
|
48128
48230
|
requestId,
|
|
48129
48231
|
resource,
|
|
48130
48232
|
requested: ids.length,
|
|
@@ -48134,25 +48236,19 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
48134
48236
|
}
|
|
48135
48237
|
if ("filter" in params) {
|
|
48136
48238
|
const { filter } = params;
|
|
48137
|
-
|
|
48239
|
+
logger10.debug("Executing findMany by filter", {
|
|
48138
48240
|
requestId,
|
|
48139
48241
|
resource,
|
|
48140
48242
|
filter
|
|
48141
48243
|
});
|
|
48142
|
-
const
|
|
48143
|
-
|
|
48144
|
-
{
|
|
48145
|
-
filter
|
|
48146
|
-
},
|
|
48147
|
-
requestId
|
|
48148
|
-
);
|
|
48149
|
-
logger9.info("findMany by filter succeeded", {
|
|
48244
|
+
const items = await findAllByFilter(resource, filter, requestId);
|
|
48245
|
+
logger10.info("findMany by filter succeeded", {
|
|
48150
48246
|
requestId,
|
|
48151
48247
|
resource,
|
|
48152
48248
|
filter,
|
|
48153
|
-
found:
|
|
48249
|
+
found: items.length
|
|
48154
48250
|
});
|
|
48155
|
-
return
|
|
48251
|
+
return items;
|
|
48156
48252
|
}
|
|
48157
48253
|
throw new Error("findMany requires either ids or filter");
|
|
48158
48254
|
}
|
|
@@ -48160,13 +48256,14 @@ __name(handleFindMany, "handleFindMany");
|
|
|
48160
48256
|
|
|
48161
48257
|
// src/server/operations/updateOne.ts
|
|
48162
48258
|
init_shared();
|
|
48163
|
-
|
|
48259
|
+
init_findAll();
|
|
48260
|
+
var logger14 = createLogger({ service: "records-lambda" });
|
|
48164
48261
|
async function handleUpdateOne(resource, params, requestId) {
|
|
48165
48262
|
const { data: patchData, options } = params;
|
|
48166
48263
|
const { handleUpdateMany: handleUpdateMany2 } = await Promise.resolve().then(() => (init_updateMany(), updateMany_exports));
|
|
48167
48264
|
if ("id" in params) {
|
|
48168
48265
|
const targetId = params.id;
|
|
48169
|
-
|
|
48266
|
+
logger14.debug("Executing updateOne with id", {
|
|
48170
48267
|
requestId,
|
|
48171
48268
|
resource,
|
|
48172
48269
|
id: targetId,
|
|
@@ -48208,19 +48305,20 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
48208
48305
|
consumedCapacity: updateManyResult.consumedCapacity
|
|
48209
48306
|
};
|
|
48210
48307
|
} else {
|
|
48211
|
-
|
|
48308
|
+
logger14.debug("Executing updateOne with filter", {
|
|
48212
48309
|
requestId,
|
|
48213
48310
|
resource,
|
|
48214
48311
|
filter: params.filter,
|
|
48215
48312
|
upsert: options?.upsert
|
|
48216
48313
|
});
|
|
48314
|
+
const target = await findOneByFilter(
|
|
48315
|
+
resource,
|
|
48316
|
+
params.filter,
|
|
48317
|
+
requestId
|
|
48318
|
+
);
|
|
48217
48319
|
const updateManyResult = await handleUpdateMany2(
|
|
48218
48320
|
resource,
|
|
48219
|
-
{
|
|
48220
|
-
filter: params.filter,
|
|
48221
|
-
data: patchData,
|
|
48222
|
-
options
|
|
48223
|
-
},
|
|
48321
|
+
target ? { ids: [target.id], data: patchData, options } : { filter: params.filter, data: patchData, options },
|
|
48224
48322
|
requestId
|
|
48225
48323
|
);
|
|
48226
48324
|
if (updateManyResult.count === 0) {
|
|
@@ -48258,7 +48356,7 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
48258
48356
|
__name(handleUpdateOne, "handleUpdateOne");
|
|
48259
48357
|
|
|
48260
48358
|
// src/server/media/process-handler-dlq.ts
|
|
48261
|
-
var
|
|
48359
|
+
var logger15 = createLogger({ service: "media-process-handler-dlq" });
|
|
48262
48360
|
var s3Client = new import_client_s3.S3Client({ region: process.env.AWS_REGION });
|
|
48263
48361
|
function extractS3Ref(envelope) {
|
|
48264
48362
|
const record = envelope.requestPayload?.Records?.[0];
|
|
@@ -48274,12 +48372,12 @@ async function processMessage(body) {
|
|
|
48274
48372
|
try {
|
|
48275
48373
|
envelope = JSON.parse(body);
|
|
48276
48374
|
} catch {
|
|
48277
|
-
|
|
48375
|
+
logger15.error("DLQ message is not valid JSON", { body });
|
|
48278
48376
|
return;
|
|
48279
48377
|
}
|
|
48280
48378
|
const ref = extractS3Ref(envelope);
|
|
48281
48379
|
if (!ref) {
|
|
48282
|
-
|
|
48380
|
+
logger15.error("Could not extract S3 reference from DLQ message", { envelope });
|
|
48283
48381
|
return;
|
|
48284
48382
|
}
|
|
48285
48383
|
const { bucket, key, fileId } = ref;
|
|
@@ -48287,7 +48385,7 @@ async function processMessage(body) {
|
|
|
48287
48385
|
const existing = await handleFindMany("media", { ids: [fileId] }, requestId);
|
|
48288
48386
|
const existingRecord = existing[0];
|
|
48289
48387
|
if (existingRecord?.status === "completed") {
|
|
48290
|
-
|
|
48388
|
+
logger15.info("Media already completed, skipping DLQ failure write", { requestId, fileId });
|
|
48291
48389
|
return;
|
|
48292
48390
|
}
|
|
48293
48391
|
let appMetadata = {};
|
|
@@ -48298,7 +48396,7 @@ async function processMessage(body) {
|
|
|
48298
48396
|
appMetadata = extractAppMetadata(metadata);
|
|
48299
48397
|
originalFilename = decodeOriginalFilename(metadata["original-filename"]);
|
|
48300
48398
|
} catch (error2) {
|
|
48301
|
-
|
|
48399
|
+
logger15.warn("Failed to re-fetch metadata for DLQ failure record", {
|
|
48302
48400
|
requestId,
|
|
48303
48401
|
fileId,
|
|
48304
48402
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
@@ -48323,7 +48421,7 @@ async function processMessage(body) {
|
|
|
48323
48421
|
},
|
|
48324
48422
|
requestId
|
|
48325
48423
|
);
|
|
48326
|
-
|
|
48424
|
+
logger15.warn("Media marked as failed via DLQ", { requestId, fileId });
|
|
48327
48425
|
}
|
|
48328
48426
|
__name(processMessage, "processMessage");
|
|
48329
48427
|
var handler = /* @__PURE__ */ __name(async (event) => {
|