@karmaniverous/entity-manager 5.0.8 → 6.0.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 (83) hide show
  1. package/README.md +15 -439
  2. package/dist/cjs/_virtual/_commonjsHelpers.js +7 -0
  3. package/dist/cjs/_virtual/lz-string.js +5 -0
  4. package/dist/cjs/node_modules/@karmaniverous/entity-tools/dist/mjs/Nil.js +14 -0
  5. package/dist/cjs/node_modules/@karmaniverous/entity-tools/dist/mjs/defaultTranscodes.js +94 -0
  6. package/dist/cjs/node_modules/@karmaniverous/entity-tools/dist/mjs/sort.js +52 -0
  7. package/dist/cjs/node_modules/lz-string/libs/lz-string.js +517 -0
  8. package/dist/cjs/node_modules/radash/dist/esm/array.js +90 -0
  9. package/dist/cjs/node_modules/radash/dist/esm/async.js +62 -0
  10. package/dist/cjs/node_modules/radash/dist/esm/object.js +25 -0
  11. package/dist/cjs/node_modules/radash/dist/esm/typed.js +35 -0
  12. package/dist/cjs/node_modules/string-hash/index.js +23 -0
  13. package/dist/cjs/node_modules/tslib/tslib.es6.js +39 -0
  14. package/dist/cjs/node_modules/zod/lib/index.js +4342 -0
  15. package/dist/cjs/src/EntityManager.js +93 -0
  16. package/dist/cjs/src/ParsedConfig.js +227 -0
  17. package/dist/cjs/src/addKeys.js +47 -0
  18. package/dist/cjs/src/decodeEntityElement.js +37 -0
  19. package/dist/cjs/src/decodeGeneratedProperty.js +48 -0
  20. package/dist/cjs/src/dehydrateIndexItem.js +52 -0
  21. package/dist/cjs/src/dehydratePageKeyMap.js +75 -0
  22. package/dist/cjs/src/encodeEntityElement.js +36 -0
  23. package/dist/cjs/src/encodeGeneratedProperty.js +44 -0
  24. package/dist/cjs/src/getHashKeySpace.js +41 -0
  25. package/dist/cjs/src/getShardBump.js +24 -0
  26. package/dist/cjs/src/index.js +7 -0
  27. package/dist/cjs/src/query.js +104 -0
  28. package/dist/cjs/src/rehydrateIndexItem.js +48 -0
  29. package/dist/cjs/src/rehydratePageKeyMap.js +66 -0
  30. package/dist/cjs/src/removeKeys.js +33 -0
  31. package/dist/cjs/src/unwrapIndex.js +40 -0
  32. package/dist/cjs/src/updateItemHashKey.js +55 -0
  33. package/dist/cjs/src/updateItemRangeKey.js +45 -0
  34. package/dist/cjs/src/validateEntityGeneratedProperty.js +29 -0
  35. package/dist/cjs/src/validateEntityIndexToken.js +22 -0
  36. package/dist/cjs/src/validateEntityToken.js +17 -0
  37. package/dist/index.d.cts +826 -0
  38. package/dist/index.d.mts +826 -0
  39. package/dist/index.d.ts +826 -0
  40. package/dist/mjs/_virtual/_commonjsHelpers.js +5 -0
  41. package/dist/mjs/_virtual/lz-string.js +3 -0
  42. package/dist/mjs/node_modules/@karmaniverous/entity-tools/dist/mjs/Nil.js +12 -0
  43. package/dist/mjs/node_modules/@karmaniverous/entity-tools/dist/mjs/defaultTranscodes.js +92 -0
  44. package/dist/mjs/node_modules/@karmaniverous/entity-tools/dist/mjs/sort.js +50 -0
  45. package/dist/mjs/node_modules/lz-string/libs/lz-string.js +515 -0
  46. package/dist/mjs/node_modules/radash/dist/esm/array.js +80 -0
  47. package/dist/mjs/node_modules/radash/dist/esm/async.js +58 -0
  48. package/dist/mjs/node_modules/radash/dist/esm/object.js +22 -0
  49. package/dist/mjs/node_modules/radash/dist/esm/typed.js +28 -0
  50. package/dist/mjs/node_modules/string-hash/index.js +21 -0
  51. package/dist/mjs/node_modules/tslib/tslib.es6.js +36 -0
  52. package/dist/mjs/node_modules/zod/lib/index.js +4233 -0
  53. package/dist/mjs/src/EntityManager.js +91 -0
  54. package/dist/mjs/src/ParsedConfig.js +225 -0
  55. package/dist/mjs/src/addKeys.js +45 -0
  56. package/dist/mjs/src/decodeEntityElement.js +35 -0
  57. package/dist/mjs/src/decodeGeneratedProperty.js +46 -0
  58. package/dist/mjs/src/dehydrateIndexItem.js +50 -0
  59. package/dist/mjs/src/dehydratePageKeyMap.js +73 -0
  60. package/dist/mjs/src/encodeEntityElement.js +34 -0
  61. package/dist/mjs/src/encodeGeneratedProperty.js +42 -0
  62. package/dist/mjs/src/getHashKeySpace.js +39 -0
  63. package/dist/mjs/src/getShardBump.js +22 -0
  64. package/dist/mjs/src/index.js +1 -0
  65. package/dist/mjs/src/query.js +102 -0
  66. package/dist/mjs/src/rehydrateIndexItem.js +46 -0
  67. package/dist/mjs/src/rehydratePageKeyMap.js +64 -0
  68. package/dist/mjs/src/removeKeys.js +31 -0
  69. package/dist/mjs/src/unwrapIndex.js +38 -0
  70. package/dist/mjs/src/updateItemHashKey.js +53 -0
  71. package/dist/mjs/src/updateItemRangeKey.js +43 -0
  72. package/dist/mjs/src/validateEntityGeneratedProperty.js +27 -0
  73. package/dist/mjs/src/validateEntityIndexToken.js +20 -0
  74. package/dist/mjs/src/validateEntityToken.js +15 -0
  75. package/package.json +108 -59
  76. package/.env +0 -1
  77. package/dist/default/lib/EntityManager/EntityManager.js +0 -423
  78. package/dist/default/lib/EntityManager/PrivateEntityManager.js +0 -421
  79. package/dist/default/lib/index.js +0 -12
  80. package/dist/package.json +0 -3
  81. package/lib/EntityManager/EntityManager.js +0 -396
  82. package/lib/EntityManager/PrivateEntityManager.js +0 -436
  83. package/lib/index.js +0 -1
