@rocicorp/zero 0.7.2024120108 → 0.7.2024120400

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 (96) hide show
  1. package/out/advanced.js +1 -1
  2. package/out/{chunk-C7M3BJ3Z.js → chunk-6HXO6VMP.js} +13 -12
  3. package/out/chunk-6HXO6VMP.js.map +7 -0
  4. package/out/{chunk-YQFIGL5R.js → chunk-WJCWI5I4.js} +76 -43
  5. package/out/{chunk-YQFIGL5R.js.map → chunk-WJCWI5I4.js.map} +3 -3
  6. package/out/shared/src/asserts.d.ts +1 -1
  7. package/out/shared/src/asserts.d.ts.map +1 -1
  8. package/out/shared/src/asserts.js +2 -1
  9. package/out/shared/src/asserts.js.map +1 -1
  10. package/out/solid.js +2 -2
  11. package/out/zero-cache/src/auth/load-schema.d.ts.map +1 -1
  12. package/out/zero-cache/src/auth/load-schema.js +4 -20
  13. package/out/zero-cache/src/auth/load-schema.js.map +1 -1
  14. package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
  15. package/out/zero-cache/src/auth/write-authorizer.js +7 -2
  16. package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
  17. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +1 -1
  18. package/out/zero-cache/src/services/change-streamer/storer.js +11 -6
  19. package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
  20. package/out/zero-cache/src/services/mutagen/mutagen.d.ts +2 -2
  21. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
  22. package/out/zero-cache/src/services/mutagen/mutagen.js +4 -3
  23. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  24. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
  25. package/out/zero-cache/src/services/view-syncer/cvr-store.js +5 -3
  26. package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
  27. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
  28. package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +5 -2
  29. package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
  30. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +5 -195
  31. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +1 -1
  32. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  33. package/out/zero-cache/src/services/view-syncer/view-syncer.js +2 -2
  34. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  35. package/out/zero-client/src/client/context.d.ts +1 -1
  36. package/out/zero-client/src/client/context.d.ts.map +1 -1
  37. package/out/zero-client/src/client/options.d.ts +9 -14
  38. package/out/zero-client/src/client/options.d.ts.map +1 -1
  39. package/out/zero-client/src/client/zero.d.ts.map +1 -1
  40. package/out/zero-protocol/src/ast.d.ts +5 -95
  41. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  42. package/out/zero-protocol/src/ast.js +7 -9
  43. package/out/zero-protocol/src/ast.js.map +1 -1
  44. package/out/zero-protocol/src/change-desired-queries.d.ts +2 -78
  45. package/out/zero-protocol/src/change-desired-queries.d.ts.map +1 -1
  46. package/out/zero-protocol/src/connect.d.ts +2 -78
  47. package/out/zero-protocol/src/connect.d.ts.map +1 -1
  48. package/out/zero-protocol/src/down.d.ts +2 -78
  49. package/out/zero-protocol/src/down.d.ts.map +1 -1
  50. package/out/zero-protocol/src/poke.d.ts +4 -156
  51. package/out/zero-protocol/src/poke.d.ts.map +1 -1
  52. package/out/zero-protocol/src/queries-patch.d.ts +3 -117
  53. package/out/zero-protocol/src/queries-patch.d.ts.map +1 -1
  54. package/out/zero-protocol/src/up.d.ts +2 -78
  55. package/out/zero-protocol/src/up.d.ts.map +1 -1
  56. package/out/zero-schema/src/build-schema.d.ts.map +1 -1
  57. package/out/zero-schema/src/build-schema.js +2 -14
  58. package/out/zero-schema/src/build-schema.js.map +1 -1
  59. package/out/zero-schema/src/compiled-permissions.d.ts +17 -459
  60. package/out/zero-schema/src/compiled-permissions.d.ts.map +1 -1
  61. package/out/zero-schema/src/normalize-table-schema.d.ts +3 -2
  62. package/out/zero-schema/src/normalize-table-schema.d.ts.map +1 -1
  63. package/out/zero-schema/src/normalize-table-schema.js +39 -13
  64. package/out/zero-schema/src/normalize-table-schema.js.map +1 -1
  65. package/out/zero-schema/src/permissions.d.ts +1 -1
  66. package/out/zero-schema/src/permissions.d.ts.map +1 -1
  67. package/out/zero-schema/src/schema-config.d.ts +15 -29
  68. package/out/zero-schema/src/schema-config.d.ts.map +1 -1
  69. package/out/zero-schema/src/schema-config.js +39 -13
  70. package/out/zero-schema/src/schema-config.js.map +1 -1
  71. package/out/zero-schema/src/table-schema.d.ts +25 -36
  72. package/out/zero-schema/src/table-schema.d.ts.map +1 -1
  73. package/out/zero-schema/src/table-schema.js.map +1 -1
  74. package/out/zero.js +2 -2
  75. package/out/zql/src/ivm/memory-source.d.ts +1 -0
  76. package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
  77. package/out/zql/src/ivm/memory-source.js +9 -9
  78. package/out/zql/src/ivm/memory-source.js.map +1 -1
  79. package/out/zql/src/ivm/schema.d.ts +6 -2
  80. package/out/zql/src/ivm/schema.d.ts.map +1 -1
  81. package/out/zql/src/ivm/source.d.ts +10 -0
  82. package/out/zql/src/ivm/source.d.ts.map +1 -1
  83. package/out/zql/src/ivm/view-apply-change.js +4 -2
  84. package/out/zql/src/ivm/view-apply-change.js.map +1 -1
  85. package/out/zql/src/query/expression.d.ts +3 -2
  86. package/out/zql/src/query/expression.d.ts.map +1 -1
  87. package/out/zql/src/query/expression.js.map +1 -1
  88. package/out/zql/src/query/query-impl.d.ts +2 -2
  89. package/out/zql/src/query/query-impl.d.ts.map +1 -1
  90. package/out/zql/src/query/query-impl.js.map +1 -1
  91. package/out/zqlite/src/table-source.d.ts +1 -0
  92. package/out/zqlite/src/table-source.d.ts.map +1 -1
  93. package/out/zqlite/src/table-source.js +9 -3
  94. package/out/zqlite/src/table-source.js.map +1 -1
  95. package/package.json +2 -2
  96. package/out/chunk-C7M3BJ3Z.js.map +0 -7
