@exabugs/dynamodb-client 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -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/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/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @exabugs/dynamodb-client v1.
|
|
2
|
-
// Built: 2026-10-11T23:
|
|
1
|
+
// @exabugs/dynamodb-client v1.10.0
|
|
2
|
+
// Built: 2026-10-11T23:48:57.909Z
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -2041,19 +2041,19 @@ var init_ProviderError = __esm({
|
|
|
2041
2041
|
name = "ProviderError";
|
|
2042
2042
|
tryNextLink;
|
|
2043
2043
|
constructor(message, options = true) {
|
|
2044
|
-
let
|
|
2044
|
+
let logger16;
|
|
2045
2045
|
let tryNextLink = true;
|
|
2046
2046
|
if (typeof options === "boolean") {
|
|
2047
|
-
|
|
2047
|
+
logger16 = void 0;
|
|
2048
2048
|
tryNextLink = options;
|
|
2049
2049
|
} else if (options != null && typeof options === "object") {
|
|
2050
|
-
|
|
2050
|
+
logger16 = options.logger;
|
|
2051
2051
|
tryNextLink = options.tryNextLink ?? true;
|
|
2052
2052
|
}
|
|
2053
2053
|
super(message);
|
|
2054
2054
|
this.tryNextLink = tryNextLink;
|
|
2055
2055
|
Object.setPrototypeOf(this, _ProviderError.prototype);
|
|
2056
|
-
|
|
2056
|
+
logger16?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
|
|
2057
2057
|
}
|
|
2058
2058
|
static from(error2, options = true) {
|
|
2059
2059
|
return Object.assign(new this(error2.message, options), error2);
|
|
@@ -2486,8 +2486,8 @@ var init_configLoader = __esm({
|
|
|
2486
2486
|
init_fromSharedConfigFiles();
|
|
2487
2487
|
init_fromStatic();
|
|
2488
2488
|
loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
|
|
2489
|
-
const { signingName, logger:
|
|
2490
|
-
const envOptions = { signingName, logger:
|
|
2489
|
+
const { signingName, logger: logger16 } = configuration;
|
|
2490
|
+
const envOptions = { signingName, logger: logger16 };
|
|
2491
2491
|
return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
|
|
2492
2492
|
}, "loadConfig");
|
|
2493
2493
|
}
|
|
@@ -4106,7 +4106,7 @@ var init_ByteArrayCollector = __esm({
|
|
|
4106
4106
|
});
|
|
4107
4107
|
|
|
4108
4108
|
// node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.browser.js
|
|
4109
|
-
function createBufferedReadableStream(upstream, size,
|
|
4109
|
+
function createBufferedReadableStream(upstream, size, logger16) {
|
|
4110
4110
|
const reader = upstream.getReader();
|
|
4111
4111
|
let streamBufferingLoggedWarning = false;
|
|
4112
4112
|
let bytesSeen = 0;
|
|
@@ -4144,7 +4144,7 @@ function createBufferedReadableStream(upstream, size, 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);
|
|
@@ -56451,7 +56451,7 @@ var require_dist_cjs81 = __commonJS({
|
|
|
56451
56451
|
return async () => handler2(this.clientCommand);
|
|
56452
56452
|
}
|
|
56453
56453
|
};
|
|
56454
|
-
var
|
|
56454
|
+
var BatchGetCommand2 = class extends DynamoDBDocumentClientCommand {
|
|
56455
56455
|
static {
|
|
56456
56456
|
__name(this, "BatchGetCommand");
|
|
56457
56457
|
}
|
|
@@ -56954,7 +56954,7 @@ var require_dist_cjs81 = __commonJS({
|
|
|
56954
56954
|
}
|
|
56955
56955
|
}
|
|
56956
56956
|
batchGet(args, optionsOrCb, cb) {
|
|
56957
|
-
const command = new
|
|
56957
|
+
const command = new BatchGetCommand2(args);
|
|
56958
56958
|
if (typeof optionsOrCb === "function") {
|
|
56959
56959
|
this.send(command, optionsOrCb);
|
|
56960
56960
|
} else if (typeof cb === "function") {
|
|
@@ -57131,7 +57131,7 @@ var require_dist_cjs81 = __commonJS({
|
|
|
57131
57131
|
}, "get")
|
|
57132
57132
|
});
|
|
57133
57133
|
exports2.BatchExecuteStatementCommand = BatchExecuteStatementCommand;
|
|
57134
|
-
exports2.BatchGetCommand =
|
|
57134
|
+
exports2.BatchGetCommand = BatchGetCommand2;
|
|
57135
57135
|
exports2.BatchWriteCommand = BatchWriteCommand;
|
|
57136
57136
|
exports2.DeleteCommand = DeleteCommand;
|
|
57137
57137
|
exports2.DynamoDBDocument = DynamoDBDocument;
|
|
@@ -57179,6 +57179,27 @@ var init_dynamodb = __esm({
|
|
|
57179
57179
|
}
|
|
57180
57180
|
});
|
|
57181
57181
|
|
|
57182
|
+
// src/shared/utils/scanSort.ts
|
|
57183
|
+
function chooseScanSortField(filter) {
|
|
57184
|
+
const keys = Object.keys(filter);
|
|
57185
|
+
if (keys.length !== 1) {
|
|
57186
|
+
return "id";
|
|
57187
|
+
}
|
|
57188
|
+
const [key] = keys;
|
|
57189
|
+
const value = filter[key];
|
|
57190
|
+
const isPlainField = !key.includes(":") && !key.includes(".") && key !== "id";
|
|
57191
|
+
const isSafeString = typeof value === "string" && value.length > 0 && new TextEncoder().encode(value).length <= 64 && // 空白や '#' はシャドーの SK でエスケープされ、'id' を含む値は SK の区切りと紛らわしくなる
|
|
57192
|
+
// (extractRecordIds は最後の '#id#' で分けるが、念のため避ける)
|
|
57193
|
+
!/[\s#]/.test(value) && value !== "id" && !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(value);
|
|
57194
|
+
return isPlainField && isSafeString ? key : "id";
|
|
57195
|
+
}
|
|
57196
|
+
var init_scanSort = __esm({
|
|
57197
|
+
"src/shared/utils/scanSort.ts"() {
|
|
57198
|
+
"use strict";
|
|
57199
|
+
__name(chooseScanSortField, "chooseScanSortField");
|
|
57200
|
+
}
|
|
57201
|
+
});
|
|
57202
|
+
|
|
57182
57203
|
// src/shared/utils/index.ts
|
|
57183
57204
|
var init_utils3 = __esm({
|
|
57184
57205
|
"src/shared/utils/index.ts"() {
|
|
@@ -57187,6 +57208,7 @@ var init_utils3 = __esm({
|
|
|
57187
57208
|
init_ulid();
|
|
57188
57209
|
init_validation();
|
|
57189
57210
|
init_dynamodb();
|
|
57211
|
+
init_scanSort();
|
|
57190
57212
|
}
|
|
57191
57213
|
});
|
|
57192
57214
|
|
|
@@ -58019,6 +58041,84 @@ var init_dynamodb3 = __esm({
|
|
|
58019
58041
|
}
|
|
58020
58042
|
});
|
|
58021
58043
|
|
|
58044
|
+
// src/server/utils/batchGet.ts
|
|
58045
|
+
function sleep(ms) {
|
|
58046
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
58047
|
+
}
|
|
58048
|
+
async function batchGetAll(keys, { consistentRead, costTracker, requestId, baseDelayMs = 50 }) {
|
|
58049
|
+
const unique = Array.from(new Map(keys.map((k4) => [`${k4.PK}\0${k4.SK}`, k4])).values());
|
|
58050
|
+
if (unique.length === 0) {
|
|
58051
|
+
return [];
|
|
58052
|
+
}
|
|
58053
|
+
const dbClient2 = getDBClient();
|
|
58054
|
+
const tableName = getTableName();
|
|
58055
|
+
const records = [];
|
|
58056
|
+
for (let i4 = 0; i4 < unique.length; i4 += BATCH_GET_MAX_KEYS) {
|
|
58057
|
+
let pending = unique.slice(i4, i4 + BATCH_GET_MAX_KEYS);
|
|
58058
|
+
for (let attempt = 0; pending.length > 0; attempt++) {
|
|
58059
|
+
if (attempt > BATCH_GET_MAX_RETRIES) {
|
|
58060
|
+
logger3.error("BatchGetItem \u306E UnprocessedKeys \u304C\u89E3\u6D88\u3057\u306A\u304B\u3063\u305F", {
|
|
58061
|
+
requestId,
|
|
58062
|
+
unprocessed: pending.length,
|
|
58063
|
+
attempts: attempt
|
|
58064
|
+
});
|
|
58065
|
+
throw new AppError(
|
|
58066
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
58067
|
+
"BatchGetItem still has unprocessed keys after retries",
|
|
58068
|
+
503,
|
|
58069
|
+
{ unprocessed: pending.length }
|
|
58070
|
+
);
|
|
58071
|
+
}
|
|
58072
|
+
if (attempt > 0) {
|
|
58073
|
+
await sleep(baseDelayMs * 2 ** (attempt - 1) * (0.5 + Math.random() / 2));
|
|
58074
|
+
}
|
|
58075
|
+
const keysToGet = pending;
|
|
58076
|
+
const result = await executeDynamoDBOperation(
|
|
58077
|
+
() => dbClient2.send(
|
|
58078
|
+
new import_lib_dynamodb2.BatchGetCommand({
|
|
58079
|
+
RequestItems: {
|
|
58080
|
+
[tableName]: {
|
|
58081
|
+
Keys: keysToGet,
|
|
58082
|
+
ConsistentRead: consistentRead
|
|
58083
|
+
}
|
|
58084
|
+
},
|
|
58085
|
+
ReturnConsumedCapacity: "TOTAL"
|
|
58086
|
+
})
|
|
58087
|
+
),
|
|
58088
|
+
"BatchGetItem"
|
|
58089
|
+
);
|
|
58090
|
+
if (costTracker) {
|
|
58091
|
+
const capacity = result.ConsumedCapacity;
|
|
58092
|
+
if (Array.isArray(capacity)) {
|
|
58093
|
+
capacity.forEach((c4) => costTracker.add(c4));
|
|
58094
|
+
} else {
|
|
58095
|
+
costTracker.add(capacity);
|
|
58096
|
+
}
|
|
58097
|
+
}
|
|
58098
|
+
records.push(...result.Responses?.[tableName] ?? []);
|
|
58099
|
+
pending = result.UnprocessedKeys?.[tableName]?.Keys ?? [];
|
|
58100
|
+
}
|
|
58101
|
+
}
|
|
58102
|
+
return records;
|
|
58103
|
+
}
|
|
58104
|
+
var import_lib_dynamodb2, logger3, BATCH_GET_MAX_KEYS, BATCH_GET_MAX_RETRIES;
|
|
58105
|
+
var init_batchGet = __esm({
|
|
58106
|
+
"src/server/utils/batchGet.ts"() {
|
|
58107
|
+
"use strict";
|
|
58108
|
+
import_lib_dynamodb2 = __toESM(require_dist_cjs81(), 1);
|
|
58109
|
+
init_shared();
|
|
58110
|
+
init_dynamodb3();
|
|
58111
|
+
logger3 = createLogger({
|
|
58112
|
+
service: "batch-get",
|
|
58113
|
+
level: process.env.LOG_LEVEL || "info"
|
|
58114
|
+
});
|
|
58115
|
+
BATCH_GET_MAX_KEYS = 100;
|
|
58116
|
+
BATCH_GET_MAX_RETRIES = 8;
|
|
58117
|
+
__name(sleep, "sleep");
|
|
58118
|
+
__name(batchGetAll, "batchGetAll");
|
|
58119
|
+
}
|
|
58120
|
+
});
|
|
58121
|
+
|
|
58022
58122
|
// src/server/utils/validation.ts
|
|
58023
58123
|
function validateSortField(_config, _resource, _sort) {
|
|
58024
58124
|
return;
|
|
@@ -58403,12 +58503,12 @@ function getScanWarnThreshold() {
|
|
|
58403
58503
|
const value = Number(raw);
|
|
58404
58504
|
return Number.isInteger(value) && value >= 1 ? value : DEFAULT_SCAN_WARN_THRESHOLD;
|
|
58405
58505
|
}
|
|
58406
|
-
var
|
|
58506
|
+
var logger4, SPARSE_SCAN_EVENT, DEFAULT_SCAN_WARN_THRESHOLD, ScanWatcher;
|
|
58407
58507
|
var init_scanWarning = __esm({
|
|
58408
58508
|
"src/server/utils/scanWarning.ts"() {
|
|
58409
58509
|
"use strict";
|
|
58410
58510
|
init_shared();
|
|
58411
|
-
|
|
58511
|
+
logger4 = createLogger({ service: "scan-warning", level: "warn" });
|
|
58412
58512
|
SPARSE_SCAN_EVENT = "SPARSE_SCAN";
|
|
58413
58513
|
DEFAULT_SCAN_WARN_THRESHOLD = 5e3;
|
|
58414
58514
|
__name(getScanWarnThreshold, "getScanWarnThreshold");
|
|
@@ -58427,7 +58527,7 @@ var init_scanWarning = __esm({
|
|
|
58427
58527
|
this.scanned += count;
|
|
58428
58528
|
if (!this.warned && this.scanned >= this.threshold) {
|
|
58429
58529
|
this.warned = true;
|
|
58430
|
-
|
|
58530
|
+
logger4.warn(
|
|
58431
58531
|
`${SPARSE_SCAN_EVENT}: 1\u30EA\u30AF\u30A8\u30B9\u30C8\u3067 ${this.scanned} \u4EF6\u4EE5\u4E0A\u3092\u8AAD\u307F\u307E\u3057\u305F\u3002\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30FB\u30B9\u30AD\u30FC\u30DE\u30FB\u30ED\u30B8\u30C3\u30AF\u306E\u898B\u76F4\u3057\u3092\u691C\u8A0E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08docs/SCAN_WARNING.md\uFF09`,
|
|
58432
58532
|
{
|
|
58433
58533
|
event: SPARSE_SCAN_EVENT,
|
|
@@ -58535,7 +58635,7 @@ function parseFilters(filter) {
|
|
|
58535
58635
|
parsedFilters.push({ parsed, value });
|
|
58536
58636
|
}
|
|
58537
58637
|
} catch (error2) {
|
|
58538
|
-
|
|
58638
|
+
logger5.error("Invalid filter field syntax", {
|
|
58539
58639
|
fieldKey,
|
|
58540
58640
|
error: error2 instanceof Error ? error2.message : String(error2)
|
|
58541
58641
|
});
|
|
@@ -58604,7 +58704,7 @@ function detectNearQuery(filter) {
|
|
|
58604
58704
|
}
|
|
58605
58705
|
return null;
|
|
58606
58706
|
}
|
|
58607
|
-
var
|
|
58707
|
+
var logger5;
|
|
58608
58708
|
var init_utils5 = __esm({
|
|
58609
58709
|
"src/server/operations/find/utils.ts"() {
|
|
58610
58710
|
"use strict";
|
|
@@ -58613,7 +58713,7 @@ var init_utils5 = __esm({
|
|
|
58613
58713
|
init_shadow();
|
|
58614
58714
|
init_filter();
|
|
58615
58715
|
init_validation2();
|
|
58616
|
-
|
|
58716
|
+
logger5 = createLogger({
|
|
58617
58717
|
service: "find-utils",
|
|
58618
58718
|
level: process.env.LOG_LEVEL || "info"
|
|
58619
58719
|
});
|
|
@@ -58630,7 +58730,7 @@ var init_utils5 = __esm({
|
|
|
58630
58730
|
async function executeIdQuery(resource, normalizedParams, requestId) {
|
|
58631
58731
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
58632
58732
|
const { perPage, nextToken } = pagination;
|
|
58633
|
-
|
|
58733
|
+
logger6.debug("Executing ID optimized query", {
|
|
58634
58734
|
requestId,
|
|
58635
58735
|
resource,
|
|
58636
58736
|
sort,
|
|
@@ -58651,7 +58751,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
58651
58751
|
const costTracker = new CostTracker();
|
|
58652
58752
|
const queryResult = await executeDynamoDBOperation(
|
|
58653
58753
|
() => dbClient2.send(
|
|
58654
|
-
new
|
|
58754
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
58655
58755
|
TableName: tableName,
|
|
58656
58756
|
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
58657
58757
|
ExpressionAttributeValues: {
|
|
@@ -58667,7 +58767,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
58667
58767
|
costTracker.add(queryResult.ConsumedCapacity);
|
|
58668
58768
|
const mainRecords = queryResult.Items || [];
|
|
58669
58769
|
const items = mainRecords.map((item) => extractCleanRecord(item));
|
|
58670
|
-
|
|
58770
|
+
logger6.info("ID specific query succeeded", {
|
|
58671
58771
|
requestId,
|
|
58672
58772
|
resource,
|
|
58673
58773
|
targetId,
|
|
@@ -58690,7 +58790,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
58690
58790
|
targetIds.map(
|
|
58691
58791
|
(id) => executeDynamoDBOperation(
|
|
58692
58792
|
() => dbClient2.send(
|
|
58693
|
-
new
|
|
58793
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
58694
58794
|
TableName: tableName,
|
|
58695
58795
|
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
58696
58796
|
ExpressionAttributeValues: {
|
|
@@ -58714,7 +58814,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
|
58714
58814
|
const bVal = String(b4.id ?? "");
|
|
58715
58815
|
return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
58716
58816
|
});
|
|
58717
|
-
|
|
58817
|
+
logger6.info("ID $in query succeeded", {
|
|
58718
58818
|
requestId,
|
|
58719
58819
|
resource,
|
|
58720
58820
|
requestedCount: targetIds.length,
|
|
@@ -58753,7 +58853,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
58753
58853
|
}
|
|
58754
58854
|
const queryResult = await executeDynamoDBOperation(
|
|
58755
58855
|
() => dbClient2.send(
|
|
58756
|
-
new
|
|
58856
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
58757
58857
|
TableName: tableName,
|
|
58758
58858
|
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
58759
58859
|
ExpressionAttributeValues: {
|
|
@@ -58790,7 +58890,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
|
|
|
58790
58890
|
queryResult.LastEvaluatedKey.PK,
|
|
58791
58891
|
queryResult.LastEvaluatedKey.SK
|
|
58792
58892
|
) : void 0;
|
|
58793
|
-
|
|
58893
|
+
logger6.info("ID all records query succeeded", {
|
|
58794
58894
|
requestId,
|
|
58795
58895
|
resource,
|
|
58796
58896
|
count: items.length,
|
|
@@ -58831,7 +58931,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58831
58931
|
});
|
|
58832
58932
|
scan: while (true) {
|
|
58833
58933
|
if (++iterations > SCAN_MAX_ITERATIONS) {
|
|
58834
|
-
|
|
58934
|
+
logger6.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
58835
58935
|
requestId,
|
|
58836
58936
|
resource,
|
|
58837
58937
|
iterations
|
|
@@ -58843,7 +58943,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58843
58943
|
}
|
|
58844
58944
|
const queryResult = await executeDynamoDBOperation(
|
|
58845
58945
|
() => dbClient2.send(
|
|
58846
|
-
new
|
|
58946
|
+
new import_lib_dynamodb3.QueryCommand({
|
|
58847
58947
|
TableName: tableName,
|
|
58848
58948
|
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
58849
58949
|
ExpressionAttributeValues: {
|
|
@@ -58879,7 +58979,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58879
58979
|
}
|
|
58880
58980
|
const nextKeySignature = `${nextKey.PK}#${nextKey.SK}`;
|
|
58881
58981
|
if (nextKeySignature === previousKeySignature) {
|
|
58882
|
-
|
|
58982
|
+
logger6.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
58883
58983
|
requestId,
|
|
58884
58984
|
resource,
|
|
58885
58985
|
iterations
|
|
@@ -58896,7 +58996,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58896
58996
|
chunkSize = Math.min(chunkSize * 2, SCAN_CHUNK_MAX);
|
|
58897
58997
|
}
|
|
58898
58998
|
const nextTokenValue = hasNextPage && lastReturned ? encodeNextToken(lastReturned.PK, lastReturned.SK) : void 0;
|
|
58899
|
-
|
|
58999
|
+
logger6.info("ID filtered scan query succeeded", {
|
|
58900
59000
|
requestId,
|
|
58901
59001
|
resource,
|
|
58902
59002
|
scanned,
|
|
@@ -58910,18 +59010,18 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
|
|
|
58910
59010
|
consumedCapacity: costTracker.getAggregated()
|
|
58911
59011
|
};
|
|
58912
59012
|
}
|
|
58913
|
-
var
|
|
59013
|
+
var import_lib_dynamodb3, logger6, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
|
|
58914
59014
|
var init_idQuery = __esm({
|
|
58915
59015
|
"src/server/operations/find/idQuery.ts"() {
|
|
58916
59016
|
"use strict";
|
|
58917
|
-
|
|
59017
|
+
import_lib_dynamodb3 = __toESM(require_dist_cjs81(), 1);
|
|
58918
59018
|
init_shared();
|
|
58919
59019
|
init_cost_tracker();
|
|
58920
59020
|
init_dynamodb3();
|
|
58921
59021
|
init_pagination();
|
|
58922
59022
|
init_scanWarning();
|
|
58923
59023
|
init_utils5();
|
|
58924
|
-
|
|
59024
|
+
logger6 = createLogger({
|
|
58925
59025
|
service: "id-query",
|
|
58926
59026
|
level: process.env.LOG_LEVEL || "info"
|
|
58927
59027
|
});
|
|
@@ -58938,7 +59038,7 @@ var init_idQuery = __esm({
|
|
|
58938
59038
|
|
|
58939
59039
|
// src/server/operations/find/nearQuery.ts
|
|
58940
59040
|
async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId) {
|
|
58941
|
-
|
|
59041
|
+
logger7.debug("Executing $near query", {
|
|
58942
59042
|
requestId,
|
|
58943
59043
|
resource,
|
|
58944
59044
|
fieldName,
|
|
@@ -58949,32 +59049,58 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58949
59049
|
const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
|
|
58950
59050
|
const dbClient2 = getDBClient();
|
|
58951
59051
|
const tableName = getTableName();
|
|
58952
|
-
|
|
59052
|
+
logger7.debug("Searching shadow records", {
|
|
58953
59053
|
requestId,
|
|
58954
59054
|
resource,
|
|
58955
59055
|
fieldName,
|
|
58956
59056
|
geohashPrefix,
|
|
58957
59057
|
skPrefix: `${fieldName}#${geohashPrefix}`
|
|
58958
59058
|
});
|
|
58959
|
-
const
|
|
58960
|
-
|
|
58961
|
-
|
|
58962
|
-
|
|
58963
|
-
|
|
58964
|
-
|
|
58965
|
-
|
|
58966
|
-
|
|
58967
|
-
|
|
58968
|
-
|
|
58969
|
-
|
|
58970
|
-
|
|
58971
|
-
|
|
58972
|
-
|
|
58973
|
-
|
|
58974
|
-
|
|
58975
|
-
|
|
58976
|
-
|
|
58977
|
-
|
|
59059
|
+
const shadowRecords = [];
|
|
59060
|
+
const watcher = new ScanWatcher({
|
|
59061
|
+
requestId,
|
|
59062
|
+
resource,
|
|
59063
|
+
path: "near-search",
|
|
59064
|
+
sortField: fieldName,
|
|
59065
|
+
filters: ["$near"]
|
|
59066
|
+
});
|
|
59067
|
+
let exclusiveStartKey;
|
|
59068
|
+
let previousKeySignature;
|
|
59069
|
+
do {
|
|
59070
|
+
const queryResult = await executeDynamoDBOperation(
|
|
59071
|
+
() => dbClient2.send(
|
|
59072
|
+
new import_lib_dynamodb4.QueryCommand({
|
|
59073
|
+
TableName: tableName,
|
|
59074
|
+
KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
|
|
59075
|
+
ExpressionAttributeValues: {
|
|
59076
|
+
":pk": resource,
|
|
59077
|
+
":skPrefix": `${fieldName}#${geohashPrefix}`
|
|
59078
|
+
},
|
|
59079
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
59080
|
+
ConsistentRead: false,
|
|
59081
|
+
// シャドウレコードは結果整合性で十分
|
|
59082
|
+
ReturnConsumedCapacity: "TOTAL"
|
|
59083
|
+
})
|
|
59084
|
+
),
|
|
59085
|
+
"Query"
|
|
59086
|
+
);
|
|
59087
|
+
costTracker.add(queryResult.ConsumedCapacity);
|
|
59088
|
+
shadowRecords.push(...queryResult.Items || []);
|
|
59089
|
+
watcher.add((queryResult.Items || []).length);
|
|
59090
|
+
const nextKey = queryResult.LastEvaluatedKey;
|
|
59091
|
+
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
59092
|
+
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
59093
|
+
throw new AppError(
|
|
59094
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
59095
|
+
"Near search received the same LastEvaluatedKey repeatedly",
|
|
59096
|
+
500,
|
|
59097
|
+
{ resource, geohashPrefix }
|
|
59098
|
+
);
|
|
59099
|
+
}
|
|
59100
|
+
previousKeySignature = nextKeySignature;
|
|
59101
|
+
exclusiveStartKey = nextKey;
|
|
59102
|
+
} while (exclusiveStartKey);
|
|
59103
|
+
logger7.debug("Shadow records found", {
|
|
58978
59104
|
requestId,
|
|
58979
59105
|
resource,
|
|
58980
59106
|
geohashPrefix,
|
|
@@ -58985,48 +59111,24 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
58985
59111
|
const parts = sk.split("#id#");
|
|
58986
59112
|
return parts.length === 2 ? parts[1] : null;
|
|
58987
59113
|
}).filter((id) => id !== null);
|
|
58988
|
-
|
|
59114
|
+
logger7.debug("Main record IDs extracted", {
|
|
58989
59115
|
requestId,
|
|
58990
59116
|
resource,
|
|
58991
59117
|
geohashPrefix,
|
|
58992
59118
|
ids: mainRecordIds
|
|
58993
59119
|
});
|
|
58994
|
-
const
|
|
58995
|
-
|
|
58996
|
-
|
|
58997
|
-
|
|
58998
|
-
|
|
58999
|
-
() => dbClient2.send(
|
|
59000
|
-
new import_lib_dynamodb3.BatchGetCommand({
|
|
59001
|
-
RequestItems: {
|
|
59002
|
-
[tableName]: {
|
|
59003
|
-
Keys: chunk.map((id) => ({
|
|
59004
|
-
PK: resource,
|
|
59005
|
-
SK: `id#${id}`
|
|
59006
|
-
})),
|
|
59007
|
-
ConsistentRead: false
|
|
59008
|
-
}
|
|
59009
|
-
},
|
|
59010
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
59011
|
-
})
|
|
59012
|
-
),
|
|
59013
|
-
"BatchGetItem"
|
|
59014
|
-
);
|
|
59015
|
-
if (batchGetResult.ConsumedCapacity) {
|
|
59016
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
59017
|
-
costTracker.add(capacity);
|
|
59018
|
-
}
|
|
59019
|
-
}
|
|
59020
|
-
validRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
59021
|
-
}
|
|
59022
|
-
logger6.debug("Main records retrieved", {
|
|
59120
|
+
const validRecords = await batchGetAll(
|
|
59121
|
+
mainRecordIds.map((id) => ({ PK: resource, SK: `id#${id}` })),
|
|
59122
|
+
{ consistentRead: false, costTracker, requestId }
|
|
59123
|
+
);
|
|
59124
|
+
logger7.debug("Main records retrieved", {
|
|
59023
59125
|
requestId,
|
|
59024
59126
|
resource,
|
|
59025
59127
|
geohashPrefix,
|
|
59026
59128
|
count: validRecords.length
|
|
59027
59129
|
});
|
|
59028
59130
|
const cleanRecords = validRecords.map((record) => extractCleanRecord(record));
|
|
59029
|
-
|
|
59131
|
+
logger7.debug("Clean records extracted", {
|
|
59030
59132
|
requestId,
|
|
59031
59133
|
resource,
|
|
59032
59134
|
geohashPrefix,
|
|
@@ -59045,7 +59147,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
59045
59147
|
config
|
|
59046
59148
|
);
|
|
59047
59149
|
const items = result.documents;
|
|
59048
|
-
|
|
59150
|
+
logger7.info("$near query succeeded", {
|
|
59049
59151
|
requestId,
|
|
59050
59152
|
resource,
|
|
59051
59153
|
fieldName,
|
|
@@ -59063,17 +59165,19 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
59063
59165
|
consumedCapacity: costTracker.getAggregated()
|
|
59064
59166
|
};
|
|
59065
59167
|
}
|
|
59066
|
-
var
|
|
59168
|
+
var import_lib_dynamodb4, logger7;
|
|
59067
59169
|
var init_nearQuery = __esm({
|
|
59068
59170
|
"src/server/operations/find/nearQuery.ts"() {
|
|
59069
59171
|
"use strict";
|
|
59070
|
-
|
|
59172
|
+
import_lib_dynamodb4 = __toESM(require_dist_cjs81(), 1);
|
|
59071
59173
|
init_geohash();
|
|
59072
59174
|
init_shared();
|
|
59073
59175
|
init_nearSearch();
|
|
59176
|
+
init_batchGet();
|
|
59074
59177
|
init_cost_tracker();
|
|
59075
59178
|
init_dynamodb3();
|
|
59076
|
-
|
|
59179
|
+
init_scanWarning();
|
|
59180
|
+
logger7 = createLogger({
|
|
59077
59181
|
service: "near-query",
|
|
59078
59182
|
level: process.env.LOG_LEVEL || "info"
|
|
59079
59183
|
});
|
|
@@ -59103,7 +59207,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
59103
59207
|
(f4) => !(isKeyConditionOptimized && f4 === optimizableFilter)
|
|
59104
59208
|
);
|
|
59105
59209
|
if (residualFilters.length > 0) {
|
|
59106
|
-
|
|
59210
|
+
logger8.debug("Residual filters detected, falling back to full scan", {
|
|
59107
59211
|
requestId,
|
|
59108
59212
|
resource,
|
|
59109
59213
|
sortField: sort.field,
|
|
@@ -59111,7 +59215,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
59111
59215
|
});
|
|
59112
59216
|
return executeFullScanQuery(resource, normalizedParams, costTracker, requestId);
|
|
59113
59217
|
}
|
|
59114
|
-
|
|
59218
|
+
logger8.debug("Executing shadow query", {
|
|
59115
59219
|
requestId,
|
|
59116
59220
|
resource,
|
|
59117
59221
|
sortField: sort.field,
|
|
@@ -59159,7 +59263,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
59159
59263
|
shadowRecords.LastEvaluatedKey.PK,
|
|
59160
59264
|
shadowRecords.LastEvaluatedKey.SK
|
|
59161
59265
|
) : void 0;
|
|
59162
|
-
|
|
59266
|
+
logger8.info("Shadow query succeeded", {
|
|
59163
59267
|
requestId,
|
|
59164
59268
|
resource,
|
|
59165
59269
|
sortField: sort.field,
|
|
@@ -59184,7 +59288,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
59184
59288
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
59185
59289
|
const filterSort = { field: filterCandidate.parsed.field, order: "ASC" };
|
|
59186
59290
|
const remainingFilters = parsedFilters.filter((f4) => f4 !== filterCandidate);
|
|
59187
|
-
|
|
59291
|
+
logger8.debug("Executing filter-first query", {
|
|
59188
59292
|
requestId,
|
|
59189
59293
|
resource,
|
|
59190
59294
|
filterField: filterCandidate.parsed.field,
|
|
@@ -59207,7 +59311,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
|
|
|
59207
59311
|
const page = items.slice(offset, offset + perPage);
|
|
59208
59312
|
const hasNextPage = offset + perPage < items.length;
|
|
59209
59313
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
59210
|
-
|
|
59314
|
+
logger8.info("Filter-first query succeeded", {
|
|
59211
59315
|
requestId,
|
|
59212
59316
|
resource,
|
|
59213
59317
|
filterField: filterCandidate.parsed.field,
|
|
@@ -59228,7 +59332,7 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
59228
59332
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
59229
59333
|
const { perPage, nextToken } = pagination;
|
|
59230
59334
|
const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
|
|
59231
|
-
|
|
59335
|
+
logger8.debug("Executing full scan query", {
|
|
59232
59336
|
requestId,
|
|
59233
59337
|
resource,
|
|
59234
59338
|
sortField: sort.field,
|
|
@@ -59249,7 +59353,7 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
|
|
|
59249
59353
|
const page = items.slice(offset, offset + perPage);
|
|
59250
59354
|
const hasNextPage = offset + perPage < items.length;
|
|
59251
59355
|
const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
|
|
59252
|
-
|
|
59356
|
+
logger8.info("Full scan query succeeded", {
|
|
59253
59357
|
requestId,
|
|
59254
59358
|
resource,
|
|
59255
59359
|
sortField: sort.field,
|
|
@@ -59280,7 +59384,7 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
59280
59384
|
let iterations = 0;
|
|
59281
59385
|
do {
|
|
59282
59386
|
if (++iterations > MAX_ITERATIONS) {
|
|
59283
|
-
|
|
59387
|
+
logger8.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
|
|
59284
59388
|
requestId,
|
|
59285
59389
|
resource,
|
|
59286
59390
|
iterations
|
|
@@ -59310,7 +59414,7 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
|
|
|
59310
59414
|
const nextKey = result.LastEvaluatedKey;
|
|
59311
59415
|
const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
|
|
59312
59416
|
if (nextKeySignature && nextKeySignature === previousKeySignature) {
|
|
59313
|
-
|
|
59417
|
+
logger8.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
|
|
59314
59418
|
requestId,
|
|
59315
59419
|
resource,
|
|
59316
59420
|
iterations
|
|
@@ -59382,7 +59486,7 @@ async function executeShadowRecordQuery(resource, sort, perPage, nextToken, opti
|
|
|
59382
59486
|
);
|
|
59383
59487
|
const result = await executeDynamoDBOperation(
|
|
59384
59488
|
() => dbClient2.send(
|
|
59385
|
-
new
|
|
59489
|
+
new import_lib_dynamodb5.QueryCommand({
|
|
59386
59490
|
TableName: tableName,
|
|
59387
59491
|
KeyConditionExpression: keyConditionExpression,
|
|
59388
59492
|
ExpressionAttributeValues: expressionAttributeValues,
|
|
@@ -59490,63 +59594,37 @@ function encodeValueForShadowSK(value, type) {
|
|
|
59490
59594
|
function extractRecordIds(shadowRecords) {
|
|
59491
59595
|
return shadowRecords.map((record) => {
|
|
59492
59596
|
const sk = record.SK;
|
|
59493
|
-
const
|
|
59494
|
-
return
|
|
59597
|
+
const index = sk.lastIndexOf("#id#");
|
|
59598
|
+
return index >= 0 ? sk.slice(index + "#id#".length) : null;
|
|
59495
59599
|
}).filter((id) => id !== null);
|
|
59496
59600
|
}
|
|
59497
59601
|
async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
|
|
59498
|
-
const
|
|
59499
|
-
|
|
59500
|
-
|
|
59501
|
-
|
|
59502
|
-
|
|
59503
|
-
for (let i4 = 0; i4 < uniqueRecordIds.length; i4 += BATCH_SIZE) {
|
|
59504
|
-
const chunk = uniqueRecordIds.slice(i4, i4 + BATCH_SIZE);
|
|
59505
|
-
const batchGetResult = await executeDynamoDBOperation(
|
|
59506
|
-
() => dbClient2.send(
|
|
59507
|
-
new import_lib_dynamodb4.BatchGetCommand({
|
|
59508
|
-
RequestItems: {
|
|
59509
|
-
[tableName]: {
|
|
59510
|
-
Keys: chunk.map((id) => ({
|
|
59511
|
-
PK: resource,
|
|
59512
|
-
SK: `id#${id}`
|
|
59513
|
-
})),
|
|
59514
|
-
ConsistentRead: true
|
|
59515
|
-
}
|
|
59516
|
-
},
|
|
59517
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
59518
|
-
})
|
|
59519
|
-
),
|
|
59520
|
-
"BatchGetItem"
|
|
59521
|
-
);
|
|
59522
|
-
if (batchGetResult.ConsumedCapacity) {
|
|
59523
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
59524
|
-
costTracker.add(capacity);
|
|
59525
|
-
}
|
|
59526
|
-
}
|
|
59527
|
-
allRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
59528
|
-
}
|
|
59529
|
-
logger7.debug("Main records fetched", {
|
|
59602
|
+
const allRecords = await batchGetAll(
|
|
59603
|
+
recordIds.map((id) => ({ PK: resource, SK: `id#${id}` })),
|
|
59604
|
+
{ consistentRead: true, costTracker, requestId }
|
|
59605
|
+
);
|
|
59606
|
+
logger8.debug("Main records fetched", {
|
|
59530
59607
|
requestId,
|
|
59531
59608
|
resource,
|
|
59532
|
-
requestedCount:
|
|
59609
|
+
requestedCount: new Set(recordIds).size,
|
|
59533
59610
|
fetchedCount: allRecords.length
|
|
59534
59611
|
});
|
|
59535
59612
|
return allRecords;
|
|
59536
59613
|
}
|
|
59537
|
-
var
|
|
59614
|
+
var import_lib_dynamodb5, logger8, KEY_CONDITION_OPERATORS;
|
|
59538
59615
|
var init_shadowQuery = __esm({
|
|
59539
59616
|
"src/server/operations/find/shadowQuery.ts"() {
|
|
59540
59617
|
"use strict";
|
|
59541
|
-
|
|
59618
|
+
import_lib_dynamodb5 = __toESM(require_dist_cjs81(), 1);
|
|
59542
59619
|
init_formatting();
|
|
59543
59620
|
init_shared();
|
|
59621
|
+
init_batchGet();
|
|
59544
59622
|
init_cost_tracker();
|
|
59545
59623
|
init_dynamodb3();
|
|
59546
59624
|
init_pagination();
|
|
59547
59625
|
init_scanWarning();
|
|
59548
59626
|
init_utils5();
|
|
59549
|
-
|
|
59627
|
+
logger8 = createLogger({
|
|
59550
59628
|
service: "shadow-query",
|
|
59551
59629
|
level: process.env.LOG_LEVEL || "info"
|
|
59552
59630
|
});
|
|
@@ -59567,14 +59645,14 @@ var init_shadowQuery = __esm({
|
|
|
59567
59645
|
|
|
59568
59646
|
// src/server/operations/find/handler.ts
|
|
59569
59647
|
async function handleFind(resource, params, requestId) {
|
|
59570
|
-
|
|
59648
|
+
logger9.debug("Executing find", {
|
|
59571
59649
|
requestId,
|
|
59572
59650
|
resource,
|
|
59573
59651
|
params
|
|
59574
59652
|
});
|
|
59575
59653
|
const nearDetection = detectNearQuery(params.filter);
|
|
59576
59654
|
if (nearDetection) {
|
|
59577
|
-
|
|
59655
|
+
logger9.debug("$near operator detected, executing near search", {
|
|
59578
59656
|
requestId,
|
|
59579
59657
|
resource,
|
|
59580
59658
|
fieldName: nearDetection.fieldName
|
|
@@ -59591,7 +59669,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
59591
59669
|
const config = initializeFindConfig();
|
|
59592
59670
|
const normalizedParams = normalizeFindParams(config, resource, params);
|
|
59593
59671
|
validateSortField(config, resource, normalizedParams.sort);
|
|
59594
|
-
|
|
59672
|
+
logger9.debug("Find parameters normalized", {
|
|
59595
59673
|
requestId,
|
|
59596
59674
|
resource,
|
|
59597
59675
|
sort: normalizedParams.sort,
|
|
@@ -59606,7 +59684,7 @@ async function handleFind(resource, params, requestId) {
|
|
|
59606
59684
|
}
|
|
59607
59685
|
return executeShadowQuery(resource, normalizedParams, requestId);
|
|
59608
59686
|
}
|
|
59609
|
-
var
|
|
59687
|
+
var logger9;
|
|
59610
59688
|
var init_handler = __esm({
|
|
59611
59689
|
"src/server/operations/find/handler.ts"() {
|
|
59612
59690
|
"use strict";
|
|
@@ -59616,7 +59694,7 @@ var init_handler = __esm({
|
|
|
59616
59694
|
init_nearQuery();
|
|
59617
59695
|
init_shadowQuery();
|
|
59618
59696
|
init_utils5();
|
|
59619
|
-
|
|
59697
|
+
logger9 = createLogger({
|
|
59620
59698
|
service: "find-handler",
|
|
59621
59699
|
level: process.env.LOG_LEVEL || "info"
|
|
59622
59700
|
});
|
|
@@ -59625,10 +59703,6 @@ var init_handler = __esm({
|
|
|
59625
59703
|
});
|
|
59626
59704
|
|
|
59627
59705
|
// src/server/operations/find.ts
|
|
59628
|
-
var find_exports = {};
|
|
59629
|
-
__export(find_exports, {
|
|
59630
|
-
handleFind: () => handleFind
|
|
59631
|
-
});
|
|
59632
59706
|
var init_find = __esm({
|
|
59633
59707
|
"src/server/operations/find.ts"() {
|
|
59634
59708
|
"use strict";
|
|
@@ -59636,10 +59710,64 @@ var init_find = __esm({
|
|
|
59636
59710
|
}
|
|
59637
59711
|
});
|
|
59638
59712
|
|
|
59713
|
+
// src/server/operations/findAll.ts
|
|
59714
|
+
async function findAllByFilter(resource, filter, requestId) {
|
|
59715
|
+
const sortField = chooseScanSortField(filter);
|
|
59716
|
+
const items = [];
|
|
59717
|
+
let nextToken;
|
|
59718
|
+
let previousToken;
|
|
59719
|
+
for (; ; ) {
|
|
59720
|
+
const result = await handleFind(
|
|
59721
|
+
resource,
|
|
59722
|
+
{
|
|
59723
|
+
filter,
|
|
59724
|
+
sort: { field: sortField, order: "ASC" },
|
|
59725
|
+
pagination: { perPage: 50, nextToken }
|
|
59726
|
+
},
|
|
59727
|
+
requestId
|
|
59728
|
+
);
|
|
59729
|
+
items.push(...result.items);
|
|
59730
|
+
nextToken = result.pageInfo?.hasNextPage ? result.nextToken : void 0;
|
|
59731
|
+
if (!nextToken) {
|
|
59732
|
+
return items;
|
|
59733
|
+
}
|
|
59734
|
+
if (nextToken === previousToken) {
|
|
59735
|
+
throw new AppError(
|
|
59736
|
+
"INTERNAL_ERROR" /* INTERNAL_ERROR */,
|
|
59737
|
+
"findAllByFilter received the same nextToken repeatedly",
|
|
59738
|
+
500,
|
|
59739
|
+
{ resource }
|
|
59740
|
+
);
|
|
59741
|
+
}
|
|
59742
|
+
previousToken = nextToken;
|
|
59743
|
+
}
|
|
59744
|
+
}
|
|
59745
|
+
async function findOneByFilter(resource, filter, requestId) {
|
|
59746
|
+
const result = await handleFind(
|
|
59747
|
+
resource,
|
|
59748
|
+
{
|
|
59749
|
+
filter,
|
|
59750
|
+
sort: { field: chooseScanSortField(filter), order: "ASC" },
|
|
59751
|
+
pagination: { perPage: 1 }
|
|
59752
|
+
},
|
|
59753
|
+
requestId
|
|
59754
|
+
);
|
|
59755
|
+
return result.items[0];
|
|
59756
|
+
}
|
|
59757
|
+
var init_findAll = __esm({
|
|
59758
|
+
"src/server/operations/findAll.ts"() {
|
|
59759
|
+
"use strict";
|
|
59760
|
+
init_shared();
|
|
59761
|
+
init_find();
|
|
59762
|
+
__name(findAllByFilter, "findAllByFilter");
|
|
59763
|
+
__name(findOneByFilter, "findOneByFilter");
|
|
59764
|
+
}
|
|
59765
|
+
});
|
|
59766
|
+
|
|
59639
59767
|
// src/server/utils/bulkOperations.ts
|
|
59640
59768
|
function logLargeBatchWarning(operation2, recordCount, requestId, resource) {
|
|
59641
59769
|
if (recordCount > LARGE_BATCH_WARNING_THRESHOLD) {
|
|
59642
|
-
|
|
59770
|
+
logger11.warn(`Large batch ${operation2} operation detected`, {
|
|
59643
59771
|
requestId,
|
|
59644
59772
|
resource,
|
|
59645
59773
|
recordCount,
|
|
@@ -59662,7 +59790,7 @@ function calculateTimeoutRisk(startTime) {
|
|
|
59662
59790
|
};
|
|
59663
59791
|
}
|
|
59664
59792
|
function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount, riskInfo) {
|
|
59665
|
-
|
|
59793
|
+
logger11.info("Records prepared for chunk execution", {
|
|
59666
59794
|
requestId,
|
|
59667
59795
|
resource,
|
|
59668
59796
|
totalRecords,
|
|
@@ -59672,7 +59800,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
59672
59800
|
timeoutRisk: riskInfo.risk
|
|
59673
59801
|
});
|
|
59674
59802
|
if (riskInfo.risk === "high") {
|
|
59675
|
-
|
|
59803
|
+
logger11.warn("High timeout risk detected during preparation phase", {
|
|
59676
59804
|
requestId,
|
|
59677
59805
|
resource,
|
|
59678
59806
|
preparationElapsedMs: riskInfo.elapsedMs,
|
|
@@ -59684,7 +59812,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
|
|
|
59684
59812
|
}
|
|
59685
59813
|
function logBulkOperationComplete(operation2, requestId, resource, requested, succeeded, failed, riskInfo, additionalInfo) {
|
|
59686
59814
|
const totalElapsedSeconds = Math.round(riskInfo.elapsedMs / 1e3);
|
|
59687
|
-
|
|
59815
|
+
logger11.info(`${operation2} completed`, {
|
|
59688
59816
|
requestId,
|
|
59689
59817
|
resource,
|
|
59690
59818
|
requested,
|
|
@@ -59699,7 +59827,7 @@ function logBulkOperationComplete(operation2, requestId, resource, requested, su
|
|
|
59699
59827
|
}
|
|
59700
59828
|
function logPartialFailure(operation2, requestId, resource, requested, succeeded, failed, errorCodes, additionalInfo) {
|
|
59701
59829
|
const failureRate = Math.round(failed / requested * 100);
|
|
59702
|
-
|
|
59830
|
+
logger11.warn(`Partial failure in ${operation2} operation`, {
|
|
59703
59831
|
requestId,
|
|
59704
59832
|
resource,
|
|
59705
59833
|
totalRequested: requested,
|
|
@@ -59710,12 +59838,12 @@ function logPartialFailure(operation2, requestId, resource, requested, succeeded
|
|
|
59710
59838
|
...additionalInfo
|
|
59711
59839
|
});
|
|
59712
59840
|
}
|
|
59713
|
-
var
|
|
59841
|
+
var logger11;
|
|
59714
59842
|
var init_bulkOperations = __esm({
|
|
59715
59843
|
"src/server/utils/bulkOperations.ts"() {
|
|
59716
59844
|
"use strict";
|
|
59717
59845
|
init_shared();
|
|
59718
|
-
|
|
59846
|
+
logger11 = createLogger({ service: "records-lambda" });
|
|
59719
59847
|
__name(logLargeBatchWarning, "logLargeBatchWarning");
|
|
59720
59848
|
__name(calculateTimeoutRisk, "calculateTimeoutRisk");
|
|
59721
59849
|
__name(logPreparationTimeoutRisk, "logPreparationTimeoutRisk");
|
|
@@ -59734,7 +59862,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
59734
59862
|
const itemCount = getItemCount(record);
|
|
59735
59863
|
if (itemCount > DYNAMODB_TRANSACT_WRITE_MAX_ITEMS) {
|
|
59736
59864
|
const errorMsg = `Single record exceeds ${DYNAMODB_TRANSACT_WRITE_MAX_ITEMS} items limit: ${itemCount} items`;
|
|
59737
|
-
|
|
59865
|
+
logger12.error("Chunk validation failed", {
|
|
59738
59866
|
itemCount,
|
|
59739
59867
|
limit: DYNAMODB_TRANSACT_WRITE_MAX_ITEMS
|
|
59740
59868
|
});
|
|
@@ -59756,7 +59884,7 @@ function calculateChunks(records, getItemCount) {
|
|
|
59756
59884
|
chunks.push(currentChunk);
|
|
59757
59885
|
itemCounts.push(currentItemCount);
|
|
59758
59886
|
}
|
|
59759
|
-
|
|
59887
|
+
logger12.info("Chunk calculation completed", {
|
|
59760
59888
|
totalRecords: records.length,
|
|
59761
59889
|
chunkCount: chunks.length,
|
|
59762
59890
|
itemCounts,
|
|
@@ -59772,7 +59900,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59772
59900
|
const errors = [];
|
|
59773
59901
|
const totalRecords = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
59774
59902
|
const executionStartTime = Date.now();
|
|
59775
|
-
|
|
59903
|
+
logger12.info("Starting chunk execution", {
|
|
59776
59904
|
totalChunks: chunks.length,
|
|
59777
59905
|
totalRecords
|
|
59778
59906
|
});
|
|
@@ -59780,14 +59908,14 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59780
59908
|
const chunk = chunks[i4];
|
|
59781
59909
|
const chunkStartTime = Date.now();
|
|
59782
59910
|
try {
|
|
59783
|
-
|
|
59911
|
+
logger12.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
|
|
59784
59912
|
chunkIndex: i4,
|
|
59785
59913
|
recordCount: chunk.length
|
|
59786
59914
|
});
|
|
59787
59915
|
const successfulRecords = await executeChunk(chunk);
|
|
59788
59916
|
successRecords.push(...successfulRecords);
|
|
59789
59917
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
59790
|
-
|
|
59918
|
+
logger12.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
|
|
59791
59919
|
chunkIndex: i4,
|
|
59792
59920
|
recordCount: chunk.length,
|
|
59793
59921
|
durationMs: chunkDuration
|
|
@@ -59796,7 +59924,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59796
59924
|
const chunkDuration = Date.now() - chunkStartTime;
|
|
59797
59925
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
|
|
59798
59926
|
const errorCode = getErrorCode(error2);
|
|
59799
|
-
|
|
59927
|
+
logger12.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
|
|
59800
59928
|
chunkIndex: i4,
|
|
59801
59929
|
recordCount: chunk.length,
|
|
59802
59930
|
durationMs: chunkDuration,
|
|
@@ -59815,7 +59943,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59815
59943
|
}
|
|
59816
59944
|
}
|
|
59817
59945
|
const totalExecutionTime = Date.now() - executionStartTime;
|
|
59818
|
-
|
|
59946
|
+
logger12.info("Chunk execution completed", {
|
|
59819
59947
|
totalChunks: chunks.length,
|
|
59820
59948
|
totalRecords,
|
|
59821
59949
|
successCount: successRecords.length,
|
|
@@ -59824,7 +59952,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
|
|
|
59824
59952
|
avgTimePerChunkMs: chunks.length > 0 ? Math.round(totalExecutionTime / chunks.length) : 0
|
|
59825
59953
|
});
|
|
59826
59954
|
if (failedIds.length > 0) {
|
|
59827
|
-
|
|
59955
|
+
logger12.warn("Partial failure detected in chunk execution", {
|
|
59828
59956
|
totalRecords,
|
|
59829
59957
|
successCount: successRecords.length,
|
|
59830
59958
|
failedCount: failedIds.length,
|
|
@@ -59856,12 +59984,12 @@ function getErrorCode(error2) {
|
|
|
59856
59984
|
}
|
|
59857
59985
|
return "TRANSACTION_FAILED";
|
|
59858
59986
|
}
|
|
59859
|
-
var
|
|
59987
|
+
var logger12;
|
|
59860
59988
|
var init_chunking = __esm({
|
|
59861
59989
|
"src/server/utils/chunking.ts"() {
|
|
59862
59990
|
"use strict";
|
|
59863
59991
|
init_shared();
|
|
59864
|
-
|
|
59992
|
+
logger12 = createLogger({ service: "records-lambda" });
|
|
59865
59993
|
__name(calculateChunks, "calculateChunks");
|
|
59866
59994
|
__name(executeChunks, "executeChunks");
|
|
59867
59995
|
__name(getErrorCode, "getErrorCode");
|
|
@@ -60032,7 +60160,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60032
60160
|
const upsert = options?.upsert ?? false;
|
|
60033
60161
|
const startTime = Date.now();
|
|
60034
60162
|
const costTracker = new CostTracker();
|
|
60035
|
-
|
|
60163
|
+
logger13.debug("Executing updateMany", {
|
|
60036
60164
|
requestId,
|
|
60037
60165
|
resource,
|
|
60038
60166
|
upsert
|
|
@@ -60040,21 +60168,31 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60040
60168
|
let ids;
|
|
60041
60169
|
if ("ids" in params) {
|
|
60042
60170
|
ids = params.ids;
|
|
60043
|
-
|
|
60171
|
+
logger13.debug("Executing updateMany with ids", {
|
|
60044
60172
|
requestId,
|
|
60045
60173
|
resource,
|
|
60046
60174
|
count: ids.length
|
|
60047
60175
|
});
|
|
60048
60176
|
} else {
|
|
60049
|
-
|
|
60177
|
+
logger13.debug("Executing updateMany with filter", {
|
|
60050
60178
|
requestId,
|
|
60051
60179
|
resource,
|
|
60052
60180
|
filter: params.filter
|
|
60053
60181
|
});
|
|
60054
|
-
|
|
60055
|
-
|
|
60056
|
-
|
|
60057
|
-
|
|
60182
|
+
if (Object.keys(params.filter).length === 0) {
|
|
60183
|
+
throw new AppError(
|
|
60184
|
+
"VALIDATION_ERROR" /* VALIDATION_ERROR */,
|
|
60185
|
+
"updateMany requires a non-empty filter or ids",
|
|
60186
|
+
400
|
|
60187
|
+
);
|
|
60188
|
+
}
|
|
60189
|
+
const matched = await findAllByFilter(
|
|
60190
|
+
resource,
|
|
60191
|
+
params.filter,
|
|
60192
|
+
requestId
|
|
60193
|
+
);
|
|
60194
|
+
ids = matched.map((item) => item.id);
|
|
60195
|
+
logger13.debug("Found records with filter", {
|
|
60058
60196
|
requestId,
|
|
60059
60197
|
resource,
|
|
60060
60198
|
count: ids.length
|
|
@@ -60063,7 +60201,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60063
60201
|
if (upsert) {
|
|
60064
60202
|
const newId = ulid2();
|
|
60065
60203
|
ids = [newId];
|
|
60066
|
-
|
|
60204
|
+
logger13.info("Creating new record with filter (upsert: true)", {
|
|
60067
60205
|
requestId,
|
|
60068
60206
|
resource,
|
|
60069
60207
|
newId,
|
|
@@ -60093,32 +60231,10 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60093
60231
|
logLargeBatchWarning("updateMany", ids.length, requestId, resource);
|
|
60094
60232
|
const dbClient2 = getDBClient();
|
|
60095
60233
|
const tableName = getTableName();
|
|
60096
|
-
const
|
|
60097
|
-
PK: resource,
|
|
60098
|
-
|
|
60099
|
-
}));
|
|
60100
|
-
const batchGetResult = await executeDynamoDBOperation(
|
|
60101
|
-
() => dbClient2.send(
|
|
60102
|
-
new import_lib_dynamodb6.BatchGetCommand({
|
|
60103
|
-
RequestItems: {
|
|
60104
|
-
[tableName]: {
|
|
60105
|
-
Keys: keys,
|
|
60106
|
-
ConsistentRead: true
|
|
60107
|
-
}
|
|
60108
|
-
},
|
|
60109
|
-
ReturnConsumedCapacity: "TOTAL"
|
|
60110
|
-
})
|
|
60111
|
-
),
|
|
60112
|
-
"BatchGetItem"
|
|
60234
|
+
const existingItems = await batchGetAll(
|
|
60235
|
+
ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
|
|
60236
|
+
{ consistentRead: true, costTracker, requestId }
|
|
60113
60237
|
);
|
|
60114
|
-
if (Array.isArray(batchGetResult.ConsumedCapacity)) {
|
|
60115
|
-
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
60116
|
-
costTracker.add(capacity);
|
|
60117
|
-
}
|
|
60118
|
-
} else {
|
|
60119
|
-
costTracker.add(batchGetResult.ConsumedCapacity);
|
|
60120
|
-
}
|
|
60121
|
-
const existingItems = batchGetResult.Responses?.[tableName] || [];
|
|
60122
60238
|
const existingIds = new Set(
|
|
60123
60239
|
existingItems.map((item) => {
|
|
60124
60240
|
const data = item.data;
|
|
@@ -60127,7 +60243,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60127
60243
|
);
|
|
60128
60244
|
const notFoundIds = ids.filter((id) => !existingIds.has(id));
|
|
60129
60245
|
if (!upsert && notFoundIds.length > 0) {
|
|
60130
|
-
|
|
60246
|
+
logger13.warn("Records not found (upsert: false)", {
|
|
60131
60247
|
requestId,
|
|
60132
60248
|
resource,
|
|
60133
60249
|
notFoundCount: notFoundIds.length,
|
|
@@ -60136,7 +60252,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60136
60252
|
});
|
|
60137
60253
|
}
|
|
60138
60254
|
if (upsert && notFoundIds.length > 0) {
|
|
60139
|
-
|
|
60255
|
+
logger13.info("Creating new records (upsert: true)", {
|
|
60140
60256
|
requestId,
|
|
60141
60257
|
resource,
|
|
60142
60258
|
notFoundCount: notFoundIds.length,
|
|
@@ -60172,7 +60288,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60172
60288
|
const failedId = existingData.id || "unknown-id";
|
|
60173
60289
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
60174
60290
|
const errorCode = getPreparationErrorCode(error2);
|
|
60175
|
-
|
|
60291
|
+
logger13.error("Failed to prepare record for update", {
|
|
60176
60292
|
requestId,
|
|
60177
60293
|
recordId: failedId,
|
|
60178
60294
|
error: errorMessage,
|
|
@@ -60212,7 +60328,7 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
60212
60328
|
} catch (error2) {
|
|
60213
60329
|
const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
|
|
60214
60330
|
const errorCode = getPreparationErrorCode(error2);
|
|
60215
|
-
|
|
60331
|
+
logger13.error("Failed to prepare new record for upsert", {
|
|
60216
60332
|
requestId,
|
|
60217
60333
|
recordId: id,
|
|
60218
60334
|
error: errorMessage,
|
|
@@ -60425,7 +60541,7 @@ function getPreparationErrorCode(error2) {
|
|
|
60425
60541
|
}
|
|
60426
60542
|
return "VALIDATION_ERROR" /* VALIDATION_ERROR */;
|
|
60427
60543
|
}
|
|
60428
|
-
var import_lib_dynamodb6,
|
|
60544
|
+
var import_lib_dynamodb6, logger13;
|
|
60429
60545
|
var init_updateMany = __esm({
|
|
60430
60546
|
"src/server/operations/updateMany.ts"() {
|
|
60431
60547
|
"use strict";
|
|
@@ -60433,13 +60549,15 @@ var init_updateMany = __esm({
|
|
|
60433
60549
|
init_shared();
|
|
60434
60550
|
init_shadow();
|
|
60435
60551
|
init_shadow();
|
|
60552
|
+
init_batchGet();
|
|
60436
60553
|
init_bulkOperations();
|
|
60437
60554
|
init_chunking();
|
|
60438
60555
|
init_cost_tracker();
|
|
60439
60556
|
init_dynamodb3();
|
|
60440
60557
|
init_mergePatch();
|
|
60441
60558
|
init_timestamps();
|
|
60442
|
-
|
|
60559
|
+
init_findAll();
|
|
60560
|
+
logger13 = createLogger({ service: "records-lambda" });
|
|
60443
60561
|
__name(handleUpdateMany, "handleUpdateMany");
|
|
60444
60562
|
__name(getPreparationErrorCode, "getPreparationErrorCode");
|
|
60445
60563
|
}
|
|
@@ -60457,16 +60575,16 @@ var import_client_ssm2 = __toESM(require_dist_cjs75(), 1);
|
|
|
60457
60575
|
init_shared();
|
|
60458
60576
|
|
|
60459
60577
|
// src/server/operations/findMany.ts
|
|
60460
|
-
var import_lib_dynamodb5 = __toESM(require_dist_cjs81(), 1);
|
|
60461
60578
|
init_shared();
|
|
60462
60579
|
init_shadow();
|
|
60580
|
+
init_batchGet();
|
|
60463
60581
|
init_dynamodb3();
|
|
60464
|
-
|
|
60465
|
-
var
|
|
60582
|
+
init_findAll();
|
|
60583
|
+
var logger10 = createLogger({ service: "records-lambda" });
|
|
60466
60584
|
async function handleFindMany(resource, params, requestId) {
|
|
60467
60585
|
if ("ids" in params) {
|
|
60468
60586
|
const { ids } = params;
|
|
60469
|
-
|
|
60587
|
+
logger10.debug("Executing findMany by ids", {
|
|
60470
60588
|
requestId,
|
|
60471
60589
|
resource,
|
|
60472
60590
|
count: ids.length
|
|
@@ -60474,28 +60592,12 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
60474
60592
|
if (ids.length === 0) {
|
|
60475
60593
|
return [];
|
|
60476
60594
|
}
|
|
60477
|
-
const
|
|
60478
|
-
|
|
60479
|
-
|
|
60480
|
-
PK: resource,
|
|
60481
|
-
SK: generateMainRecordSK2(id)
|
|
60482
|
-
}));
|
|
60483
|
-
const result = await executeDynamoDBOperation(
|
|
60484
|
-
() => dbClient2.send(
|
|
60485
|
-
new import_lib_dynamodb5.BatchGetCommand({
|
|
60486
|
-
RequestItems: {
|
|
60487
|
-
[tableName]: {
|
|
60488
|
-
Keys: keys,
|
|
60489
|
-
ConsistentRead: true
|
|
60490
|
-
}
|
|
60491
|
-
}
|
|
60492
|
-
})
|
|
60493
|
-
),
|
|
60494
|
-
"BatchGetItem"
|
|
60595
|
+
const items = await batchGetAll(
|
|
60596
|
+
ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
|
|
60597
|
+
{ consistentRead: true, requestId }
|
|
60495
60598
|
);
|
|
60496
|
-
const items = result.Responses?.[tableName] || [];
|
|
60497
60599
|
const records = items.map((item) => extractCleanRecord(item));
|
|
60498
|
-
|
|
60600
|
+
logger10.info("findMany by ids succeeded", {
|
|
60499
60601
|
requestId,
|
|
60500
60602
|
resource,
|
|
60501
60603
|
requested: ids.length,
|
|
@@ -60505,25 +60607,19 @@ async function handleFindMany(resource, params, requestId) {
|
|
|
60505
60607
|
}
|
|
60506
60608
|
if ("filter" in params) {
|
|
60507
60609
|
const { filter } = params;
|
|
60508
|
-
|
|
60610
|
+
logger10.debug("Executing findMany by filter", {
|
|
60509
60611
|
requestId,
|
|
60510
60612
|
resource,
|
|
60511
60613
|
filter
|
|
60512
60614
|
});
|
|
60513
|
-
const
|
|
60514
|
-
|
|
60515
|
-
{
|
|
60516
|
-
filter
|
|
60517
|
-
},
|
|
60518
|
-
requestId
|
|
60519
|
-
);
|
|
60520
|
-
logger9.info("findMany by filter succeeded", {
|
|
60615
|
+
const items = await findAllByFilter(resource, filter, requestId);
|
|
60616
|
+
logger10.info("findMany by filter succeeded", {
|
|
60521
60617
|
requestId,
|
|
60522
60618
|
resource,
|
|
60523
60619
|
filter,
|
|
60524
|
-
found:
|
|
60620
|
+
found: items.length
|
|
60525
60621
|
});
|
|
60526
|
-
return
|
|
60622
|
+
return items;
|
|
60527
60623
|
}
|
|
60528
60624
|
throw new Error("findMany requires either ids or filter");
|
|
60529
60625
|
}
|
|
@@ -60531,13 +60627,14 @@ __name(handleFindMany, "handleFindMany");
|
|
|
60531
60627
|
|
|
60532
60628
|
// src/server/operations/updateOne.ts
|
|
60533
60629
|
init_shared();
|
|
60534
|
-
|
|
60630
|
+
init_findAll();
|
|
60631
|
+
var logger14 = createLogger({ service: "records-lambda" });
|
|
60535
60632
|
async function handleUpdateOne(resource, params, requestId) {
|
|
60536
60633
|
const { data: patchData, options } = params;
|
|
60537
60634
|
const { handleUpdateMany: handleUpdateMany2 } = await Promise.resolve().then(() => (init_updateMany(), updateMany_exports));
|
|
60538
60635
|
if ("id" in params) {
|
|
60539
60636
|
const targetId = params.id;
|
|
60540
|
-
|
|
60637
|
+
logger14.debug("Executing updateOne with id", {
|
|
60541
60638
|
requestId,
|
|
60542
60639
|
resource,
|
|
60543
60640
|
id: targetId,
|
|
@@ -60579,19 +60676,20 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
60579
60676
|
consumedCapacity: updateManyResult.consumedCapacity
|
|
60580
60677
|
};
|
|
60581
60678
|
} else {
|
|
60582
|
-
|
|
60679
|
+
logger14.debug("Executing updateOne with filter", {
|
|
60583
60680
|
requestId,
|
|
60584
60681
|
resource,
|
|
60585
60682
|
filter: params.filter,
|
|
60586
60683
|
upsert: options?.upsert
|
|
60587
60684
|
});
|
|
60685
|
+
const target = await findOneByFilter(
|
|
60686
|
+
resource,
|
|
60687
|
+
params.filter,
|
|
60688
|
+
requestId
|
|
60689
|
+
);
|
|
60588
60690
|
const updateManyResult = await handleUpdateMany2(
|
|
60589
60691
|
resource,
|
|
60590
|
-
{
|
|
60591
|
-
filter: params.filter,
|
|
60592
|
-
data: patchData,
|
|
60593
|
-
options
|
|
60594
|
-
},
|
|
60692
|
+
target ? { ids: [target.id], data: patchData, options } : { filter: params.filter, data: patchData, options },
|
|
60595
60693
|
requestId
|
|
60596
60694
|
);
|
|
60597
60695
|
if (updateManyResult.count === 0) {
|
|
@@ -60727,7 +60825,7 @@ async function getImagePolicy(ssmClient2, paramName) {
|
|
|
60727
60825
|
__name(getImagePolicy, "getImagePolicy");
|
|
60728
60826
|
|
|
60729
60827
|
// src/server/media/process-handler.ts
|
|
60730
|
-
var
|
|
60828
|
+
var logger15 = createLogger({ service: "media-process-handler" });
|
|
60731
60829
|
var s3Client = new import_client_s3.S3Client({ region: process.env.AWS_REGION });
|
|
60732
60830
|
var ssmClient = new import_client_ssm2.SSMClient({ region: process.env.AWS_REGION });
|
|
60733
60831
|
var MAX_INPUT_PIXELS = 1e8;
|
|
@@ -60767,7 +60865,7 @@ async function processRecord(bucket, rawKey) {
|
|
|
60767
60865
|
const existing = await handleFindMany("media", { ids: [fileId] }, requestId);
|
|
60768
60866
|
const existingRecord = existing[0];
|
|
60769
60867
|
if (existingRecord?.status === "completed") {
|
|
60770
|
-
|
|
60868
|
+
logger15.warn("Media already completed, ignoring re-upload to the same fileId", {
|
|
60771
60869
|
requestId,
|
|
60772
60870
|
fileId
|
|
60773
60871
|
});
|
|
@@ -60779,7 +60877,7 @@ async function processRecord(bucket, rawKey) {
|
|
|
60779
60877
|
const originalFilename = decodeOriginalFilename(metadata["original-filename"]);
|
|
60780
60878
|
const headBytes = await getHeadBytes(bucket, key);
|
|
60781
60879
|
if (!verifyMagicBytes(contentType, headBytes)) {
|
|
60782
|
-
|
|
60880
|
+
logger15.warn("Content type does not match file signature", { requestId, fileId, contentType });
|
|
60783
60881
|
await writeMediaRecord(
|
|
60784
60882
|
fileId,
|
|
60785
60883
|
{
|
|
@@ -60854,7 +60952,7 @@ async function processRecord(bucket, rawKey) {
|
|
|
60854
60952
|
requestId
|
|
60855
60953
|
);
|
|
60856
60954
|
}
|
|
60857
|
-
|
|
60955
|
+
logger15.info("Media processed", { requestId, fileId, contentType });
|
|
60858
60956
|
}
|
|
60859
60957
|
__name(processRecord, "processRecord");
|
|
60860
60958
|
var handler = /* @__PURE__ */ __name(async (event) => {
|
|
@@ -60864,7 +60962,7 @@ var handler = /* @__PURE__ */ __name(async (event) => {
|
|
|
60864
60962
|
try {
|
|
60865
60963
|
await processRecord(bucket, key);
|
|
60866
60964
|
} catch (error2) {
|
|
60867
|
-
|
|
60965
|
+
logger15.error("Failed to process media", {
|
|
60868
60966
|
bucket,
|
|
60869
60967
|
key,
|
|
60870
60968
|
error: error2 instanceof Error ? error2.message : String(error2)
|