@rocicorp/zero 0.6.2024111800 → 0.6.2024112000

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/out/{chunk-N4TOAWSH.js → chunk-W4HNSZIF.js} +149 -54
  2. package/out/chunk-W4HNSZIF.js.map +7 -0
  3. package/out/shared/src/valita.d.ts.map +1 -1
  4. package/out/shared/src/valita.js +53 -4
  5. package/out/shared/src/valita.js.map +1 -1
  6. package/out/solid.js +1 -1
  7. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  8. package/out/zero-cache/src/config/zero-config.js +12 -4
  9. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  10. package/out/zero-cache/src/db/create.d.ts.map +1 -1
  11. package/out/zero-cache/src/db/create.js +1 -3
  12. package/out/zero-cache/src/db/create.js.map +1 -1
  13. package/out/zero-cache/src/db/pg-to-lite.d.ts.map +1 -1
  14. package/out/zero-cache/src/db/pg-to-lite.js +12 -3
  15. package/out/zero-cache/src/db/pg-to-lite.js.map +1 -1
  16. package/out/zero-cache/src/server/main.js +1 -1
  17. package/out/zero-cache/src/server/main.js.map +1 -1
  18. package/out/zero-cache/src/server/syncer.d.ts +1 -1
  19. package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
  20. package/out/zero-cache/src/server/syncer.js +15 -5
  21. package/out/zero-cache/src/server/syncer.js.map +1 -1
  22. package/out/zero-cache/src/services/change-streamer/pg/schema/shard.js +1 -1
  23. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
  24. package/out/zero-cache/src/services/mutagen/mutagen.js +1 -3
  25. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  26. package/out/zero-cache/src/services/mutagen/write-authorizer.d.ts.map +1 -1
  27. package/out/zero-cache/src/services/mutagen/write-authorizer.js +22 -42
  28. package/out/zero-cache/src/services/mutagen/write-authorizer.js.map +1 -1
  29. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +1 -1
  30. package/out/zero-cache/src/services/replicator/incremental-sync.js +2 -3
  31. package/out/zero-cache/src/services/replicator/incremental-sync.js.map +1 -1
  32. package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
  33. package/out/zero-cache/src/services/view-syncer/cvr.js +8 -2
  34. package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
  35. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +80 -15
  36. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +1 -1
  37. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  38. package/out/zero-cache/src/services/view-syncer/view-syncer.js +1 -3
  39. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  40. package/out/zero-cache/src/workers/replicator.d.ts +1 -0
  41. package/out/zero-cache/src/workers/replicator.d.ts.map +1 -1
  42. package/out/zero-cache/src/workers/replicator.js +4 -1
  43. package/out/zero-cache/src/workers/replicator.js.map +1 -1
  44. package/out/zero-protocol/src/ast.d.ts +75 -18
  45. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  46. package/out/zero-protocol/src/ast.js +36 -13
  47. package/out/zero-protocol/src/ast.js.map +1 -1
  48. package/out/zero-protocol/src/change-desired-queries.d.ts +32 -6
  49. package/out/zero-protocol/src/change-desired-queries.d.ts.map +1 -1
  50. package/out/zero-protocol/src/connect.d.ts +32 -6
  51. package/out/zero-protocol/src/connect.d.ts.map +1 -1
  52. package/out/zero-protocol/src/down.d.ts +32 -6
  53. package/out/zero-protocol/src/down.d.ts.map +1 -1
  54. package/out/zero-protocol/src/poke.d.ts +64 -12
  55. package/out/zero-protocol/src/poke.d.ts.map +1 -1
  56. package/out/zero-protocol/src/queries-patch.d.ts +48 -9
  57. package/out/zero-protocol/src/queries-patch.d.ts.map +1 -1
  58. package/out/zero-protocol/src/up.d.ts +32 -6
  59. package/out/zero-protocol/src/up.d.ts.map +1 -1
  60. package/out/zero-schema/src/authorization.d.ts +6 -6
  61. package/out/zero-schema/src/authorization.d.ts.map +1 -1
  62. package/out/zero-schema/src/compiled-authorization.d.ts +224 -42
  63. package/out/zero-schema/src/compiled-authorization.d.ts.map +1 -1
  64. package/out/zero.js +1 -1
  65. package/out/zql/src/builder/builder.d.ts.map +1 -1
  66. package/out/zql/src/builder/builder.js +10 -12
  67. package/out/zql/src/builder/builder.js.map +1 -1
  68. package/out/zql/src/builder/filter.d.ts.map +1 -1
  69. package/out/zql/src/builder/filter.js +20 -5
  70. package/out/zql/src/builder/filter.js.map +1 -1
  71. package/out/zql/src/query/expression.d.ts +4 -2
  72. package/out/zql/src/query/expression.d.ts.map +1 -1
  73. package/out/zql/src/query/query-impl.d.ts.map +1 -1
  74. package/out/zqlite/src/table-source.d.ts +1 -1
  75. package/out/zqlite/src/table-source.d.ts.map +1 -1
  76. package/out/zqlite/src/table-source.js +38 -10
  77. package/out/zqlite/src/table-source.js.map +1 -1
  78. package/package.json +1 -1
  79. package/out/chunk-N4TOAWSH.js.map +0 -7
  80. package/out/zql/src/builder/error.d.ts +0 -3
  81. package/out/zql/src/builder/error.d.ts.map +0 -1
  82. package/out/zql/src/builder/error.js +0 -3
  83. package/out/zql/src/builder/error.js.map +0 -1
