@exabugs/dynamodb-client 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -0
  3. package/dist/client/FindCursor.d.ts +11 -6
  4. package/dist/client/FindCursor.d.ts.map +1 -1
  5. package/dist/client/FindCursor.js +30 -11
  6. package/dist/client/FindCursor.js.map +1 -1
  7. package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyField.d.ts.map +1 -1
  8. package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyField.js +5 -4
  9. package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyField.js.map +1 -1
  10. package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyInput.d.ts.map +1 -1
  11. package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyInput.js +5 -4
  12. package/dist/integrations/react-admin/components/ReferenceManyToMany/ReferenceManyToManyInput.js.map +1 -1
  13. package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.d.ts +19 -0
  14. package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.d.ts.map +1 -0
  15. package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.js +36 -0
  16. package/dist/integrations/react-admin/components/ReferenceManyToMany/useGetListAll.js.map +1 -0
  17. package/dist/integrations/react-admin/dataProvider.d.ts +15 -1
  18. package/dist/integrations/react-admin/dataProvider.d.ts.map +1 -1
  19. package/dist/integrations/react-admin/dataProvider.js +61 -4
  20. package/dist/integrations/react-admin/dataProvider.js.map +1 -1
  21. package/dist/integrations/react-admin/index.d.ts +1 -0
  22. package/dist/integrations/react-admin/index.d.ts.map +1 -1
  23. package/dist/integrations/react-admin/index.js.map +1 -1
  24. package/dist/server/handler.cjs +683 -499
  25. package/dist/server/handler.cjs.map +4 -4
  26. package/dist/server/media-handler.cjs +2 -2
  27. package/dist/server/media-process-handler-dlq.cjs +544 -344
  28. package/dist/server/media-process-handler-dlq.cjs.map +4 -4
  29. package/dist/server/media-process-handler.cjs +543 -343
  30. package/dist/server/media-process-handler.cjs.map +4 -4
  31. package/dist/server/operations/deleteMany.d.ts.map +1 -1
  32. package/dist/server/operations/deleteMany.js +15 -30
  33. package/dist/server/operations/deleteMany.js.map +1 -1
  34. package/dist/server/operations/deleteOne.d.ts.map +1 -1
  35. package/dist/server/operations/deleteOne.js +7 -4
  36. package/dist/server/operations/deleteOne.js.map +1 -1
  37. package/dist/server/operations/find/idQuery.d.ts.map +1 -1
  38. package/dist/server/operations/find/idQuery.js +23 -9
  39. package/dist/server/operations/find/idQuery.js.map +1 -1
  40. package/dist/server/operations/find/nearQuery.d.ts.map +1 -1
  41. package/dist/server/operations/find/nearQuery.js +41 -40
  42. package/dist/server/operations/find/nearQuery.js.map +1 -1
  43. package/dist/server/operations/find/shadowQuery.d.ts +7 -0
  44. package/dist/server/operations/find/shadowQuery.d.ts.map +1 -1
  45. package/dist/server/operations/find/shadowQuery.js +34 -42
  46. package/dist/server/operations/find/shadowQuery.js.map +1 -1
  47. package/dist/server/operations/findAll.d.ts +8 -0
  48. package/dist/server/operations/findAll.d.ts.map +1 -0
  49. package/dist/server/operations/findAll.js +46 -0
  50. package/dist/server/operations/findAll.js.map +1 -0
  51. package/dist/server/operations/findMany.d.ts.map +1 -1
  52. package/dist/server/operations/findMany.js +9 -26
  53. package/dist/server/operations/findMany.js.map +1 -1
  54. package/dist/server/operations/findManyReference.d.ts.map +1 -1
  55. package/dist/server/operations/findManyReference.js +4 -14
  56. package/dist/server/operations/findManyReference.js.map +1 -1
  57. package/dist/server/operations/parameterConverter.d.ts.map +1 -1
  58. package/dist/server/operations/parameterConverter.js +16 -8
  59. package/dist/server/operations/parameterConverter.js.map +1 -1
  60. package/dist/server/operations/updateMany.d.ts.map +1 -1
  61. package/dist/server/operations/updateMany.js +15 -30
  62. package/dist/server/operations/updateMany.js.map +1 -1
  63. package/dist/server/operations/updateOne.d.ts.map +1 -1
  64. package/dist/server/operations/updateOne.js +8 -6
  65. package/dist/server/operations/updateOne.js.map +1 -1
  66. package/dist/server/utils/batchGet.d.ts +21 -0
  67. package/dist/server/utils/batchGet.d.ts.map +1 -0
  68. package/dist/server/utils/batchGet.js +73 -0
  69. package/dist/server/utils/batchGet.js.map +1 -0
  70. package/dist/server/utils/scanWarning.d.ts +30 -0
  71. package/dist/server/utils/scanWarning.d.ts.map +1 -0
  72. package/dist/server/utils/scanWarning.js +63 -0
  73. package/dist/server/utils/scanWarning.js.map +1 -0
  74. package/dist/shared/utils/index.d.ts +1 -0
  75. package/dist/shared/utils/index.d.ts.map +1 -1
  76. package/dist/shared/utils/index.js +1 -0
  77. package/dist/shared/utils/index.js.map +1 -1
  78. package/dist/shared/utils/scanSort.d.ts +16 -0
  79. package/dist/shared/utils/scanSort.d.ts.map +1 -0
  80. package/dist/shared/utils/scanSort.js +33 -0
  81. package/dist/shared/utils/scanSort.js.map +1 -0
  82. package/dist/sharp-layer.zip +0 -0
  83. package/docs/README.md +286 -0
  84. package/docs/SCAN_WARNING.md +81 -0
  85. package/package.json +2 -1
  86. package/terraform/README.md +8 -6
  87. package/terraform/main.tf +40 -1
  88. package/terraform/outputs.tf +13 -0
  89. package/terraform/variables.tf +17 -0
@@ -1,5 +1,5 @@
1
- // @exabugs/dynamodb-client v1.8.0
2
- // Built: 2026-10-11T23:03:45.636Z
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 logger14;
2044
+ let logger16;
2045
2045
  let tryNextLink = true;
