@cdklabs/cdk-construct-connect-datalake 0.0.13 → 0.0.14

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 (124) hide show
  1. package/.jsii +9 -9
  2. package/lib/index.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/package.json +5 -5
  4. package/node_modules/@aws-sdk/client-connect/package.json +5 -5
  5. package/node_modules/@aws-sdk/client-glue/dist-cjs/index.js +6 -4
  6. package/node_modules/@aws-sdk/client-glue/dist-cjs/schemas/schemas_0.js +57 -30
  7. package/node_modules/@aws-sdk/client-glue/dist-es/models/enums.js +6 -4
  8. package/node_modules/@aws-sdk/client-glue/dist-es/schemas/schemas_0.js +42 -15
  9. package/node_modules/@aws-sdk/client-glue/dist-types/commands/GetTableCommand.d.ts +121 -0
  10. package/node_modules/@aws-sdk/client-glue/dist-types/commands/GetTableVersionCommand.d.ts +118 -0
  11. package/node_modules/@aws-sdk/client-glue/dist-types/commands/GetTableVersionsCommand.d.ts +118 -0
  12. package/node_modules/@aws-sdk/client-glue/dist-types/commands/GetTablesCommand.d.ts +119 -1
  13. package/node_modules/@aws-sdk/client-glue/dist-types/commands/GetUnfilteredTableMetadataCommand.d.ts +118 -0
  14. package/node_modules/@aws-sdk/client-glue/dist-types/commands/SearchTablesCommand.d.ts +118 -0
  15. package/node_modules/@aws-sdk/client-glue/dist-types/commands/UpdateCrawlerScheduleCommand.d.ts +2 -1
  16. package/node_modules/@aws-sdk/client-glue/dist-types/models/enums.d.ts +14 -12
  17. package/node_modules/@aws-sdk/client-glue/dist-types/models/models_2.d.ts +87 -6
  18. package/node_modules/@aws-sdk/client-glue/dist-types/models/models_3.d.ts +11 -1
  19. package/node_modules/@aws-sdk/client-glue/dist-types/schemas/schemas_0.d.ts +1 -0
  20. package/node_modules/@aws-sdk/client-glue/dist-types/ts3.4/commands/UpdateCrawlerScheduleCommand.d.ts +2 -4
  21. package/node_modules/@aws-sdk/client-glue/dist-types/ts3.4/models/enums.d.ts +8 -6
  22. package/node_modules/@aws-sdk/client-glue/dist-types/ts3.4/models/models_2.d.ts +18 -1
  23. package/node_modules/@aws-sdk/client-glue/dist-types/ts3.4/models/models_3.d.ts +3 -0
  24. package/node_modules/@aws-sdk/client-glue/dist-types/ts3.4/schemas/schemas_0.d.ts +1 -0
  25. package/node_modules/@aws-sdk/client-glue/package.json +5 -5
  26. package/node_modules/@aws-sdk/client-lakeformation/package.json +5 -5
  27. package/node_modules/@aws-sdk/client-ram/package.json +5 -5
  28. package/node_modules/@aws-sdk/client-sts/package.json +6 -6
  29. package/node_modules/@aws-sdk/core/dist-cjs/index.js +47 -2297
  30. package/node_modules/@aws-sdk/core/dist-es/index.js +3 -3
  31. package/node_modules/@aws-sdk/core/dist-types/index.d.ts +5 -5
  32. package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +5 -5
  33. package/node_modules/@aws-sdk/core/package.json +8 -8
  34. package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
  35. package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -5
  36. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  37. package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
  38. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  39. package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
  40. package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +4 -1
  41. package/node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js +4 -1
  42. package/node_modules/@aws-sdk/credential-provider-sso/package.json +9 -7
  43. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
  44. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  45. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  46. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  47. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  48. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  49. package/node_modules/@aws-sdk/nested-clients/package.json +6 -6
  50. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +7 -6
  51. package/node_modules/@aws-sdk/token-providers/package.json +5 -5
  52. package/node_modules/@aws-sdk/types/package.json +2 -2
  53. package/node_modules/@aws-sdk/util-locate-window/package.json +2 -2
  54. package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/CHANGELOG.md +8 -0
  55. package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/README.md +9 -0
  56. package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/package.json +4 -1
  57. package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/strnum.js +9 -1
  58. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  59. package/node_modules/@nodable/entities/package.json +4 -1
  60. package/node_modules/@nodable/entities/src/EntityDecoder.js +104 -3
  61. package/node_modules/@nodable/entities/src/index.d.ts +77 -0
  62. package/node_modules/@nodable/entities/src/index.js +1 -1
  63. package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
  64. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
  65. package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
  66. package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
  67. package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
  68. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
  69. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
  70. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
  71. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
  72. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
  73. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
  74. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
  75. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
  76. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
  77. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +26 -27
  78. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +28 -29
  79. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
  80. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
  81. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
  82. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
  83. package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
  84. package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
  85. package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
  86. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
  87. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
  88. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +2 -2
  89. package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRateLimiter.js +1 -1
  90. package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
  91. package/node_modules/@smithy/core/package.json +18 -17
  92. package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
  93. package/node_modules/@smithy/credential-provider-imds/package.json +7 -7
  94. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
  95. package/node_modules/@smithy/fetch-http-handler/package.json +10 -10
  96. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
  97. package/node_modules/@smithy/node-http-handler/package.json +8 -8
  98. package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
  99. package/node_modules/@smithy/signature-v4/package.json +7 -7
  100. package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
  101. package/node_modules/@smithy/types/package.json +10 -10
  102. package/node_modules/anynum/LICENSE +21 -0
  103. package/node_modules/anynum/README.md +142 -0
  104. package/node_modules/anynum/anynum.js +135 -0
  105. package/node_modules/anynum/digitTable.js +116 -0
  106. package/node_modules/anynum/package.json +42 -0
  107. package/node_modules/watchpack/README.md +9 -0
  108. package/node_modules/watchpack/lib/DirectoryWatcher.js +182 -25
  109. package/node_modules/watchpack/lib/index.js +55 -15
  110. package/node_modules/watchpack/lib/reducePlan.js +56 -35
  111. package/node_modules/watchpack/lib/util/globToRegExp.js +142 -0
  112. package/node_modules/watchpack/lib/watchEventSource.js +18 -10
  113. package/node_modules/watchpack/package.json +17 -23
  114. package/node_modules/watchpack/types/DirectoryWatcher.d.ts +2 -0
  115. package/node_modules/watchpack/types/index.d.ts +121 -113
  116. package/node_modules/watchpack/types/util/globToRegExp.d.ts +2 -0
  117. package/node_modules/watchpack/types/watchpack.d.ts +1 -1
  118. package/package.json +10 -10
  119. package/node_modules/glob-to-regexp/.travis.yml +0 -4
  120. package/node_modules/glob-to-regexp/README.md +0 -75
  121. package/node_modules/glob-to-regexp/index.js +0 -130
  122. package/node_modules/glob-to-regexp/package.json +0 -23
  123. package/node_modules/glob-to-regexp/test.js +0 -235
  124. /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/LICENSE +0 -0