@@ -34,12 +34,25 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
34
34
  where?: {
35
35
  type: "simple";
36
36
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
37
- field: string;
38
- value: string | number | boolean | readonly (string | number | boolean)[] | {
37
+ left: {
38
+ type: "literal";
39
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
40
+ } | {
41
+ type: "column";
42
+ name: string;
43
+ } | {
39
44
  type: "static";
40
45
  anchor: "authData" | "preMutationRow";
41
46
  field: string;
42
- } | null;
47
+ };
48
+ right: {
49
+ type: "literal";
50
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
51
+ } | {
52
+ type: "static";
53
+ anchor: "authData" | "preMutationRow";
54
+ field: string;
55
+ };
43
56
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
44
57
  readonly type: "correlatedSubquery";
45
58
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -69,12 +82,25 @@ export declare const downstreamSchema: v.UnionType<[v.TupleType<[v.Type<"connect
69
82
  where?: {
70
83
  type: "simple";
71
84
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
72
- field: string;
73
- value: string | number | boolean | readonly (string | number | boolean)[] | {
85
+ left: {
86
+ type: "literal";
87
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
88
+ } | {
89
+ type: "column";
90
+ name: string;
91
+ } | {
92
+ type: "static";
93
+ anchor: "authData" | "preMutationRow";
94
+ field: string;
95
+ };
96
+ right: {
97
+ type: "literal";
98
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
99
+ } | {
74
100
  type: "static";
75
101
  anchor: "authData" | "preMutationRow";
76
102
  field: string;
77
- } | null;
103
+ };
78
104
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
79
105
  readonly type: "correlatedSubquery";
80
106
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -1 +1 @@
1
- {"version":3,"file":"down.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/down.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAYhD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"down.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/down.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAYhD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -54,12 +54,25 @@ export declare const pokePartBodySchema: v.ObjectType<{
54
54
  where?: {
55
55
  type: "simple";
56
56
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
57
- field: string;
58
- value: string | number | boolean | readonly (string | number | boolean)[] | {
57
+ left: {
58
+ type: "literal";
59
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
60
+ } | {
61
+ type: "column";
62
+ name: string;
63
+ } | {
59
64
  type: "static";
60
65
  anchor: "authData" | "preMutationRow";
61
66
  field: string;
62
- } | null;
67
+ };
68
+ right: {
69
+ type: "literal";
70
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
71
+ } | {
72
+ type: "static";
73
+ anchor: "authData" | "preMutationRow";
74
+ field: string;
75
+ };
63
76
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
64
77
  readonly type: "correlatedSubquery";
65
78
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -89,12 +102,25 @@ export declare const pokePartBodySchema: v.ObjectType<{
89
102
  where?: {
90
103
  type: "simple";
91
104
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
92
- field: string;
93
- value: string | number | boolean | readonly (string | number | boolean)[] | {
105
+ left: {
106
+ type: "literal";
107
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
108
+ } | {
109
+ type: "column";
110
+ name: string;
111
+ } | {
112
+ type: "static";
113
+ anchor: "authData" | "preMutationRow";
114
+ field: string;
115
+ };
116
+ right: {
117
+ type: "literal";
118
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
119
+ } | {
94
120
  type: "static";
95
121
  anchor: "authData" | "preMutationRow";
96
122
  field: string;
97
- } | null;
123
+ };
98
124
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
99
125
  readonly type: "correlatedSubquery";
100
126
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -168,12 +194,25 @@ export declare const pokePartMessageSchema: v.TupleType<[v.Type<"pokePart">, v.O
168
194
  where?: {
169
195
  type: "simple";
170
196
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
171
- field: string;
172
- value: string | number | boolean | readonly (string | number | boolean)[] | {
197
+ left: {
198
+ type: "literal";
199
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
200
+ } | {
201
+ type: "column";
202
+ name: string;
203
+ } | {
173
204
  type: "static";
174
205
  anchor: "authData" | "preMutationRow";
175
206
  field: string;
176
- } | null;
207
+ };
208
+ right: {
209
+ type: "literal";
210
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
211
+ } | {
212
+ type: "static";
213
+ anchor: "authData" | "preMutationRow";
214
+ field: string;
215
+ };
177
216
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
178
217
  readonly type: "correlatedSubquery";
179
218
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -203,12 +242,25 @@ export declare const pokePartMessageSchema: v.TupleType<[v.Type<"pokePart">, v.O
203
242
  where?: {
204
243
  type: "simple";
205
244
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
206
- field: string;
207
- value: string | number | boolean | readonly (string | number | boolean)[] | {
245
+ left: {
246
+ type: "literal";
247
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
248
+ } | {
249
+ type: "column";
250
+ name: string;
251
+ } | {
252
+ type: "static";
253
+ anchor: "authData" | "preMutationRow";
254
+ field: string;
255
+ };
256
+ right: {
257
+ type: "literal";
258
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
259
+ } | {
208
260
  type: "static";
209
261
  anchor: "authData" | "preMutationRow";
210
262
  field: string;
211
- } | null;
263
+ };
212
264
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
213
265
  readonly type: "correlatedSubquery";
214
266
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -1 +1 @@
1
- {"version":3,"file":"poke.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/poke.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAMhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;aAY9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAc7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;aAK5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;eAGjC,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGhC,CAAC;AACH,eAAO,MAAM,oBAAoB;;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H,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -9,12 +9,25 @@ declare const putOpSchema: v.ObjectType<{
9
9
  where: v.Optional<{
10
10
  type: "simple";
11
11
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
12
- field: string;
13
- value: string | number | boolean | readonly (string | number | boolean)[] | {
12
+ left: {
13
+ type: "literal";
14
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
15
+ } | {
16
+ type: "column";
17
+ name: string;
18
+ } | {
14
19
  type: "static";
15
20
  anchor: "authData" | "preMutationRow";
16
21
  field: string;
17
- } | null;
22
+ };
23
+ right: {
24
+ type: "literal";
25
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
26
+ } | {
27
+ type: "static";
28
+ anchor: "authData" | "preMutationRow";
29
+ field: string;
30
+ };
18
31
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
19
32
  readonly type: "correlatedSubquery";
20
33
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -46,12 +59,25 @@ declare const patchOpSchema: v.UnionType<[v.ObjectType<{
46
59
  where: v.Optional<{
47
60
  type: "simple";
48
61
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
49
- field: string;
50
- value: string | number | boolean | readonly (string | number | boolean)[] | {
62
+ left: {
63
+ type: "literal";
64
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
65
+ } | {
66
+ type: "column";
67
+ name: string;
68
+ } | {
51
69
  type: "static";
52
70
  anchor: "authData" | "preMutationRow";
53
71
  field: string;
54
- } | null;
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
+ };
55
81
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
56
82
  readonly type: "correlatedSubquery";
57
83
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -81,12 +107,25 @@ export declare const queriesPatchSchema: v.ArrayType<v.UnionType<[v.ObjectType<{
81
107
  where: v.Optional<{
82
108
  type: "simple";
83
109
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
84
- field: string;
85
- value: string | number | boolean | readonly (string | number | boolean)[] | {
110
+ left: {
111
+ type: "literal";
112
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
113
+ } | {
114
+ type: "column";
115
+ name: string;
116
+ } | {
117
+ type: "static";
118
+ anchor: "authData" | "preMutationRow";
119
+ field: string;
120
+ };
121
+ right: {
122
+ type: "literal";
123
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
124
+ } | {
86
125
  type: "static";
87
126
  anchor: "authData" | "preMutationRow";
88
127
  field: string;
89
- } | null;
128
+ };
90
129
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
91
130
  readonly type: "correlatedSubquery";
92
131
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -1 +1 @@
1
- {"version":3,"file":"queries-patch.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/queries-patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAIf,CAAC;AAEH,QAAA,MAAM,WAAW;;;aAGf,CAAC;AAEH,QAAA,MAAM,aAAa;;aAEjB,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAmD,CAAC;AAEvE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAyB,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"queries-patch.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/queries-patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAIf,CAAC;AAEH,QAAA,MAAM,WAAW;;;aAGf,CAAC;AAEH,QAAA,MAAM,aAAa;;aAEjB,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAmD,CAAC;AAEvE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAyB,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -10,12 +10,25 @@ export declare const upstreamSchema: v.UnionType<[v.TupleType<[v.Type<"initConne
10
10
  where: v.Optional<{
11
11
  type: "simple";
12
12
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
13
- field: string;
14
- value: string | number | boolean | readonly (string | number | boolean)[] | {
13
+ left: {
14
+ type: "literal";
15
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
16
+ } | {
17
+ type: "column";
18
+ name: string;
19
+ } | {
15
20
  type: "static";
16
21
  anchor: "authData" | "preMutationRow";
17
22
  field: string;
18
- } | null;
23
+ };
24
+ right: {
25
+ type: "literal";
26
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
27
+ } | {
28
+ type: "static";
29
+ anchor: "authData" | "preMutationRow";
30
+ field: string;
31
+ };
19
32
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
20
33
  readonly type: "correlatedSubquery";
21
34
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -48,12 +61,25 @@ export declare const upstreamSchema: v.UnionType<[v.TupleType<[v.Type<"initConne
48
61
  where: v.Optional<{
49
62
  type: "simple";
50
63
  op: "=" | "!=" | "IS" | "IS NOT" | "<" | ">" | "<=" | ">=" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "IN" | "NOT IN";
51
- field: string;
52
- value: string | number | boolean | readonly (string | number | boolean)[] | {
64
+ left: {
65
+ type: "literal";
66
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
67
+ } | {
68
+ type: "column";
69
+ name: string;
70
+ } | {
71
+ type: "static";
72
+ anchor: "authData" | "preMutationRow";
73
+ field: string;
74
+ };
75
+ right: {
76
+ type: "literal";
77
+ value: string | number | boolean | readonly (string | number | boolean)[] | null;
78
+ } | {
53
79
  type: "static";
54
80
  anchor: "authData" | "preMutationRow";
55
81
  field: string;
56
- } | null;
82
+ };
57
83
  } | import("./ast.js").Conjunction | import("./ast.js").Disjunction | {
58
84
  readonly type: "correlatedSubquery";
59
85
  readonly related: import("./ast.js").CorrelatedSubquery;
@@ -1 +1 @@
1
- {"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAQhD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO1B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAQhD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO1B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -6,16 +6,16 @@ type Action = 'select' | 'insert' | 'update' | 'delete';
6
6
  export type Queries<TSchema extends Schema> = {
7
7
  [K in keyof TSchema['tables']]: Query<TSchema['tables'][K]>;
8
8
  };
9
- type InstanceAuthzRule<TAuthDataShape, TSchema extends TableSchema> = (authData: TAuthDataShape, row: TableSchemaToRow<TSchema>) => Query<TableSchema>;
10
- type InstanceAssetAuthorization<TAuthDataShape, TSchema extends TableSchema> = {
11
- [K in Action]?: InstanceAuthzRule<TAuthDataShape, TSchema>[];
9
+ type AuthorizationRule<TAuthDataShape, TSchema extends TableSchema> = (authData: TAuthDataShape, row: TableSchemaToRow<TSchema>) => Query<TableSchema>;
10
+ type AssetAuthorization<TAuthDataShape, TSchema extends TableSchema> = {
11
+ [K in Action]?: AuthorizationRule<TAuthDataShape, TSchema>[] | undefined;
12
12
  };
13
13
  export type AuthorizationConfig<TAuthDataShape, TSchema extends Schema> = {
14
14
  [K in keyof TSchema['tables']]?: {
15
- row?: InstanceAssetAuthorization<TAuthDataShape, TSchema['tables'][K]>;
15
+ row?: AssetAuthorization<TAuthDataShape, TSchema['tables'][K]> | undefined;
16
16
  cell?: {
17
- [C in keyof TSchema['tables'][K]['columns']]?: InstanceAssetAuthorization<TAuthDataShape, TSchema['tables'][K]>;
18
- };
17
+ [C in keyof TSchema['tables'][K]['columns']]?: AssetAuthorization<TAuthDataShape, TSchema['tables'][K]>;
18
+ } | undefined;
19
19
  };
20
20
  };
21
21
  export declare function defineAuthorization<TAuthDataShape, TSchema extends Schema>(schema: TSchema, definer: (query: Queries<TSchema>) => Promise<AuthorizationConfig<TAuthDataShape, TSchema>> | AuthorizationConfig<TAuthDataShape, TSchema>): Promise<CompiledA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