@@ -1,478 +1,36 @@
1
1
  import * as v from '../../shared/src/valita.js';
2
- declare const ruleSchema: v.TupleType<[v.Type<"allow">, v.UnionType<[v.ObjectType<{
3
- type: v.Type<"simple">;
4
- op: v.UnionType<[v.UnionType<[v.Type<"=">, v.Type<"!=">, v.Type<"IS">, v.Type<"IS NOT">]>, v.UnionType<[v.Type<"<">, v.Type<">">, v.Type<"<=">, v.Type<">=">]>, v.UnionType<[v.Type<"LIKE">, v.Type<"NOT LIKE">, v.Type<"ILIKE">, v.Type<"NOT ILIKE">]>, v.UnionType<[v.Type<"IN">, v.Type<"NOT IN">]>]>;
5
- left: v.UnionType<[v.ObjectType<{
6
- type: v.Type<"literal">;
7
- value: v.UnionType<[v.Type<string>, v.Type<number>, v.Type<boolean>, v.Type<null>, v.Type<readonly (string | number | boolean)[]>]>;
8
- }, undefined>, v.ObjectType<{
9
- type: v.Type<"column">;
10
- name: v.Type<string>;
11
- }, undefined>, v.ObjectType<{
12
- type: v.Type<"static">;
13
- anchor: v.UnionType<[v.Type<"authData">, v.Type<"preMutationRow">]>;
14
- field: v.Type<string>;
15
- }, undefined>]>;
16
- right: v.UnionType<[v.ObjectType<{
17
- type: v.Type<"static">;
18
- anchor: v.UnionType<[v.Type<"authData">, v.Type<"preMutationRow">]>;
19
- field: v.Type<string>;
20
- }, undefined>, v.ObjectType<{
21
- type: v.Type<"literal">;
22
- value: v.UnionType<[v.Type<string>, v.Type<number>, v.Type<boolean>, v.Type<null>, v.Type<readonly (string | number | boolean)[]>]>;
23
- }, undefined>]>;
24
- }, undefined>, v.Type<import("../../zero-protocol/src/ast.js").Conjunction>, v.Type<import("../../zero-protocol/src/ast.js").Disjunction>, v.ObjectType<Readonly<{
25
- type: v.Type<"correlatedSubquery">;
26
- related: v.Type<import("../../zero-protocol/src/ast.js").CorrelatedSubquery>;
27
- op: v.UnionType<[v.Type<"EXISTS">, v.Type<"NOT EXISTS">]>;
28
- }>, undefined>]>]>;
2
+ declare const ruleSchema: v.TupleType<[v.Type<"allow">, v.Type<import("../../zero-protocol/src/ast.js").Condition>]>;
29
3
  export type Rule = v.Infer<typeof ruleSchema>;