@@ -1,6 +1,10 @@
1
1
  # strnum
2
2
  Parse string into Number based on configuration
3
3
 
4
+ [![strnum downloads](https://img.shields.io/npm/dw/strnum.svg)](https://npm-compare.com/strnum)
5
+ [![strnum version](https://img.shields.io/npm/v/strnum.svg)](https://www.npmjs.com/package/strnum)
6
+ [![strnum license](https://img.shields.io/npm/l/strnum.svg)](https://github.com/NaturalIntelligence/strnum)
7
+
4
8
  ## Users
5
9
 
6
10
  <a href="https://github.com/aws-amplify" target="_blank"><img src="https://avatars.githubusercontent.com/u/41077760?s=100&v=4"></a>
@@ -86,6 +90,10 @@ toNumber("1.0e-2"); //0.01)
86
90
 
87
91
  toNumber("+1212121212"); // 1212121212
88
92
  toNumber("+1212121212", { skipLike: /\+[0-9]{10}/} )); //"+1212121212"
93
+
94
+ toNumber("1e1000", { unicode: true, infinity: "original" }); //"1e1000"
95
+ toNumber("1000", { unicode: true }); //1000
96
+ toNumber("1000", { unicode: false }); //"1000"
89
97
  ```
90
98
 
91
99
  Supported Options
@@ -95,6 +103,7 @@ leadingZeros: true, //when number with leading zeros like 08 should be parsed. 0
95
103
  eNotation: true, //when number with eNotation or number parsed in eNotation should be considered
96
104
  skipLike: /regex/ //when string should not be parsed when it matches the specified regular expression
97
105
  infinity: "original", // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
106
+ unicode: false, //when number with unicode numerals should be parsed
98
107
  ```
99
108
 
100
109
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strnum",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Parse String to Number based on configuration",
5
5
  "type": "module",
6
6
  "main": "strnum.js",
@@ -28,5 +28,8 @@
28
28
  "devDependencies": {
29
29
  "@byspec/numbers": "^0.1.1",
30
30
  "jasmine": "^5.6.0"
31
+ },
32
+ "dependencies": {
33
+ "anynum": "^1.0.0"
31
34
  }
32
35
  }
@@ -3,6 +3,8 @@ const binRegex = /^0b[01]+$/;
3
3
  const octRegex = /^0o[0-7]+$/;
4
4
  const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
5
5
 
6
+ import anynum from "anynum";
7
+
6
8
  const consider = {
7
9
  hex: true,
8
10
  binary: false,
@@ -12,6 +14,7 @@ const consider = {
12
14
  eNotation: true,
13
15
  //skipLike: /regex/,
14
16
  infinity: "original", // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
17
+ unicode: false,
15
18
  };
16
19
 
17
20
  export default function toNumber(str, options = {}) {
@@ -23,7 +26,12 @@ export default function toNumber(str, options = {}) {
23
26
  if (trimmedStr.length === 0) return str;
24
27
  else if (options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
25
28
  else if (trimmedStr === "0") return 0;
26
- else if (options.hex && hexRegex.test(trimmedStr)) {
29
+
30
+ if (options.unicode) {
31
+ trimmedStr = anynum(trimmedStr);
32
+ if (trimmedStr === "0") return 0; // re-check after normalization
33
+ }
34
+ if (options.hex && hexRegex.test(trimmedStr)) {
27
35
  return parse_int(trimmedStr, 16);
28
36
  } else if (options.binary && binRegex.test(trimmedStr)) {
29
37
  return parse_int(trimmedStr, 2);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/xml-builder",
3
- "version": "3.972.28",
3
+ "version": "3.972.29",
4
4
  "description": "XML utilities for the AWS SDK",
5
5
  "dependencies": {
6
6
  "@smithy/types": "^4.14.3",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
12
- "build:cjs": "node ../../scripts/compilation/inline xml-builder",
12
+ "build:cjs": "node ../../scripts/compilation/inline",
13
13
  "build:es": "tsc -p tsconfig.es.json",
14
14
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
15
15
  "build:types": "tsc -p tsconfig.types.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodable/entities",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Entity parser for XML, HTML, External entites with security and NCR control",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -25,10 +25,13 @@
25
25
  "xml",
26
26
  "html",
27
27
  "entity",
28
+ "entities",
29
+ "stringify",
28
30
  "encode",
29
31
  "decode",
30
32
  "ncr",
31
33
  "security",
34
+ "safe",
32
35
  "performance"
33
36
  ],
34
37
  "author": "Amit Gupta (https://solothought.com)",
@@ -5,6 +5,30 @@
5
5
 
6
6
  import { XML as DEFAULT_XML_ENTITIES } from "./entities.js"
7
7
 
8
+ // ---------------------------------------------------------------------------
9
+ // Entity hook action constants
10
+ // ---------------------------------------------------------------------------
11
+
12
+ /**
13
+ * Action constants for `onExternalEntity` and `onInputEntity` hooks.
14
+ *
15
+ * Use these instead of raw strings to avoid typos:
16
+ *
17
+ * @example
18
+ * import EntityDecoder, { ENTITY_ACTION } from './EntityDecoder.js';
19
+ * const dec = new EntityDecoder({
20
+ * onInputEntity: (name, value) => ENTITY_ACTION.BLOCK,
21
+ * });
22
+ */
23
+ export const ENTITY_ACTION = Object.freeze({
24
+ /** Resolve and expand the entity normally. */
25
+ ALLOW: 'allow',
26
+ /** Silently skip this entity — it will not be registered. */
27
+ BLOCK: 'block',
28
+ /** Throw an error, aborting entity registration entirely. */
29
+ THROW: 'throw',
30
+ });
31
+
8
32
  // ---------------------------------------------------------------------------
9
33
  // Helpers
10
34
  // ---------------------------------------------------------------------------
@@ -169,6 +193,14 @@ export default class EntityDecoder {
169
193
  * the effective action is max(onNCR, rangeMinimum).
170
194
  * @param {'remove'|'throw'} [options.ncr.nullNCR='remove']
171
195
  * Action for U+0000 (null). 'allow' and 'leave' are clamped to 'remove' since null is never safe.
196
+ * @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} [options.onExternalEntity=null]
197
+ * Hook called when an external entity is registered via `setExternalEntities()` or
198
+ * `addExternalEntity()`. Return `ENTITY_ACTION.ALLOW` to accept the entity,
199
+ * `ENTITY_ACTION.BLOCK` to silently skip it, or `ENTITY_ACTION.THROW` to abort with an error.
200
+ * @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} [options.onInputEntity=null]
201
+ * Hook called when an input entity is registered via `addInputEntities()`. Return
202
+ * `ENTITY_ACTION.ALLOW` to accept, `ENTITY_ACTION.BLOCK` to silently skip, or
203
+ * `ENTITY_ACTION.THROW` to abort with an error.
172
204
  */
173
205
  constructor(options = {}) {
174
206
  this._limit = options.limit || {};
@@ -204,6 +236,43 @@ export default class EntityDecoder {
204
236
  this._ncrXmlVersion = ncrCfg.xmlVersion;
205
237
  this._ncrOnLevel = ncrCfg.onLevel;
206
238
  this._ncrNullLevel = ncrCfg.nullLevel;
239
+
240
+ // --- Registration hooks ---
241
+ /** @type {((name: string, value: string) => 'allow'|'block'|'throw')|null} */
242
+ this._onExternalEntity = typeof options.onExternalEntity === 'function'
243
+ ? options.onExternalEntity
244
+ : null;
245
+ /** @type {((name: string, value: string) => 'allow'|'block'|'throw')|null} */
246
+ this._onInputEntity = typeof options.onInputEntity === 'function'
247
+ ? options.onInputEntity
248
+ : null;
249
+ }
250
+
251
+ // -------------------------------------------------------------------------
252
+ // Private: registration hook dispatch
253
+ // -------------------------------------------------------------------------
254
+
255
+ /**
256
+ * Invoke a registration hook for a single entity name/value pair.
257
+ * Returns true when the entity should be accepted, false when it should be
258
+ * silently skipped (BLOCK), and throws when the hook returns THROW.
259
+ *
260
+ * @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} hook
261
+ * @param {string} name
262
+ * @param {string} value
263
+ * @param {string} context — used in error messages ('external' | 'input')
264
+ * @returns {boolean} true = accept, false = skip
265
+ */
266
+ _applyRegistrationHook(hook, name, value, context) {
267
+ if (!hook) return true; // no hook → always accept
268
+ const action = hook(name, value);
269
+ if (action === ENTITY_ACTION.BLOCK) return false;
270
+ if (action === ENTITY_ACTION.THROW) {
271
+ throw new Error(
272
+ `[EntityDecoder] Registration of ${context} entity "&${name};" was rejected by hook`
273
+ );
274
+ }
275
+ return true; // ALLOW or any unknown return value → accept
207
276
  }
208
277
 
209
278
  // -------------------------------------------------------------------------
@@ -213,6 +282,9 @@ export default class EntityDecoder {
213
282
  /**
214
283
  * Replace the full set of persistent external entities.
215
284
  * All keys are validated — throws on invalid characters.
285
+ * If `onExternalEntity` is set, it is called once per entry; entries that
286
+ * return `ENTITY_ACTION.BLOCK` are silently omitted, `ENTITY_ACTION.THROW`
287
+ * aborts the whole call.
216
288
  * @param {Record<string, string | { regex?: RegExp, val: string }>} map
217
289
  */
218
290
  setExternalEntities(map) {
@@ -221,18 +293,34 @@ export default class EntityDecoder {
221
293
  validateEntityName(key);
222
294
  }
223
295
  }
224
- this._externalMap = mergeEntityMaps(map);
296
+ if (!this._onExternalEntity) {
297
+ this._externalMap = mergeEntityMaps(map);
298
+ return;
299
+ }
300
+ // Hook present — resolve values first, then filter
301
+ const flat = mergeEntityMaps(map);
302
+ const filtered = Object.create(null);
303
+ for (const [name, value] of Object.entries(flat)) {
304
+ if (this._applyRegistrationHook(this._onExternalEntity, name, value, 'external')) {
305
+ filtered[name] = value;
306
+ }
307
+ }
308
+ this._externalMap = filtered;
225
309
  }
226
310
 
227
311
  /**
228
312
  * Add a single persistent external entity.
313
+ * If `onExternalEntity` is set it is called before the entity is stored;
314
+ * `ENTITY_ACTION.BLOCK` silently skips storage, `ENTITY_ACTION.THROW` raises.
229
315
  * @param {string} key
230
316
  * @param {string} value
231
317
  */
232
318
  addExternalEntity(key, value) {
233
319
  validateEntityName(key);
234
320
  if (typeof value === 'string' && value.indexOf('&') === -1) {
235
- this._externalMap[key] = value;
321
+ if (this._applyRegistrationHook(this._onExternalEntity, key, value, 'external')) {
322
+ this._externalMap[key] = value;
323
+ }
236
324
  }
237
325
  }
238
326
 
@@ -243,12 +331,25 @@ export default class EntityDecoder {
243
331
  /**
244
332
  * Inject DOCTYPE entities for the current document.
245
333
  * Also resets per-document expansion counters.
334
+ * If `onInputEntity` is set it is called once per entry; entries returning
335
+ * `ENTITY_ACTION.BLOCK` are silently omitted, `ENTITY_ACTION.THROW` aborts.
246
336
  * @param {Record<string, string | { regx?: RegExp, regex?: RegExp, val: string }>} map
247
337
  */
248
338
  addInputEntities(map) {
249
339
  this._totalExpansions = 0;
250
340
  this._expandedLength = 0;
251
- this._inputMap = mergeEntityMaps(map);
341
+ if (!this._onInputEntity) {
342
+ this._inputMap = mergeEntityMaps(map);
343
+ return;
344
+ }
345
+ const flat = mergeEntityMaps(map);
346
+ const filtered = Object.create(null);
347
+ for (const [name, value] of Object.entries(flat)) {
348
+ if (this._applyRegistrationHook(this._onInputEntity, name, value, 'input')) {
349
+ filtered[name] = value;
350
+ }
351
+ }
352
+ this._inputMap = filtered;
252
353
  }
253
354
 
254
355
  // -------------------------------------------------------------------------
@@ -5,6 +5,50 @@
5
5
  /** A function-based entity replacement value (used for numeric refs). */
6
6
  export type EntityValFn = (match: string, captured: string, ...rest: unknown[]) => string;
7
7
 
8
+ // ---------------------------------------------------------------------------
9
+ // Entity registration hook
10
+ // ---------------------------------------------------------------------------
11
+
12
+ /**
13
+ * Actions returned by `onExternalEntity` / `onInputEntity` hooks.
14
+ * Use the `ENTITY_ACTION` constant object instead of raw strings to avoid typos.
15
+ *
16
+ * - `'allow'` — register and expand the entity normally
17
+ * - `'block'` — silently skip the entity (not registered, treated as unknown)
18
+ * - `'throw'` — abort registration with an error
19
+ */
20
+ export type EntityHookAction = 'allow' | 'block' | 'throw';
21
+
22
+ /**
23
+ * Immutable constant bag for entity registration hook return values.
24
+ *
25
+ * @example
26
+ * import { ENTITY_ACTION } from '@nodable/entities';
27
+ * const dec = new EntityDecoder({
28
+ * onInputEntity: (_name, _value) => ENTITY_ACTION.BLOCK,
29
+ * });
30
+ */
31
+ export const ENTITY_ACTION: Readonly<{
32
+ /** Register and expand the entity normally. */
33
+ ALLOW: 'allow';
34
+ /** Silently skip this entity — it will not be registered. */
35
+ BLOCK: 'block';
36
+ /** Throw an error, aborting entity registration. */
37
+ THROW: 'throw';
38
+ }>;
39
+
40
+ /**
41
+ * Callback signature for `onExternalEntity` and `onInputEntity` hooks.
42
+ *
43
+ * Called once per entity **at registration time** (not at decode time).
44
+ * Return `ENTITY_ACTION.ALLOW` (or `'allow'`) to accept, `ENTITY_ACTION.BLOCK`
45
+ * to silently skip, or `ENTITY_ACTION.THROW` to raise an error.
46
+ *
47
+ * @param name — the entity name without `&` / `;`, e.g. `"brand"`
48
+ * @param value — the resolved string value after any `{regex,val}` unwrapping
49
+ */
50
+ export type EntityRegistrationHook = (name: string, value: string) => EntityHookAction;
51
+
8
52
  // ---------------------------------------------------------------------------
9
53
  // Encoder options
10
54
  // ---------------------------------------------------------------------------
@@ -191,6 +235,39 @@ export interface EntityDecoderOptions {
191
235
  * Numeric Character Reference (NCR) policy.
192
236
  */
193
237
  ncr?: EntityDecoderNCROptions;
238
+
239
+ /**
240
+ * Hook called once **at registration time** for each entity passed to
241
+ * `setExternalEntities()` or `addExternalEntity()`.
242
+ *
243
+ * - `'allow'` (or `ENTITY_ACTION.ALLOW`) — register the entity normally (default)
244
+ * - `'block'` (or `ENTITY_ACTION.BLOCK`) — silently skip; the entity is not stored
245
+ * - `'throw'` (or `ENTITY_ACTION.THROW`) — abort registration with an `Error`
246
+ *
247
+ * The hook receives the entity name (without `&`/`;`) and the resolved string
248
+ * value. It is **not** called during `decode()` — only when entities are added.
249
+ *
250
+ * @example
251
+ * const dec = new EntityDecoder({
252
+ * onExternalEntity: (name, value) =>
253
+ * DANGEROUS_NAMES.has(name) ? ENTITY_ACTION.BLOCK : ENTITY_ACTION.ALLOW,
254
+ * });
255
+ */
256
+ onExternalEntity?: EntityRegistrationHook | null;
257
+
258
+ /**
259
+ * Hook called once **at registration time** for each entity passed to
260
+ * `addInputEntities()`.
261
+ *
262
+ * Follows the same `'allow' | 'block' | 'throw'` contract as `onExternalEntity`.
263
+ *
264
+ * @example
265
+ * const dec = new EntityDecoder({
266
+ * // Block all input / DOCTYPE entities unconditionally
267
+ * onInputEntity: () => ENTITY_ACTION.BLOCK,
268
+ * });
269
+ */
270
+ onInputEntity?: EntityRegistrationHook | null;
194
271
  }
195
272
 
196
273
  // ---------------------------------------------------------------------------
@@ -6,7 +6,7 @@
6
6
 
7
7
  */
8
8
 
9
- export { default as EntityDecoder } from './EntityDecoder.js';
9
+ export { default as EntityDecoder, ENTITY_ACTION } from './EntityDecoder.js';
10
10
  export {
11
11
  COMMON_HTML,
12
12
  XML,
@@ -1,9 +1,9 @@
1
- 'use strict';
2
-
3
- var transport = require('@smithy/core/transport');
4
- var protocols = require('@smithy/core/protocols');
5
- var types = require('@smithy/types');
6
- var client = require('@smithy/core/client');
1
+ const { getSmithyContext } = require("@smithy/core/transport");
2
+ exports.getSmithyContext = getSmithyContext;
3
+ const { HttpRequest } = require("@smithy/core/protocols");
4
+ const { requestBuilder } = require("@smithy/core/protocols");
5
+ exports.requestBuilder = requestBuilder;
6
+ const { HttpApiKeyAuthLocation } = require("@smithy/types");
7
7
 
8
8
  const resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
9
9
  if (!authSchemePreference || authSchemePreference.length === 0) {
@@ -38,7 +38,7 @@ const httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async
38
38
  const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
39
39
  const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
40
40
  const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
41
- const smithyContext = client.getSmithyContext(context);
41
+ const smithyContext = getSmithyContext(context);
42
42
  const failureReasons = [];
43
43
  for (const option of resolvedOptions) {
44
44
  const scheme = authSchemes.get(option.schemeId);
@@ -106,10 +106,10 @@ const defaultErrorHandler = (signingProperties) => (error) => {
106
106
  };
107
107
  const defaultSuccessHandler = (httpResponse, signingProperties) => { };
108
108
  const httpSigningMiddleware = (config) => (next, context) => async (args) => {
109
- if (!protocols.HttpRequest.isInstance(args.request)) {
109
+ if (!HttpRequest.isInstance(args.request)) {
110
110
  return next(args);
111
111
  }
112
- const smithyContext = client.getSmithyContext(context);
112
+ const smithyContext = getSmithyContext(context);
113
113
  const scheme = smithyContext.selectedHttpAuthScheme;
114
114
  if (!scheme) {
115
115
  throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
@@ -228,11 +228,11 @@ class HttpApiKeyAuthSigner {
228
228
  if (!identity.apiKey) {
229
229
  throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");
230
230
  }
231
- const clonedRequest = protocols.HttpRequest.clone(httpRequest);
232
- if (signingProperties.in === types.HttpApiKeyAuthLocation.QUERY) {
231
+ const clonedRequest = HttpRequest.clone(httpRequest);
232
+ if (signingProperties.in === HttpApiKeyAuthLocation.QUERY) {
233
233
  clonedRequest.query[signingProperties.name] = identity.apiKey;
234
234
  }
235
- else if (signingProperties.in === types.HttpApiKeyAuthLocation.HEADER) {
235
+ else if (signingProperties.in === HttpApiKeyAuthLocation.HEADER) {
236
236
  clonedRequest.headers[signingProperties.name] = signingProperties.scheme
237
237
  ? `${signingProperties.scheme} ${identity.apiKey}`
238
238
  : identity.apiKey;
@@ -249,7 +249,7 @@ class HttpApiKeyAuthSigner {
249
249
 
250
250
  class HttpBearerAuthSigner {
251
251
  async sign(httpRequest, identity, signingProperties) {
252
- const clonedRequest = protocols.HttpRequest.clone(httpRequest);
252
+ const clonedRequest = HttpRequest.clone(httpRequest);
253
253
  if (!identity.token) {
254
254
  throw new Error("request could not be signed with `token` since the `token` is not defined");
255
255
  }
@@ -320,8 +320,6 @@ const memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => {
320
320
  };
321
321
  };
322
322
 
323
- exports.getSmithyContext = transport.getSmithyContext;
324
- exports.requestBuilder = protocols.requestBuilder;
325
323
  exports.DefaultIdentityProviderConfig = DefaultIdentityProviderConfig;
326
324
  exports.EXPIRATION_MS = EXPIRATION_MS;
327
325
  exports.HttpApiKeyAuthSigner = HttpApiKeyAuthSigner;
@@ -1,9 +1,7 @@
1
- 'use strict';
2
-
3
- var serde = require('@smithy/core/serde');
4
- var protocols = require('@smithy/core/protocols');
5
- var client = require('@smithy/core/client');
6
- var schema = require('@smithy/core/schema');
1
+ const { nv, toUtf8, fromUtf8, NumericValue, calculateBodyLength, _parseEpochTimestamp, fromBase64, generateIdempotencyToken } = require("@smithy/core/serde");
2
+ const { HttpRequest, collectBody, SerdeContext, RpcProtocol } = require("@smithy/core/protocols");
3
+ const { NormalizedSchema, deref, TypeRegistry } = require("@smithy/core/schema");
4
+ const { getSmithyContext } = require("@smithy/core/transport");
7
5
 
8
6
  const majorUint64 = 0;
9
7
  const majorNegativeInt64 = 1;
@@ -133,7 +131,7 @@ function decode(at, to) {
133
131
  }
134
132
  numericString = sign + numericString;
135
133
  _offset = offset + _offset;
136
- return serde.nv(numericString);
134
+ return nv(numericString);
137
135
  }
138
136
  else {
139
137
  const value = decode(at + offset, to);
@@ -181,7 +179,7 @@ function bytesToUtf8(bytes, at, to) {
181
179
  if (textDecoder) {
182
180
  return textDecoder.decode(bytes.subarray(at, to));
183
181
  }
184
- return serde.toUtf8(bytes.subarray(at, to));
182
+ return toUtf8(bytes.subarray(at, to));
185
183
  }
186
184
  function demote(bigInteger) {
187
185
  const num = Number(bigInteger);
@@ -525,7 +523,7 @@ function encode(_input) {
525
523
  cursor += data.write(input, cursor);
526
524
  }
527
525
  else {
528
- const bytes = serde.fromUtf8(input);
526
+ const bytes = fromUtf8(input);
529
527
  encodeHeader(majorUtf8String, bytes.byteLength);
530
528
  data.set(bytes, cursor);
531
529
  cursor += bytes.byteLength;
@@ -641,7 +639,7 @@ function encode(_input) {
641
639
  continue;
642
640
  }
643
641
  else if (typeof input === "object") {
644
- if (input instanceof serde.NumericValue) {
642
+ if (input instanceof NumericValue) {
645
643
  const decimalIndex = input.string.indexOf(".");
646
644
  const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1;
647
645
  const mantissa = BigInt(input.string.replace(".", ""));
@@ -695,7 +693,7 @@ const cbor = {
695
693
  };
696
694
 
697
695
  const parseCborBody = (streamBody, context) => {
698
- return protocols.collectBody(streamBody, context).then(async (bytes) => {
696
+ return collectBody(streamBody, context).then(async (bytes) => {
699
697
  if (bytes.length) {
700
698
  try {
701
699
  return cbor.deserialize(bytes);
@@ -781,14 +779,14 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
781
779
  if (body !== undefined) {
782
780
  contents.body = body;
783
781
  try {
784
- contents.headers["content-length"] = String(serde.calculateBodyLength(body));
782
+ contents.headers["content-length"] = String(calculateBodyLength(body));
785
783
  }
786
784
  catch (e) { }
787
785
  }
788
- return new protocols.HttpRequest(contents);
786
+ return new HttpRequest(contents);
789
787
  };
790
788
 
791
- class CborCodec extends protocols.SerdeContext {
789
+ class CborCodec extends SerdeContext {
792
790
  createSerializer() {
793
791
  const serializer = new CborShapeSerializer();
794
792
  serializer.setSerdeContext(this.serdeContext);
@@ -800,22 +798,22 @@ class CborCodec extends protocols.SerdeContext {
800
798
  return deserializer;
801
799
  }
802
800
  }
803
- class CborShapeSerializer extends protocols.SerdeContext {
801
+ class CborShapeSerializer extends SerdeContext {
804
802
  value;
805
803
  write(schema, value) {
806
804
  this.value = this.serialize(schema, value);
807
805
  }
808
- serialize(schema$1, source) {
809
- const ns = schema.NormalizedSchema.of(schema$1);
806
+ serialize(schema, source) {
807
+ const ns = NormalizedSchema.of(schema);
810
808
  if (source == null) {
811
809
  if (ns.isIdempotencyToken()) {
812
- return serde.generateIdempotencyToken();
810
+ return generateIdempotencyToken();
813
811
  }
814
812
  return source;
815
813
  }
816
814
  if (ns.isBlobSchema()) {
817
815
  if (typeof source === "string") {
818
- return (this.serdeContext?.base64Decoder ?? serde.fromBase64)(source);
816
+ return (this.serdeContext?.base64Decoder ?? fromBase64)(source);
819
817
  }
820
818
  return source;
821
819
  }
@@ -890,26 +888,26 @@ class CborShapeSerializer extends protocols.SerdeContext {
890
888
  return buffer;
891
889
  }
892
890
  }
893
- class CborShapeDeserializer extends protocols.SerdeContext {
891
+ class CborShapeDeserializer extends SerdeContext {
894
892
  read(schema, bytes) {
895
893
  const data = cbor.deserialize(bytes);
896
894
  return this.readValue(schema, data);
897
895
  }
898
896
  readValue(_schema, value) {
899
- const ns = schema.NormalizedSchema.of(_schema);
897
+ const ns = NormalizedSchema.of(_schema);
900
898
  if (ns.isTimestampSchema()) {
901
899
  if (typeof value === "number") {
902
- return serde._parseEpochTimestamp(value);
900
+ return _parseEpochTimestamp(value);
903
901
  }
904
902
  if (typeof value === "object") {
905
903
  if (value.tag === 1 && "value" in value) {
906
- return serde._parseEpochTimestamp(value.value);
904
+ return _parseEpochTimestamp(value.value);
907
905
  }
908
906
  }
909
907
  }
910
908
  if (ns.isBlobSchema()) {
911
909
  if (typeof value === "string") {
912
- return (this.serdeContext?.base64Decoder ?? serde.fromBase64)(value);
910
+ return (this.serdeContext?.base64Decoder ?? fromBase64)(value);
913
911
  }
914
912
  return value;
915
913
  }
@@ -989,7 +987,7 @@ class CborShapeDeserializer extends protocols.SerdeContext {
989
987
  }
990
988
  }
991
989
  }
992
- else if (value instanceof serde.NumericValue) {
990
+ else if (value instanceof NumericValue) {
993
991
  return value;
994
992
  }
995
993
  return newObject;
@@ -1000,7 +998,7 @@ class CborShapeDeserializer extends protocols.SerdeContext {
1000
998
  }
1001
999
  }
1002
1000
 
1003
- class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1001
+ class SmithyRpcV2CborProtocol extends RpcProtocol {
1004
1002
  codec = new CborCodec();
1005
1003
  serializer = this.codec.createSerializer();
1006
1004
  deserializer = this.codec.createDeserializer();
@@ -1020,7 +1018,7 @@ class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1020
1018
  "smithy-protocol": "rpc-v2-cbor",
1021
1019
  accept: this.getDefaultContentType(),
1022
1020
  });
1023
- if (schema.deref(operationSchema.input) === "unit") {
1021
+ if (deref(operationSchema.input) === "unit") {
1024
1022
  delete request.body;
1025
1023
  delete request.headers["content-type"];
1026
1024
  }
@@ -1034,7 +1032,7 @@ class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1034
1032
  }
1035
1033
  catch (e) { }
1036
1034
  }
1037
- const { service, operation } = client.getSmithyContext(context);
1035
+ const { service, operation } = getSmithyContext(context);
1038
1036
  const path = `/service/${service}/operation/${operation}`;
1039
1037
  if (request.path.endsWith("/")) {
1040
1038
  request.path += path.slice(1);
@@ -1058,7 +1056,7 @@ class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1058
1056
  [namespace] = errorName.split("#");
1059
1057
  }
1060
1058
  const registry = this.compositeErrorRegistry;
1061
- const nsRegistry = schema.TypeRegistry.for(namespace);
1059
+ const nsRegistry = TypeRegistry.for(namespace);
1062
1060
  registry.copyFrom(nsRegistry);
1063
1061
  let errorSchema;
1064
1062
  try {
@@ -1068,7 +1066,7 @@ class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1068
1066
  if (dataObject.Message) {
1069
1067
  dataObject.message = dataObject.Message;
1070
1068
  }
1071
- const syntheticRegistry = schema.TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
1069
+ const syntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
1072
1070
  registry.copyFrom(syntheticRegistry);
1073
1071
  const baseExceptionSchema = registry.getBaseException();
1074
1072
  if (baseExceptionSchema) {
@@ -1077,7 +1075,7 @@ class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
1077
1075
  }
1078
1076
  throw Object.assign(new Error(errorName), errorMetadata, dataObject);
1079
1077
  }
1080
- const ns = schema.NormalizedSchema.of(errorSchema);
1078
+ const ns = NormalizedSchema.of(errorSchema);
1081
1079
  const ErrorCtor = registry.getErrorCtor(errorSchema);
1082
1080
  const message = dataObject.message ?? dataObject.Message ?? "Unknown";
1083
1081
  const exception = new ErrorCtor({});
@@ -1,6 +1,4 @@
1
- 'use strict';
2
-
3
- var serde = require('@smithy/core/serde');
1
+ const { fromUtf8 } = require("@smithy/core/serde");
4
2
 
5
3
  async function blobReader(blob, onChunk, chunkSize = 1024 * 1024) {
6
4
  const size = blob.size;
@@ -183,7 +181,7 @@ function isEmptyData(data) {
183
181
  }
184
182
  function convertToBuffer(data) {
185
183
  if (typeof data === "string") {
186
- return serde.fromUtf8(data);
184
+ return fromUtf8(data);
187
185
  }
188
186
  if (ArrayBuffer.isView(data)) {
189
187
  return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);