@@ -0,0 +1,826 @@
1
+ import { Entity, Exactify, TranscodeMap, PropertiesOfType, TranscodableProperties, Transcodes, DefaultTranscodeMap, SortOrder } from '@karmaniverous/entity-tools';
2
+ export { DefaultTranscodeMap, Entity, PropertiesOfType, SortOrder, TranscodableProperties, TranscodeMap, Transcodes, defaultTranscodes } from '@karmaniverous/entity-tools';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * The base EntityMap type. All EntityMaps should extend this type.
7
+ *
8
+ * @category Entities
9
+ */
10
+ type EntityMap = Record<string, Entity>;
11
+ /**
12
+ * Tests a string literal type to determine whether it is a key of any {@link Entity | `Entity`} in an {@link EntityMap | `EntityMap`} or is a member of a union of reserved keys.
13
+ *
14
+ * @typeParam K - The string literal type to test.
15
+ * @typeParam M - The {@link EntityMap | `EntityMap`}.
16
+ * @typeParam R - The reserved set of string literal types.
17
+ *
18
+ * @returns `K` if `K` is exclusive or `never` otherwise.
19
+ *
20
+ * @category Config
21
+ * @protected
22
+ */
23
+ type ExclusiveKey<K extends string, M extends EntityMap, R extends string = never> = keyof {
24
+ [E in keyof Exactify<M> as K extends keyof Exactify<M[E]> | R ? K : never]: never;
25
+ } extends never ? K : never;
26
+ /**
27
+ * Returns the `generated` property of a Config entity.
28
+ *
29
+ * @typeParam EntityToken - The {@link Entity | `Entity`} token.
30
+ * @typeParam M - The {@link EntityMap | `EntityMap`}.
31
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying transcodable property types.
32
+ *
33
+ * @remarks
34
+ * All Entity properties of type `never` must be represented, and no extra properties are allowed.
35
+ *
36
+ * @category Config
37
+ * @protected
38
+ */
39
+ type ConfigEntityGenerated<EntityToken extends keyof Exactify<M>, M extends EntityMap, T extends TranscodeMap> = ([PropertiesOfType<M[EntityToken], never>] extends [never] ? never : Record<PropertiesOfType<M[EntityToken], never>, {
40
+ atomic?: boolean;
41
+ elements: TranscodableProperties<M[EntityToken], T>[];
42
+ sharded?: boolean;
43
+ }>) | ([PropertiesOfType<M[EntityToken], never>] extends [never] ? Record<string, never> : never);
44
+ /**
45
+ * Defines a single time period in an {@link Entity | `Entity`} sharding strategy.
46
+ *
47
+ * @category Config
48
+ * @protected
49
+ */
50
+ interface ShardBump {
51
+ /**
52
+ * The timestamp marking the beginning of the time period. Must be a non-negative integer.
53
+ *
54
+ * This value must be unique across all {@link ShardBump | `ShardBumps`} for the {@link Entity | `Entity`}.
55
+ */
56
+ timestamp: number;
57
+ /**
58
+ * The number of bits per character in the bump's shard space. For example, `0` yields a single shard per character, and a value of `2` would yield 4 shards per character.
59
+ *
60
+ * This value must be an integer between `1` and `5` inclusive.
61
+ */
62
+ charBits: number;
63
+ /**
64
+ * The number of characters used to represent the bump's shard key.
65
+ *
66
+ * This value must be an integer between `0` and `40` inclusive. Note that more than a few characters will result in an impossibly large shard space! *
67
+ * A ShardBump with `chars` of `2` and `charBits` of `3` would yield a two-character shard key with a space of 16 shards.
68
+ */
69
+ chars: number;
70
+ }
71
+ /**
72
+ * Returns a Config entity type.
73
+ *
74
+ * @typeParam EntityToken - The {@link Entity | `Entity`} token.
75
+ * @typeParam M - The {@link EntityMap | `EntityMap`}.
76
+ * @typeParam HashKey - The property used across the configuration to store an {@link Entity | `Entity`}'s sharded hash key. Should be configured as the table hash key. Must not conflict with any {@link Entity | `Entity`} property.
77
+ * @typeParam RangeKey - The property used across the configuration to store an {@link Entity | `Entity`}'s range key. Should be configured as the table range key. Must not conflict with any {@link Entity | `Entity`} property.
78
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying transcodable property types. Only {@link Entity | `Entity`} properties of these types can be components of an {@link ConfigEntity.indexes | index} or a {@link ConfigEntityGenerated | generated property}.
79
+
80
+ * @remarks
81
+ * `generated` is optional if `E` has no properties of type `never`.
82
+ *
83
+ * @category Config
84
+ * @protected
85
+ */
86
+ type ConfigEntity<EntityToken extends keyof Exactify<M>, M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> = {
87
+ /**
88
+ * The default maximum number of records to return from a query.
89
+ *
90
+ * @defaultValue `10`
91
+ *
92
+ * @remarks
93
+ * Can be overridden at {@link QueryOptions.limit | `QueryOptions.limit`}.
94
+ *
95
+ * In cross-shard queries, the actual number of records returned is heavily influenced by {@link QueryOptions.pageSize | query pageSize} and the number of shards queried. Actual results may significantly exceed this limit.
96
+ */
97
+ defaultLimit?: number;
98
+ /**
99
+ * The default maximum number of records to return per data page on an individual shard query.
100
+ *
101
+ * @defaultValue `10`
102
+ *
103
+ * @remarks
104
+ * Shard queries will be repeated internally until either the shard is exhausted or the number of records returned exceeds the {@link QueryOptions.limit | query limit}.
105
+ *
106
+ * Can be overridden at {@link QueryOptions.pageSize | `QueryOptions.pageSize`}.
107
+ */
108
+ defaultPageSize?: number;
109
+ /**
110
+ * This object assigns transcodes to {@link Entity | `Entity`} generated property & ungenerated index elements.
111
+ *
112
+ * These transcodes are used to encode and decode generated property values & pageKeys.
113
+ *
114
+ * The keys of this object must be transcodable properties of the {@link Entity | `Entity`}.
115
+ *
116
+ * The values of this object must be one of the keys of the {@link Config | `Config`} `T` type parameter (the config's {@link TranscodeMap | `TranscodeMap`}).
117
+ *
118
+ * The types of the related {@link Entity | `Entity`} and {@link TranscodeMap | `TranscodeMap`} properties should match.
119
+ *
120
+ * If any entity generated property element or ungenerated index element is not included here, the {@link Config | `Config`} object will fail to parse.
121
+ *
122
+ * @example
123
+ * ```
124
+ * // Default transcodable types.
125
+ * interface DefaultTranscodeMap extends TranscodeMap {
126
+ * string: string;
127
+ * number: number;
128
+ * boolean: boolean;
129
+ * bigint: bigint;
130
+ * }
131
+ *
132
+ * interface MyEntityMap extends EntityMap {
133
+ * user: {
134
+ * created: number;
135
+ * data?: Json; // Not a Stringifiable type
136
+ * userId: string;
137
+ * };
138
+ * }
139
+ *
140
+ * // T type param defaults to DefaultTranscodeMap.
141
+ * const config: Config<MyEntityMap> = {
142
+ * entities: {
143
+ * user: {
144
+ * ...,
145
+ * types: { // All Stringafiable properties required!
146
+ * created: 'number',
147
+ * userId: 'string',
148
+ * // 'data' not allowed: not a Stringifiable type
149
+ * }
150
+ * }
151
+ * },
152
+ * ...
153
+ * };
154
+ * ```
155
+ */
156
+ elementTypes?: ([TranscodableProperties<M[EntityToken], T>] extends [never] ? never : {
157
+ [P in TranscodableProperties<M[EntityToken], T>]?: PropertiesOfType<T, M[EntityToken][P]>;
158
+ }) | ([TranscodableProperties<M[EntityToken], T>] extends [never] ? Record<string, never> : never);
159
+ /**
160
+ * Indexes defined for the {@link Entity | `Entity`}. Should reflect the underlying database table indexes.
161
+ *
162
+ * Each key is the name of an index, and each value is a non-empty array of {@link Entity | `Entity`} property names that define the index.
163
+ *
164
+ * Related property types must be align with the {@link Config | `Config`} `T` type parameter. Note tha all {@link ConfigEntityGenerated | generated property} types are transcodable by definition.
165
+ */
166
+ indexes?: Record<string, (TranscodableProperties<M[EntityToken], T> | PropertiesOfType<M[EntityToken], never> | HashKey | RangeKey)[]>;
167
+ /**
168
+ * An array of {@link ShardBump | `ShardBump`} objects representing the {@link Entity | `Entity`}'s sharding strategy.
169
+ *
170
+ * If omitted, or if configured without a zero-{@link ShardBump.timestamp | `timestamp`} {@link ShardBump | `ShardBump`}, this array will be initialized with the following {@link ShardBump | `ShardBump`} as its first member:
171
+ *
172
+ * ```
173
+ * { timestamp: 0, charBits: 0, chars: 1 }
174
+ * ```
175
+ *
176
+ * Members must be unique by {@link ShardBump.timestamp | `timestamp`}.
177
+ *
178
+ * {@link ShardBump.chars | `chars`} must increase monotonically with {@link ShardBump.timestamp | `timestamp`}
179
+ *
180
+ * Array will be sorted in ascending order by {@link ShardBump.timestamp | `timestamp`} on initialization.
181
+ *
182
+ * Future {@link ShardBump | `ShardBumps`} can be changed as required, but past {@link ShardBump | `ShardBumps`} should not be modified or data integrity will be compromised!
183
+ */
184
+ shardBumps?: ShardBump[];
185
+ /**
186
+ * Identifies the {@link Entity | `Entity`} property used as the timestamp for shard key calculations.
187
+ *
188
+ * This property must be of type `number`. Its value should not change over the life of the record. A `created` timestamp is ideal.
189
+ *
190
+ * Once in production, this configuration property should not be changed or data integrity will be compromised!
191
+ */
192
+ timestampProperty: PropertiesOfType<M[EntityToken], number>;
193
+ /**
194
+ * Identifies the {@link Entity | `Entity`} used as the basis for both shard key calculations and the table's {@link ConfigKeys.rangeKey | range key}.
195
+ *
196
+ * This property must be of type `string` or `number`. Its value should be a unique record identifier and should not change over the life of the record.
197
+ *
198
+ * Once in production, this configuration property should not be changed or data integrity will be compromised!
199
+ */
200
+ uniqueProperty: PropertiesOfType<M[EntityToken], number | string>;
201
+ } & ([PropertiesOfType<M[EntityToken], never>] extends [never] ? {
202
+ generated?: ConfigEntityGenerated<EntityToken, M, T>;
203
+ } : {
204
+ /**
205
+ * {@link Entity | `Entity`} properties whose values will be generated by EntityManager.
206
+ *
207
+ * These properties should be indicated by a `never` type in the {@link Config | `Config`} `EntityMap` type parameter.
208
+ *
209
+ * All such properties must be accounted for in the `generated` object, and no additional properties are permitted..
210
+ */
211
+ generated: ConfigEntityGenerated<EntityToken, M, T>;
212
+ });
213
+ /**
214
+ * Returns the `entities` property of the {@link Config | `Config`} tyoe.
215
+ *
216
+ * @typeParam M - The {@link EntityMap | `EntityMap`} type that identitfies the {@link Entity | `Entity`} & related property types to be managed by EntityManager.
217
+ * @typeParam HashKey - The property used across the configuration to store an {@link Entity | `Entity`}'s sharded hash key. Should be configured as the table hash key. Must not conflict with any {@link Entity | `Entity`} property.
218
+ * @typeParam RangeKey - The property used across the configuration to store an {@link Entity | `Entity`}'s range key. Should be configured as the table range key. Must not conflict with any {@link Entity | `Entity`} property.
219
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying transcodable property types. Only {@link Entity | `Entity`} properties of these types can be components of an {@link ConfigEntity.indexes | index} or a {@link ConfigEntityGenerated | generated property}.
220
+ *
221
+ * @remarks
222
+ * All properties of `M` must be represented, and no extra properties are allowed.
223
+ *
224
+ * @category Config
225
+ * @protected
226
+ */
227
+ type ConfigEntities<M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> = ([keyof Exactify<M>] extends [never] ? never : {
228
+ [E in keyof Exactify<M>]: ConfigEntity<E, M, HashKey, RangeKey, T>;
229
+ }) | Record<string, never>;
230
+ /**
231
+ * Returns variably-optional properties of the {@link Config | `Config`} type as optional.
232
+
233
+ * @typeParam M - The {@link EntityMap | `EntityMap`} type that identitfies the {@link Entity | `Entity`} & related property types to be managed by EntityManager.
234
+ * @typeParam HashKey - The property used across the configuration to store an {@link Entity | `Entity`}'s sharded hash key. Should be configured as the table hash key. Must not conflict with any {@link Entity | `Entity`} property.
235
+ * @typeParam RangeKey - The property used across the configuration to store an {@link Entity | `Entity`}'s range key. Should be configured as the table range key. Must not conflict with any {@link Entity | `Entity`} property.
236
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying transcodable property types. Only {@link Entity | `Entity`} properties of these types can be components of an {@link ConfigEntity.indexes | index} or a {@link ConfigEntityGenerated | generated property}.
237
+ *
238
+ * @category Config
239
+ * @protected
240
+ */
241
+ interface ConfigKeys<M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> {
242
+ /**
243
+ * Defines options for each {@link Entity | `Entity`} in the {@link Config | `Config`} `EntityMap` type parameter.
244
+ *
245
+ * The properties of this object must exactly match the keys of the {@link Config | `Config`} `EntityMap` type parameter.
246
+ */
247
+ entities?: ConfigEntities<M, HashKey, RangeKey, T>;
248
+ /**
249
+ * The property used across the configuration to store an {@link Entity | `Entity`}'s sharded hash key. Should be configured as the table hash key.
250
+ *
251
+ * This value must exactly match the {@link Config | `Config`} `HashKey` type parameter, and must not conflict with any {@link Entity | `Entity`} property.
252
+ *
253
+ * @defaultValue `'hashKey'`
254
+ *
255
+ * @category Config
256
+ * @protected
257
+ */
258
+ hashKey?: ExclusiveKey<HashKey, M, RangeKey>;
259
+ /**
260
+ * The property used across the configuration to store an {@link Entity | `Entity`}'s range key. Should be configured as the table range key.
261
+ *
262
+ * This value must exactly match the {@link Config | `Config`} `RangeKey` type parameter, and must not conflict with any {@link Entity | `Entity`} property.
263
+ *
264
+ * @defaultValue `'rangeKey'`
265
+ */
266
+ rangeKey?: ExclusiveKey<RangeKey, M, HashKey>;
267
+ }
268
+ /**
269
+ * @category Config
270
+ * @protected
271
+ */
272
+ type ConfigTranscodes<T extends TranscodeMap> = ([keyof Exactify<T>] extends [never] ? never : Transcodes<T>) | ([keyof Exactify<T>] extends [never] ? Record<string, never> : never);
273
+ /**
274
+ * EntityManager Config type.
275
+ *
276
+ * @typeParam M - The {@link EntityMap | `EntityMap`} type that identitfies the {@link Entity | `Entity`} & related property types to be managed by EntityManager.
277
+ * @typeParam HashKey - The property used across the configuration to store an {@link Entity | `Entity`}'s sharded hash key. Should be configured as the table hash key. Must not conflict with any {@link Entity | `Entity`} property. Defaults to `'hashKey'`.
278
+ * @typeParam RangeKey - The property used across the configuration to store an {@link Entity | `Entity`}'s range key. Should be configured as the table range key. Must not conflict with any {@link Entity | `Entity`} property. Defaults to `'rangeKey'`.
279
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying transcodable property types. Only {@link Entity | `Entity`} properties of these types can be components of an {@link ConfigEntity.indexes | index} or a {@link ConfigEntityGenerated | generated property}. Defaults to {@link DefaultTranscodeMap | `DefaultTranscodeMap`}.
280
+ *
281
+ * @remarks
282
+ * `entities` is optional if `M` is empty.
283
+ *
284
+ * @category Config
285
+ */
286
+ type Config<M extends EntityMap = Record<string, never>, HashKey extends string = 'hashKey', RangeKey extends string = 'rangeKey', T extends TranscodeMap = DefaultTranscodeMap> = ([keyof Exactify<M>] extends [never] ? ConfigKeys<M, HashKey, RangeKey, T> : Required<ConfigKeys<M, HashKey, RangeKey, T>>) & {
287
+ /**
288
+ * Defines the delimiter used to separate key-value pairs in a generated property value.
289
+ *
290
+ * Must consist of one or more non-word characters, and must not intersect with {@link Config.generatedValueDelimiter | `generatedValueDelimiter`} or {@link Config.shardKeyDelimiter | `shardKeyDelimiter`}.
291
+ *
292
+ * @defaultValue `'|'`
293
+ */
294
+ generatedKeyDelimiter?: string;
295
+ /**
296
+ * Defines the delimiter used to separate keys & values in a generated property value.
297
+ *
298
+ * Must consist of one or more non-word characters, and must not intersect with {@link Config.generatedKeyDelimiter | `generatedKeyDelimiter`} or {@link Config.shardKeyDelimiter | `shardKeyDelimiter`}.
299
+ *
300
+ * @defaultValue `'#'`
301
+ */
302
+ generatedValueDelimiter?: string;
303
+ /**
304
+ * Defines the delimiter used to construct an Entity's hashKey value from its Entity key and shard key.
305
+ *
306
+ * Must consist of one or more non-word characters, and must not intersect with {@link Config.generatedKeyDelimiter | `generatedKeyDelimiter`} or {@link Config.generatedValueDelimiter | `generatedValueDelimiter`}.
307
+ *
308
+ * @defaultValue `'!'`
309
+ */
310
+ shardKeyDelimiter?: string;
311
+ /**
312
+ * The default maximum number of shards to query in parallel. Can be overridden at {@link QueryOptions.throttle | `QueryOptions.throttle`}.
313
+ *
314
+ * @defaultValue `10`
315
+ */
316
+ throttle?: number;
317
+ } & ([keyof Exactify<T>] extends [never] ? {
318
+ transcodes?: ConfigTranscodes<T>;
319
+ } : DefaultTranscodeMap extends T ? {
320
+ transcodes?: ConfigTranscodes<T>;
321
+ } : {
322
+ transcodes: ConfigTranscodes<T>;
323
+ });
324
+ /**
325
+ * Flattens the top layer of logic in a type.
326
+ *
327
+ * @category Utility
328
+ * @protected
329
+ */
330
+ type Unwrap<T> = {
331
+ [P in keyof T]: T[P];
332
+ };
333
+ /**
334
+ * Extracts a map of {@link Entity | `Entity`} item types decorated with {@link ConfigKeys.hashKey | hashKey}, {@link ConfigKeys.rangeKey | rangeKey}, and {@link ConfigEntityGenerated | generated properties}.
335
+ *
336
+ * @typeParam M - The {@link EntityMap | `EntityMap`} type that identitfies the {@link Entity | `Entity`} & related property types to be managed by EntityManager.
337
+ * @typeParam HashKey - The property used across the configuration to store an {@link Entity | `Entity`}'s sharded hash key. Should be configured as the table hash key. Must not conflict with any {@link Entity | `Entity`} property. Defaults to `'hashKey'`.
338
+ * @typeParam RangeKey - The property used across the configuration to store an {@link Entity | `Entity`}'s range key. Should be configured as the table range key. Must not conflict with any {@link Entity | `Entity`} property. Defaults to `'rangeKey'`.
339
+ *
340
+ * @category Entities
341
+ */
342
+ type ItemMap<M extends EntityMap, HashKey extends string = 'hashKey', RangeKey extends string = 'rangeKey'> = {
343
+ [EntityToken in keyof Exactify<M>]: Unwrap<{
344
+ [P in keyof Exactify<M[EntityToken]>]: [
345
+ NonNullable<M[EntityToken][P]>
346
+ ] extends [never] ? string : M[EntityToken][P];
347
+ } & {
348
+ [P in HashKey | RangeKey]?: string;
349
+ }>;
350
+ };
351
+
352
+ declare const configSchema: z.ZodEffects<z.ZodObject<{
353
+ entities: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
354
+ defaultLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
355
+ defaultPageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
356
+ generated: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodObject<{
357
+ atomic: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
358
+ elements: z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>;
359
+ sharded: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ atomic: boolean;
362
+ elements: [string, ...string[]];
363
+ sharded: boolean;
364
+ }, {
365
+ elements: [string, ...string[]];
366
+ atomic?: boolean | undefined;
367
+ sharded?: boolean | undefined;
368
+ }>>>>>;
369
+ elementTypes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
370
+ indexes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>>>>;
371
+ shardBumps: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
372
+ timestamp: z.ZodNumber;
373
+ charBits: z.ZodNumber;
374
+ chars: z.ZodNumber;
375
+ }, "strict", z.ZodTypeAny, {
376
+ timestamp: number;
377
+ charBits: number;
378
+ chars: number;
379
+ }, {
380
+ timestamp: number;
381
+ charBits: number;
382
+ chars: number;
383
+ }>, "many">>>, {
384
+ timestamp: number;
385
+ charBits: number;
386
+ chars: number;
387
+ }[], {
388
+ timestamp: number;
389
+ charBits: number;
390
+ chars: number;
391
+ }[] | undefined>, {
392
+ timestamp: number;
393
+ charBits: number;
394
+ chars: number;
395
+ }[], {
396
+ timestamp: number;
397
+ charBits: number;
398
+ chars: number;
399
+ }[] | undefined>, {
400
+ timestamp: number;
401
+ charBits: number;
402
+ chars: number;
403
+ }[], {
404
+ timestamp: number;
405
+ charBits: number;
406
+ chars: number;
407
+ }[] | undefined>;
408
+ timestampProperty: z.ZodString;
409
+ uniqueProperty: z.ZodString;
410
+ }, "strict", z.ZodTypeAny, {
411
+ defaultLimit: number;
412
+ defaultPageSize: number;
413
+ elementTypes: Record<string, string>;
414
+ indexes: Record<string, [string, ...string[]]>;
415
+ shardBumps: {
416
+ timestamp: number;
417
+ charBits: number;
418
+ chars: number;
419
+ }[];
420
+ timestampProperty: string;
421
+ uniqueProperty: string;
422
+ generated: Record<string, {
423
+ atomic: boolean;
424
+ elements: [string, ...string[]];
425
+ sharded: boolean;
426
+ } | undefined>;
427
+ }, {
428
+ timestampProperty: string;
429
+ uniqueProperty: string;
430
+ defaultLimit?: number | undefined;
431
+ defaultPageSize?: number | undefined;
432
+ elementTypes?: Record<string, string> | undefined;
433
+ indexes?: Record<string, [string, ...string[]]> | undefined;
434
+ shardBumps?: {
435
+ timestamp: number;
436
+ charBits: number;
437
+ chars: number;
438
+ }[] | undefined;
439
+ generated?: Record<string, {
440
+ elements: [string, ...string[]];
441
+ atomic?: boolean | undefined;
442
+ sharded?: boolean | undefined;
443
+ } | undefined> | undefined;
444
+ }>, {
445
+ defaultLimit: number;
446
+ defaultPageSize: number;
447
+ elementTypes: Record<string, string>;
448
+ indexes: Record<string, [string, ...string[]]>;
449
+ shardBumps: {
450
+ timestamp: number;
451
+ charBits: number;
452
+ chars: number;
453
+ }[];
454
+ timestampProperty: string;
455
+ uniqueProperty: string;
456
+ generated: Record<string, {
457
+ atomic: boolean;
458
+ elements: [string, ...string[]];
459
+ sharded: boolean;
460
+ } | undefined>;
461
+ }, {
462
+ timestampProperty: string;
463
+ uniqueProperty: string;
464
+ defaultLimit?: number | undefined;
465
+ defaultPageSize?: number | undefined;
466
+ elementTypes?: Record<string, string> | undefined;
467
+ indexes?: Record<string, [string, ...string[]]> | undefined;
468
+ shardBumps?: {
469
+ timestamp: number;
470
+ charBits: number;
471
+ chars: number;
472
+ }[] | undefined;
473
+ generated?: Record<string, {
474
+ elements: [string, ...string[]];
475
+ atomic?: boolean | undefined;
476
+ sharded?: boolean | undefined;
477
+ } | undefined> | undefined;
478
+ }>>>>;
479
+ generatedKeyDelimiter: z.ZodDefault<z.ZodOptional<z.ZodString>>;
480
+ generatedValueDelimiter: z.ZodDefault<z.ZodOptional<z.ZodString>>;
481
+ shardKeyDelimiter: z.ZodDefault<z.ZodOptional<z.ZodString>>;
482
+ hashKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
483
+ rangeKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
484
+ throttle: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
485
+ transcodes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
486
+ encode: z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodString>;
487
+ decode: z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodAny>;
488
+ }, "strict", z.ZodTypeAny, {
489
+ encode: (args_0: any, ...args: unknown[]) => string;
490
+ decode: (args_0: string, ...args: unknown[]) => any;
491
+ }, {
492
+ encode: (args_0: any, ...args: unknown[]) => string;
493
+ decode: (args_0: string, ...args: unknown[]) => any;
494
+ }>>>>;
495
+ }, "strict", z.ZodTypeAny, {
496
+ hashKey: string;
497
+ rangeKey: string;
498
+ entities: Record<string, {
499
+ defaultLimit: number;
500
+ defaultPageSize: number;
501
+ elementTypes: Record<string, string>;
502
+ indexes: Record<string, [string, ...string[]]>;
503
+ shardBumps: {
504
+ timestamp: number;
505
+ charBits: number;
506
+ chars: number;
507
+ }[];
508
+ timestampProperty: string;
509
+ uniqueProperty: string;
510
+ generated: Record<string, {
511
+ atomic: boolean;
512
+ elements: [string, ...string[]];
513
+ sharded: boolean;
514
+ } | undefined>;
515
+ }>;
516
+ generatedKeyDelimiter: string;
517
+ generatedValueDelimiter: string;
518
+ shardKeyDelimiter: string;
519
+ throttle: number;
520
+ transcodes: Record<string, {
521
+ encode: (args_0: any, ...args: unknown[]) => string;
522
+ decode: (args_0: string, ...args: unknown[]) => any;
523
+ }>;
524
+ }, {
525
+ hashKey?: string | undefined;
526
+ rangeKey?: string | undefined;
527
+ entities?: Record<string, {
528
+ timestampProperty: string;
529
+ uniqueProperty: string;
530
+ defaultLimit?: number | undefined;
531
+ defaultPageSize?: number | undefined;
532
+ elementTypes?: Record<string, string> | undefined;
533
+ indexes?: Record<string, [string, ...string[]]> | undefined;
534
+ shardBumps?: {
535
+ timestamp: number;
536
+ charBits: number;
537
+ chars: number;
538
+ }[] | undefined;
539
+ generated?: Record<string, {
540
+ elements: [string, ...string[]];
541
+ atomic?: boolean | undefined;
542
+ sharded?: boolean | undefined;
543
+ } | undefined> | undefined;
544
+ }> | undefined;
545
+ generatedKeyDelimiter?: string | undefined;
546
+ generatedValueDelimiter?: string | undefined;
547
+ shardKeyDelimiter?: string | undefined;
548
+ throttle?: number | undefined;
549
+ transcodes?: Record<string, {
550
+ encode: (args_0: any, ...args: unknown[]) => string;
551
+ decode: (args_0: string, ...args: unknown[]) => any;
552
+ }> | undefined;
553
+ }>, {
554
+ hashKey: string;
555
+ rangeKey: string;
556
+ entities: Record<string, {
557
+ defaultLimit: number;
558
+ defaultPageSize: number;
559
+ elementTypes: Record<string, string>;
560
+ indexes: Record<string, [string, ...string[]]>;
561
+ shardBumps: {
562
+ timestamp: number;
563
+ charBits: number;
564
+ chars: number;
565
+ }[];
566
+ timestampProperty: string;
567
+ uniqueProperty: string;
568
+ generated: Record<string, {
569
+ atomic: boolean;
570
+ elements: [string, ...string[]];
571
+ sharded: boolean;
572
+ } | undefined>;
573
+ }>;
574
+ generatedKeyDelimiter: string;
575
+ generatedValueDelimiter: string;
576
+ shardKeyDelimiter: string;
577
+ throttle: number;
578
+ transcodes: Record<string, {
579
+ encode: (args_0: any, ...args: unknown[]) => string;
580
+ decode: (args_0: string, ...args: unknown[]) => any;
581
+ }>;
582
+ }, {
583
+ hashKey?: string | undefined;
584
+ rangeKey?: string | undefined;
585
+ entities?: Record<string, {
586
+ timestampProperty: string;
587
+ uniqueProperty: string;
588
+ defaultLimit?: number | undefined;
589
+ defaultPageSize?: number | undefined;
590
+ elementTypes?: Record<string, string> | undefined;
591
+ indexes?: Record<string, [string, ...string[]]> | undefined;
592
+ shardBumps?: {
593
+ timestamp: number;
594
+ charBits: number;
595
+ chars: number;
596
+ }[] | undefined;
597
+ generated?: Record<string, {
598
+ elements: [string, ...string[]];
599
+ atomic?: boolean | undefined;
600
+ sharded?: boolean | undefined;
601
+ } | undefined> | undefined;
602
+ }> | undefined;
603
+ generatedKeyDelimiter?: string | undefined;
604
+ generatedValueDelimiter?: string | undefined;
605
+ shardKeyDelimiter?: string | undefined;
606
+ throttle?: number | undefined;
607
+ transcodes?: Record<string, {
608
+ encode: (args_0: any, ...args: unknown[]) => string;
609
+ decode: (args_0: string, ...args: unknown[]) => any;
610
+ }> | undefined;
611
+ }>;
612
+ /**
613
+ * Foo
614
+ *
615
+ * @category Config
616
+ */
617
+ type ParsedConfig = z.infer<typeof configSchema>;
618
+
619
+ /**
620
+ * A result returned by a {@link ShardQueryFunction | `ShardQueryFunction`} querying an individual shard.
621
+ *
622
+ * @typeParam Item - The {@link ItemMap | `ItemMap`} type being queried.
623
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying property types that can be indexed.
624
+
625
+ * @category Query
626
+ */
627
+ interface ShardQueryResult<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string = 'hashKey', RangeKey extends string = 'rangeKey', T extends TranscodeMap = DefaultTranscodeMap> {
628
+ /** The number of records returned. */
629
+ count: number;
630
+ /** The returned records. */
631
+ items: Item[];
632
+ /** The page key for the next query on this shard. */
633
+ pageKey?: Partial<Pick<Item, PropertiesOfType<Item, T[keyof T]>>>;
634
+ }
635
+
636
+ /**
637
+ * A query function that returns a single page of results from an individual
638
+ * shard. This function will typically be composed dynamically to express a
639
+ * specific query index & logic. The arguments to this function will be
640
+ * provided by the {@link EntityManager.query | `EntityManager.query`} method, which assembles many returned
641
+ * pages queried across multiple shards into a single query result.
642
+ *
643
+ * @typeParam Item - The {@link ItemMap | `ItemMap`} type being queried.
644
+ * @typeParam T - The {@link TranscodeMap | `TranscodeMap`} identifying property types that can be indexed. Defaults to {@link DefaultTranscodeMap | `DefaultTranscodeMap`}.
645
+
646
+ * @param hashKey - The {@link ConfigKeys.hashKey | `this.config.hashKey`} property value of the shard being queried.
647
+ * @param pageKey - The page key returned by the previous query on this shard.
648
+ * @param pageSize - The maximum number of items to return from this query.
649
+ *
650
+ * @category Query
651
+ */
652
+ type ShardQueryFunction<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string = 'hashKey', RangeKey extends string = 'rangeKey', T extends TranscodeMap = DefaultTranscodeMap> = (hashKey: string, pageKey?: Partial<Pick<Item, PropertiesOfType<Item, T[keyof T]>>>, pageSize?: number) => Promise<ShardQueryResult<Item, EntityToken, M, HashKey, RangeKey, T>>;
653
+
654
+ /**
655
+ * Options passed to the {@link EntityManager.query | `EntityManager.query`} method.
656
+ *
657
+ * @category Query
658
+ */
659
+ interface QueryOptions<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> {
660
+ /** Identifies the entity to be queried. Key of {@link Config | `EntityManager.config.entities`}. */
661
+ entityToken: EntityToken;
662
+ /**
663
+ * Identifies the entity key across which the query will be sharded. Key of
664
+ * {@link Config | `EntityManager.config.entities.<entityToken>.keys`}.
665
+ */
666
+ hashKey: string;
667
+ /**
668
+ * A partial {@link ItemMap | `ItemMap`} object containing at least the properties specified in
669
+ * {@link Config | `EntityManager.config.entities.<entityToken>.keys.<keyToken>.elements`}, except for the properties specified in {@link Config | `EntityManager.config.tokens`}.
670
+ *
671
+ * This data will be used to generate query keys across all shards.
672
+ */
673
+ item?: Item;
674
+ /**
675
+ * The target maximum number of records to be returned by the query across
676
+ * all shards.
677
+ *
678
+ * The actual number of records returned will be a product of {@link QueryOptions.pageSize | `pageSize`} and the
679
+ * number of shards queried, unless limited by available records in a given
680
+ * shard.
681
+ */
682
+ limit?: number;
683
+ /**
684
+ * {@link QueryResult.pageKeyMap | `pageKeyMap`} returned by the previous iteration of this query.
685
+ */
686
+ pageKeyMap?: string;
687
+ /**
688
+ * The maximum number of records to be returned by each individual query to a
689
+ * single shard (i.e. {@link ShardQueryFunction | `ShardQueryFunction`} execution).
690
+ *
691
+ * Note that, within a given {@link EntityManager.query | `query`} method execution, these queries will be
692
+ * repeated until either available data is exhausted or the {@link QueryOptions.limit | `limit`} value is
693
+ * reached.
694
+ */
695
+ pageSize?: number;
696
+ /**
697
+ * Each key in this object is a valid entity index token. Each value is a valid
698
+ * {@link ShardQueryFunction | 'ShardQueryFunction'} that specifies the query of a single page of data on a
699
+ * single shard for the mapped index.
700
+ *
701
+ * This allows simultaneous queries on multiple sort keys to share a single
702
+ * page key, e.g. to match the same string against `firstName` and `lastName`
703
+ * properties without performing a table scan for either.
704
+ */
705
+ queryMap: Record<string, ShardQueryFunction<Item, EntityToken, M, HashKey, RangeKey, T>>;
706
+ /**
707
+ * A {@link SortOrder | `SortOrder`} object specifying the sort order of the result set. Defaults to `[]`.
708
+ */
709
+ sortOrder?: SortOrder<Item>;
710
+ /**
711
+ * Lower limit to query shard space.
712
+ *
713
+ * Only valid if the query is constrained along the dimension used by the
714
+ * {@link Config | `EntityManager.config.entities.<entityToken>.sharding.timestamptokens.timestamp`}
715
+ * function to generate `shardKey`.
716
+ *
717
+ * @defaultValue `0`
718
+ */
719
+ timestampFrom?: number;
720
+ /**
721
+ * Upper limit to query shard space.
722
+ *
723
+ * Only valid if the query is constrained along the dimension used by the
724
+ * {@link Config | `EntityManager.config.entities.<entityToken>.sharding.timestamptokens.timestamp`}
725
+ * function to generate `shardKey`.
726
+ *
727
+ * @defaultValue `Date.now()`
728
+ */
729
+ timestampTo?: number;
730
+ /**
731
+ * The maximum number of shards to query in parallel. Overrides options `throttle`.
732
+ *
733
+ * @defaultValue `options.throttle`
734
+ */
735
+ throttle?: number;
736
+ }
737
+
738
+ /**
739
+ * A result returned by a query across multiple shards, where each shard may
740
+ * receive multiple page queries via a dynamically-generated {@link ShardQueryFunction | `ShardQueryFunction`}.
741
+ *
742
+ * @category Query
743
+ */
744
+ interface QueryResult<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string, M extends EntityMap, HashKey extends string, RangeKey extends string> {
745
+ /** Total number of records returned across all shards. */
746
+ count: number;
747
+ /** The returned records. */
748
+ items: Item[];
749
+ /**
750
+ * A compressed, two-layer map of page keys, used to query the next page of
751
+ * data for a given sort key on each shard of a given hash key.
752
+ */
753
+ pageKeyMap: string;
754
+ }
755
+
756
+ /**
757
+ * The EntityManager class applies a configuration-driven sharded data model &
758
+ * query strategy to NoSql data.
759
+ *
760
+ * @category Entity Manager
761
+ */
762
+ declare class EntityManager<M extends EntityMap, HashKey extends string, RangeKey extends string, T extends TranscodeMap> {
763
+ #private;
764
+ /**
765
+ * Create an EntityManager instance.
766
+ *
767
+ * @param config - EntityManager {@link Config | `Config`} object.
768
+ */
769
+ constructor(config: Config<M, HashKey, RangeKey, T>);
770
+ /**
771
+ * Get the current EntityManager {@link Config | `Config`} object.
772
+ *
773
+ * @returns Current {@link Config | `Config`} object.
774
+ */
775
+ get config(): ParsedConfig;
776
+ /**
777
+ * Set the current EntityManager {@link Config | `Config`} object.
778
+ *
779
+ * @param value - {@link Config | `Config`} object.
780
+ */
781
+ set config(value: ParsedConfig);
782
+ /**
783
+ * Update generated properties, hash key, and range key on an {@link ItemMap | `ItemMap`} object. Mutates `item`.
784
+ *
785
+ * @param item - {@link ItemMap | `ItemMap`} object.
786
+ * @param entityToken - {@link ConfigKeys.entities | `this.config.entities`} key.
787
+ * @param overwrite - Overwrite existing properties (default `false`).
788
+ *
789
+ * @returns Mutated `item` with updated properties.
790
+ *
791
+ * @throws `Error` if `entityToken` is invalid.
792
+ */
793
+ addKeys<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string>(item: Item, entityToken: EntityToken, overwrite?: boolean): Item;
794
+ /**
795
+ * Strips generated properties, hash key, and range key from an {@link ItemMap | `ItemMap`} object. Mutates `item`.
796
+ *
797
+ * @param item - {@link ItemMap | `ItemMap`} object.
798
+ * @param entityToken - {@link ConfigKeys.entities | `this.config.entities`} key.
799
+ *
800
+ * @returns Mutated `item` without generated properties, hash key or range key.
801
+ *
802
+ * @throws `Error` if `entityToken` is invalid.
803
+ */
804
+ removeKeys<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string>(item: Item, entityToken: EntityToken): Item;
805
+ /**
806
+ * Query a database entity across shards in a provider-generic fashion.
807
+ *
808
+ * @remarks
809
+ * The provided {@link ShardQueryFunction | `ShardQueryFunction`} performs the actual query of individual data pages on individual shards. This function is presumed to express provider-specific query logic, including any necessary indexing or search constraints.
810
+ *
811
+ * Individual shard query results will be combined, deduped by {@link ConfigEntity.uniqueProperty} property value, and sorted by {@link QueryOptions.sortOrder | `sortOrder`}.
812
+ *
813
+ * In queries on sharded data, expect the leading and trailing edges of returned data pages to interleave somewhat with preceding & following pages.
814
+ *
815
+ * Unsharded query results should sort & page as expected.
816
+ *
817
+ * @param options - {@link QueryOptions | `QueryOptions`} object.
818
+ *
819
+ * @returns {@link QueryResult} object.
820
+ *
821
+ * @throws Error if {@link QueryOptions.pageKeyMap | `pageKeyMap`} keys do not match {@link QueryOptions.queryMap | `queryMap`} keys.
822
+ */
823
+ query<Item extends ItemMap<M, HashKey, RangeKey>[EntityToken], EntityToken extends keyof Exactify<M> & string>(options: QueryOptions<Item, EntityToken, M, HashKey, RangeKey, T>): Promise<QueryResult<Item, EntityToken, M, HashKey, RangeKey>>;
824
+ }
825
+
826
+ export { type Config, type ConfigEntities, type ConfigEntity, type ConfigEntityGenerated, type ConfigKeys, type ConfigTranscodes, EntityManager, type EntityMap, type ExclusiveKey, type ItemMap, type ParsedConfig, type QueryOptions, type QueryResult, type ShardBump, type ShardQueryFunction, type ShardQueryResult, type Unwrap };