30
- declare const policySchema: v.ArrayType<v.TupleType<[v.Type<"allow">, v.UnionType<[v.ObjectType<{
31
- type: v.Type<"simple">;
32
- op: v.UnionType<[v.UnionType<[v.Type<"=">, v.Type<"!=">, v.Type<"IS">, v.Type<"IS NOT">]>, v.UnionType<[v.Type<"<">, v.Type<">">, v.Type<"<=">, v.Type<">=">]>, v.UnionType<[v.Type<"LIKE">, v.Type<"NOT LIKE">, v.Type<"ILIKE">, v.Type<"NOT ILIKE">]>, v.UnionType<[v.Type<"IN">, v.Type<"NOT IN">]>]>;
33
- left: v.UnionType<[v.ObjectType<{
34
- type: v.Type<"literal">;
35
- value: v.UnionType<[v.Type<string>, v.Type<number>, v.Type<boolean>, v.Type<null>, v.Type<readonly (string | number | boolean)[]>]>;
36
- }, undefined>, v.ObjectType<{
37
- type: v.Type<"column">;
38
- name: v.Type<string>;
39
- }, undefined>, v.ObjectType<{
40
- type: v.Type<"static">;
41
- anchor: v.UnionType<[v.Type<"authData">, v.Type<"preMutationRow">]>;
42
- field: v.Type<string>;
43
- }, undefined>]>;
44
- right: v.UnionType<[v.ObjectType<{
45
- type: v.Type<"static">;
46
- anchor: v.UnionType<[v.Type<"authData">, v.Type<"preMutationRow">]>;
47
- field: v.Type<string>;
48
- }, undefined>, v.ObjectType<{
49
- type: v.Type<"literal">;
50
- value: v.UnionType<[v.Type<string>, v.Type<number>, v.Type<boolean>, v.Type<null>, v.Type<readonly (string | number | boolean)[]>]>;
51
- }, undefined>]>;
52
- }, undefined>, v.Type<import("../../zero-protocol/src/ast.js").Conjunction>, v.Type<import("../../zero-protocol/src/ast.js").Disjunction>, v.ObjectType<Readonly<{
53
- type: v.Type<"correlatedSubquery">;
54
- related: v.Type<import("../../zero-protocol/src/ast.js").CorrelatedSubquery>;
55
- op: v.UnionType<[v.Type<"EXISTS">, v.Type<"NOT EXISTS">]>;
56
- }>, undefined>]>]>>;
4
+ declare const policySchema: v.ArrayType<v.TupleType<[v.Type<"allow">, v.Type<import("../../zero-protocol/src/ast.js").Condition>]>>;
57
5
  export type Policy = v.Infer<typeof policySchema>;
