@karmaniverous/entity-manager 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/cjs/src/ParsedConfig.js +4 -4
- package/dist/cjs/src/decodeEntityElement.js +1 -1
- package/dist/cjs/src/encodeEntityElement.js +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/mjs/src/ParsedConfig.js +4 -4
- package/dist/mjs/src/decodeEntityElement.js +1 -1
- package/dist/mjs/src/encodeEntityElement.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- TYPEDOC_EXCLUDE -->
|
|
2
|
+
|
|
3
|
+
> [API Documentation](https://docs.karmanivero.us/entity-manager/) • [CHANGELOG](https://github.com/karmaniverous/entity-manager/tree/main/CHANGELOG.md)
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<!-- /TYPEDOC_EXCLUDE -->
|
|
6
|
+
|
|
7
|
+
# entity-manager
|
|
4
8
|
|
|
5
9
|
**EntityManager implements rational indexing & cross-shard querying at scale in your NoSQL database so you can focus on your application logic.**
|
|
6
10
|
|
|
7
|
-
I've just released a full Typescript refactor. Everything works beatuifully, but I'm still fleshing out the documentation.
|
|
11
|
+
I've just released a full Typescript refactor. Everything works beatuifully, but I'm still fleshing out [the documentation](https://karmanivero.us/projects/entity-manager/intro/).
|
|
8
12
|
|
|
9
13
|
If you have any questions, please [start a discussion](https://github.com/karmaniverous/entity-manager/discussions). Otherwise stay tuned!
|
|
10
14
|
|
|
@@ -29,4 +33,3 @@ With EntityManager, you can:
|
|
|
29
33
|
---
|
|
30
34
|
|
|
31
35
|
Built for you with ❤️ on Bali! Find more great tools & templates on [my GitHub Profile](https://github.com/karmaniverous).
|
|
32
|
-
|
|
@@ -55,7 +55,7 @@ const configSchema = index.default
|
|
|
55
55
|
.optional())
|
|
56
56
|
.optional()
|
|
57
57
|
.default({}),
|
|
58
|
-
|
|
58
|
+
elementTranscodes: index.default.record(index.default.string()).optional().default({}),
|
|
59
59
|
indexes: index.default
|
|
60
60
|
.record(index.default
|
|
61
61
|
.array(index.default.string().min(1))
|
|
@@ -184,16 +184,16 @@ const configSchema = index.default
|
|
|
184
184
|
const transcodes = Object.keys(data.transcodes);
|
|
185
185
|
for (const [entityToken, entity] of Object.entries(data.entities)) {
|
|
186
186
|
// validate all entity generated element type values are transcode keys.
|
|
187
|
-
for (const [element, generatedElementType] of Object.entries(entity.
|
|
187
|
+
for (const [element, generatedElementType] of Object.entries(entity.elementTranscodes))
|
|
188
188
|
if (!transcodes.includes(generatedElementType))
|
|
189
189
|
ctx.addIssue({
|
|
190
190
|
code: index.default.ZodIssueCode.invalid_enum_value,
|
|
191
191
|
options: transcodes,
|
|
192
|
-
path: ['entities', entityToken, '
|
|
192
|
+
path: ['entities', entityToken, 'elementTranscodes', element],
|
|
193
193
|
received: generatedElementType,
|
|
194
194
|
});
|
|
195
195
|
// validate all entity generated property elements have a corresponding entity element type.
|
|
196
|
-
const typedElements = Object.keys(entity.
|
|
196
|
+
const typedElements = Object.keys(entity.elementTranscodes);
|
|
197
197
|
for (const [generatedKey, generated] of Object.entries(entity.generated))
|
|
198
198
|
for (const element of generated?.elements ?? [])
|
|
199
199
|
if (!typedElements.includes(element))
|
|
@@ -26,7 +26,7 @@ function decodeEntityElement(entityManager, value, entityToken, element) {
|
|
|
26
26
|
return;
|
|
27
27
|
if ([hashKey, rangeKey].includes(element))
|
|
28
28
|
return value;
|
|
29
|
-
const decoded = transcodes[entities[entityToken].
|
|
29
|
+
const decoded = transcodes[entities[entityToken].elementTranscodes[element]].decode(value);
|
|
30
30
|
return decoded;
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
@@ -25,7 +25,7 @@ function encodeEntityElement(entityManager, item, entityToken, element) {
|
|
|
25
25
|
const value = item[element];
|
|
26
26
|
if (value === undefined || [hashKey, rangeKey].includes(element))
|
|
27
27
|
return value;
|
|
28
|
-
const encoded = transcodes[entities[entityToken].
|
|
28
|
+
const encoded = transcodes[entities[entityToken].elementTranscodes[element]].encode(item[element]) || undefined;
|
|
29
29
|
return encoded;
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
package/dist/index.d.cts
CHANGED
|
@@ -153,7 +153,7 @@ type ConfigEntity<EntityToken extends keyof Exactify<M>, M extends EntityMap, Ha
|
|
|
153
153
|
* };
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
elementTranscodes?: ([TranscodableProperties<M[EntityToken], T>] extends [never] ? never : {
|
|
157
157
|
[P in TranscodableProperties<M[EntityToken], T>]?: PropertiesOfType<T, M[EntityToken][P]>;
|
|
158
158
|
}) | ([TranscodableProperties<M[EntityToken], T>] extends [never] ? Record<string, never> : never);
|
|
159
159
|
/**
|
|
@@ -366,7 +366,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
366
366
|
atomic?: boolean | undefined;
|
|
367
367
|
sharded?: boolean | undefined;
|
|
368
368
|
}>>>>>;
|
|
369
|
-
|
|
369
|
+
elementTranscodes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
370
370
|
indexes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>>>>;
|
|
371
371
|
shardBumps: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
372
372
|
timestamp: z.ZodNumber;
|
|
@@ -410,7 +410,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
410
410
|
}, "strict", z.ZodTypeAny, {
|
|
411
411
|
defaultLimit: number;
|
|
412
412
|
defaultPageSize: number;
|
|
413
|
-
|
|
413
|
+
elementTranscodes: Record<string, string>;
|
|
414
414
|
indexes: Record<string, [string, ...string[]]>;
|
|
415
415
|
shardBumps: {
|
|
416
416
|
timestamp: number;
|
|
@@ -429,7 +429,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
429
429
|
uniqueProperty: string;
|
|
430
430
|
defaultLimit?: number | undefined;
|
|
431
431
|
defaultPageSize?: number | undefined;
|
|
432
|
-
|
|
432
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
433
433
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
434
434
|
shardBumps?: {
|
|
435
435
|
timestamp: number;
|
|
@@ -444,7 +444,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
444
444
|
}>, {
|
|
445
445
|
defaultLimit: number;
|
|
446
446
|
defaultPageSize: number;
|
|
447
|
-
|
|
447
|
+
elementTranscodes: Record<string, string>;
|
|
448
448
|
indexes: Record<string, [string, ...string[]]>;
|
|
449
449
|
shardBumps: {
|
|
450
450
|
timestamp: number;
|
|
@@ -463,7 +463,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
463
463
|
uniqueProperty: string;
|
|
464
464
|
defaultLimit?: number | undefined;
|
|
465
465
|
defaultPageSize?: number | undefined;
|
|
466
|
-
|
|
466
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
467
467
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
468
468
|
shardBumps?: {
|
|
469
469
|
timestamp: number;
|
|
@@ -498,7 +498,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
498
498
|
entities: Record<string, {
|
|
499
499
|
defaultLimit: number;
|
|
500
500
|
defaultPageSize: number;
|
|
501
|
-
|
|
501
|
+
elementTranscodes: Record<string, string>;
|
|
502
502
|
indexes: Record<string, [string, ...string[]]>;
|
|
503
503
|
shardBumps: {
|
|
504
504
|
timestamp: number;
|
|
@@ -529,7 +529,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
529
529
|
uniqueProperty: string;
|
|
530
530
|
defaultLimit?: number | undefined;
|
|
531
531
|
defaultPageSize?: number | undefined;
|
|
532
|
-
|
|
532
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
533
533
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
534
534
|
shardBumps?: {
|
|
535
535
|
timestamp: number;
|
|
@@ -556,7 +556,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
556
556
|
entities: Record<string, {
|
|
557
557
|
defaultLimit: number;
|
|
558
558
|
defaultPageSize: number;
|
|
559
|
-
|
|
559
|
+
elementTranscodes: Record<string, string>;
|
|
560
560
|
indexes: Record<string, [string, ...string[]]>;
|
|
561
561
|
shardBumps: {
|
|
562
562
|
timestamp: number;
|
|
@@ -587,7 +587,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
587
587
|
uniqueProperty: string;
|
|
588
588
|
defaultLimit?: number | undefined;
|
|
589
589
|
defaultPageSize?: number | undefined;
|
|
590
|
-
|
|
590
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
591
591
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
592
592
|
shardBumps?: {
|
|
593
593
|
timestamp: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -153,7 +153,7 @@ type ConfigEntity<EntityToken extends keyof Exactify<M>, M extends EntityMap, Ha
|
|
|
153
153
|
* };
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
elementTranscodes?: ([TranscodableProperties<M[EntityToken], T>] extends [never] ? never : {
|
|
157
157
|
[P in TranscodableProperties<M[EntityToken], T>]?: PropertiesOfType<T, M[EntityToken][P]>;
|
|
158
158
|
}) | ([TranscodableProperties<M[EntityToken], T>] extends [never] ? Record<string, never> : never);
|
|
159
159
|
/**
|
|
@@ -366,7 +366,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
366
366
|
atomic?: boolean | undefined;
|
|
367
367
|
sharded?: boolean | undefined;
|
|
368
368
|
}>>>>>;
|
|
369
|
-
|
|
369
|
+
elementTranscodes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
370
370
|
indexes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>>>>;
|
|
371
371
|
shardBumps: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
372
372
|
timestamp: z.ZodNumber;
|
|
@@ -410,7 +410,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
410
410
|
}, "strict", z.ZodTypeAny, {
|
|
411
411
|
defaultLimit: number;
|
|
412
412
|
defaultPageSize: number;
|
|
413
|
-
|
|
413
|
+
elementTranscodes: Record<string, string>;
|
|
414
414
|
indexes: Record<string, [string, ...string[]]>;
|
|
415
415
|
shardBumps: {
|
|
416
416
|
timestamp: number;
|
|
@@ -429,7 +429,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
429
429
|
uniqueProperty: string;
|
|
430
430
|
defaultLimit?: number | undefined;
|
|
431
431
|
defaultPageSize?: number | undefined;
|
|
432
|
-
|
|
432
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
433
433
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
434
434
|
shardBumps?: {
|
|
435
435
|
timestamp: number;
|
|
@@ -444,7 +444,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
444
444
|
}>, {
|
|
445
445
|
defaultLimit: number;
|
|
446
446
|
defaultPageSize: number;
|
|
447
|
-
|
|
447
|
+
elementTranscodes: Record<string, string>;
|
|
448
448
|
indexes: Record<string, [string, ...string[]]>;
|
|
449
449
|
shardBumps: {
|
|
450
450
|
timestamp: number;
|
|
@@ -463,7 +463,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
463
463
|
uniqueProperty: string;
|
|
464
464
|
defaultLimit?: number | undefined;
|
|
465
465
|
defaultPageSize?: number | undefined;
|
|
466
|
-
|
|
466
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
467
467
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
468
468
|
shardBumps?: {
|
|
469
469
|
timestamp: number;
|
|
@@ -498,7 +498,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
498
498
|
entities: Record<string, {
|
|
499
499
|
defaultLimit: number;
|
|
500
500
|
defaultPageSize: number;
|
|
501
|
-
|
|
501
|
+
elementTranscodes: Record<string, string>;
|
|
502
502
|
indexes: Record<string, [string, ...string[]]>;
|
|
503
503
|
shardBumps: {
|
|
504
504
|
timestamp: number;
|
|
@@ -529,7 +529,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
529
529
|
uniqueProperty: string;
|
|
530
530
|
defaultLimit?: number | undefined;
|
|
531
531
|
defaultPageSize?: number | undefined;
|
|
532
|
-
|
|
532
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
533
533
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
534
534
|
shardBumps?: {
|
|
535
535
|
timestamp: number;
|
|
@@ -556,7 +556,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
556
556
|
entities: Record<string, {
|
|
557
557
|
defaultLimit: number;
|
|
558
558
|
defaultPageSize: number;
|
|
559
|
-
|
|
559
|
+
elementTranscodes: Record<string, string>;
|
|
560
560
|
indexes: Record<string, [string, ...string[]]>;
|
|
561
561
|
shardBumps: {
|
|
562
562
|
timestamp: number;
|
|
@@ -587,7 +587,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
587
587
|
uniqueProperty: string;
|
|
588
588
|
defaultLimit?: number | undefined;
|
|
589
589
|
defaultPageSize?: number | undefined;
|
|
590
|
-
|
|
590
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
591
591
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
592
592
|
shardBumps?: {
|
|
593
593
|
timestamp: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ type ConfigEntity<EntityToken extends keyof Exactify<M>, M extends EntityMap, Ha
|
|
|
153
153
|
* };
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
elementTranscodes?: ([TranscodableProperties<M[EntityToken], T>] extends [never] ? never : {
|
|
157
157
|
[P in TranscodableProperties<M[EntityToken], T>]?: PropertiesOfType<T, M[EntityToken][P]>;
|
|
158
158
|
}) | ([TranscodableProperties<M[EntityToken], T>] extends [never] ? Record<string, never> : never);
|
|
159
159
|
/**
|
|
@@ -366,7 +366,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
366
366
|
atomic?: boolean | undefined;
|
|
367
367
|
sharded?: boolean | undefined;
|
|
368
368
|
}>>>>>;
|
|
369
|
-
|
|
369
|
+
elementTranscodes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
370
370
|
indexes: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>>>>;
|
|
371
371
|
shardBumps: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
372
372
|
timestamp: z.ZodNumber;
|
|
@@ -410,7 +410,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
410
410
|
}, "strict", z.ZodTypeAny, {
|
|
411
411
|
defaultLimit: number;
|
|
412
412
|
defaultPageSize: number;
|
|
413
|
-
|
|
413
|
+
elementTranscodes: Record<string, string>;
|
|
414
414
|
indexes: Record<string, [string, ...string[]]>;
|
|
415
415
|
shardBumps: {
|
|
416
416
|
timestamp: number;
|
|
@@ -429,7 +429,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
429
429
|
uniqueProperty: string;
|
|
430
430
|
defaultLimit?: number | undefined;
|
|
431
431
|
defaultPageSize?: number | undefined;
|
|
432
|
-
|
|
432
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
433
433
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
434
434
|
shardBumps?: {
|
|
435
435
|
timestamp: number;
|
|
@@ -444,7 +444,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
444
444
|
}>, {
|
|
445
445
|
defaultLimit: number;
|
|
446
446
|
defaultPageSize: number;
|
|
447
|
-
|
|
447
|
+
elementTranscodes: Record<string, string>;
|
|
448
448
|
indexes: Record<string, [string, ...string[]]>;
|
|
449
449
|
shardBumps: {
|
|
450
450
|
timestamp: number;
|
|
@@ -463,7 +463,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
463
463
|
uniqueProperty: string;
|
|
464
464
|
defaultLimit?: number | undefined;
|
|
465
465
|
defaultPageSize?: number | undefined;
|
|
466
|
-
|
|
466
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
467
467
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
468
468
|
shardBumps?: {
|
|
469
469
|
timestamp: number;
|
|
@@ -498,7 +498,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
498
498
|
entities: Record<string, {
|
|
499
499
|
defaultLimit: number;
|
|
500
500
|
defaultPageSize: number;
|
|
501
|
-
|
|
501
|
+
elementTranscodes: Record<string, string>;
|
|
502
502
|
indexes: Record<string, [string, ...string[]]>;
|
|
503
503
|
shardBumps: {
|
|
504
504
|
timestamp: number;
|
|
@@ -529,7 +529,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
529
529
|
uniqueProperty: string;
|
|
530
530
|
defaultLimit?: number | undefined;
|
|
531
531
|
defaultPageSize?: number | undefined;
|
|
532
|
-
|
|
532
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
533
533
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
534
534
|
shardBumps?: {
|
|
535
535
|
timestamp: number;
|
|
@@ -556,7 +556,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
556
556
|
entities: Record<string, {
|
|
557
557
|
defaultLimit: number;
|
|
558
558
|
defaultPageSize: number;
|
|
559
|
-
|
|
559
|
+
elementTranscodes: Record<string, string>;
|
|
560
560
|
indexes: Record<string, [string, ...string[]]>;
|
|
561
561
|
shardBumps: {
|
|
562
562
|
timestamp: number;
|
|
@@ -587,7 +587,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
587
587
|
uniqueProperty: string;
|
|
588
588
|
defaultLimit?: number | undefined;
|
|
589
589
|
defaultPageSize?: number | undefined;
|
|
590
|
-
|
|
590
|
+
elementTranscodes?: Record<string, string> | undefined;
|
|
591
591
|
indexes?: Record<string, [string, ...string[]]> | undefined;
|
|
592
592
|
shardBumps?: {
|
|
593
593
|
timestamp: number;
|
|
@@ -53,7 +53,7 @@ const configSchema = z
|
|
|
53
53
|
.optional())
|
|
54
54
|
.optional()
|
|
55
55
|
.default({}),
|
|
56
|
-
|
|
56
|
+
elementTranscodes: z.record(z.string()).optional().default({}),
|
|
57
57
|
indexes: z
|
|
58
58
|
.record(z
|
|
59
59
|
.array(z.string().min(1))
|
|
@@ -182,16 +182,16 @@ const configSchema = z
|
|
|
182
182
|
const transcodes = Object.keys(data.transcodes);
|
|
183
183
|
for (const [entityToken, entity] of Object.entries(data.entities)) {
|
|
184
184
|
// validate all entity generated element type values are transcode keys.
|
|
185
|
-
for (const [element, generatedElementType] of Object.entries(entity.
|
|
185
|
+
for (const [element, generatedElementType] of Object.entries(entity.elementTranscodes))
|
|
186
186
|
if (!transcodes.includes(generatedElementType))
|
|
187
187
|
ctx.addIssue({
|
|
188
188
|
code: z.ZodIssueCode.invalid_enum_value,
|
|
189
189
|
options: transcodes,
|
|
190
|
-
path: ['entities', entityToken, '
|
|
190
|
+
path: ['entities', entityToken, 'elementTranscodes', element],
|
|
191
191
|
received: generatedElementType,
|
|
192
192
|
});
|
|
193
193
|
// validate all entity generated property elements have a corresponding entity element type.
|
|
194
|
-
const typedElements = Object.keys(entity.
|
|
194
|
+
const typedElements = Object.keys(entity.elementTranscodes);
|
|
195
195
|
for (const [generatedKey, generated] of Object.entries(entity.generated))
|
|
196
196
|
for (const element of generated?.elements ?? [])
|
|
197
197
|
if (!typedElements.includes(element))
|
|
@@ -24,7 +24,7 @@ function decodeEntityElement(entityManager, value, entityToken, element) {
|
|
|
24
24
|
return;
|
|
25
25
|
if ([hashKey, rangeKey].includes(element))
|
|
26
26
|
return value;
|
|
27
|
-
const decoded = transcodes[entities[entityToken].
|
|
27
|
+
const decoded = transcodes[entities[entityToken].elementTranscodes[element]].decode(value);
|
|
28
28
|
return decoded;
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
@@ -23,7 +23,7 @@ function encodeEntityElement(entityManager, item, entityToken, element) {
|
|
|
23
23
|
const value = item[element];
|
|
24
24
|
if (value === undefined || [hashKey, rangeKey].includes(element))
|
|
25
25
|
return value;
|
|
26
|
-
const encoded = transcodes[entities[entityToken].
|
|
26
|
+
const encoded = transcodes[entities[entityToken].elementTranscodes[element]].encode(item[element]) || undefined;
|
|
27
27
|
return encoded;
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"string-hash": "^1.1.3",
|
|
13
13
|
"zod": "^3.23.8"
|
|
14
14
|
},
|
|
15
|
-
"description": "
|
|
15
|
+
"description": "Rational indexing & cross-shard querying at scale in your NoSQL database so you can focus on your application logic.",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@dotenvx/dotenvx": "^1.14.1",
|
|
18
18
|
"@eslint/js": "^9.10.0",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
},
|
|
133
133
|
"type": "module",
|
|
134
134
|
"types": "dist/index.d.ts",
|
|
135
|
-
"version": "6.0.
|
|
135
|
+
"version": "6.0.1"
|
|
136
136
|
}
|