2046
2046
  if (typeof options === "boolean") {
2047
- logger14 = void 0;
2047
+ logger16 = void 0;
2048
2048
  tryNextLink = options;
2049
2049
  } else if (options != null && typeof options === "object") {
2050
- logger14 = options.logger;
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
- logger14?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
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: logger14 } = configuration;
2490
- const envOptions = { signingName, logger: logger14 };
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, logger14) {
4109
+ function createBufferedReadableStream(upstream, size, logger16) {
4110
4110
  const reader = upstream.getReader();
4111
4111
  let streamBufferingLoggedWarning = false;
4112
4112
  let bytesSeen = 0;
@@ -4144,7 +4144,7 @@ function createBufferedReadableStream(upstream, size, logger14) {
4144
4144
  const newSize = merge(buffers, mode, chunk);
4145
4145
  if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
4146
4146
  streamBufferingLoggedWarning = true;
4147
- logger14?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
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, logger14) {
4211
+ function createBufferedReadable(upstream, size, logger16) {
4212
4212
  if (isReadableStream(upstream)) {
4213
- return createBufferedReadableStream(upstream, size, logger14);
4213
+ return createBufferedReadableStream(upstream, size, logger16);
4214
4214
  }
4215
4215
  const downstream = new import_node_stream2.Readable({ read() {
4216
4216
  } });
@@ -4243,7 +4243,7 @@ function createBufferedReadable(upstream, size, logger14) {
4243
4243
  const newSize = merge(buffers, mode, chunk);
4244
4244
  if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
4245
4245
  streamBufferingLoggedWarning = true;
4246
- logger14?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
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 logger14;
8284
+ let logger16;
8285
8285
  let tryNextLink = true;
8286
8286
  if (typeof options === "boolean") {
8287
- logger14 = void 0;
8287
+ logger16 = void 0;
8288
8288
  tryNextLink = options;
8289
8289
  } else if (options != null && typeof options === "object") {
8290
- logger14 = options.logger;
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
- logger14?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
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: logger14 } = configuration;
11109
+ const { logger: logger16 } = configuration;
11110
11110
  const handlerExecutionContext = {
11111
- logger: logger14,
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, logger14) {
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
- logger14?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
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, logger14) {
15034
+ function createBufferedReadable2(upstream, size, logger16) {
15035
15035
  if ((0, stream_type_check_1.isReadableStream)(upstream)) {
15036
- return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size, logger14);
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
- logger14?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
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, logger14) => {
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
- logger14?.warn?.(msg);
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, logger14 = console) {
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
- logger14?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
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: logger14 }) => {
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
- logger14?.warn(`Skipping ${exports2.ChecksumAlgorithm.CRC64NVME} checksum validation: ${error2.message}`);
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: logger14, dynamoDbDocumentClientOptions = {} } = context;
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
- logger14?.info?.({
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: logger14, dynamoDbDocumentClientOptions = {} } = context;
18813
+ const { clientName, commandName, logger: logger16, dynamoDbDocumentClientOptions = {} } = context;
18814
18814
  const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
18815
18815
  const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
18816
- logger14?.error?.({
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: logger14 } = options;
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: logger14, referenceRecord: {} });
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 logger14 = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
20631
+ const logger16 = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
20632
20632
  if (typeof appId !== "string") {
20633
- logger14?.warn("userAgentAppId must be a string or undefined.");
20633
+ logger16?.warn("userAgentAppId must be a string or undefined.");
20634
20634
  } else if (appId.length > 50) {
20635
- logger14?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
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: logger14 } = configuration;
21504
- const envOptions = { signingName, logger: logger14 };
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: logger14 }) => {
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: logger14
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: logger14
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: logger14
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, logger14) => {
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
- logger14.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}.
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 logger14 = options?.logger || console;
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, logger14);
23843
+ credentials = getExtendedInstanceMetadataCredentials(credentials, logger16);
23844
23844
  }
23845
23845
  } catch (e4) {
23846
23846
  if (pastCredentials) {
23847
- logger14.warn("Credential renew failed: ", e4);
23848
- credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger14);
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: logger14, profile } = init;
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
- logger14?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
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
- logger14?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
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, logger14) => {
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: logger14 });
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, logger14) {
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: logger14 });
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: logger14 }), {
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: logger14 });
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: logger14, signingName } = {}) => async () => {
25449
- logger14?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
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: logger14 });
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: logger14 });
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: logger14 }) => async () => {
25577
- logger14?.debug("@aws-sdk/token-providers - fromStatic");
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: logger14 }) => {
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: logger14
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: logger14
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: logger14
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: logger14
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: logger14
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, logger14) => {
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: logger14 });
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: logger14, userAgentAppId } = this.callerClientConfig ?? {};
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: logger14,
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: logger14 = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
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: logger14,
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: logger14
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: logger14 = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
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: logger14,
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: logger14
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, logger14) => {
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: logger14 });
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: logger14 });
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: logger14
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, logger14) => {
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
- logger14?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
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
- logger14?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
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
- logger14?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
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: logger14 });
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: logger14 } = {}) => {
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: logger14 }) || isCredentialSourceProfile(arg, { profile, logger: logger14 }));
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: logger14 }) => {
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
- logger14?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
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: logger14 }) => {
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
- logger14?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
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 sleep = /* @__PURE__ */ __name((seconds) => {
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 sleep(delay);
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 BatchGetCommand5 = class extends DynamoDBDocumentClientCommand {
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 BatchGetCommand5(args);
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 = BatchGetCommand5;
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;
@@ -58394,6 +58494,59 @@ var init_pagination = __esm({
58394
58494
  }
58395
58495
  });
58396
58496
 
58497
+ // src/server/utils/scanWarning.ts
58498
+ function getScanWarnThreshold() {
58499
+ const raw = process.env.SCAN_WARN_THRESHOLD;
58500
+ if (raw === void 0 || raw === "") {
58501
+ return DEFAULT_SCAN_WARN_THRESHOLD;
58502
+ }
58503
+ const value = Number(raw);
58504
+ return Number.isInteger(value) && value >= 1 ? value : DEFAULT_SCAN_WARN_THRESHOLD;
58505
+ }
58506
+ var logger4, SPARSE_SCAN_EVENT, DEFAULT_SCAN_WARN_THRESHOLD, ScanWatcher;
58507
+ var init_scanWarning = __esm({
58508
+ "src/server/utils/scanWarning.ts"() {
58509
+ "use strict";
58510
+ init_shared();
58511
+ logger4 = createLogger({ service: "scan-warning", level: "warn" });
58512
+ SPARSE_SCAN_EVENT = "SPARSE_SCAN";
58513
+ DEFAULT_SCAN_WARN_THRESHOLD = 5e3;
58514
+ __name(getScanWarnThreshold, "getScanWarnThreshold");
58515
+ ScanWatcher = class {
58516
+ constructor(context) {
58517
+ this.context = context;
58518
+ }
58519
+ static {
58520
+ __name(this, "ScanWatcher");
58521
+ }
58522
+ scanned = 0;
58523
+ warned = false;
58524
+ threshold = getScanWarnThreshold();
58525
+ /** 読んだ件数を加える */
58526
+ add(count) {
58527
+ this.scanned += count;
58528
+ if (!this.warned && this.scanned >= this.threshold) {
58529
+ this.warned = true;
58530
+ logger4.warn(
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`,
58532
+ {
58533
+ event: SPARSE_SCAN_EVENT,
58534
+ ...this.context,
58535
+ scanned: this.scanned,
58536
+ threshold: this.threshold,
58537
+ actions: [
58538
+ "\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9: \u7D5E\u308A\u8FBC\u307F\u306B\u4F7F\u3046\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30B7\u30E3\u30C9\u30FC\u8A2D\u5B9A\u306B\u8FFD\u52A0\u3057\u3001$eq \u306A\u3069\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3067\u89E3\u6C7A\u3067\u304D\u308B\u6761\u4EF6\u306B\u3059\u308B",
58539
+ "\u30B9\u30AD\u30FC\u30DE: \u7D5E\u308A\u8FBC\u307F\u6761\u4EF6\u3092\u30AD\u30FC\u306B\u3067\u304D\u308B\u3088\u3046\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u5206\u5272\u30FB\u975E\u6B63\u898F\u5316\u3092\u691C\u8A0E\u3059\u308B",
58540
+ "\u30ED\u30B8\u30C3\u30AF: \u7D5E\u308A\u8FBC\u307F\u3092\u6BCE\u56DE\u884C\u3046\u5FC5\u8981\u304C\u3042\u308B\u304B\u3001\u6761\u4EF6\u3092\u5909\u3048\u3089\u308C\u306A\u3044\u304B\u3001\u7D50\u679C\u3092\u30AD\u30E3\u30C3\u30B7\u30E5\u3067\u304D\u306A\u3044\u304B\u3092\u898B\u76F4\u3059"
58541
+ ]
58542
+ }
58543
+ );
58544
+ }
58545
+ }
58546
+ };
58547
+ }
58548
+ });
58549
+
58397
58550
  // src/server/utils/filter.ts
58398
58551
  function parseFilterField(fieldKey) {
58399
58552
  const parts = fieldKey.split(":");
@@ -58482,7 +58635,7 @@ function parseFilters(filter) {
58482
58635
  parsedFilters.push({ parsed, value });
58483
58636
  }
58484
58637
  } catch (error2) {
58485
- logger3.error("Invalid filter field syntax", {
58638
+ logger5.error("Invalid filter field syntax", {
58486
58639
  fieldKey,
58487
58640
  error: error2 instanceof Error ? error2.message : String(error2)
58488
58641
  });
@@ -58551,7 +58704,7 @@ function detectNearQuery(filter) {
58551
58704
  }
58552
58705
  return null;
58553
58706
  }
58554
- var logger3;
58707
+ var logger5;
58555
58708
  var init_utils5 = __esm({
58556
58709
  "src/server/operations/find/utils.ts"() {
58557
58710
  "use strict";
@@ -58560,7 +58713,7 @@ var init_utils5 = __esm({
58560
58713
  init_shadow();
58561
58714
  init_filter();
58562
58715
  init_validation2();
58563
- logger3 = createLogger({
58716
+ logger5 = createLogger({
58564
58717
  service: "find-utils",
58565
58718
  level: process.env.LOG_LEVEL || "info"
58566
58719
  });
@@ -58577,7 +58730,7 @@ var init_utils5 = __esm({
58577
58730
  async function executeIdQuery(resource, normalizedParams, requestId) {
58578
58731
  const { sort, pagination, parsedFilters } = normalizedParams;
58579
58732
  const { perPage, nextToken } = pagination;
58580
- logger4.debug("Executing ID optimized query", {
58733
+ logger6.debug("Executing ID optimized query", {
58581
58734
  requestId,
58582
58735
  resource,
58583
58736
  sort,
@@ -58598,7 +58751,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
58598
58751
  const costTracker = new CostTracker();
58599
58752
  const queryResult = await executeDynamoDBOperation(
58600
58753
  () => dbClient2.send(
58601
- new import_lib_dynamodb2.QueryCommand({
58754
+ new import_lib_dynamodb3.QueryCommand({
58602
58755
  TableName: tableName,
58603
58756
  KeyConditionExpression: "PK = :pk AND SK = :sk",
58604
58757
  ExpressionAttributeValues: {
@@ -58614,7 +58767,7 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
58614
58767
  costTracker.add(queryResult.ConsumedCapacity);
58615
58768
  const mainRecords = queryResult.Items || [];
58616
58769
  const items = mainRecords.map((item) => extractCleanRecord(item));
58617
- logger4.info("ID specific query succeeded", {
58770
+ logger6.info("ID specific query succeeded", {
58618
58771
  requestId,
58619
58772
  resource,
58620
58773
  targetId,
@@ -58637,7 +58790,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
58637
58790
  targetIds.map(
58638
58791
  (id) => executeDynamoDBOperation(
58639
58792
  () => dbClient2.send(
58640
- new import_lib_dynamodb2.QueryCommand({
58793
+ new import_lib_dynamodb3.QueryCommand({
58641
58794
  TableName: tableName,
58642
58795
  KeyConditionExpression: "PK = :pk AND SK = :sk",
58643
58796
  ExpressionAttributeValues: {
@@ -58661,7 +58814,7 @@ async function executeInQuery(resource, targetIds, sort, requestId) {
58661
58814
  const bVal = String(b4.id ?? "");
58662
58815
  return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
58663
58816
  });
58664
- logger4.info("ID $in query succeeded", {
58817
+ logger6.info("ID $in query succeeded", {
58665
58818
  requestId,
58666
58819
  resource,
58667
58820
  requestedCount: targetIds.length,
@@ -58700,7 +58853,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
58700
58853
  }
58701
58854
  const queryResult = await executeDynamoDBOperation(
58702
58855
  () => dbClient2.send(
58703
- new import_lib_dynamodb2.QueryCommand({
58856
+ new import_lib_dynamodb3.QueryCommand({
58704
58857
  TableName: tableName,
58705
58858
  KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
58706
58859
  ExpressionAttributeValues: {
@@ -58737,7 +58890,7 @@ async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsed
58737
58890
  queryResult.LastEvaluatedKey.PK,
58738
58891
  queryResult.LastEvaluatedKey.SK
58739
58892
  ) : void 0;
58740
- logger4.info("ID all records query succeeded", {
58893
+ logger6.info("ID all records query succeeded", {
58741
58894
  requestId,
58742
58895
  resource,
58743
58896
  count: items.length,
@@ -58769,18 +58922,28 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
58769
58922
  let iterations = 0;
58770
58923
  let previousKeySignature;
58771
58924
  let chunkSize = SCAN_CHUNK_INITIAL;
58925
+ const watcher = new ScanWatcher({
58926
+ requestId,
58927
+ resource,
58928
+ path: "id-filtered-scan",
58929
+ sortField: sort.field,
58930
+ filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
58931
+ });
58772
58932
  scan: while (true) {
58773
58933
  if (++iterations > SCAN_MAX_ITERATIONS) {
58774
- logger4.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E\u3057\u305F\u305F\u3081\u4E2D\u65AD", {
58934
+ logger6.error("executeAllRecordsQueryFullScan: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
58775
58935
  requestId,
58776
58936
  resource,
58777
58937
  iterations
58778
58938
  });
58779
- break;
58939
+ throw new AppError("INTERNAL_ERROR" /* INTERNAL_ERROR */, "ID scan exceeded the iteration limit", 500, {
58940
+ resource,
58941
+ iterations
58942
+ });
58780
58943
  }
58781
58944
  const queryResult = await executeDynamoDBOperation(
58782
58945
  () => dbClient2.send(
58783
- new import_lib_dynamodb2.QueryCommand({
58946
+ new import_lib_dynamodb3.QueryCommand({
58784
58947
  TableName: tableName,
58785
58948
  KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
58786
58949
  ExpressionAttributeValues: {
@@ -58797,6 +58960,7 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
58797
58960
  "Query"
58798
58961
  );
58799
58962
  costTracker.add(queryResult.ConsumedCapacity);
58963
+ watcher.add((queryResult.Items || []).length);
58800
58964
  for (const row of queryResult.Items || []) {
58801
58965
  scanned++;
58802
58966
  if (!matchesAllFilters(extractCleanRecord(row), parsedFilters)) {
@@ -58815,19 +58979,24 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
58815
58979
  }
58816
58980
  const nextKeySignature = `${nextKey.PK}#${nextKey.SK}`;
58817
58981
  if (nextKeySignature === previousKeySignature) {
58818
- logger4.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F\u305F\u3081\u4E2D\u65AD", {
58982
+ logger6.error("executeAllRecordsQueryFullScan: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
58819
58983
  requestId,
58820
58984
  resource,
58821
58985
  iterations
58822
58986
  });
58823
- break;
58987
+ throw new AppError(
58988
+ "INTERNAL_ERROR" /* INTERNAL_ERROR */,
58989
+ "ID scan received the same LastEvaluatedKey repeatedly",
58990
+ 500,
58991
+ { resource, iterations }
58992
+ );
58824
58993
  }
58825
58994
  previousKeySignature = nextKeySignature;
58826
58995
  exclusiveStartKey = nextKey;
58827
58996
  chunkSize = Math.min(chunkSize * 2, SCAN_CHUNK_MAX);
58828
58997
  }
58829
58998
  const nextTokenValue = hasNextPage && lastReturned ? encodeNextToken(lastReturned.PK, lastReturned.SK) : void 0;
58830
- logger4.info("ID filtered scan query succeeded", {
58999
+ logger6.info("ID filtered scan query succeeded", {
58831
59000
  requestId,
58832
59001
  resource,
58833
59002
  scanned,
@@ -58841,17 +59010,18 @@ async function executeAllRecordsQueryFullScan(resource, sort, perPage, nextToken
58841
59010
  consumedCapacity: costTracker.getAggregated()
58842
59011
  };
58843
59012
  }
58844
- var import_lib_dynamodb2, logger4, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
59013
+ var import_lib_dynamodb3, logger6, SCAN_CHUNK_INITIAL, SCAN_CHUNK_MAX, SCAN_MAX_ITERATIONS;
58845
59014
  var init_idQuery = __esm({
58846
59015
  "src/server/operations/find/idQuery.ts"() {
58847
59016
  "use strict";
58848
- import_lib_dynamodb2 = __toESM(require_dist_cjs81(), 1);
59017
+ import_lib_dynamodb3 = __toESM(require_dist_cjs81(), 1);
58849
59018
  init_shared();
58850
59019
  init_cost_tracker();
58851
59020
  init_dynamodb3();
58852
59021
  init_pagination();
59022
+ init_scanWarning();
58853
59023
  init_utils5();
58854
- logger4 = createLogger({
59024
+ logger6 = createLogger({
58855
59025
  service: "id-query",
58856
59026
  level: process.env.LOG_LEVEL || "info"
58857
59027
  });
@@ -58868,7 +59038,7 @@ var init_idQuery = __esm({
58868
59038
 
58869
59039
  // src/server/operations/find/nearQuery.ts
58870
59040
  async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId) {
58871
- logger5.debug("Executing $near query", {
59041
+ logger7.debug("Executing $near query", {
58872
59042
  requestId,
58873
59043
  resource,
58874
59044
  fieldName,
@@ -58879,32 +59049,58 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
58879
59049
  const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
58880
59050
  const dbClient2 = getDBClient();
58881
59051
  const tableName = getTableName();
58882
- logger5.debug("Searching shadow records", {
59052
+ logger7.debug("Searching shadow records", {
58883
59053
  requestId,
58884
59054
  resource,
58885
59055
  fieldName,
58886
59056
  geohashPrefix,
58887
59057
  skPrefix: `${fieldName}#${geohashPrefix}`
58888
59058
  });
58889
- const queryResult = await executeDynamoDBOperation(
58890
- () => dbClient2.send(
58891
- new import_lib_dynamodb3.QueryCommand({
58892
- TableName: tableName,
58893
- KeyConditionExpression: "PK = :pk AND begins_with(SK, :skPrefix)",
58894
- ExpressionAttributeValues: {
58895
- ":pk": resource,
58896
- ":skPrefix": `${fieldName}#${geohashPrefix}`
58897
- },
58898
- ConsistentRead: false,
58899
- // シャドウレコードは結果整合性で十分
58900
- ReturnConsumedCapacity: "TOTAL"
58901
- })
58902
- ),
58903
- "Query"
58904
- );
58905
- costTracker.add(queryResult.ConsumedCapacity);
58906
- const shadowRecords = queryResult.Items || [];
58907
- logger5.debug("Shadow records found", {
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", {
58908
59104
  requestId,
58909
59105
  resource,
58910
59106
  geohashPrefix,
@@ -58915,48 +59111,24 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
58915
59111
  const parts = sk.split("#id#");
58916
59112
  return parts.length === 2 ? parts[1] : null;
58917
59113
  }).filter((id) => id !== null);
58918
- logger5.debug("Main record IDs extracted", {
59114
+ logger7.debug("Main record IDs extracted", {
58919
59115
  requestId,
58920
59116
  resource,
58921
59117
  geohashPrefix,
58922
59118
  ids: mainRecordIds
58923
59119
  });
58924
- const BATCH_SIZE = 100;
58925
- const validRecords = [];
58926
- for (let i4 = 0; i4 < mainRecordIds.length; i4 += BATCH_SIZE) {
58927
- const chunk = mainRecordIds.slice(i4, i4 + BATCH_SIZE);
58928
- const batchGetResult = await executeDynamoDBOperation(
58929
- () => dbClient2.send(
58930
- new import_lib_dynamodb3.BatchGetCommand({
58931
- RequestItems: {
58932
- [tableName]: {
58933
- Keys: chunk.map((id) => ({
58934
- PK: resource,
58935
- SK: `id#${id}`
58936
- })),
58937
- ConsistentRead: false
58938
- }
58939
- },
58940
- ReturnConsumedCapacity: "TOTAL"
58941
- })
58942
- ),
58943
- "BatchGetItem"
58944
- );
58945
- if (batchGetResult.ConsumedCapacity) {
58946
- for (const capacity of batchGetResult.ConsumedCapacity) {
58947
- costTracker.add(capacity);
58948
- }
58949
- }
58950
- validRecords.push(...batchGetResult.Responses?.[tableName] || []);
58951
- }
58952
- logger5.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", {
58953
59125
  requestId,
58954
59126
  resource,
58955
59127
  geohashPrefix,
58956
59128
  count: validRecords.length
58957
59129
  });
58958
59130
  const cleanRecords = validRecords.map((record) => extractCleanRecord(record));
58959
- logger5.debug("Clean records extracted", {
59131
+ logger7.debug("Clean records extracted", {
58960
59132
  requestId,
58961
59133
  resource,
58962
59134
  geohashPrefix,
@@ -58975,7 +59147,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
58975
59147
  config
58976
59148
  );
58977
59149
  const items = result.documents;
58978
- logger5.info("$near query succeeded", {
59150
+ logger7.info("$near query succeeded", {
58979
59151
  requestId,
58980
59152
  resource,
58981
59153
  fieldName,
@@ -58993,17 +59165,19 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
58993
59165
  consumedCapacity: costTracker.getAggregated()
58994
59166
  };
58995
59167
  }
58996
- var import_lib_dynamodb3, logger5;
59168
+ var import_lib_dynamodb4, logger7;
58997
59169
  var init_nearQuery = __esm({
58998
59170
  "src/server/operations/find/nearQuery.ts"() {
58999
59171
  "use strict";
59000
- import_lib_dynamodb3 = __toESM(require_dist_cjs81(), 1);
59172
+ import_lib_dynamodb4 = __toESM(require_dist_cjs81(), 1);
59001
59173
  init_geohash();
59002
59174
  init_shared();
59003
59175
  init_nearSearch();
59176
+ init_batchGet();
59004
59177
  init_cost_tracker();
59005
59178
  init_dynamodb3();
59006
- logger5 = createLogger({
59179
+ init_scanWarning();
59180
+ logger7 = createLogger({
59007
59181
  service: "near-query",
59008
59182
  level: process.env.LOG_LEVEL || "info"
59009
59183
  });
@@ -59033,7 +59207,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
59033
59207
  (f4) => !(isKeyConditionOptimized && f4 === optimizableFilter)
59034
59208
  );
59035
59209
  if (residualFilters.length > 0) {
59036
- logger6.debug("Residual filters detected, falling back to full scan", {
59210
+ logger8.debug("Residual filters detected, falling back to full scan", {
59037
59211
  requestId,
59038
59212
  resource,
59039
59213
  sortField: sort.field,
@@ -59041,7 +59215,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
59041
59215
  });
59042
59216
  return executeFullScanQuery(resource, normalizedParams, costTracker, requestId);
59043
59217
  }
59044
- logger6.debug("Executing shadow query", {
59218
+ logger8.debug("Executing shadow query", {
59045
59219
  requestId,
59046
59220
  resource,
59047
59221
  sortField: sort.field,
@@ -59089,7 +59263,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
59089
59263
  shadowRecords.LastEvaluatedKey.PK,
59090
59264
  shadowRecords.LastEvaluatedKey.SK
59091
59265
  ) : void 0;
59092
- logger6.info("Shadow query succeeded", {
59266
+ logger8.info("Shadow query succeeded", {
59093
59267
  requestId,
59094
59268
  resource,
59095
59269
  sortField: sort.field,
@@ -59114,7 +59288,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
59114
59288
  const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
59115
59289
  const filterSort = { field: filterCandidate.parsed.field, order: "ASC" };
59116
59290
  const remainingFilters = parsedFilters.filter((f4) => f4 !== filterCandidate);
59117
- logger6.debug("Executing filter-first query", {
59291
+ logger8.debug("Executing filter-first query", {
59118
59292
  requestId,
59119
59293
  resource,
59120
59294
  filterField: filterCandidate.parsed.field,
@@ -59126,7 +59300,9 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
59126
59300
  filterSort,
59127
59301
  filterCandidate,
59128
59302
  costTracker,
59129
- requestId
59303
+ requestId,
59304
+ "shadow-filter-first",
59305
+ parsedFilters
59130
59306
  );
59131
59307
  if (remainingFilters.length > 0) {
59132
59308
  items = items.filter((r4) => matchesAllFilters(r4, remainingFilters));
@@ -59135,7 +59311,7 @@ async function executeFilterFirstQuery(resource, normalizedParams, filterCandida
59135
59311
  const page = items.slice(offset, offset + perPage);
59136
59312
  const hasNextPage = offset + perPage < items.length;
59137
59313
  const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
59138
- logger6.info("Filter-first query succeeded", {
59314
+ logger8.info("Filter-first query succeeded", {
59139
59315
  requestId,
59140
59316
  resource,
59141
59317
  filterField: filterCandidate.parsed.field,
@@ -59156,20 +59332,28 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
59156
59332
  const { sort, pagination, parsedFilters } = normalizedParams;
59157
59333
  const { perPage, nextToken } = pagination;
59158
59334
  const offset = nextToken ? decodeOffsetToken(nextToken) ?? 0 : 0;
59159
- logger6.debug("Executing full scan query", {
59335
+ logger8.debug("Executing full scan query", {
59160
59336
  requestId,
59161
59337
  resource,
59162
59338
  sortField: sort.field,
59163
59339
  offset
59164
59340
  });
59165
- let items = await fetchAllRecordsViaShadowIndex(resource, sort, void 0, costTracker, requestId);
59341
+ let items = await fetchAllRecordsViaShadowIndex(
59342
+ resource,
59343
+ sort,
59344
+ void 0,
59345
+ costTracker,
59346
+ requestId,
59347
+ "shadow-full-scan",
59348
+ parsedFilters
59349
+ );
59166
59350
  if (parsedFilters.length > 0) {
59167
59351
  items = items.filter((r4) => matchesAllFilters(r4, parsedFilters));
59168
59352
  }
59169
59353
  const page = items.slice(offset, offset + perPage);
59170
59354
  const hasNextPage = offset + perPage < items.length;
59171
59355
  const nextTokenValue = hasNextPage ? encodeOffsetToken(offset + perPage) : void 0;
59172
- logger6.info("Full scan query succeeded", {
59356
+ logger8.info("Full scan query succeeded", {
59173
59357
  requestId,
59174
59358
  resource,
59175
59359
  sortField: sort.field,
@@ -59185,20 +59369,35 @@ async function executeFullScanQuery(resource, normalizedParams, costTracker, req
59185
59369
  consumedCapacity: costTracker.getAggregated()
59186
59370
  };
59187
59371
  }
59188
- async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId) {
59372
+ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, costTracker, requestId, scanPath, parsedFilters) {
59189
59373
  const allShadowItems = [];
59374
+ const watcher = new ScanWatcher({
59375
+ requestId,
59376
+ resource,
59377
+ path: scanPath,
59378
+ sortField: indexSort.field,
59379
+ filters: parsedFilters.map((f4) => `${f4.parsed.field}:${f4.parsed.operator}`)
59380
+ });
59190
59381
  let lastKey;
59191
59382
  let previousKeySignature;
59192
59383
  const MAX_ITERATIONS = 1e4;
59193
59384
  let iterations = 0;
59194
59385
  do {
59195
59386
  if (++iterations > MAX_ITERATIONS) {
59196
- logger6.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E\u3057\u305F\u305F\u3081\u4E2D\u65AD", {
59387
+ logger8.error("fetchAllRecordsViaShadowIndex: \u6700\u5927\u53CD\u5FA9\u56DE\u6570\u3092\u8D85\u904E", {
59197
59388
  requestId,
59198
59389
  resource,
59199
59390
  iterations
59200
59391
  });
59201
- break;
59392
+ throw new AppError(
59393
+ "INTERNAL_ERROR" /* INTERNAL_ERROR */,
59394
+ "Shadow index scan exceeded the iteration limit",
59395
+ 500,
59396
+ {
59397
+ resource,
59398
+ iterations
59399
+ }
59400
+ );
59202
59401
  }
59203
59402
  const result = await executeShadowRecordQuery(
59204
59403
  resource,
@@ -59211,15 +59410,21 @@ async function fetchAllRecordsViaShadowIndex(resource, indexSort, indexFilter, c
59211
59410
  requestId
59212
59411
  );
59213
59412
  allShadowItems.push(...result.Items || []);
59413
+ watcher.add((result.Items || []).length);
59214
59414
  const nextKey = result.LastEvaluatedKey;
59215
59415
  const nextKeySignature = nextKey ? `${nextKey.PK}#${nextKey.SK}` : void 0;
59216
59416
  if (nextKeySignature && nextKeySignature === previousKeySignature) {
59217
- logger6.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F\u305F\u3081\u4E2D\u65AD", {
59417
+ logger8.error("fetchAllRecordsViaShadowIndex: \u540C\u4E00\u306ELastEvaluatedKey\u304C\u8FD4\u5374\u3055\u308C\u305F", {
59218
59418
  requestId,
59219
59419
  resource,
59220
59420
  iterations
59221
59421
  });
59222
- break;
59422
+ throw new AppError(
59423
+ "INTERNAL_ERROR" /* INTERNAL_ERROR */,
59424
+ "Shadow index scan received the same LastEvaluatedKey repeatedly",
59425
+ 500,
59426
+ { resource, iterations }
59427
+ );
59223
59428
  }
59224
59429
  previousKeySignature = nextKeySignature;
59225
59430
  lastKey = nextKey;
@@ -59281,7 +59486,7 @@ async function executeShadowRecordQuery(resource, sort, perPage, nextToken, opti
59281
59486
  );
59282
59487
  const result = await executeDynamoDBOperation(
59283
59488
  () => dbClient2.send(
59284
- new import_lib_dynamodb4.QueryCommand({
59489
+ new import_lib_dynamodb5.QueryCommand({
59285
59490
  TableName: tableName,
59286
59491
  KeyConditionExpression: keyConditionExpression,
59287
59492
  ExpressionAttributeValues: expressionAttributeValues,
@@ -59389,62 +59594,37 @@ function encodeValueForShadowSK(value, type) {
59389
59594
  function extractRecordIds(shadowRecords) {
59390
59595
  return shadowRecords.map((record) => {
59391
59596
  const sk = record.SK;
59392
- const parts = sk.split("#id#");
59393
- return parts.length > 1 ? parts[1] : null;
59597
+ const index = sk.lastIndexOf("#id#");
59598
+ return index >= 0 ? sk.slice(index + "#id#".length) : null;
59394
59599
  }).filter((id) => id !== null);
59395
59600
  }
59396
59601
  async function fetchMainRecords(resource, recordIds, costTracker, requestId) {
59397
- const dbClient2 = getDBClient();
59398
- const tableName = getTableName();
59399
- const uniqueRecordIds = Array.from(new Set(recordIds));
59400
- const BATCH_SIZE = 100;
59401
- const allRecords = [];
59402
- for (let i4 = 0; i4 < uniqueRecordIds.length; i4 += BATCH_SIZE) {
59403
- const chunk = uniqueRecordIds.slice(i4, i4 + BATCH_SIZE);
59404
- const batchGetResult = await executeDynamoDBOperation(
59405
- () => dbClient2.send(
59406
- new import_lib_dynamodb4.BatchGetCommand({
59407
- RequestItems: {
59408
- [tableName]: {
59409
- Keys: chunk.map((id) => ({
59410
- PK: resource,
59411
- SK: `id#${id}`
59412
- })),
59413
- ConsistentRead: true
59414
- }
59415
- },
59416
- ReturnConsumedCapacity: "TOTAL"
59417
- })
59418
- ),
59419
- "BatchGetItem"
59420
- );
59421
- if (batchGetResult.ConsumedCapacity) {
59422
- for (const capacity of batchGetResult.ConsumedCapacity) {
59423
- costTracker.add(capacity);
59424
- }
59425
- }
59426
- allRecords.push(...batchGetResult.Responses?.[tableName] || []);
59427
- }
59428
- logger6.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", {
59429
59607
  requestId,
59430
59608
  resource,
59431
- requestedCount: uniqueRecordIds.length,
59609
+ requestedCount: new Set(recordIds).size,
59432
59610
  fetchedCount: allRecords.length
59433
59611
  });
59434
59612
  return allRecords;
59435
59613
  }
59436
- var import_lib_dynamodb4, logger6, KEY_CONDITION_OPERATORS;
59614
+ var import_lib_dynamodb5, logger8, KEY_CONDITION_OPERATORS;
59437
59615
  var init_shadowQuery = __esm({
59438
59616
  "src/server/operations/find/shadowQuery.ts"() {
59439
59617
  "use strict";
59440
- import_lib_dynamodb4 = __toESM(require_dist_cjs81(), 1);
59618
+ import_lib_dynamodb5 = __toESM(require_dist_cjs81(), 1);
59441
59619
  init_formatting();
59442
59620
  init_shared();
59621
+ init_batchGet();
59443
59622
  init_cost_tracker();
59444
59623
  init_dynamodb3();
59445
59624
  init_pagination();
59625
+ init_scanWarning();
59446
59626
  init_utils5();
59447
- logger6 = createLogger({
59627
+ logger8 = createLogger({
59448
59628
  service: "shadow-query",
59449
59629
  level: process.env.LOG_LEVEL || "info"
59450
59630
  });
@@ -59465,14 +59645,14 @@ var init_shadowQuery = __esm({
59465
59645
 
59466
59646
  // src/server/operations/find/handler.ts
59467
59647
  async function handleFind(resource, params, requestId) {
59468
- logger7.debug("Executing find", {
59648
+ logger9.debug("Executing find", {
59469
59649
  requestId,
59470
59650
  resource,
59471
59651
  params
59472
59652
  });
59473
59653
  const nearDetection = detectNearQuery(params.filter);
59474
59654
  if (nearDetection) {
59475
- logger7.debug("$near operator detected, executing near search", {
59655
+ logger9.debug("$near operator detected, executing near search", {
59476
59656
  requestId,
59477
59657
  resource,
59478
59658
  fieldName: nearDetection.fieldName
@@ -59489,7 +59669,7 @@ async function handleFind(resource, params, requestId) {
59489
59669
  const config = initializeFindConfig();
59490
59670
  const normalizedParams = normalizeFindParams(config, resource, params);
59491
59671
  validateSortField(config, resource, normalizedParams.sort);
59492
- logger7.debug("Find parameters normalized", {
59672
+ logger9.debug("Find parameters normalized", {
59493
59673
  requestId,
59494
59674
  resource,
59495
59675
  sort: normalizedParams.sort,
@@ -59504,7 +59684,7 @@ async function handleFind(resource, params, requestId) {
59504
59684
  }
59505
59685
  return executeShadowQuery(resource, normalizedParams, requestId);
59506
59686
  }
59507
- var logger7;
59687
+ var logger9;
59508
59688
  var init_handler = __esm({
59509
59689
  "src/server/operations/find/handler.ts"() {
59510
59690
  "use strict";
@@ -59514,7 +59694,7 @@ var init_handler = __esm({
59514
59694
  init_nearQuery();
59515
59695
  init_shadowQuery();
59516
59696
  init_utils5();
59517
- logger7 = createLogger({
59697
+ logger9 = createLogger({
59518
59698
  service: "find-handler",
59519
59699
  level: process.env.LOG_LEVEL || "info"
59520
59700
  });
@@ -59523,10 +59703,6 @@ var init_handler = __esm({
59523
59703
  });
59524
59704
 
59525
59705
  // src/server/operations/find.ts
59526
- var find_exports = {};
59527
- __export(find_exports, {
59528
- handleFind: () => handleFind
59529
- });
59530
59706
  var init_find = __esm({
59531
59707
  "src/server/operations/find.ts"() {
59532
59708
  "use strict";
@@ -59534,10 +59710,64 @@ var init_find = __esm({
59534
59710
  }
59535
59711
  });
59536
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
+
59537
59767
  // src/server/utils/bulkOperations.ts
59538
59768
  function logLargeBatchWarning(operation2, recordCount, requestId, resource) {
59539
59769
  if (recordCount > LARGE_BATCH_WARNING_THRESHOLD) {
59540
- logger9.warn(`Large batch ${operation2} operation detected`, {
59770
+ logger11.warn(`Large batch ${operation2} operation detected`, {
59541
59771
  requestId,
59542
59772
  resource,
59543
59773
  recordCount,
@@ -59560,7 +59790,7 @@ function calculateTimeoutRisk(startTime) {
59560
59790
  };
59561
59791
  }
59562
59792
  function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount, riskInfo) {
59563
- logger9.info("Records prepared for chunk execution", {
59793
+ logger11.info("Records prepared for chunk execution", {
59564
59794
  requestId,
59565
59795
  resource,
59566
59796
  totalRecords,
@@ -59570,7 +59800,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
59570
59800
  timeoutRisk: riskInfo.risk
59571
59801
  });
59572
59802
  if (riskInfo.risk === "high") {
59573
- logger9.warn("High timeout risk detected during preparation phase", {
59803
+ logger11.warn("High timeout risk detected during preparation phase", {
59574
59804
  requestId,
59575
59805
  resource,
59576
59806
  preparationElapsedMs: riskInfo.elapsedMs,
@@ -59582,7 +59812,7 @@ function logPreparationTimeoutRisk(requestId, resource, totalRecords, chunkCount
59582
59812
  }
59583
59813
  function logBulkOperationComplete(operation2, requestId, resource, requested, succeeded, failed, riskInfo, additionalInfo) {
59584
59814
  const totalElapsedSeconds = Math.round(riskInfo.elapsedMs / 1e3);
59585
- logger9.info(`${operation2} completed`, {
59815
+ logger11.info(`${operation2} completed`, {
59586
59816
  requestId,
59587
59817
  resource,
59588
59818
  requested,
@@ -59597,7 +59827,7 @@ function logBulkOperationComplete(operation2, requestId, resource, requested, su
59597
59827
  }
59598
59828
  function logPartialFailure(operation2, requestId, resource, requested, succeeded, failed, errorCodes, additionalInfo) {
59599
59829
  const failureRate = Math.round(failed / requested * 100);
59600
- logger9.warn(`Partial failure in ${operation2} operation`, {
59830
+ logger11.warn(`Partial failure in ${operation2} operation`, {
59601
59831
  requestId,
59602
59832
  resource,
59603
59833
  totalRequested: requested,
@@ -59608,12 +59838,12 @@ function logPartialFailure(operation2, requestId, resource, requested, succeeded
59608
59838
  ...additionalInfo
59609
59839
  });
59610
59840
  }
59611
- var logger9;
59841
+ var logger11;
59612
59842
  var init_bulkOperations = __esm({
59613
59843
  "src/server/utils/bulkOperations.ts"() {
59614
59844
  "use strict";
59615
59845
  init_shared();
59616
- logger9 = createLogger({ service: "records-lambda" });
59846
+ logger11 = createLogger({ service: "records-lambda" });
59617
59847
  __name(logLargeBatchWarning, "logLargeBatchWarning");
59618
59848
  __name(calculateTimeoutRisk, "calculateTimeoutRisk");
59619
59849
  __name(logPreparationTimeoutRisk, "logPreparationTimeoutRisk");
@@ -59632,7 +59862,7 @@ function calculateChunks(records, getItemCount) {
59632
59862
  const itemCount = getItemCount(record);
59633
59863
  if (itemCount > DYNAMODB_TRANSACT_WRITE_MAX_ITEMS) {
59634
59864
  const errorMsg = `Single record exceeds ${DYNAMODB_TRANSACT_WRITE_MAX_ITEMS} items limit: ${itemCount} items`;
59635
- logger10.error("Chunk validation failed", {
59865
+ logger12.error("Chunk validation failed", {
59636
59866
  itemCount,
59637
59867
  limit: DYNAMODB_TRANSACT_WRITE_MAX_ITEMS
59638
59868
  });
@@ -59654,7 +59884,7 @@ function calculateChunks(records, getItemCount) {
59654
59884
  chunks.push(currentChunk);
59655
59885
  itemCounts.push(currentItemCount);
59656
59886
  }
59657
- logger10.info("Chunk calculation completed", {
59887
+ logger12.info("Chunk calculation completed", {
59658
59888
  totalRecords: records.length,
59659
59889
  chunkCount: chunks.length,
59660
59890
  itemCounts,
@@ -59670,7 +59900,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
59670
59900
  const errors = [];
59671
59901
  const totalRecords = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
59672
59902
  const executionStartTime = Date.now();
59673
- logger10.info("Starting chunk execution", {
59903
+ logger12.info("Starting chunk execution", {
59674
59904
  totalChunks: chunks.length,
59675
59905
  totalRecords
59676
59906
  });
@@ -59678,14 +59908,14 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
59678
59908
  const chunk = chunks[i4];
59679
59909
  const chunkStartTime = Date.now();
59680
59910
  try {
59681
- logger10.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
59911
+ logger12.debug(`Executing chunk ${i4 + 1}/${chunks.length}`, {
59682
59912
  chunkIndex: i4,
59683
59913
  recordCount: chunk.length
59684
59914
  });
59685
59915
  const successfulRecords = await executeChunk(chunk);
59686
59916
  successRecords.push(...successfulRecords);
59687
59917
  const chunkDuration = Date.now() - chunkStartTime;
59688
- logger10.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
59918
+ logger12.info(`Chunk ${i4 + 1}/${chunks.length} succeeded`, {
59689
59919
  chunkIndex: i4,
59690
59920
  recordCount: chunk.length,
59691
59921
  durationMs: chunkDuration
@@ -59694,7 +59924,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
59694
59924
  const chunkDuration = Date.now() - chunkStartTime;
59695
59925
  const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
59696
59926
  const errorCode = getErrorCode(error2);
59697
- logger10.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
59927
+ logger12.error(`Chunk ${i4 + 1}/${chunks.length} failed`, {
59698
59928
  chunkIndex: i4,
59699
59929
  recordCount: chunk.length,
59700
59930
  durationMs: chunkDuration,
@@ -59713,7 +59943,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
59713
59943
  }
59714
59944
  }
59715
59945
  const totalExecutionTime = Date.now() - executionStartTime;
59716
- logger10.info("Chunk execution completed", {
59946
+ logger12.info("Chunk execution completed", {
59717
59947
  totalChunks: chunks.length,
59718
59948
  totalRecords,
59719
59949
  successCount: successRecords.length,
@@ -59722,7 +59952,7 @@ async function executeChunks(chunks, executeChunk, getRecordId) {
59722
59952
  avgTimePerChunkMs: chunks.length > 0 ? Math.round(totalExecutionTime / chunks.length) : 0
59723
59953
  });
59724
59954
  if (failedIds.length > 0) {
59725
- logger10.warn("Partial failure detected in chunk execution", {
59955
+ logger12.warn("Partial failure detected in chunk execution", {
59726
59956
  totalRecords,
59727
59957
  successCount: successRecords.length,
59728
59958
  failedCount: failedIds.length,
@@ -59754,12 +59984,12 @@ function getErrorCode(error2) {
59754
59984
  }
59755
59985
  return "TRANSACTION_FAILED";
59756
59986
  }
59757
- var logger10;
59987
+ var logger12;
59758
59988
  var init_chunking = __esm({
59759
59989
  "src/server/utils/chunking.ts"() {
59760
59990
  "use strict";
59761
59991
  init_shared();
59762
- logger10 = createLogger({ service: "records-lambda" });
59992
+ logger12 = createLogger({ service: "records-lambda" });
59763
59993
  __name(calculateChunks, "calculateChunks");
59764
59994
  __name(executeChunks, "executeChunks");
59765
59995
  __name(getErrorCode, "getErrorCode");
@@ -59930,7 +60160,7 @@ async function handleUpdateMany(resource, params, requestId) {
59930
60160
  const upsert = options?.upsert ?? false;
59931
60161
  const startTime = Date.now();
59932
60162
  const costTracker = new CostTracker();
59933
- logger11.debug("Executing updateMany", {
60163
+ logger13.debug("Executing updateMany", {
59934
60164
  requestId,
59935
60165
  resource,
59936
60166
  upsert
@@ -59938,21 +60168,31 @@ async function handleUpdateMany(resource, params, requestId) {
59938
60168
  let ids;
59939
60169
  if ("ids" in params) {
59940
60170
  ids = params.ids;
59941
- logger11.debug("Executing updateMany with ids", {
60171
+ logger13.debug("Executing updateMany with ids", {
59942
60172
  requestId,
59943
60173
  resource,
59944
60174
  count: ids.length
59945
60175
  });
59946
60176
  } else {
59947
- logger11.debug("Executing updateMany with filter", {
60177
+ logger13.debug("Executing updateMany with filter", {
59948
60178
  requestId,
59949
60179
  resource,
59950
60180
  filter: params.filter
59951
60181
  });
59952
- const { handleFind: handleFind2 } = await Promise.resolve().then(() => (init_find(), find_exports));
59953
- const findResult = await handleFind2(resource, { filter: params.filter }, requestId);
59954
- ids = findResult.items.map((item) => item.id);
59955
- logger11.debug("Found records with filter", {
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", {
59956
60196
  requestId,
59957
60197
  resource,
59958
60198
  count: ids.length
@@ -59961,7 +60201,7 @@ async function handleUpdateMany(resource, params, requestId) {
59961
60201
  if (upsert) {
59962
60202
  const newId = ulid2();
59963
60203
  ids = [newId];
59964
- logger11.info("Creating new record with filter (upsert: true)", {
60204
+ logger13.info("Creating new record with filter (upsert: true)", {
59965
60205
  requestId,
59966
60206
  resource,
59967
60207
  newId,
@@ -59991,32 +60231,10 @@ async function handleUpdateMany(resource, params, requestId) {
59991
60231
  logLargeBatchWarning("updateMany", ids.length, requestId, resource);
59992
60232
  const dbClient2 = getDBClient();
59993
60233
  const tableName = getTableName();
59994
- const keys = ids.map((id) => ({
59995
- PK: resource,
59996
- SK: generateMainRecordSK2(id)
59997
- }));
59998
- const batchGetResult = await executeDynamoDBOperation(
59999
- () => dbClient2.send(
60000
- new import_lib_dynamodb6.BatchGetCommand({
60001
- RequestItems: {
60002
- [tableName]: {
60003
- Keys: keys,
60004
- ConsistentRead: true
60005
- }
60006
- },
60007
- ReturnConsumedCapacity: "TOTAL"
60008
- })
60009
- ),
60010
- "BatchGetItem"
60234
+ const existingItems = await batchGetAll(
60235
+ ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
60236
+ { consistentRead: true, costTracker, requestId }
60011
60237
  );
60012
- if (Array.isArray(batchGetResult.ConsumedCapacity)) {
60013
- for (const capacity of batchGetResult.ConsumedCapacity) {
60014
- costTracker.add(capacity);
60015
- }
60016
- } else {
60017
- costTracker.add(batchGetResult.ConsumedCapacity);
60018
- }
60019
- const existingItems = batchGetResult.Responses?.[tableName] || [];
60020
60238
  const existingIds = new Set(
60021
60239
  existingItems.map((item) => {
60022
60240
  const data = item.data;
@@ -60025,7 +60243,7 @@ async function handleUpdateMany(resource, params, requestId) {
60025
60243
  );
60026
60244
  const notFoundIds = ids.filter((id) => !existingIds.has(id));
60027
60245
  if (!upsert && notFoundIds.length > 0) {
60028
- logger11.warn("Records not found (upsert: false)", {
60246
+ logger13.warn("Records not found (upsert: false)", {
60029
60247
  requestId,
60030
60248
  resource,
60031
60249
  notFoundCount: notFoundIds.length,
@@ -60034,7 +60252,7 @@ async function handleUpdateMany(resource, params, requestId) {
60034
60252
  });
60035
60253
  }
60036
60254
  if (upsert && notFoundIds.length > 0) {
60037
- logger11.info("Creating new records (upsert: true)", {
60255
+ logger13.info("Creating new records (upsert: true)", {
60038
60256
  requestId,
60039
60257
  resource,
60040
60258
  notFoundCount: notFoundIds.length,
@@ -60070,7 +60288,7 @@ async function handleUpdateMany(resource, params, requestId) {
60070
60288
  const failedId = existingData.id || "unknown-id";
60071
60289
  const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
60072
60290
  const errorCode = getPreparationErrorCode(error2);
60073
- logger11.error("Failed to prepare record for update", {
60291
+ logger13.error("Failed to prepare record for update", {
60074
60292
  requestId,
60075
60293
  recordId: failedId,
60076
60294
  error: errorMessage,
@@ -60110,7 +60328,7 @@ async function handleUpdateMany(resource, params, requestId) {
60110
60328
  } catch (error2) {
60111
60329
  const errorMessage = error2 instanceof Error ? error2.message : "Unknown preparation error";
60112
60330
  const errorCode = getPreparationErrorCode(error2);
60113
- logger11.error("Failed to prepare new record for upsert", {
60331
+ logger13.error("Failed to prepare new record for upsert", {
60114
60332
  requestId,
60115
60333
  recordId: id,
60116
60334
  error: errorMessage,
@@ -60323,7 +60541,7 @@ function getPreparationErrorCode(error2) {
60323
60541
  }
60324
60542
  return "VALIDATION_ERROR" /* VALIDATION_ERROR */;
60325
60543
  }
60326
- var import_lib_dynamodb6, logger11;
60544
+ var import_lib_dynamodb6, logger13;
60327
60545
  var init_updateMany = __esm({
60328
60546
  "src/server/operations/updateMany.ts"() {
60329
60547
  "use strict";
@@ -60331,13 +60549,15 @@ var init_updateMany = __esm({
60331
60549
  init_shared();
60332
60550
  init_shadow();
60333
60551
  init_shadow();
60552
+ init_batchGet();
60334
60553
  init_bulkOperations();
60335
60554
  init_chunking();
60336
60555
  init_cost_tracker();
60337
60556
  init_dynamodb3();
60338
60557
  init_mergePatch();
60339
60558
  init_timestamps();
60340
- logger11 = createLogger({ service: "records-lambda" });
60559
+ init_findAll();
60560
+ logger13 = createLogger({ service: "records-lambda" });
60341
60561
  __name(handleUpdateMany, "handleUpdateMany");
60342
60562
  __name(getPreparationErrorCode, "getPreparationErrorCode");
60343
60563
  }
@@ -60355,16 +60575,16 @@ var import_client_ssm2 = __toESM(require_dist_cjs75(), 1);
60355
60575
  init_shared();
60356
60576
 
60357
60577
  // src/server/operations/findMany.ts
60358
- var import_lib_dynamodb5 = __toESM(require_dist_cjs81(), 1);
60359
60578
  init_shared();
60360
60579
  init_shadow();
60580
+ init_batchGet();
60361
60581
  init_dynamodb3();
60362
- init_find();
60363
- var logger8 = createLogger({ service: "records-lambda" });
60582
+ init_findAll();
60583
+ var logger10 = createLogger({ service: "records-lambda" });
60364
60584
  async function handleFindMany(resource, params, requestId) {
60365
60585
  if ("ids" in params) {
60366
60586
  const { ids } = params;
60367
- logger8.debug("Executing findMany by ids", {
60587
+ logger10.debug("Executing findMany by ids", {
60368
60588
  requestId,
60369
60589
  resource,
60370
60590
  count: ids.length
@@ -60372,28 +60592,12 @@ async function handleFindMany(resource, params, requestId) {
60372
60592
  if (ids.length === 0) {
60373
60593
  return [];
60374
60594
  }
60375
- const dbClient2 = getDBClient();
60376
- const tableName = getTableName();
60377
- const keys = ids.map((id) => ({
60378
- PK: resource,
60379
- SK: generateMainRecordSK2(id)
60380
- }));
60381
- const result = await executeDynamoDBOperation(
60382
- () => dbClient2.send(
60383
- new import_lib_dynamodb5.BatchGetCommand({
60384
- RequestItems: {
60385
- [tableName]: {
60386
- Keys: keys,
60387
- ConsistentRead: true
60388
- }
60389
- }
60390
- })
60391
- ),
60392
- "BatchGetItem"
60595
+ const items = await batchGetAll(
60596
+ ids.map((id) => ({ PK: resource, SK: generateMainRecordSK2(id) })),
60597
+ { consistentRead: true, requestId }
60393
60598
  );
60394
- const items = result.Responses?.[tableName] || [];
60395
60599
  const records = items.map((item) => extractCleanRecord(item));
60396
- logger8.info("findMany by ids succeeded", {
60600
+ logger10.info("findMany by ids succeeded", {
60397
60601
  requestId,
60398
60602
  resource,
60399
60603
  requested: ids.length,
@@ -60403,25 +60607,19 @@ async function handleFindMany(resource, params, requestId) {
60403
60607
  }
60404
60608
  if ("filter" in params) {
60405
60609
  const { filter } = params;
60406
- logger8.debug("Executing findMany by filter", {
60610
+ logger10.debug("Executing findMany by filter", {
60407
60611
  requestId,
60408
60612
  resource,
60409
60613
  filter
60410
60614
  });
60411
- const findResult = await handleFind(
60412
- resource,
60413
- {
60414
- filter
60415
- },
60416
- requestId
60417
- );
60418
- logger8.info("findMany by filter succeeded", {
60615
+ const items = await findAllByFilter(resource, filter, requestId);
60616
+ logger10.info("findMany by filter succeeded", {
60419
60617
  requestId,
60420
60618
  resource,
60421
60619
  filter,
60422
- found: findResult.items.length
60620
+ found: items.length
60423
60621
  });
60424
- return findResult.items;
60622
+ return items;
60425
60623
  }
60426
60624
  throw new Error("findMany requires either ids or filter");
60427
60625
  }
@@ -60429,13 +60627,14 @@ __name(handleFindMany, "handleFindMany");
60429
60627
 
60430
60628
  // src/server/operations/updateOne.ts
60431
60629
  init_shared();
60432
- var logger12 = createLogger({ service: "records-lambda" });
60630
+ init_findAll();
60631
+ var logger14 = createLogger({ service: "records-lambda" });
60433
60632
  async function handleUpdateOne(resource, params, requestId) {
60434
60633
  const { data: patchData, options } = params;
60435
60634
  const { handleUpdateMany: handleUpdateMany2 } = await Promise.resolve().then(() => (init_updateMany(), updateMany_exports));
60436
60635
  if ("id" in params) {
60437
60636
  const targetId = params.id;
60438
- logger12.debug("Executing updateOne with id", {
60637
+ logger14.debug("Executing updateOne with id", {
60439
60638
  requestId,
60440
60639
  resource,
60441
60640
  id: targetId,
@@ -60477,19 +60676,20 @@ async function handleUpdateOne(resource, params, requestId) {
60477
60676
  consumedCapacity: updateManyResult.consumedCapacity
60478
60677
  };
60479
60678
  } else {
60480
- logger12.debug("Executing updateOne with filter", {
60679
+ logger14.debug("Executing updateOne with filter", {
60481
60680
  requestId,
60482
60681
  resource,
60483
60682
  filter: params.filter,
60484
60683
  upsert: options?.upsert
60485
60684
  });
60685
+ const target = await findOneByFilter(
60686
+ resource,
60687
+ params.filter,
60688
+ requestId
60689
+ );
60486
60690
  const updateManyResult = await handleUpdateMany2(
60487
60691
  resource,
60488
- {
60489
- filter: params.filter,
60490
- data: patchData,
60491
- options
60492
- },
60692
+ target ? { ids: [target.id], data: patchData, options } : { filter: params.filter, data: patchData, options },
60493
60693
  requestId
60494
60694
  );
60495
60695
  if (updateManyResult.count === 0) {
@@ -60625,7 +60825,7 @@ async function getImagePolicy(ssmClient2, paramName) {
60625
60825
  __name(getImagePolicy, "getImagePolicy");
60626
60826
 
60627
60827
  // src/server/media/process-handler.ts
60628
- var logger13 = createLogger({ service: "media-process-handler" });
60828
+ var logger15 = createLogger({ service: "media-process-handler" });
60629
60829
  var s3Client = new import_client_s3.S3Client({ region: process.env.AWS_REGION });
60630
60830
  var ssmClient = new import_client_ssm2.SSMClient({ region: process.env.AWS_REGION });
60631
60831
  var MAX_INPUT_PIXELS = 1e8;
@@ -60665,7 +60865,7 @@ async function processRecord(bucket, rawKey) {
60665
60865
  const existing = await handleFindMany("media", { ids: [fileId] }, requestId);
60666
60866
  const existingRecord = existing[0];
60667
60867
  if (existingRecord?.status === "completed") {
60668
- logger13.warn("Media already completed, ignoring re-upload to the same fileId", {
60868
+ logger15.warn("Media already completed, ignoring re-upload to the same fileId", {
60669
60869
  requestId,
60670
60870
  fileId
60671
60871
  });
@@ -60677,7 +60877,7 @@ async function processRecord(bucket, rawKey) {
60677
60877
  const originalFilename = decodeOriginalFilename(metadata["original-filename"]);
60678
60878
  const headBytes = await getHeadBytes(bucket, key);
60679
60879
  if (!verifyMagicBytes(contentType, headBytes)) {
60680
- logger13.warn("Content type does not match file signature", { requestId, fileId, contentType });
60880
+ logger15.warn("Content type does not match file signature", { requestId, fileId, contentType });
60681
60881
  await writeMediaRecord(
60682
60882
  fileId,
60683
60883
  {
@@ -60752,7 +60952,7 @@ async function processRecord(bucket, rawKey) {
60752
60952
  requestId
60753
60953
  );
60754
60954
  }
60755
- logger13.info("Media processed", { requestId, fileId, contentType });
60955
+ logger15.info("Media processed", { requestId, fileId, contentType });
60756
60956
  }
60757
60957
  __name(processRecord, "processRecord");
60758
60958
  var handler = /* @__PURE__ */ __name(async (event) => {
@@ -60762,7 +60962,7 @@ var handler = /* @__PURE__ */ __name(async (event) => {
60762
60962
  try {
60763
60963
  await processRecord(bucket, key);
60764
60964
  } catch (error2) {
60765
- logger13.error("Failed to process media", {
60965
+ logger15.error("Failed to process media", {
60766
60966
  bucket,
60767
60967
  key,
60768
60968
  error: error2 instanceof Error ? error2.message : String(error2)