58
6
  declare const assetSchema: v.ObjectType<{
59
- select: v.Optional<["allow", {
60
- type: "simple";
61
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
62
- left: {
63
- type: "literal";
64
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
65
- } | {
66
- type: "column";
67
- name: string;
68
- } | {
69
- type: "static";
70
- anchor: "authData" | "preMutationRow";
71
- field: string;
72
- };
73
- right: {
74
- type: "literal";
75
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
76
- } | {
77
- type: "static";
78
- anchor: "authData" | "preMutationRow";
79
- field: string;
80
- };
81
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
82
- readonly type: "correlatedSubquery";
83
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
84
- readonly op: "EXISTS" | "NOT EXISTS";
85
- }][]>;
86
- insert: v.Optional<["allow", {
87
- type: "simple";
88
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
89
- left: {
90
- type: "literal";
91
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
92
- } | {
93
- type: "column";
94
- name: string;
95
- } | {
96
- type: "static";
97
- anchor: "authData" | "preMutationRow";
98
- field: string;
99
- };
100
- right: {
101
- type: "literal";
102
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
103
- } | {
104
- type: "static";
105
- anchor: "authData" | "preMutationRow";
106
- field: string;
107
- };
108
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
109
- readonly type: "correlatedSubquery";
110
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
111
- readonly op: "EXISTS" | "NOT EXISTS";
112
- }][]>;
7
+ select: v.Optional<["allow", import("../../zero-protocol/src/ast.js").Condition][]>;
8
+ insert: v.Optional<["allow", import("../../zero-protocol/src/ast.js").Condition][]>;
113
9
  update: v.Optional<{
114
- preMutation?: ["allow", {
115
- type: "simple";
116
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
117
- left: {
118
- type: "literal";
119
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
120
- } | {
121
- type: "column";
122
- name: string;
123
- } | {
124
- type: "static";
125
- anchor: "authData" | "preMutationRow";
126
- field: string;
127
- };
128
- right: {
129
- type: "literal";
130
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
131
- } | {
132
- type: "static";
133
- anchor: "authData" | "preMutationRow";
134
- field: string;
135
- };
136
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
137
- readonly type: "correlatedSubquery";
138
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
139
- readonly op: "EXISTS" | "NOT EXISTS";
140
- }][] | undefined;
141
- postProposedMutation?: ["allow", {
142
- type: "simple";
143
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
144
- left: {
145
- type: "literal";
146
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
147
- } | {
148
- type: "column";
149
- name: string;
150
- } | {
151
- type: "static";
152
- anchor: "authData" | "preMutationRow";
153
- field: string;
154
- };
155
- right: {
156
- type: "literal";
157
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
158
- } | {
159
- type: "static";
160
- anchor: "authData" | "preMutationRow";
161
- field: string;
162
- };
163
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
164
- readonly type: "correlatedSubquery";
165
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
166
- readonly op: "EXISTS" | "NOT EXISTS";
167
- }][] | undefined;
10
+ preMutation?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
11
+ postProposedMutation?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
168
12
  }>;
169
- delete: v.Optional<["allow", {
170
- type: "simple";
171
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
172
- left: {
173
- type: "literal";
174
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
175
- } | {
176
- type: "column";
177
- name: string;
178
- } | {
179
- type: "static";
180
- anchor: "authData" | "preMutationRow";
181
- field: string;
182
- };
183
- right: {
184
- type: "literal";
185
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
186
- } | {
187
- type: "static";
188
- anchor: "authData" | "preMutationRow";
189
- field: string;
190
- };
191
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
192
- readonly type: "correlatedSubquery";
193
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
194
- readonly op: "EXISTS" | "NOT EXISTS";
195
- }][]>;
13
+ delete: v.Optional<["allow", import("../../zero-protocol/src/ast.js").Condition][]>;
196
14
  }, undefined>;
197
15
  export type AssetPermissions = v.Infer<typeof assetSchema>;
