dyna-record 0.5.1 → 0.5.2
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/dist/src/metadata/EntityMetadata.d.ts +5 -0
- package/dist/src/metadata/EntityMetadata.d.ts.map +1 -1
- package/dist/src/metadata/EntityMetadata.js +17 -2
- package/dist/src/metadata/schemas.d.ts +40 -262
- package/dist/src/metadata/schemas.d.ts.map +1 -1
- package/dist/src/metadata/schemas.js +6 -6
- package/package.json +2 -2
|
@@ -58,6 +58,11 @@ declare class EntityMetadata {
|
|
|
58
58
|
* @param attributes
|
|
59
59
|
*/
|
|
60
60
|
parseRawEntityDefinedAttributesPartial(attributes: Partial<EntityDefinedAttributes<DynaRecord>>): Partial<EntityDefinedAttributes<DynaRecord>>;
|
|
61
|
+
/**
|
|
62
|
+
* Filters reserved keys to only include keys present in the given attributes.
|
|
63
|
+
* Zod v4 throws on .omit() with keys not in the schema.
|
|
64
|
+
*/
|
|
65
|
+
private filterReservedKeys;
|
|
61
66
|
/**
|
|
62
67
|
* Build validation errors with the cause
|
|
63
68
|
* @param error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityMetadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/EntityMetadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,GAAG,CAAC;AACX,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAY7D,KAAK,WAAW,GAAG,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,cAAM,cAAc;;IAClB;;OAEG;IACH,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC;;OAEG;IACH,SAAgB,UAAU,EAAE,wBAAwB,CAAC;IACrD;;OAEG;IACH,SAAgB,eAAe,EAAE,wBAAwB,CAAC;IAE1D;;OAEG;IACH,SAAgB,aAAa,EAAE,2BAA2B,CAAC;IAE3D,SAAgB,WAAW,EAAE,WAAW,CAAC;IAEzC;;OAEG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;gBAuBZ,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM;IAS5D;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAStD;;;;;OAKG;IACI,+BAA+B,CACpC,UAAU,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAC9C,uBAAuB,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityMetadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/EntityMetadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,GAAG,CAAC;AACX,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAY7D,KAAK,WAAW,GAAG,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,cAAM,cAAc;;IAClB;;OAEG;IACH,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC;;OAEG;IACH,SAAgB,UAAU,EAAE,wBAAwB,CAAC;IACrD;;OAEG;IACH,SAAgB,eAAe,EAAE,wBAAwB,CAAC;IAE1D;;OAEG;IACH,SAAgB,aAAa,EAAE,2BAA2B,CAAC;IAE3D,SAAgB,WAAW,EAAE,WAAW,CAAC;IAEzC;;OAEG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;gBAuBZ,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM;IAS5D;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAStD;;;;;OAKG;IACI,+BAA+B,CACpC,UAAU,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAC9C,uBAAuB,CAAC,UAAU,CAAC;IAmBtC;;;;;;OAMG;IACI,sCAAsC,CAC3C,UAAU,EAAE,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC,GACvD,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAgC/C;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACH,IAAW,gBAAgB,IAAI,oBAAoB,EAAE,CAEpD;IAED;;OAEG;IACH,IAAW,sBAAsB,IAAI,qBAAqB,EAAE,CAI3D;IAED;;OAEG;IACH,IAAW,oBAAoB,IAAI,mBAAmB,EAAE,CAIvD;IAED;;OAEG;IACH,IAAW,+BAA+B,IAAI,8BAA8B,EAAE,CAE7E;IAED;;OAEG;IACH,IAAW,gBAAgB,IAAI,gBAAgB,CAO9C;IAED;;;OAGG;IACH,IAAW,oBAAoB,IAAI,2BAA2B,EAAE,CAE/D;IAED;;;OAGG;IACH,IAAW,8BAA8B,IAAI,2BAA2B,EAAE,CAUzE;CACF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -85,7 +85,8 @@ class EntityMetadata {
|
|
|
85
85
|
parseRawEntityDefinedAttributes(attributes) {
|
|
86
86
|
if (this.#schema === undefined) {
|
|
87
87
|
const tableMeta = _1.default.getTable(this.tableClassName);
|
|
88
|
-
|
|
88
|
+
const omitKeys = this.filterReservedKeys(tableMeta.reservedKeys, this.#zodAttributes);
|
|
89
|
+
this.#schema = zod_1.z.object(this.#zodAttributes).omit(omitKeys);
|
|
89
90
|
}
|
|
90
91
|
try {
|
|
91
92
|
return this.#schema.parse(attributes);
|
|
@@ -104,9 +105,10 @@ class EntityMetadata {
|
|
|
104
105
|
parseRawEntityDefinedAttributesPartial(attributes) {
|
|
105
106
|
if (this.#schemaPartial === undefined) {
|
|
106
107
|
const tableMeta = _1.default.getTable(this.tableClassName);
|
|
108
|
+
const omitKeys = this.filterReservedKeys(tableMeta.reservedKeys, this.#zodPartialAttributes);
|
|
107
109
|
this.#schemaPartial = zod_1.z
|
|
108
110
|
.object(this.#zodPartialAttributes)
|
|
109
|
-
.omit(
|
|
111
|
+
.omit(omitKeys)
|
|
110
112
|
.partial()
|
|
111
113
|
.transform((data) => {
|
|
112
114
|
// Remove undefined values but keep null values
|
|
@@ -126,6 +128,19 @@ class EntityMetadata {
|
|
|
126
128
|
throw this.buildValidationError(error);
|
|
127
129
|
}
|
|
128
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Filters reserved keys to only include keys present in the given attributes.
|
|
133
|
+
* Zod v4 throws on .omit() with keys not in the schema.
|
|
134
|
+
*/
|
|
135
|
+
filterReservedKeys(reservedKeys, attributes) {
|
|
136
|
+
const filtered = {};
|
|
137
|
+
for (const key of Object.keys(reservedKeys)) {
|
|
138
|
+
if (key in attributes) {
|
|
139
|
+
filtered[key] = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return filtered;
|
|
143
|
+
}
|
|
129
144
|
/**
|
|
130
145
|
* Build validation errors with the cause
|
|
131
146
|
* @param error
|
|
@@ -25,186 +25,112 @@ import type DynaRecord from "../DynaRecord";
|
|
|
25
25
|
export declare const TableMetadataTransform: z.ZodObject<{
|
|
26
26
|
name: z.ZodString;
|
|
27
27
|
delimiter: z.ZodString;
|
|
28
|
-
defaultAttributes: z.ZodRecord<z.ZodString, z.
|
|
28
|
+
defaultAttributes: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodObject<{
|
|
29
29
|
name: z.ZodString;
|
|
30
30
|
alias: z.ZodString;
|
|
31
31
|
nullable: z.ZodBoolean;
|
|
32
|
-
foreignKeyTarget: z.ZodOptional<z.
|
|
33
|
-
},
|
|
34
|
-
name: string;
|
|
35
|
-
nullable: boolean;
|
|
36
|
-
alias: string;
|
|
37
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
name: string;
|
|
40
|
-
nullable: boolean;
|
|
41
|
-
alias: string;
|
|
42
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
43
|
-
}>, {
|
|
32
|
+
foreignKeyTarget: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
33
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
44
34
|
foreignKeyTarget?: string | undefined;
|
|
45
35
|
name: string;
|
|
46
36
|
alias: string;
|
|
47
37
|
nullable: boolean;
|
|
48
38
|
}, {
|
|
49
39
|
name: string;
|
|
50
|
-
nullable: boolean;
|
|
51
40
|
alias: string;
|
|
41
|
+
nullable: boolean;
|
|
52
42
|
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
53
|
-
}
|
|
54
|
-
defaultTableAttributes: z.ZodRecord<z.ZodString, z.
|
|
43
|
+
}>>>;
|
|
44
|
+
defaultTableAttributes: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodObject<{
|
|
55
45
|
name: z.ZodString;
|
|
56
46
|
alias: z.ZodString;
|
|
57
47
|
nullable: z.ZodBoolean;
|
|
58
|
-
foreignKeyTarget: z.ZodOptional<z.
|
|
59
|
-
},
|
|
60
|
-
name: string;
|
|
61
|
-
nullable: boolean;
|
|
62
|
-
alias: string;
|
|
63
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
64
|
-
}, {
|
|
65
|
-
name: string;
|
|
66
|
-
nullable: boolean;
|
|
67
|
-
alias: string;
|
|
68
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
69
|
-
}>, {
|
|
48
|
+
foreignKeyTarget: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
49
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
70
50
|
foreignKeyTarget?: string | undefined;
|
|
71
51
|
name: string;
|
|
72
52
|
alias: string;
|
|
73
53
|
nullable: boolean;
|
|
74
54
|
}, {
|
|
75
55
|
name: string;
|
|
76
|
-
nullable: boolean;
|
|
77
56
|
alias: string;
|
|
57
|
+
nullable: boolean;
|
|
78
58
|
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
79
|
-
}
|
|
80
|
-
partitionKeyAttribute: z.
|
|
59
|
+
}>>>;
|
|
60
|
+
partitionKeyAttribute: z.ZodPipe<z.ZodObject<{
|
|
81
61
|
name: z.ZodString;
|
|
82
62
|
alias: z.ZodString;
|
|
83
63
|
nullable: z.ZodBoolean;
|
|
84
|
-
foreignKeyTarget: z.ZodOptional<z.
|
|
85
|
-
},
|
|
86
|
-
name: string;
|
|
87
|
-
nullable: boolean;
|
|
88
|
-
alias: string;
|
|
89
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
90
|
-
}, {
|
|
91
|
-
name: string;
|
|
92
|
-
nullable: boolean;
|
|
93
|
-
alias: string;
|
|
94
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
95
|
-
}>, {
|
|
64
|
+
foreignKeyTarget: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
65
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
96
66
|
foreignKeyTarget?: string | undefined;
|
|
97
67
|
name: string;
|
|
98
68
|
alias: string;
|
|
99
69
|
nullable: boolean;
|
|
100
70
|
}, {
|
|
101
71
|
name: string;
|
|
102
|
-
nullable: boolean;
|
|
103
72
|
alias: string;
|
|
73
|
+
nullable: boolean;
|
|
104
74
|
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
105
|
-
}
|
|
106
|
-
sortKeyAttribute: z.
|
|
75
|
+
}>>;
|
|
76
|
+
sortKeyAttribute: z.ZodPipe<z.ZodObject<{
|
|
107
77
|
name: z.ZodString;
|
|
108
78
|
alias: z.ZodString;
|
|
109
79
|
nullable: z.ZodBoolean;
|
|
110
|
-
foreignKeyTarget: z.ZodOptional<z.
|
|
111
|
-
},
|
|
112
|
-
name: string;
|
|
113
|
-
nullable: boolean;
|
|
114
|
-
alias: string;
|
|
115
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
116
|
-
}, {
|
|
117
|
-
name: string;
|
|
118
|
-
nullable: boolean;
|
|
119
|
-
alias: string;
|
|
120
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
121
|
-
}>, {
|
|
80
|
+
foreignKeyTarget: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
81
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
122
82
|
foreignKeyTarget?: string | undefined;
|
|
123
83
|
name: string;
|
|
124
84
|
alias: string;
|
|
125
85
|
nullable: boolean;
|
|
126
86
|
}, {
|
|
127
87
|
name: string;
|
|
128
|
-
nullable: boolean;
|
|
129
88
|
alias: string;
|
|
89
|
+
nullable: boolean;
|
|
130
90
|
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
131
|
-
}
|
|
132
|
-
entities: z.ZodRecord<z.ZodString, z.
|
|
91
|
+
}>>;
|
|
92
|
+
entities: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodObject<{
|
|
133
93
|
tableClassName: z.ZodString;
|
|
134
|
-
attributes: z.ZodRecord<z.ZodString, z.
|
|
94
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodObject<{
|
|
135
95
|
name: z.ZodString;
|
|
136
96
|
alias: z.ZodString;
|
|
137
97
|
nullable: z.ZodBoolean;
|
|
138
|
-
foreignKeyTarget: z.ZodOptional<z.
|
|
139
|
-
},
|
|
140
|
-
name: string;
|
|
141
|
-
nullable: boolean;
|
|
142
|
-
alias: string;
|
|
143
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
144
|
-
}, {
|
|
145
|
-
name: string;
|
|
146
|
-
nullable: boolean;
|
|
147
|
-
alias: string;
|
|
148
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
149
|
-
}>, {
|
|
98
|
+
foreignKeyTarget: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
99
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
150
100
|
foreignKeyTarget?: string | undefined;
|
|
151
101
|
name: string;
|
|
152
102
|
alias: string;
|
|
153
103
|
nullable: boolean;
|
|
154
104
|
}, {
|
|
155
105
|
name: string;
|
|
156
|
-
nullable: boolean;
|
|
157
106
|
alias: string;
|
|
107
|
+
nullable: boolean;
|
|
158
108
|
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
159
|
-
}
|
|
160
|
-
tableAttributes: z.ZodRecord<z.ZodString, z.
|
|
109
|
+
}>>>;
|
|
110
|
+
tableAttributes: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodObject<{
|
|
161
111
|
name: z.ZodString;
|
|
162
112
|
alias: z.ZodString;
|
|
163
113
|
nullable: z.ZodBoolean;
|
|
164
|
-
foreignKeyTarget: z.ZodOptional<z.
|
|
165
|
-
},
|
|
166
|
-
name: string;
|
|
167
|
-
nullable: boolean;
|
|
168
|
-
alias: string;
|
|
169
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
170
|
-
}, {
|
|
171
|
-
name: string;
|
|
172
|
-
nullable: boolean;
|
|
173
|
-
alias: string;
|
|
174
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
175
|
-
}>, {
|
|
114
|
+
foreignKeyTarget: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
115
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
176
116
|
foreignKeyTarget?: string | undefined;
|
|
177
117
|
name: string;
|
|
178
118
|
alias: string;
|
|
179
119
|
nullable: boolean;
|
|
180
120
|
}, {
|
|
181
121
|
name: string;
|
|
182
|
-
nullable: boolean;
|
|
183
122
|
alias: string;
|
|
123
|
+
nullable: boolean;
|
|
184
124
|
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
185
|
-
}
|
|
186
|
-
relationships: z.ZodRecord<z.ZodString, z.
|
|
125
|
+
}>>>;
|
|
126
|
+
relationships: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodObject<{
|
|
187
127
|
type: z.ZodString;
|
|
188
128
|
propertyName: z.ZodString;
|
|
189
|
-
target: z.ZodOptional<z.
|
|
129
|
+
target: z.ZodOptional<z.ZodCustom<EntityClass<DynaRecord>, EntityClass<DynaRecord>>>;
|
|
190
130
|
foreignKey: z.ZodOptional<z.ZodString>;
|
|
191
131
|
joinTableName: z.ZodOptional<z.ZodString>;
|
|
192
132
|
uniDirectional: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
-
},
|
|
194
|
-
type: string;
|
|
195
|
-
propertyName: string;
|
|
196
|
-
foreignKey?: string | undefined;
|
|
197
|
-
uniDirectional?: boolean | undefined;
|
|
198
|
-
joinTableName?: string | undefined;
|
|
199
|
-
target?: EntityClass<DynaRecord> | undefined;
|
|
200
|
-
}, {
|
|
201
|
-
type: string;
|
|
202
|
-
propertyName: string;
|
|
203
|
-
foreignKey?: string | undefined;
|
|
204
|
-
uniDirectional?: boolean | undefined;
|
|
205
|
-
joinTableName?: string | undefined;
|
|
206
|
-
target?: EntityClass<DynaRecord> | undefined;
|
|
207
|
-
}>, {
|
|
133
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
208
134
|
uniDirectional?: boolean | undefined;
|
|
209
135
|
joinTableName?: string | undefined;
|
|
210
136
|
foreignKey?: string | undefined;
|
|
@@ -214,59 +140,13 @@ export declare const TableMetadataTransform: z.ZodObject<{
|
|
|
214
140
|
}, {
|
|
215
141
|
type: string;
|
|
216
142
|
propertyName: string;
|
|
217
|
-
foreignKey?: string | undefined;
|
|
218
|
-
uniDirectional?: boolean | undefined;
|
|
219
|
-
joinTableName?: string | undefined;
|
|
220
143
|
target?: EntityClass<DynaRecord> | undefined;
|
|
221
|
-
}>>;
|
|
222
|
-
idField: z.ZodOptional<z.ZodString>;
|
|
223
|
-
}, "strip", z.ZodTypeAny, {
|
|
224
|
-
tableClassName: string;
|
|
225
|
-
attributes: Record<string, {
|
|
226
|
-
foreignKeyTarget?: string | undefined;
|
|
227
|
-
name: string;
|
|
228
|
-
alias: string;
|
|
229
|
-
nullable: boolean;
|
|
230
|
-
}>;
|
|
231
|
-
tableAttributes: Record<string, {
|
|
232
|
-
foreignKeyTarget?: string | undefined;
|
|
233
|
-
name: string;
|
|
234
|
-
alias: string;
|
|
235
|
-
nullable: boolean;
|
|
236
|
-
}>;
|
|
237
|
-
relationships: Record<string, {
|
|
238
|
-
uniDirectional?: boolean | undefined;
|
|
239
|
-
joinTableName?: string | undefined;
|
|
240
144
|
foreignKey?: string | undefined;
|
|
241
|
-
target?: string | undefined;
|
|
242
|
-
type: string;
|
|
243
|
-
propertyName: string;
|
|
244
|
-
}>;
|
|
245
|
-
idField?: string | undefined;
|
|
246
|
-
}, {
|
|
247
|
-
tableClassName: string;
|
|
248
|
-
attributes: Record<string, {
|
|
249
|
-
name: string;
|
|
250
|
-
nullable: boolean;
|
|
251
|
-
alias: string;
|
|
252
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
253
|
-
}>;
|
|
254
|
-
tableAttributes: Record<string, {
|
|
255
|
-
name: string;
|
|
256
|
-
nullable: boolean;
|
|
257
|
-
alias: string;
|
|
258
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
259
|
-
}>;
|
|
260
|
-
relationships: Record<string, {
|
|
261
|
-
type: string;
|
|
262
|
-
propertyName: string;
|
|
263
|
-
foreignKey?: string | undefined;
|
|
264
|
-
uniDirectional?: boolean | undefined;
|
|
265
145
|
joinTableName?: string | undefined;
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
idField
|
|
269
|
-
}>, {
|
|
146
|
+
uniDirectional?: boolean | undefined;
|
|
147
|
+
}>>>;
|
|
148
|
+
idField: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
270
150
|
idField?: string | undefined;
|
|
271
151
|
tableClassName: string;
|
|
272
152
|
attributes: Record<string, {
|
|
@@ -290,58 +170,6 @@ export declare const TableMetadataTransform: z.ZodObject<{
|
|
|
290
170
|
propertyName: string;
|
|
291
171
|
}>;
|
|
292
172
|
}, {
|
|
293
|
-
tableClassName: string;
|
|
294
|
-
attributes: Record<string, {
|
|
295
|
-
name: string;
|
|
296
|
-
nullable: boolean;
|
|
297
|
-
alias: string;
|
|
298
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
299
|
-
}>;
|
|
300
|
-
tableAttributes: Record<string, {
|
|
301
|
-
name: string;
|
|
302
|
-
nullable: boolean;
|
|
303
|
-
alias: string;
|
|
304
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
305
|
-
}>;
|
|
306
|
-
relationships: Record<string, {
|
|
307
|
-
type: string;
|
|
308
|
-
propertyName: string;
|
|
309
|
-
foreignKey?: string | undefined;
|
|
310
|
-
uniDirectional?: boolean | undefined;
|
|
311
|
-
joinTableName?: string | undefined;
|
|
312
|
-
target?: EntityClass<DynaRecord> | undefined;
|
|
313
|
-
}>;
|
|
314
|
-
idField?: string | undefined;
|
|
315
|
-
}>>;
|
|
316
|
-
}, "strip", z.ZodTypeAny, {
|
|
317
|
-
name: string;
|
|
318
|
-
delimiter: string;
|
|
319
|
-
defaultAttributes: Record<string, {
|
|
320
|
-
foreignKeyTarget?: string | undefined;
|
|
321
|
-
name: string;
|
|
322
|
-
alias: string;
|
|
323
|
-
nullable: boolean;
|
|
324
|
-
}>;
|
|
325
|
-
defaultTableAttributes: Record<string, {
|
|
326
|
-
foreignKeyTarget?: string | undefined;
|
|
327
|
-
name: string;
|
|
328
|
-
alias: string;
|
|
329
|
-
nullable: boolean;
|
|
330
|
-
}>;
|
|
331
|
-
partitionKeyAttribute: {
|
|
332
|
-
foreignKeyTarget?: string | undefined;
|
|
333
|
-
name: string;
|
|
334
|
-
alias: string;
|
|
335
|
-
nullable: boolean;
|
|
336
|
-
};
|
|
337
|
-
sortKeyAttribute: {
|
|
338
|
-
foreignKeyTarget?: string | undefined;
|
|
339
|
-
name: string;
|
|
340
|
-
alias: string;
|
|
341
|
-
nullable: boolean;
|
|
342
|
-
};
|
|
343
|
-
entities: Record<string, {
|
|
344
|
-
idField?: string | undefined;
|
|
345
173
|
tableClassName: string;
|
|
346
174
|
attributes: Record<string, {
|
|
347
175
|
foreignKeyTarget?: string | undefined;
|
|
@@ -363,59 +191,9 @@ export declare const TableMetadataTransform: z.ZodObject<{
|
|
|
363
191
|
type: string;
|
|
364
192
|
propertyName: string;
|
|
365
193
|
}>;
|
|
366
|
-
}>;
|
|
367
|
-
}, {
|
|
368
|
-
name: string;
|
|
369
|
-
delimiter: string;
|
|
370
|
-
defaultAttributes: Record<string, {
|
|
371
|
-
name: string;
|
|
372
|
-
nullable: boolean;
|
|
373
|
-
alias: string;
|
|
374
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
375
|
-
}>;
|
|
376
|
-
defaultTableAttributes: Record<string, {
|
|
377
|
-
name: string;
|
|
378
|
-
nullable: boolean;
|
|
379
|
-
alias: string;
|
|
380
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
381
|
-
}>;
|
|
382
|
-
partitionKeyAttribute: {
|
|
383
|
-
name: string;
|
|
384
|
-
nullable: boolean;
|
|
385
|
-
alias: string;
|
|
386
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
387
|
-
};
|
|
388
|
-
sortKeyAttribute: {
|
|
389
|
-
name: string;
|
|
390
|
-
nullable: boolean;
|
|
391
|
-
alias: string;
|
|
392
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
393
|
-
};
|
|
394
|
-
entities: Record<string, {
|
|
395
|
-
tableClassName: string;
|
|
396
|
-
attributes: Record<string, {
|
|
397
|
-
name: string;
|
|
398
|
-
nullable: boolean;
|
|
399
|
-
alias: string;
|
|
400
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
401
|
-
}>;
|
|
402
|
-
tableAttributes: Record<string, {
|
|
403
|
-
name: string;
|
|
404
|
-
nullable: boolean;
|
|
405
|
-
alias: string;
|
|
406
|
-
foreignKeyTarget?: EntityClass<DynaRecord> | undefined;
|
|
407
|
-
}>;
|
|
408
|
-
relationships: Record<string, {
|
|
409
|
-
type: string;
|
|
410
|
-
propertyName: string;
|
|
411
|
-
foreignKey?: string | undefined;
|
|
412
|
-
uniDirectional?: boolean | undefined;
|
|
413
|
-
joinTableName?: string | undefined;
|
|
414
|
-
target?: EntityClass<DynaRecord> | undefined;
|
|
415
|
-
}>;
|
|
416
194
|
idField?: string | undefined;
|
|
417
|
-
}
|
|
418
|
-
}>;
|
|
195
|
+
}>>>;
|
|
196
|
+
}, z.core.$strip>;
|
|
419
197
|
/**
|
|
420
198
|
* Type representing the serialized output of table metadata.
|
|
421
199
|
* This type is inferred from the {@link TableMetadataTransform} schema and represents
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/metadata/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AA4F5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/metadata/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AA4F5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQjC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -76,9 +76,9 @@ const RelationshipMetadataTransform = zod_1.z
|
|
|
76
76
|
const EntityMetadataTransform = zod_1.z
|
|
77
77
|
.object({
|
|
78
78
|
tableClassName: zod_1.z.string(),
|
|
79
|
-
attributes: zod_1.z.record(AttributeMetadataTransform),
|
|
80
|
-
tableAttributes: zod_1.z.record(AttributeMetadataTransform),
|
|
81
|
-
relationships: zod_1.z.record(RelationshipMetadataTransform),
|
|
79
|
+
attributes: zod_1.z.record(zod_1.z.string(), AttributeMetadataTransform),
|
|
80
|
+
tableAttributes: zod_1.z.record(zod_1.z.string(), AttributeMetadataTransform),
|
|
81
|
+
relationships: zod_1.z.record(zod_1.z.string(), RelationshipMetadataTransform),
|
|
82
82
|
idField: zod_1.z.string().optional()
|
|
83
83
|
})
|
|
84
84
|
.transform(entity => ({
|
|
@@ -113,9 +113,9 @@ const EntityMetadataTransform = zod_1.z
|
|
|
113
113
|
exports.TableMetadataTransform = zod_1.z.object({
|
|
114
114
|
name: zod_1.z.string(),
|
|
115
115
|
delimiter: zod_1.z.string(),
|
|
116
|
-
defaultAttributes: zod_1.z.record(AttributeMetadataTransform),
|
|
117
|
-
defaultTableAttributes: zod_1.z.record(AttributeMetadataTransform),
|
|
116
|
+
defaultAttributes: zod_1.z.record(zod_1.z.string(), AttributeMetadataTransform),
|
|
117
|
+
defaultTableAttributes: zod_1.z.record(zod_1.z.string(), AttributeMetadataTransform),
|
|
118
118
|
partitionKeyAttribute: AttributeMetadataTransform,
|
|
119
119
|
sortKeyAttribute: AttributeMetadataTransform,
|
|
120
|
-
entities: zod_1.z.record(EntityMetadataTransform)
|
|
120
|
+
entities: zod_1.z.record(zod_1.z.string(), EntityMetadataTransform)
|
|
121
121
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dyna-record",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Typescript Data Modeler and ORM for Dynamo",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@aws-sdk/lib-dynamodb": "^3.502.0",
|
|
32
32
|
"@aws-sdk/util-dynamodb": "^3.509.0",
|
|
33
33
|
"uuid": "^9.0.1",
|
|
34
|
-
"zod": "^3.
|
|
34
|
+
"zod": "^4.3.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@aws-sdk/types": "^3.502.0",
|