198
16
  export declare const permissionsConfigSchema: v.Type<Record<string, {
199
17
  row?: {
200
- select?: ["allow", {
201
- type: "simple";
202
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
203
- left: {
204
- type: "literal";
205
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
206
- } | {
207
- type: "column";
208
- name: string;
209
- } | {
210
- type: "static";
211
- anchor: "authData" | "preMutationRow";
212
- field: string;
213
- };
214
- right: {
215
- type: "literal";
216
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
217
- } | {
218
- type: "static";
219
- anchor: "authData" | "preMutationRow";
220
- field: string;
221
- };
222
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
223
- readonly type: "correlatedSubquery";
224
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
225
- readonly op: "EXISTS" | "NOT EXISTS";
226
- }][] | undefined;
227
- insert?: ["allow", {
228
- type: "simple";
229
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
230
- left: {
231
- type: "literal";
232
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
233
- } | {
234
- type: "column";
235
- name: string;
236
- } | {
237
- type: "static";
238
- anchor: "authData" | "preMutationRow";
239
- field: string;
240
- };
241
- right: {
242
- type: "literal";
243
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
244
- } | {
245
- type: "static";
246
- anchor: "authData" | "preMutationRow";
247
- field: string;
248
- };
249
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
250
- readonly type: "correlatedSubquery";
251
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
252
- readonly op: "EXISTS" | "NOT EXISTS";
253
- }][] | undefined;
18
+ select?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
19
+ insert?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
254
20
  update?: {
255
- preMutation?: ["allow", {
256
- type: "simple";
257
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
258
- left: {
259
- type: "literal";
260
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
261
- } | {
262
- type: "column";
263
- name: string;
264
- } | {
265
- type: "static";
266
- anchor: "authData" | "preMutationRow";
267
- field: string;
268
- };
269
- right: {
270
- type: "literal";
271
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
272
- } | {
273
- type: "static";
274
- anchor: "authData" | "preMutationRow";
275
- field: string;
276
- };
277
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
278
- readonly type: "correlatedSubquery";
279
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
280
- readonly op: "EXISTS" | "NOT EXISTS";
281
- }][] | undefined;
282
- postProposedMutation?: ["allow", {
283
- type: "simple";
284
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
285
- left: {
286
- type: "literal";
287
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
288
- } | {
289
- type: "column";
290
- name: string;
291
- } | {
292
- type: "static";
293
- anchor: "authData" | "preMutationRow";
294
- field: string;
295
- };
296
- right: {
297
- type: "literal";
298
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
299
- } | {
300
- type: "static";
301
- anchor: "authData" | "preMutationRow";
302
- field: string;
303
- };
304
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
305
- readonly type: "correlatedSubquery";
306
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
307
- readonly op: "EXISTS" | "NOT EXISTS";
308
- }][] | undefined;
21
+ preMutation?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
22
+ postProposedMutation?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
309
23
  } | undefined;
310
- delete?: ["allow", {
311
- type: "simple";
312
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
313
- left: {
314
- type: "literal";
315
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
316
- } | {
317
- type: "column";
318
- name: string;
319
- } | {
320
- type: "static";
321
- anchor: "authData" | "preMutationRow";
322
- field: string;
323
- };
324
- right: {
325
- type: "literal";
326
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
327
- } | {
328
- type: "static";
329
- anchor: "authData" | "preMutationRow";
330
- field: string;
331
- };
332
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
333
- readonly type: "correlatedSubquery";
334
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
335
- readonly op: "EXISTS" | "NOT EXISTS";
336
- }][] | undefined;
24
+ delete?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
337
25
  } | undefined;
338
26
  cell?: Record<string, {
339
- select?: ["allow", {
340
- type: "simple";
341
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
342
- left: {
343
- type: "literal";
344
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
345
- } | {
346
- type: "column";
347
- name: string;
348
- } | {
349
- type: "static";
350
- anchor: "authData" | "preMutationRow";
351
- field: string;
352
- };
353
- right: {
354
- type: "literal";
355
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
356
- } | {
357
- type: "static";
358
- anchor: "authData" | "preMutationRow";
359
- field: string;
360
- };
361
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
362
- readonly type: "correlatedSubquery";
363
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
364
- readonly op: "EXISTS" | "NOT EXISTS";
365
- }][] | undefined;
366
- insert?: ["allow", {
367
- type: "simple";
368
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
369
- left: {
370
- type: "literal";
371
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
372
- } | {
373
- type: "column";
374
- name: string;
375
- } | {
376
- type: "static";
377
- anchor: "authData" | "preMutationRow";
378
- field: string;
379
- };
380
- right: {
381
- type: "literal";
382
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
383
- } | {
384
- type: "static";
385
- anchor: "authData" | "preMutationRow";
386
- field: string;
387
- };
388
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
389
- readonly type: "correlatedSubquery";
390
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
391
- readonly op: "EXISTS" | "NOT EXISTS";
392
- }][] | undefined;
27
+ select?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
28
+ insert?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
393
29
  update?: {
394
- preMutation?: ["allow", {
395
- type: "simple";
396
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
397
- left: {
398
- type: "literal";
399
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
400
- } | {
401
- type: "column";
402
- name: string;
403
- } | {
404
- type: "static";
405
- anchor: "authData" | "preMutationRow";
406
- field: string;
407
- };
408
- right: {
409
- type: "literal";
410
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
411
- } | {
412
- type: "static";
413
- anchor: "authData" | "preMutationRow";
414
- field: string;
415
- };
416
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
417
- readonly type: "correlatedSubquery";
418
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
419
- readonly op: "EXISTS" | "NOT EXISTS";
420
- }][] | undefined;
421
- postProposedMutation?: ["allow", {
422
- type: "simple";
423
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
424
- left: {
425
- type: "literal";
426
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
427
- } | {
428
- type: "column";
429
- name: string;
430
- } | {
431
- type: "static";
432
- anchor: "authData" | "preMutationRow";
433
- field: string;
434
- };
435
- right: {
436
- type: "literal";
437
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
438
- } | {
439
- type: "static";
440
- anchor: "authData" | "preMutationRow";
441
- field: string;
442
- };
443
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
444
- readonly type: "correlatedSubquery";
445
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
446
- readonly op: "EXISTS" | "NOT EXISTS";
447
- }][] | undefined;
30
+ preMutation?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
31
+ postProposedMutation?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
448
32
  } | undefined;
449
- delete?: ["allow", {
450
- type: "simple";
451
- op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
452
- left: {
453
- type: "literal";
454
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
455
- } | {
456
- type: "column";
457
- name: string;
458
- } | {
459
- type: "static";
460
- anchor: "authData" | "preMutationRow";
461
- field: string;
462
- };
463
- right: {
464
- type: "literal";
465
- value: string | number | boolean | readonly (string | number | boolean)[] | null;
466
- } | {
467
- type: "static";
468
- anchor: "authData" | "preMutationRow";
469
- field: string;
470
- };
471
- } | import("../../zero-protocol/src/ast.js").Conjunction | import("../../zero-protocol/src/ast.js").Disjunction | {
472
- readonly type: "correlatedSubquery";
473
- readonly related: import("../../zero-protocol/src/ast.js").CorrelatedSubquery;
474
- readonly op: "EXISTS" | "NOT EXISTS";
475
- }][] | undefined;
33
+ delete?: ["allow", import("../../zero-protocol/src/ast.js").Condition][] | undefined;
476
34
  }> | undefined;
477
35
  }>>;
478
36
  export type PermissionsConfig = v.Infer<typeof permissionsConfigSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"compiled-permissions.d.ts","sourceRoot":"","sources":["../../../../zero-schema/src/compiled-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAiD,CAAC;AAClE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAsB,CAAC;AACzC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAUf,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"compiled-permissions.d.ts","sourceRoot":"","sources":["../../../../zero-schema/src/compiled-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,QAAA,MAAM,UAAU,4FAAiD,CAAC;AAClE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,QAAA,MAAM,YAAY,yGAAsB,CAAC;AACzC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,QAAA,MAAM,WAAW;;;;;;;;aAUf,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;GAKnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -10,7 +10,7 @@ type Normalized<T> = T & {
10
10
  * dependencies.
11
11
  */
12
12
  export type TableSchemaCache = Map<TableSchema, NormalizedTableSchema>;
13
- export declare class NormalizedTableSchema {
13
+ export declare class NormalizedTableSchema implements TableSchema {
14
14
  readonly [normalized]: true;
15
15
  readonly tableName: string;
16
16
  readonly primaryKey: NormalizedPrimaryKey;
@@ -23,7 +23,7 @@ export declare class NormalizedTableSchema {
23
23
  export declare function normalizeTableSchema(tableSchema: TableSchema | NormalizedTableSchema): NormalizedTableSchema;
24
24
  export declare function normalizeTableSchemaWithCache(tableSchema: TableSchema | NormalizedTableSchema, expectedName: string, tableSchemaCache: TableSchemaCache): NormalizedTableSchema;
25
25
  export type NormalizedPrimaryKey = Normalized<PrimaryKey>;
26
- export declare function normalizePrimaryKey(arr: PrimaryKey): NormalizedPrimaryKey;
26
+ export declare function normalizePrimaryKey(primaryKey: PrimaryKey | string): NormalizedPrimaryKey;
27
27
  export type DecycledNormalizedTableSchema = Omit<NormalizedTableSchema, 'relationships'> & {
28
28
  readonly relationships: {
29
29
  readonly [relationship: string]: DecycledNormalizedFieldRelationship | readonly [
@@ -45,5 +45,6 @@ export type NormalizedJunctionRelationship = readonly [
45
45
  NormalizedFieldRelationship,
46
46
  NormalizedFieldRelationship
47
47
  ];
48
+ export declare function normalizeTables(tables: Record<string, TableSchema>): Record<string, NormalizedTableSchema>;
48
49
  export {};
49
50
  //# sourceMappingURL=normalize-table-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-table-schema.d.ts","sourceRoot":"","sources":["../../../../zero-schema/src/normalize-table-schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AAExC,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG;IAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;AAEvE,qBAAa,qBAAqB;IAChC,SAAiB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9C,QAAQ,CAAC,aAAa,EAAE;QAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,sBAAsB,CAAA;KAAC,CAAC;gBAE9D,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB;CAWzE;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,GAAG,qBAAqB,GAC/C,qBAAqB,CAMvB;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,WAAW,GAAG,qBAAqB,EAChD,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,GACjC,qBAAqB,CAmBvB;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAS1D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,oBAAoB,CAGzE;AA+CD,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,qBAAqB,EACrB,eAAe,CAChB,GAAG;IACF,QAAQ,CAAC,aAAa,EAAE;QACtB,QAAQ,EAAE,YAAY,EAAE,MAAM,GAC1B,mCAAmC,GACnC,SAAS;YACP,mCAAmC;YACnC,mCAAmC;SACpC,CAAC;KACP,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,2BAA2B,EAC3B,YAAY,CACb,GAAG;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAElC,KAAK,sBAAsB,GACvB,2BAA2B,GAC3B,8BAA8B,CAAC;AAcnC,KAAK,2BAA2B,GAAG;IACjC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAoBF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IACpD,2BAA2B;IAC3B,2BAA2B;CAC5B,CAAC"}
1
+ {"version":3,"file":"normalize-table-schema.d.ts","sourceRoot":"","sources":["../../../../zero-schema/src/normalize-table-schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AAExC,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG;IAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;AAEvE,qBAAa,qBAAsB,YAAW,WAAW;IACvD,SAAiB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9C,QAAQ,CAAC,aAAa,EAAE;QAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,sBAAsB,CAAA;KAAC,CAAC;gBAE9D,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB;CAWzE;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,GAAG,qBAAqB,GAC/C,qBAAqB,CAMvB;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,WAAW,GAAG,qBAAqB,EAChD,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,GACjC,qBAAqB,CAmBvB;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAS1D,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,GAAG,MAAM,GAC9B,oBAAoB,CAMtB;AAsDD,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,qBAAqB,EACrB,eAAe,CAChB,GAAG;IACF,QAAQ,CAAC,aAAa,EAAE;QACtB,QAAQ,EAAE,YAAY,EAAE,MAAM,GAC1B,mCAAmC,GACnC,SAAS;YACP,mCAAmC;YACnC,mCAAmC;SACpC,CAAC;KACP,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,2BAA2B,EAC3B,YAAY,CACb,GAAG;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAElC,KAAK,sBAAsB,GACvB,2BAA2B,GAC3B,8BAA8B,CAAC;AAYnC,KAAK,2BAA2B,GAAG;IACjC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAsBF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IACpD,2BAA2B;IAC3B,2BAA2B;CAC5B,CAAC;AAiCF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAMvC"}
@@ -33,25 +33,33 @@ export function normalizeTableSchemaWithCache(tableSchema, expectedName, tableSc
33
33
  function assertNoDuplicates(arr) {
34
34
  assert(new Set(arr).size === arr.length, 'Primary key must not contain duplicates');
35
35
  }
36
- export function normalizePrimaryKey(arr) {
37
- assertNoDuplicates(arr);
38
- return arr;
36
+ export function normalizePrimaryKey(primaryKey) {
37
+ if (typeof primaryKey === 'string') {
38
+ return [primaryKey];
39
+ }
40
+ assertNoDuplicates(primaryKey);
41
+ return primaryKey;
39
42
  }
40
43
  function normalizeColumns(columns, primaryKey) {
41
44
  const rv = {};
42
45
  for (const pk of primaryKey) {
43
46
  const schemaValue = columns[pk];
44
47
  assert(schemaValue, `Primary key column "${pk}" not found`);
45
- const { type, optional } = schemaValue;
46
- assert(!optional, `Primary key column "${pk}" cannot be optional`);
47
- assert(type === 'string' || type === 'number' || type === 'boolean', `Primary key column "${pk}" must be a string, number, or boolean. Got ${type}`);
48
+ if (typeof schemaValue !== 'string') {
49
+ const { type, optional } = schemaValue;
50
+ assert(!optional, `Primary key column "${pk}" cannot be optional`);
51
+ assert(type === 'string' || type === 'number' || type === 'boolean', `Primary key column "${pk}" must be a string, number, or boolean. Got ${type}`);
52
+ }
48
53
  }
49
54
  for (const [name, column] of sortedEntries(columns)) {
50
- rv[name] = normalizeSchemaValue(column);
55
+ rv[name] = normalizeColumn(column);
51
56
  }
52
57
  return rv;
53
58
  }
54
- function normalizeSchemaValue(value) {
59
+ function normalizeColumn(value) {
60
+ if (typeof value === 'string') {
61
+ return { type: value, optional: false };
62
+ }
55
63
  return {
56
64
  type: value.type,
57
65
  optional: value.optional ?? false,
@@ -59,8 +67,10 @@ function normalizeSchemaValue(value) {
59
67
  }
60
68
  function normalizeRelationships(relationships, tableSchemaCache) {
61
69
  const rv = {};
62
- for (const [name, relationship] of sortedEntries(relationships)) {
63
- rv[name] = normalizeRelationship(relationship, tableSchemaCache);
70
+ if (relationships) {
71
+ for (const [name, relationship] of sortedEntries(relationships)) {
72
+ rv[name] = normalizeRelationship(relationship, tableSchemaCache);
73
+ }
64
74
  }
65
75
  return rv;
66
76
  }
@@ -71,10 +81,12 @@ function normalizeRelationship(relationship, tableSchemaCache) {
71
81
  return normalizeJunctionRelationship(relationship, tableSchemaCache);
72
82
  }
73
83
  function normalizeFieldRelationship(relationship, tableSchemaCache) {
74
- assert(relationship.sourceField.length === relationship.destField.length, 'Source and destination fields must have the same length');
84
+ const sourceField = normalizeFieldName(relationship.sourceField);
85
+ const destField = normalizeFieldName(relationship.destField);
86
+ assert(sourceField.length === destField.length, 'Source and destination fields must have the same length');
75
87
  return {
76
- sourceField: relationship.sourceField,
77
- destField: relationship.destField,
88
+ sourceField,
89
+ destField,
78
90
  destSchema: normalizeLazyTableSchema(relationship.destSchema, tableSchemaCache),
79
91
  };
80
92
  }
@@ -89,4 +101,18 @@ function normalizeLazyTableSchema(tableSchema, buildCache) {
89
101
  return normalizeTableSchemaWithCache(tableSchemaInstance, tableSchemaInstance.tableName, // Don't care about name here.
90
102
  buildCache);
91
103
  }
104
+ function normalizeFieldName(sourceField) {
105
+ if (typeof sourceField === 'string') {
106
+ return [sourceField];
107
+ }
108
+ assert(sourceField.length > 0, 'Expected at least one field');
109
+ return sourceField;
110
+ }
111
+ export function normalizeTables(tables) {
112
+ const result = {};
113
+ for (const [name, table] of sortedEntries(tables)) {
114
+ result[name] = normalizeTableSchemaWithCache(table, name, new Map());
115
+ }
116
+ return result;
117
+ }
92
118
  //# sourceMappingURL=normalize-table-schema.js.map