@rocicorp/zero 1.4.0 → 1.5.0-canary.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/out/analyze-query/src/analyze-cli.js +2 -2
- package/out/analyze-query/src/analyze-cli.js.map +1 -1
- package/out/zero/package.js +1 -1
- package/out/zero/package.js.map +1 -1
- package/out/zero-cache/src/auth/auth.d.ts +1 -1
- package/out/zero-cache/src/auth/auth.d.ts.map +1 -1
- package/out/zero-cache/src/auth/auth.js +1 -1
- package/out/zero-cache/src/auth/auth.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.d.ts +1 -1
- package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/normalize.d.ts.map +1 -1
- package/out/zero-cache/src/config/normalize.js +8 -0
- package/out/zero-cache/src/config/normalize.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +8 -4
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +28 -6
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/custom/fetch.d.ts +1 -1
- package/out/zero-cache/src/custom/fetch.d.ts.map +1 -1
- package/out/zero-cache/src/custom/fetch.js +2 -2
- package/out/zero-cache/src/custom/fetch.js.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.d.ts +21 -7
- package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.js +26 -9
- package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
- package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
- package/out/zero-cache/src/server/change-streamer.js +2 -1
- package/out/zero-cache/src/server/change-streamer.js.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.d.ts.map +1 -1
- package/out/zero-cache/src/server/runner/run-worker.js +5 -2
- package/out/zero-cache/src/server/runner/run-worker.js.map +1 -1
- package/out/zero-cache/src/server/syncer.js +3 -3
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/change-source/custom/change-source.js +2 -2
- package/out/zero-cache/src/services/change-source/custom/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/change-source.js +24 -20
- package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts +258 -45
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.js +119 -83
- package/out/zero-cache/src/services/change-source/pg/schema/ddl.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.js +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/init.js.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.js +2 -1
- package/out/zero-cache/src/services/change-source/pg/schema/shard.js.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +1 -0
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +3 -3
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
- package/out/zero-cache/src/services/http-service.d.ts +1 -0
- package/out/zero-cache/src/services/http-service.d.ts.map +1 -1
- package/out/zero-cache/src/services/http-service.js +5 -4
- package/out/zero-cache/src/services/http-service.js.map +1 -1
- package/out/zero-cache/src/services/life-cycle.d.ts +1 -1
- package/out/zero-cache/src/services/life-cycle.d.ts.map +1 -1
- package/out/zero-cache/src/services/life-cycle.js +1 -2
- package/out/zero-cache/src/services/life-cycle.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.d.ts +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js +1 -1
- package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +4 -3
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +57 -38
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/shadow-sync/shadow-sync-service.js +2 -1
- package/out/zero-cache/src/services/shadow-sync/shadow-sync-service.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.js +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts +41 -27
- package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/connection-context-manager.js +147 -104
- package/out/zero-cache/src/services/view-syncer/connection-context-manager.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts +6 -0
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +8 -0
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +3 -3
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +119 -86
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/workers/connection.js +2 -2
- package/out/zero-cache/src/workers/connection.js.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js +7 -7
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-cache/src/workers/syncer.d.ts +1 -1
- package/out/zero-cache/src/workers/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/workers/syncer.js +11 -10
- package/out/zero-cache/src/workers/syncer.js.map +1 -1
- package/out/zero-client/src/client/connection.d.ts +15 -7
- package/out/zero-client/src/client/connection.d.ts.map +1 -1
- package/out/zero-client/src/client/connection.js.map +1 -1
- package/out/zero-client/src/client/crud-impl.d.ts +1 -1
- package/out/zero-client/src/client/crud-impl.d.ts.map +1 -1
- package/out/zero-client/src/client/crud-impl.js +1 -1
- package/out/zero-client/src/client/crud-impl.js.map +1 -1
- package/out/zero-client/src/client/crud.d.ts +1 -1
- package/out/zero-client/src/client/crud.d.ts.map +1 -1
- package/out/zero-client/src/client/crud.js +1 -1
- package/out/zero-client/src/client/crud.js.map +1 -1
- package/out/zero-client/src/client/keys.d.ts +1 -1
- package/out/zero-client/src/client/keys.d.ts.map +1 -1
- package/out/zero-client/src/client/keys.js.map +1 -1
- package/out/zero-client/src/client/make-replicache-mutators.js +1 -1
- package/out/zero-client/src/client/make-replicache-mutators.js.map +1 -1
- package/out/zero-client/src/client/mutation-tracker.d.ts +2 -1
- package/out/zero-client/src/client/mutation-tracker.d.ts.map +1 -1
- package/out/zero-client/src/client/mutation-tracker.js +3 -3
- package/out/zero-client/src/client/mutation-tracker.js.map +1 -1
- package/out/zero-client/src/client/version.js +1 -1
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.js +2 -2
- package/out/zero-client/src/client/zero.js.map +1 -1
- package/out/zero-client/src/types/client-state.d.ts +1 -1
- package/out/zero-client/src/types/client-state.d.ts.map +1 -1
- package/out/zero-protocol/src/custom-queries.js +1 -1
- package/out/zero-protocol/src/down.js +1 -1
- package/out/zero-protocol/src/error-kind-enum.d.ts +1 -2
- package/out/zero-protocol/src/error-kind-enum.d.ts.map +1 -1
- package/out/zero-protocol/src/error-kind-enum.js.map +1 -1
- package/out/zero-protocol/src/mutate-server.d.ts +165 -0
- package/out/zero-protocol/src/mutate-server.d.ts.map +1 -0
- package/out/zero-protocol/src/mutate-server.js +24 -0
- package/out/zero-protocol/src/mutate-server.js.map +1 -0
- package/out/zero-protocol/src/mutation.d.ts +229 -0
- package/out/zero-protocol/src/mutation.d.ts.map +1 -0
- package/out/zero-protocol/src/mutation.js +112 -0
- package/out/zero-protocol/src/mutation.js.map +1 -0
- package/out/zero-protocol/src/mutations-patch.js +1 -1
- package/out/zero-protocol/src/mutations-patch.js.map +1 -1
- package/out/zero-protocol/src/push.d.ts +3 -234
- package/out/zero-protocol/src/push.d.ts.map +1 -1
- package/out/zero-protocol/src/push.js +3 -114
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-protocol/src/query-server.d.ts +150 -0
- package/out/zero-protocol/src/query-server.d.ts.map +1 -0
- package/out/zero-protocol/src/query-server.js +16 -0
- package/out/zero-protocol/src/query-server.js.map +1 -0
- package/out/zero-protocol/src/up.js +1 -1
- package/out/zero-server/src/mod.d.ts +4 -2
- package/out/zero-server/src/mod.d.ts.map +1 -1
- package/out/zero-server/src/process-mutations.d.ts +50 -4
- package/out/zero-server/src/process-mutations.d.ts.map +1 -1
- package/out/zero-server/src/process-mutations.js +73 -36
- package/out/zero-server/src/process-mutations.js.map +1 -1
- package/out/zero-server/src/push-processor.d.ts +3 -3
- package/out/zero-server/src/push-processor.d.ts.map +1 -1
- package/out/zero-server/src/push-processor.js.map +1 -1
- package/out/zero-server/src/queries/process-queries.d.ts +45 -53
- package/out/zero-server/src/queries/process-queries.d.ts.map +1 -1
- package/out/zero-server/src/queries/process-queries.js +72 -53
- package/out/zero-server/src/queries/process-queries.js.map +1 -1
- package/out/zero-server/src/zql-database.js.map +1 -1
- package/out/zero-types/src/default-types.d.ts +1 -0
- package/out/zero-types/src/default-types.d.ts.map +1 -1
- package/out/zql/src/builder/builder.d.ts.map +1 -1
- package/out/zql/src/builder/builder.js +17 -7
- package/out/zql/src/builder/builder.js.map +1 -1
- package/out/zql/src/ivm/cap.d.ts +32 -0
- package/out/zql/src/ivm/cap.d.ts.map +1 -0
- package/out/zql/src/ivm/cap.js +205 -0
- package/out/zql/src/ivm/cap.js.map +1 -0
- package/out/zql/src/ivm/constraint.js +1 -1
- package/out/zql/src/ivm/flipped-join.d.ts.map +1 -1
- package/out/zql/src/ivm/flipped-join.js +61 -15
- package/out/zql/src/ivm/flipped-join.js.map +1 -1
- package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
- package/out/zql/src/ivm/memory-source.js +3 -4
- package/out/zql/src/ivm/memory-source.js.map +1 -1
- package/out/zql/src/ivm/schema.d.ts +8 -0
- package/out/zql/src/ivm/schema.d.ts.map +1 -1
- package/out/zql/src/ivm/take.js +2 -2
- package/out/zql/src/mutate/mutator-registry.js.map +1 -1
- package/out/zql/src/mutate/mutator.d.ts +11 -2
- package/out/zql/src/mutate/mutator.d.ts.map +1 -1
- package/out/zql/src/mutate/mutator.js.map +1 -1
- package/out/zql/src/query/query-registry.d.ts +9 -2
- package/out/zql/src/query/query-registry.d.ts.map +1 -1
- package/out/zql/src/query/query-registry.js.map +1 -1
- package/out/zqlite/src/table-source.d.ts.map +1 -1
- package/out/zqlite/src/table-source.js +4 -1
- package/out/zqlite/src/table-source.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations-patch.js","names":[],"sources":["../../../../zero-protocol/src/mutations-patch.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport {mutationResponseSchema} from './
|
|
1
|
+
{"version":3,"file":"mutations-patch.js","names":[],"sources":["../../../../zero-protocol/src/mutations-patch.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport {mutationResponseSchema} from './mutation.ts';\n\n/**\n * Mutation results are stored ephemerally in the client\n * hence why we only have the `put` operation.\n *\n * On put the mutation promise is resolved/rejected\n * and reference released.\n */\nexport const putOpSchema = v.object({\n op: v.literal('put'),\n mutation: mutationResponseSchema,\n});\nexport const delOpSchema = v.object({\n op: v.literal('del'),\n id: mutationIDSchema,\n});\n\nconst patchOpSchema = v.union(putOpSchema, delOpSchema);\nexport const mutationsPatchSchema = v.array(patchOpSchema);\nexport type MutationPatch = v.Infer<typeof patchOpSchema>;\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,cAAc,eAAE,OAAO;CAClC,IAAI,eAAE,QAAQ,MAAM;CACpB,UAAU;CACX,CAAC;AACF,IAAa,cAAc,eAAE,OAAO;CAClC,IAAI,eAAE,QAAQ,MAAM;CACpB,IAAI;CACL,CAAC;AAEF,IAAM,gBAAgB,eAAE,MAAM,aAAa,YAAY;AACvD,IAAa,uBAAuB,eAAE,MAAM,cAAc"}
|
|
@@ -1,177 +1,5 @@
|
|
|
1
1
|
import * as v from '../../shared/src/valita.ts';
|
|
2
|
-
import
|
|
3
|
-
export declare const CRUD_MUTATION_NAME = "_zero_crud";
|
|
4
|
-
export declare const CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
|
|
5
|
-
export declare const cleanupResultsArgSchema: v.UnionType<[v.ObjectType<{
|
|
6
|
-
clientGroupID: v.Type<string>;
|
|
7
|
-
clientID: v.Type<string>;
|
|
8
|
-
upToMutationID: v.Type<number>;
|
|
9
|
-
}, undefined>, v.ObjectType<{
|
|
10
|
-
type: v.Type<"single">;
|
|
11
|
-
clientGroupID: v.Type<string>;
|
|
12
|
-
clientID: v.Type<string>;
|
|
13
|
-
upToMutationID: v.Type<number>;
|
|
14
|
-
}, undefined>, v.ObjectType<{
|
|
15
|
-
type: v.Type<"bulk">;
|
|
16
|
-
clientGroupID: v.Type<string>;
|
|
17
|
-
clientIDs: v.VariadicTupleType<[v.Type<string>], v.Type<string>, []>;
|
|
18
|
-
}, undefined>]>;
|
|
19
|
-
/**
|
|
20
|
-
* Inserts if entity with id does not already exist.
|
|
21
|
-
*/
|
|
22
|
-
declare const insertOpSchema: v.ObjectType<{
|
|
23
|
-
op: v.Type<"insert">;
|
|
24
|
-
tableName: v.Type<string>;
|
|
25
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
26
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
27
|
-
}, undefined>;
|
|
28
|
-
/**
|
|
29
|
-
* Upsert semantics. Inserts if entity with id does not already exist,
|
|
30
|
-
* otherwise updates existing entity with id.
|
|
31
|
-
*/
|
|
32
|
-
declare const upsertOpSchema: v.ObjectType<{
|
|
33
|
-
op: v.Type<"upsert">;
|
|
34
|
-
tableName: v.Type<string>;
|
|
35
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
36
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
37
|
-
}, undefined>;
|
|
38
|
-
/**
|
|
39
|
-
* Updates if entity with id exists, otherwise does nothing.
|
|
40
|
-
*/
|
|
41
|
-
declare const updateOpSchema: v.ObjectType<{
|
|
42
|
-
op: v.Type<"update">;
|
|
43
|
-
tableName: v.Type<string>;
|
|
44
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
45
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
46
|
-
}, undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* Deletes entity with id if it exists, otherwise does nothing.
|
|
49
|
-
*/
|
|
50
|
-
declare const deleteOpSchema: v.ObjectType<{
|
|
51
|
-
op: v.Type<"delete">;
|
|
52
|
-
tableName: v.Type<string>;
|
|
53
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
54
|
-
value: v.Type<Readonly<Record<string, string | number | boolean>>>;
|
|
55
|
-
}, undefined>;
|
|
56
|
-
declare const crudOpSchema: v.UnionType<[v.ObjectType<{
|
|
57
|
-
op: v.Type<"insert">;
|
|
58
|
-
tableName: v.Type<string>;
|
|
59
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
60
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
61
|
-
}, undefined>, v.ObjectType<{
|
|
62
|
-
op: v.Type<"upsert">;
|
|
63
|
-
tableName: v.Type<string>;
|
|
64
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
65
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
66
|
-
}, undefined>, v.ObjectType<{
|
|
67
|
-
op: v.Type<"update">;
|
|
68
|
-
tableName: v.Type<string>;
|
|
69
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
70
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
71
|
-
}, undefined>, v.ObjectType<{
|
|
72
|
-
op: v.Type<"delete">;
|
|
73
|
-
tableName: v.Type<string>;
|
|
74
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
75
|
-
value: v.Type<Readonly<Record<string, string | number | boolean>>>;
|
|
76
|
-
}, undefined>]>;
|
|
77
|
-
declare const crudArgSchema: v.ObjectType<{
|
|
78
|
-
ops: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
79
|
-
op: v.Type<"insert">;
|
|
80
|
-
tableName: v.Type<string>;
|
|
81
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
82
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
83
|
-
}, undefined>, v.ObjectType<{
|
|
84
|
-
op: v.Type<"upsert">;
|
|
85
|
-
tableName: v.Type<string>;
|
|
86
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
87
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
88
|
-
}, undefined>, v.ObjectType<{
|
|
89
|
-
op: v.Type<"update">;
|
|
90
|
-
tableName: v.Type<string>;
|
|
91
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
92
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
93
|
-
}, undefined>, v.ObjectType<{
|
|
94
|
-
op: v.Type<"delete">;
|
|
95
|
-
tableName: v.Type<string>;
|
|
96
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
97
|
-
value: v.Type<Readonly<Record<string, string | number | boolean>>>;
|
|
98
|
-
}, undefined>]>>;
|
|
99
|
-
}, undefined>;
|
|
100
|
-
export declare const crudMutationSchema: v.ObjectType<{
|
|
101
|
-
type: v.Type<"crud">;
|
|
102
|
-
id: v.Type<number>;
|
|
103
|
-
clientID: v.Type<string>;
|
|
104
|
-
name: v.Type<"_zero_crud">;
|
|
105
|
-
args: v.TupleType<[v.ObjectType<{
|
|
106
|
-
ops: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
107
|
-
op: v.Type<"insert">;
|
|
108
|
-
tableName: v.Type<string>;
|
|
109
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
110
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
111
|
-
}, undefined>, v.ObjectType<{
|
|
112
|
-
op: v.Type<"upsert">;
|
|
113
|
-
tableName: v.Type<string>;
|
|
114
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
115
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
116
|
-
}, undefined>, v.ObjectType<{
|
|
117
|
-
op: v.Type<"update">;
|
|
118
|
-
tableName: v.Type<string>;
|
|
119
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
120
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
121
|
-
}, undefined>, v.ObjectType<{
|
|
122
|
-
op: v.Type<"delete">;
|
|
123
|
-
tableName: v.Type<string>;
|
|
124
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
125
|
-
value: v.Type<Readonly<Record<string, string | number | boolean>>>;
|
|
126
|
-
}, undefined>]>>;
|
|
127
|
-
}, undefined>]>;
|
|
128
|
-
timestamp: v.Type<number>;
|
|
129
|
-
}, undefined>;
|
|
130
|
-
export declare const customMutationSchema: v.ObjectType<{
|
|
131
|
-
type: v.Type<"custom">;
|
|
132
|
-
id: v.Type<number>;
|
|
133
|
-
clientID: v.Type<string>;
|
|
134
|
-
name: v.Type<string>;
|
|
135
|
-
args: v.ArrayType<v.Type<import("../../shared/src/json.ts").ReadonlyJSONValue>>;
|
|
136
|
-
timestamp: v.Type<number>;
|
|
137
|
-
}, undefined>;
|
|
138
|
-
export declare const mutationSchema: v.UnionType<[v.ObjectType<{
|
|
139
|
-
type: v.Type<"crud">;
|
|
140
|
-
id: v.Type<number>;
|
|
141
|
-
clientID: v.Type<string>;
|
|
142
|
-
name: v.Type<"_zero_crud">;
|
|
143
|
-
args: v.TupleType<[v.ObjectType<{
|
|
144
|
-
ops: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
145
|
-
op: v.Type<"insert">;
|
|
146
|
-
tableName: v.Type<string>;
|
|
147
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
148
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
149
|
-
}, undefined>, v.ObjectType<{
|
|
150
|
-
op: v.Type<"upsert">;
|
|
151
|
-
tableName: v.Type<string>;
|
|
152
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
153
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
154
|
-
}, undefined>, v.ObjectType<{
|
|
155
|
-
op: v.Type<"update">;
|
|
156
|
-
tableName: v.Type<string>;
|
|
157
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
158
|
-
value: v.Type<Readonly<Record<string, import("../../shared/src/json.ts").ReadonlyJSONValue | undefined>>>;
|
|
159
|
-
}, undefined>, v.ObjectType<{
|
|
160
|
-
op: v.Type<"delete">;
|
|
161
|
-
tableName: v.Type<string>;
|
|
162
|
-
primaryKey: v.Type<readonly [string, ...string[]]>;
|
|
163
|
-
value: v.Type<Readonly<Record<string, string | number | boolean>>>;
|
|
164
|
-
}, undefined>]>>;
|
|
165
|
-
}, undefined>]>;
|
|
166
|
-
timestamp: v.Type<number>;
|
|
167
|
-
}, undefined>, v.ObjectType<{
|
|
168
|
-
type: v.Type<"custom">;
|
|
169
|
-
id: v.Type<number>;
|
|
170
|
-
clientID: v.Type<string>;
|
|
171
|
-
name: v.Type<string>;
|
|
172
|
-
args: v.ArrayType<v.Type<import("../../shared/src/json.ts").ReadonlyJSONValue>>;
|
|
173
|
-
timestamp: v.Type<number>;
|
|
174
|
-
}, undefined>]>;
|
|
2
|
+
import { mutationResponseSchema } from './mutation.ts';
|
|
175
3
|
export declare const pushBodySchema: v.ObjectType<{
|
|
176
4
|
clientGroupID: v.Type<string>;
|
|
177
5
|
mutations: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
@@ -274,43 +102,6 @@ export declare const pushMessageSchema: v.TupleType<[v.Type<"push">, v.ObjectTyp
|
|
|
274
102
|
/** W3C traceparent header for distributed tracing. */
|
|
275
103
|
traceparent: v.Optional<string>;
|
|
276
104
|
}, undefined>]>;
|
|
277
|
-
declare const mutationOkSchema: v.ObjectType<{
|
|
278
|
-
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
279
|
-
}, undefined>;
|
|
280
|
-
declare const mutationErrorSchema: v.UnionType<[v.ObjectType<{
|
|
281
|
-
error: v.Type<"app">;
|
|
282
|
-
message: v.Optional<string>;
|
|
283
|
-
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
284
|
-
}, undefined>, v.ObjectType<{
|
|
285
|
-
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
286
|
-
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
287
|
-
}, undefined>]>;
|
|
288
|
-
export declare const mutationResultSchema: v.UnionType<[v.ObjectType<{
|
|
289
|
-
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
290
|
-
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
291
|
-
error: v.Type<"app">;
|
|
292
|
-
message: v.Optional<string>;
|
|
293
|
-
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
294
|
-
}, undefined>, v.ObjectType<{
|
|
295
|
-
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
296
|
-
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
297
|
-
}, undefined>]>]>;
|
|
298
|
-
export declare const mutationResponseSchema: v.ObjectType<{
|
|
299
|
-
id: v.ObjectType<{
|
|
300
|
-
id: v.Type<number>;
|
|
301
|
-
clientID: v.Type<string>;
|
|
302
|
-
}, undefined>;
|
|
303
|
-
result: v.UnionType<[v.ObjectType<{
|
|
304
|
-
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
305
|
-
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
306
|
-
error: v.Type<"app">;
|
|
307
|
-
message: v.Optional<string>;
|
|
308
|
-
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
309
|
-
}, undefined>, v.ObjectType<{
|
|
310
|
-
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
311
|
-
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
312
|
-
}, undefined>]>]>;
|
|
313
|
-
}, undefined>;
|
|
314
105
|
declare const pushOkSchema: v.ObjectType<{
|
|
315
106
|
mutations: v.ArrayType<v.ObjectType<{
|
|
316
107
|
id: v.ObjectType<{
|
|
@@ -332,7 +123,7 @@ declare const pushOkSchema: v.ObjectType<{
|
|
|
332
123
|
/**
|
|
333
124
|
* @deprecated push errors are now represented as ['error', { ... }] messages
|
|
334
125
|
*/
|
|
335
|
-
declare const pushErrorSchema: v.UnionType<[v.ObjectType<{
|
|
126
|
+
export declare const pushErrorSchema: v.UnionType<[v.ObjectType<{
|
|
336
127
|
/** @deprecated */
|
|
337
128
|
error: v.Type<"unsupportedPushVersion">;
|
|
338
129
|
/** @deprecated */
|
|
@@ -578,39 +369,17 @@ export declare const ackMutationResponsesMessageSchema: v.TupleType<[v.Type<"ack
|
|
|
578
369
|
id: v.Type<number>;
|
|
579
370
|
clientID: v.Type<string>;
|
|
580
371
|
}, undefined>]>;
|
|
581
|
-
/**
|
|
582
|
-
* The schema for the querystring parameters of the custom push endpoint.
|
|
583
|
-
*/
|
|
584
|
-
export declare const pushParamsSchema: v.ObjectType<{
|
|
585
|
-
schema: v.Type<string>;
|
|
586
|
-
appID: v.Type<string>;
|
|
587
|
-
}, undefined>;
|
|
588
|
-
export type InsertOp = v.Infer<typeof insertOpSchema>;
|
|
589
|
-
export type UpsertOp = v.Infer<typeof upsertOpSchema>;
|
|
590
|
-
export type UpdateOp = v.Infer<typeof updateOpSchema>;
|
|
591
|
-
export type DeleteOp = v.Infer<typeof deleteOpSchema>;
|
|
592
|
-
export type CRUDOp = v.Infer<typeof crudOpSchema>;
|
|
593
|
-
export type CRUDOpKind = CRUDOp['op'];
|
|
594
|
-
export type CRUDMutationArg = v.Infer<typeof crudArgSchema>;
|
|
595
|
-
export type CRUDMutation = v.Infer<typeof crudMutationSchema>;
|
|
596
|
-
export type CustomMutation = v.Infer<typeof customMutationSchema>;
|
|
597
|
-
export type Mutation = v.Infer<typeof mutationSchema>;
|
|
598
372
|
export type PushBody = v.Infer<typeof pushBodySchema>;
|
|
599
373
|
export type PushMessage = v.Infer<typeof pushMessageSchema>;
|
|
600
374
|
export type PushResponseBody = v.Infer<typeof pushResponseBodySchema>;
|
|
601
375
|
export type PushResponse = v.Infer<typeof pushResponseSchema>;
|
|
602
376
|
export type PushResponseMessage = v.Infer<typeof pushResponseMessageSchema>;
|
|
603
377
|
export type MutationResponse = v.Infer<typeof mutationResponseSchema>;
|
|
604
|
-
export type MutationOk = v.Infer<typeof mutationOkSchema>;
|
|
605
|
-
export type MutationError = v.Infer<typeof mutationErrorSchema>;
|
|
606
378
|
/**
|
|
607
379
|
* @deprecated push errors are now represented as ['error', { ... }] messages
|
|
608
380
|
*/
|
|
609
381
|
export type PushError = v.Infer<typeof pushErrorSchema>;
|
|
610
382
|
export type PushOk = v.Infer<typeof pushOkSchema>;
|
|
611
|
-
export type MutationResult = v.Infer<typeof mutationResultSchema>;
|
|
612
383
|
export type AckMutationMessage = v.Infer<typeof ackMutationResponsesMessageSchema>;
|
|
613
|
-
export
|
|
614
|
-
export type { MutationID } from './mutation-id.ts';
|
|
615
|
-
export declare function mapCRUD(arg: CRUDMutationArg, map: NameMapper): CRUDMutationArg;
|
|
384
|
+
export {};
|
|
616
385
|
//# sourceMappingURL=push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/push.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAGhD,OAAO,EAAC,sBAAsB,EAAiB,MAAM,eAAe,CAAC;AAErE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUzB;;;OAGG;;IAEH,sDAAsD;;aAEtD,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAT5B;;;OAGG;;IAEH,sDAAsD;;eAIqB,CAAC;AAE9E,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;aAEhB,CAAC;AA4CH;;GAEG;AACH,eAAO,MAAM,eAAe;IAzC1B,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;eAWnB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;IAhDjC,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;iBAawD,CAAC;AAE7E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;IAlD7B,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBnB,CAAC;AACF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;IAtDpC,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;IAOlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;mBAsBlB,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;eAG5C,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CACtC,OAAO,iCAAiC,CACzC,CAAC"}
|
|
@@ -1,84 +1,8 @@
|
|
|
1
1
|
import { valita_exports } from "../../shared/src/valita.js";
|
|
2
|
-
import { jsonSchema } from "../../shared/src/json-schema.js";
|
|
3
|
-
import { rowSchema } from "./data.js";
|
|
4
2
|
import { mutationIDSchema } from "./mutation-id.js";
|
|
5
3
|
import { pushFailedBodySchema } from "./error.js";
|
|
6
|
-
import {
|
|
7
|
-
import { primaryKeySchema, primaryKeyValueRecordSchema } from "./primary-key.js";
|
|
4
|
+
import { mutationResponseSchema, mutationSchema } from "./mutation.js";
|
|
8
5
|
//#region ../zero-protocol/src/push.ts
|
|
9
|
-
var CRUD_MUTATION_NAME = "_zero_crud";
|
|
10
|
-
var CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
|
|
11
|
-
var cleanupResultsArgSchema = valita_exports.union(valita_exports.object({
|
|
12
|
-
clientGroupID: valita_exports.string(),
|
|
13
|
-
clientID: valita_exports.string(),
|
|
14
|
-
upToMutationID: valita_exports.number()
|
|
15
|
-
}), valita_exports.object({
|
|
16
|
-
type: valita_exports.literal("single"),
|
|
17
|
-
clientGroupID: valita_exports.string(),
|
|
18
|
-
clientID: valita_exports.string(),
|
|
19
|
-
upToMutationID: valita_exports.number()
|
|
20
|
-
}), valita_exports.object({
|
|
21
|
-
type: valita_exports.literal("bulk"),
|
|
22
|
-
clientGroupID: valita_exports.string(),
|
|
23
|
-
clientIDs: valita_exports.tuple([valita_exports.string()]).concat(valita_exports.array(valita_exports.string()))
|
|
24
|
-
}));
|
|
25
|
-
/**
|
|
26
|
-
* Inserts if entity with id does not already exist.
|
|
27
|
-
*/
|
|
28
|
-
var insertOpSchema = valita_exports.object({
|
|
29
|
-
op: valita_exports.literal("insert"),
|
|
30
|
-
tableName: valita_exports.string(),
|
|
31
|
-
primaryKey: primaryKeySchema,
|
|
32
|
-
value: rowSchema
|
|
33
|
-
});
|
|
34
|
-
/**
|
|
35
|
-
* Upsert semantics. Inserts if entity with id does not already exist,
|
|
36
|
-
* otherwise updates existing entity with id.
|
|
37
|
-
*/
|
|
38
|
-
var upsertOpSchema = valita_exports.object({
|
|
39
|
-
op: valita_exports.literal("upsert"),
|
|
40
|
-
tableName: valita_exports.string(),
|
|
41
|
-
primaryKey: primaryKeySchema,
|
|
42
|
-
value: rowSchema
|
|
43
|
-
});
|
|
44
|
-
/**
|
|
45
|
-
* Updates if entity with id exists, otherwise does nothing.
|
|
46
|
-
*/
|
|
47
|
-
var updateOpSchema = valita_exports.object({
|
|
48
|
-
op: valita_exports.literal("update"),
|
|
49
|
-
tableName: valita_exports.string(),
|
|
50
|
-
primaryKey: primaryKeySchema,
|
|
51
|
-
value: rowSchema
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Deletes entity with id if it exists, otherwise does nothing.
|
|
55
|
-
*/
|
|
56
|
-
var deleteOpSchema = valita_exports.object({
|
|
57
|
-
op: valita_exports.literal("delete"),
|
|
58
|
-
tableName: valita_exports.string(),
|
|
59
|
-
primaryKey: primaryKeySchema,
|
|
60
|
-
value: primaryKeyValueRecordSchema
|
|
61
|
-
});
|
|
62
|
-
var crudOpSchema = valita_exports.union(insertOpSchema, upsertOpSchema, updateOpSchema, deleteOpSchema);
|
|
63
|
-
var crudArgSchema = valita_exports.object({ ops: valita_exports.array(crudOpSchema) });
|
|
64
|
-
var crudArgsSchema = valita_exports.tuple([crudArgSchema]);
|
|
65
|
-
var crudMutationSchema = valita_exports.object({
|
|
66
|
-
type: valita_exports.literal(CRUD),
|
|
67
|
-
id: valita_exports.number(),
|
|
68
|
-
clientID: valita_exports.string(),
|
|
69
|
-
name: valita_exports.literal(CRUD_MUTATION_NAME),
|
|
70
|
-
args: crudArgsSchema,
|
|
71
|
-
timestamp: valita_exports.number()
|
|
72
|
-
});
|
|
73
|
-
var customMutationSchema = valita_exports.object({
|
|
74
|
-
type: valita_exports.literal(Custom),
|
|
75
|
-
id: valita_exports.number(),
|
|
76
|
-
clientID: valita_exports.string(),
|
|
77
|
-
name: valita_exports.string(),
|
|
78
|
-
args: valita_exports.array(jsonSchema),
|
|
79
|
-
timestamp: valita_exports.number()
|
|
80
|
-
});
|
|
81
|
-
var mutationSchema = valita_exports.union(crudMutationSchema, customMutationSchema);
|
|
82
6
|
var pushBodySchema = valita_exports.object({
|
|
83
7
|
clientGroupID: valita_exports.string(),
|
|
84
8
|
mutations: valita_exports.array(mutationSchema),
|
|
@@ -90,26 +14,6 @@ var pushBodySchema = valita_exports.object({
|
|
|
90
14
|
traceparent: valita_exports.string().optional()
|
|
91
15
|
});
|
|
92
16
|
var pushMessageSchema = valita_exports.tuple([valita_exports.literal("push"), pushBodySchema]);
|
|
93
|
-
var appErrorSchema = valita_exports.object({
|
|
94
|
-
error: valita_exports.literal("app"),
|
|
95
|
-
message: valita_exports.string().optional(),
|
|
96
|
-
details: jsonSchema.optional()
|
|
97
|
-
});
|
|
98
|
-
var zeroErrorSchema = valita_exports.object({
|
|
99
|
-
error: valita_exports.union(
|
|
100
|
-
/** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */
|
|
101
|
-
valita_exports.literal("oooMutation"),
|
|
102
|
-
valita_exports.literal("alreadyProcessed")
|
|
103
|
-
),
|
|
104
|
-
details: jsonSchema.optional()
|
|
105
|
-
});
|
|
106
|
-
var mutationOkSchema = valita_exports.object({ data: jsonSchema.optional() });
|
|
107
|
-
var mutationErrorSchema = valita_exports.union(appErrorSchema, zeroErrorSchema);
|
|
108
|
-
var mutationResultSchema = valita_exports.union(mutationOkSchema, mutationErrorSchema);
|
|
109
|
-
var mutationResponseSchema = valita_exports.object({
|
|
110
|
-
id: mutationIDSchema,
|
|
111
|
-
result: mutationResultSchema
|
|
112
|
-
});
|
|
113
17
|
var pushOkSchema = valita_exports.object({ mutations: valita_exports.array(mutationResponseSchema) });
|
|
114
18
|
/**
|
|
115
19
|
* @deprecated push errors are now represented as ['error', { ... }] messages
|
|
@@ -147,25 +51,10 @@ var zeroPusherErrorSchema = valita_exports.object({
|
|
|
147
51
|
*/
|
|
148
52
|
var pushErrorSchema = valita_exports.union(unsupportedPushVersionSchema, unsupportedSchemaVersionSchema, httpErrorSchema, zeroPusherErrorSchema);
|
|
149
53
|
var pushResponseBodySchema = valita_exports.union(pushOkSchema, pushErrorSchema);
|
|
150
|
-
|
|
54
|
+
valita_exports.union(pushResponseBodySchema, pushFailedBodySchema);
|
|
151
55
|
var pushResponseMessageSchema = valita_exports.tuple([valita_exports.literal("pushResponse"), pushResponseBodySchema]);
|
|
152
56
|
var ackMutationResponsesMessageSchema = valita_exports.tuple([valita_exports.literal("ackMutationResponses"), mutationIDSchema]);
|
|
153
|
-
/**
|
|
154
|
-
* The schema for the querystring parameters of the custom push endpoint.
|
|
155
|
-
*/
|
|
156
|
-
var pushParamsSchema = valita_exports.object({
|
|
157
|
-
schema: valita_exports.string(),
|
|
158
|
-
appID: valita_exports.string()
|
|
159
|
-
});
|
|
160
|
-
function mapCRUD(arg, map) {
|
|
161
|
-
return { ops: arg.ops.map(({ op, tableName, primaryKey, value }) => ({
|
|
162
|
-
op,
|
|
163
|
-
tableName: map.tableName(tableName),
|
|
164
|
-
primaryKey: map.columns(tableName, primaryKey),
|
|
165
|
-
value: map.row(tableName, value)
|
|
166
|
-
})) };
|
|
167
|
-
}
|
|
168
57
|
//#endregion
|
|
169
|
-
export {
|
|
58
|
+
export { ackMutationResponsesMessageSchema, pushBodySchema, pushErrorSchema, pushMessageSchema, pushResponseMessageSchema };
|
|
170
59
|
|
|
171
60
|
//# sourceMappingURL=push.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","names":[],"sources":["../../../../zero-protocol/src/push.ts"],"sourcesContent":["import {jsonSchema} from '../../shared/src/json-schema.ts';\nimport * as v from '../../shared/src/valita.ts';\nimport type {NameMapper} from '../../zero-types/src/name-mapper.ts';\nimport {rowSchema} from './data.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport * as MutationType from './mutation-type-enum.ts';\nimport {primaryKeySchema, primaryKeyValueRecordSchema} from './primary-key.ts';\n\n// NOTE! If you change this name you must also change the\n// string in `replicache-impl.ts` But CRUD mutators are being\n// deleted soon so this should not happen.\nexport const CRUD_MUTATION_NAME = '_zero_crud';\n\n// Internal mutation name for cleaning up mutation results.\n// This mutation is sent from zero-cache to zero-server to delete\n// acknowledged mutation results from the upstream database.\nexport const CLEANUP_RESULTS_MUTATION_NAME = '_zero_cleanupResults';\n\nexport const cleanupResultsArgSchema = v.union(\n // Legacy format (no type field) - treat as single\n v.object({\n clientGroupID: v.string(),\n clientID: v.string(),\n upToMutationID: v.number(),\n }),\n // Explicit single: delete up to a specific mutation ID for one client\n v.object({\n type: v.literal('single'),\n clientGroupID: v.string(),\n clientID: v.string(),\n upToMutationID: v.number(),\n }),\n // Bulk: delete all mutations for multiple clients\n v.object({\n type: v.literal('bulk'),\n clientGroupID: v.string(),\n // oxlint-disable-next-line e18e/prefer-spread-syntax\n clientIDs: v.tuple([v.string()]).concat(v.array(v.string())),\n }),\n);\n\n/**\n * Inserts if entity with id does not already exist.\n */\nconst insertOpSchema = v.object({\n op: v.literal('insert'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n value: rowSchema,\n});\n\n/**\n * Upsert semantics. Inserts if entity with id does not already exist,\n * otherwise updates existing entity with id.\n */\nconst upsertOpSchema = v.object({\n op: v.literal('upsert'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n value: rowSchema,\n});\n\n/**\n * Updates if entity with id exists, otherwise does nothing.\n */\nconst updateOpSchema = v.object({\n op: v.literal('update'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n // Partial value with at least the primary key fields\n value: rowSchema,\n});\n\n/**\n * Deletes entity with id if it exists, otherwise does nothing.\n */\nconst deleteOpSchema = v.object({\n op: v.literal('delete'),\n tableName: v.string(),\n primaryKey: primaryKeySchema,\n // Partial value representing the primary key\n value: primaryKeyValueRecordSchema,\n});\n\nconst crudOpSchema = v.union(\n insertOpSchema,\n upsertOpSchema,\n updateOpSchema,\n deleteOpSchema,\n);\n\nconst crudArgSchema = v.object({\n ops: v.array(crudOpSchema),\n});\n\nconst crudArgsSchema = v.tuple([crudArgSchema]);\n\nexport const crudMutationSchema = v.object({\n type: v.literal(MutationType.CRUD),\n id: v.number(),\n clientID: v.string(),\n name: v.literal(CRUD_MUTATION_NAME),\n args: crudArgsSchema,\n timestamp: v.number(),\n});\n\nexport const customMutationSchema = v.object({\n type: v.literal(MutationType.Custom),\n id: v.number(),\n clientID: v.string(),\n name: v.string(),\n args: v.array(jsonSchema),\n timestamp: v.number(),\n});\n\nexport const mutationSchema = v.union(crudMutationSchema, customMutationSchema);\n\nexport const pushBodySchema = v.object({\n clientGroupID: v.string(),\n mutations: v.array(mutationSchema),\n pushVersion: v.number(),\n // For legacy (CRUD) mutations, the schema is tied to the client group /\n // sync connection. For custom mutations, schema versioning is delegated\n // to the custom protocol / api-server.\n schemaVersion: v.number().optional(),\n timestamp: v.number(),\n requestID: v.string(),\n /**\n * @deprecated auth is managed at client-group scope via connect/updateAuth\n * and should not be included in push messages.\n */\n auth: v.string().optional(),\n /** W3C traceparent header for distributed tracing. */\n traceparent: v.string().optional(),\n});\n\nexport const pushMessageSchema = v.tuple([v.literal('push'), pushBodySchema]);\n\nconst appErrorSchema = v.object({\n error: v.literal('app'),\n // The user can return any additional data here\n message: v.string().optional(),\n details: jsonSchema.optional(),\n});\nconst zeroErrorSchema = v.object({\n error: v.union(\n /** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */\n v.literal('oooMutation'),\n v.literal('alreadyProcessed'),\n ),\n details: jsonSchema.optional(),\n});\n\nconst mutationOkSchema = v.object({\n // The user can return any additional data here\n data: jsonSchema.optional(),\n});\nconst mutationErrorSchema = v.union(appErrorSchema, zeroErrorSchema);\n\nexport const mutationResultSchema = v.union(\n mutationOkSchema,\n mutationErrorSchema,\n);\n\nexport const mutationResponseSchema = v.object({\n id: mutationIDSchema,\n result: mutationResultSchema,\n});\n\nconst pushOkSchema = v.object({\n mutations: v.array(mutationResponseSchema),\n});\n\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedPushVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedPushVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedSchemaVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedSchemaVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push http errors are now represented as ['error', { ... }] messages\n */\nconst httpErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('http'),\n /** @deprecated */\n status: v.number(),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push zero errors are now represented as ['error', { ... }] messages\n */\nconst zeroPusherErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('zeroPusher'),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst pushErrorSchema = v.union(\n unsupportedPushVersionSchema,\n unsupportedSchemaVersionSchema,\n httpErrorSchema,\n zeroPusherErrorSchema,\n);\n\nexport const pushResponseBodySchema = v.union(pushOkSchema, pushErrorSchema);\n\nexport const pushResponseSchema = v.union(\n pushResponseBodySchema,\n pushFailedBodySchema,\n);\nexport const pushResponseMessageSchema = v.tuple([\n v.literal('pushResponse'),\n pushResponseBodySchema,\n]);\n\nexport const ackMutationResponsesMessageSchema = v.tuple([\n v.literal('ackMutationResponses'),\n mutationIDSchema,\n]);\n\n/**\n * The schema for the querystring parameters of the custom push endpoint.\n */\nexport const pushParamsSchema = v.object({\n schema: v.string(),\n appID: v.string(),\n});\n\nexport type InsertOp = v.Infer<typeof insertOpSchema>;\nexport type UpsertOp = v.Infer<typeof upsertOpSchema>;\nexport type UpdateOp = v.Infer<typeof updateOpSchema>;\nexport type DeleteOp = v.Infer<typeof deleteOpSchema>;\nexport type CRUDOp = v.Infer<typeof crudOpSchema>;\nexport type CRUDOpKind = CRUDOp['op'];\nexport type CRUDMutationArg = v.Infer<typeof crudArgSchema>;\nexport type CRUDMutation = v.Infer<typeof crudMutationSchema>;\nexport type CustomMutation = v.Infer<typeof customMutationSchema>;\nexport type Mutation = v.Infer<typeof mutationSchema>;\nexport type PushBody = v.Infer<typeof pushBodySchema>;\nexport type PushMessage = v.Infer<typeof pushMessageSchema>;\nexport type PushResponseBody = v.Infer<typeof pushResponseBodySchema>;\nexport type PushResponse = v.Infer<typeof pushResponseSchema>;\nexport type PushResponseMessage = v.Infer<typeof pushResponseMessageSchema>;\nexport type MutationResponse = v.Infer<typeof mutationResponseSchema>;\nexport type MutationOk = v.Infer<typeof mutationOkSchema>;\nexport type MutationError = v.Infer<typeof mutationErrorSchema>;\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport type PushError = v.Infer<typeof pushErrorSchema>;\nexport type PushOk = v.Infer<typeof pushOkSchema>;\nexport type MutationResult = v.Infer<typeof mutationResultSchema>;\nexport type AckMutationMessage = v.Infer<\n typeof ackMutationResponsesMessageSchema\n>;\nexport type CleanupResultsArg = v.Infer<typeof cleanupResultsArgSchema>;\nexport type {MutationID} from './mutation-id.ts';\n\nexport function mapCRUD(\n arg: CRUDMutationArg,\n map: NameMapper,\n): CRUDMutationArg {\n return {\n ops: arg.ops.map(\n ({op, tableName, primaryKey, value}) =>\n ({\n op,\n tableName: map.tableName(tableName),\n primaryKey: map.columns(tableName, primaryKey),\n value: map.row(tableName, value),\n // The cast is necessary because ts objects to the `value` field\n // for \"delete\" ops being different.\n }) as unknown as CRUDOp,\n ),\n };\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,qBAAqB;AAKlC,IAAa,gCAAgC;AAE7C,IAAa,0BAA0B,eAAE,MAEvC,eAAE,OAAO;CACP,eAAe,eAAE,QAAQ;CACzB,UAAU,eAAE,QAAQ;CACpB,gBAAgB,eAAE,QAAQ;CAC3B,CAAC,EAEF,eAAE,OAAO;CACP,MAAM,eAAE,QAAQ,SAAS;CACzB,eAAe,eAAE,QAAQ;CACzB,UAAU,eAAE,QAAQ;CACpB,gBAAgB,eAAE,QAAQ;CAC3B,CAAC,EAEF,eAAE,OAAO;CACP,MAAM,eAAE,QAAQ,OAAO;CACvB,eAAe,eAAE,QAAQ;CAEzB,WAAW,eAAE,MAAM,CAAC,eAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,eAAE,MAAM,eAAE,QAAQ,CAAC,CAAC;CAC7D,CAAC,CACH;;;;AAKD,IAAM,iBAAiB,eAAE,OAAO;CAC9B,IAAI,eAAE,QAAQ,SAAS;CACvB,WAAW,eAAE,QAAQ;CACrB,YAAY;CACZ,OAAO;CACR,CAAC;;;;;AAMF,IAAM,iBAAiB,eAAE,OAAO;CAC9B,IAAI,eAAE,QAAQ,SAAS;CACvB,WAAW,eAAE,QAAQ;CACrB,YAAY;CACZ,OAAO;CACR,CAAC;;;;AAKF,IAAM,iBAAiB,eAAE,OAAO;CAC9B,IAAI,eAAE,QAAQ,SAAS;CACvB,WAAW,eAAE,QAAQ;CACrB,YAAY;CAEZ,OAAO;CACR,CAAC;;;;AAKF,IAAM,iBAAiB,eAAE,OAAO;CAC9B,IAAI,eAAE,QAAQ,SAAS;CACvB,WAAW,eAAE,QAAQ;CACrB,YAAY;CAEZ,OAAO;CACR,CAAC;AAEF,IAAM,eAAe,eAAE,MACrB,gBACA,gBACA,gBACA,eACD;AAED,IAAM,gBAAgB,eAAE,OAAO,EAC7B,KAAK,eAAE,MAAM,aAAa,EAC3B,CAAC;AAEF,IAAM,iBAAiB,eAAE,MAAM,CAAC,cAAc,CAAC;AAE/C,IAAa,qBAAqB,eAAE,OAAO;CACzC,MAAM,eAAE,QAAQ,KAAkB;CAClC,IAAI,eAAE,QAAQ;CACd,UAAU,eAAE,QAAQ;CACpB,MAAM,eAAE,QAAQ,mBAAmB;CACnC,MAAM;CACN,WAAW,eAAE,QAAQ;CACtB,CAAC;AAEF,IAAa,uBAAuB,eAAE,OAAO;CAC3C,MAAM,eAAE,QAAQ,OAAoB;CACpC,IAAI,eAAE,QAAQ;CACd,UAAU,eAAE,QAAQ;CACpB,MAAM,eAAE,QAAQ;CAChB,MAAM,eAAE,MAAM,WAAW;CACzB,WAAW,eAAE,QAAQ;CACtB,CAAC;AAEF,IAAa,iBAAiB,eAAE,MAAM,oBAAoB,qBAAqB;AAE/E,IAAa,iBAAiB,eAAE,OAAO;CACrC,eAAe,eAAE,QAAQ;CACzB,WAAW,eAAE,MAAM,eAAe;CAClC,aAAa,eAAE,QAAQ;CAIvB,eAAe,eAAE,QAAQ,CAAC,UAAU;CACpC,WAAW,eAAE,QAAQ;CACrB,WAAW,eAAE,QAAQ;CAKrB,MAAM,eAAE,QAAQ,CAAC,UAAU;CAE3B,aAAa,eAAE,QAAQ,CAAC,UAAU;CACnC,CAAC;AAEF,IAAa,oBAAoB,eAAE,MAAM,CAAC,eAAE,QAAQ,OAAO,EAAE,eAAe,CAAC;AAE7E,IAAM,iBAAiB,eAAE,OAAO;CAC9B,OAAO,eAAE,QAAQ,MAAM;CAEvB,SAAS,eAAE,QAAQ,CAAC,UAAU;CAC9B,SAAS,WAAW,UAAU;CAC/B,CAAC;AACF,IAAM,kBAAkB,eAAE,OAAO;CAC/B,OAAO,eAAE;;EAEP,eAAE,QAAQ,cAAc;EACxB,eAAE,QAAQ,mBAAmB;EAC9B;CACD,SAAS,WAAW,UAAU;CAC/B,CAAC;AAEF,IAAM,mBAAmB,eAAE,OAAO,EAEhC,MAAM,WAAW,UAAU,EAC5B,CAAC;AACF,IAAM,sBAAsB,eAAE,MAAM,gBAAgB,gBAAgB;AAEpE,IAAa,uBAAuB,eAAE,MACpC,kBACA,oBACD;AAED,IAAa,yBAAyB,eAAE,OAAO;CAC7C,IAAI;CACJ,QAAQ;CACT,CAAC;AAEF,IAAM,eAAe,eAAE,OAAO,EAC5B,WAAW,eAAE,MAAM,uBAAuB,EAC3C,CAAC;;;;AAKF,IAAM,+BAA+B,eAAE,OAAO;CAE5C,OAAO,eAAE,QAAQ,yBAAyB;CAE1C,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,iCAAiC,eAAE,OAAO;CAE9C,OAAO,eAAE,QAAQ,2BAA2B;CAE5C,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,kBAAkB,eAAE,OAAO;CAE/B,OAAO,eAAE,QAAQ,OAAO;CAExB,QAAQ,eAAE,QAAQ;CAElB,SAAS,eAAE,QAAQ;CAEnB,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,wBAAwB,eAAE,OAAO;CAErC,OAAO,eAAE,QAAQ,aAAa;CAE9B,SAAS,eAAE,QAAQ;CAEnB,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,kBAAkB,eAAE,MACxB,8BACA,gCACA,iBACA,sBACD;AAED,IAAa,yBAAyB,eAAE,MAAM,cAAc,gBAAgB;AAE5E,IAAa,qBAAqB,eAAE,MAClC,wBACA,qBACD;AACD,IAAa,4BAA4B,eAAE,MAAM,CAC/C,eAAE,QAAQ,eAAe,EACzB,uBACD,CAAC;AAEF,IAAa,oCAAoC,eAAE,MAAM,CACvD,eAAE,QAAQ,uBAAuB,EACjC,iBACD,CAAC;;;;AAKF,IAAa,mBAAmB,eAAE,OAAO;CACvC,QAAQ,eAAE,QAAQ;CAClB,OAAO,eAAE,QAAQ;CAClB,CAAC;AAgCF,SAAgB,QACd,KACA,KACiB;AACjB,QAAO,EACL,KAAK,IAAI,IAAI,KACV,EAAC,IAAI,WAAW,YAAY,aAC1B;EACC;EACA,WAAW,IAAI,UAAU,UAAU;EACnC,YAAY,IAAI,QAAQ,WAAW,WAAW;EAC9C,OAAO,IAAI,IAAI,WAAW,MAAM;EAGjC,EACJ,EACF"}
|
|
1
|
+
{"version":3,"file":"push.js","names":[],"sources":["../../../../zero-protocol/src/push.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationIDSchema} from './mutation-id.ts';\nimport {mutationResponseSchema, mutationSchema} from './mutation.ts';\n\nexport const pushBodySchema = v.object({\n clientGroupID: v.string(),\n mutations: v.array(mutationSchema),\n pushVersion: v.number(),\n // For legacy (CRUD) mutations, the schema is tied to the client group /\n // sync connection. For custom mutations, schema versioning is delegated\n // to the custom protocol / api-server.\n schemaVersion: v.number().optional(),\n timestamp: v.number(),\n requestID: v.string(),\n /**\n * @deprecated auth is managed at client-group scope via connect/updateAuth\n * and should not be included in push messages.\n */\n auth: v.string().optional(),\n /** W3C traceparent header for distributed tracing. */\n traceparent: v.string().optional(),\n});\n\nexport const pushMessageSchema = v.tuple([v.literal('push'), pushBodySchema]);\n\nconst pushOkSchema = v.object({\n mutations: v.array(mutationResponseSchema),\n});\n\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedPushVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedPushVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nconst unsupportedSchemaVersionSchema = v.object({\n /** @deprecated */\n error: v.literal('unsupportedSchemaVersion'),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push http errors are now represented as ['error', { ... }] messages\n */\nconst httpErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('http'),\n /** @deprecated */\n status: v.number(),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push zero errors are now represented as ['error', { ... }] messages\n */\nconst zeroPusherErrorSchema = v.object({\n /** @deprecated */\n error: v.literal('zeroPusher'),\n /** @deprecated */\n details: v.string(),\n /** @deprecated */\n mutationIDs: v.array(mutationIDSchema).optional(),\n});\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport const pushErrorSchema = v.union(\n unsupportedPushVersionSchema,\n unsupportedSchemaVersionSchema,\n httpErrorSchema,\n zeroPusherErrorSchema,\n);\n\nexport const pushResponseBodySchema = v.union(pushOkSchema, pushErrorSchema);\n\nexport const pushResponseSchema = v.union(\n pushResponseBodySchema,\n pushFailedBodySchema,\n);\nexport const pushResponseMessageSchema = v.tuple([\n v.literal('pushResponse'),\n pushResponseBodySchema,\n]);\n\nexport const ackMutationResponsesMessageSchema = v.tuple([\n v.literal('ackMutationResponses'),\n mutationIDSchema,\n]);\n\nexport type PushBody = v.Infer<typeof pushBodySchema>;\nexport type PushMessage = v.Infer<typeof pushMessageSchema>;\nexport type PushResponseBody = v.Infer<typeof pushResponseBodySchema>;\nexport type PushResponse = v.Infer<typeof pushResponseSchema>;\nexport type PushResponseMessage = v.Infer<typeof pushResponseMessageSchema>;\nexport type MutationResponse = v.Infer<typeof mutationResponseSchema>;\n/**\n * @deprecated push errors are now represented as ['error', { ... }] messages\n */\nexport type PushError = v.Infer<typeof pushErrorSchema>;\nexport type PushOk = v.Infer<typeof pushOkSchema>;\nexport type AckMutationMessage = v.Infer<\n typeof ackMutationResponsesMessageSchema\n>;\n"],"mappings":";;;;;AAKA,IAAa,iBAAiB,eAAE,OAAO;CACrC,eAAe,eAAE,QAAQ;CACzB,WAAW,eAAE,MAAM,eAAe;CAClC,aAAa,eAAE,QAAQ;CAIvB,eAAe,eAAE,QAAQ,CAAC,UAAU;CACpC,WAAW,eAAE,QAAQ;CACrB,WAAW,eAAE,QAAQ;CAKrB,MAAM,eAAE,QAAQ,CAAC,UAAU;CAE3B,aAAa,eAAE,QAAQ,CAAC,UAAU;CACnC,CAAC;AAEF,IAAa,oBAAoB,eAAE,MAAM,CAAC,eAAE,QAAQ,OAAO,EAAE,eAAe,CAAC;AAE7E,IAAM,eAAe,eAAE,OAAO,EAC5B,WAAW,eAAE,MAAM,uBAAuB,EAC3C,CAAC;;;;AAKF,IAAM,+BAA+B,eAAE,OAAO;CAE5C,OAAO,eAAE,QAAQ,yBAAyB;CAE1C,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,iCAAiC,eAAE,OAAO;CAE9C,OAAO,eAAE,QAAQ,2BAA2B;CAE5C,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,kBAAkB,eAAE,OAAO;CAE/B,OAAO,eAAE,QAAQ,OAAO;CAExB,QAAQ,eAAE,QAAQ;CAElB,SAAS,eAAE,QAAQ;CAEnB,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAM,wBAAwB,eAAE,OAAO;CAErC,OAAO,eAAE,QAAQ,aAAa;CAE9B,SAAS,eAAE,QAAQ;CAEnB,aAAa,eAAE,MAAM,iBAAiB,CAAC,UAAU;CAClD,CAAC;;;;AAIF,IAAa,kBAAkB,eAAE,MAC/B,8BACA,gCACA,iBACA,sBACD;AAED,IAAa,yBAAyB,eAAE,MAAM,cAAc,gBAAgB;AAE1C,eAAE,MAClC,wBACA,qBACD;AACD,IAAa,4BAA4B,eAAE,MAAM,CAC/C,eAAE,QAAQ,eAAe,EACzB,uBACD,CAAC;AAEF,IAAa,oCAAoC,eAAE,MAAM,CACvD,eAAE,QAAQ,uBAAuB,EACjC,iBACD,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as v from '../../shared/src/valita.ts';
|
|
2
|
+
export declare const queryResultSchema: v.UnionType<[v.ObjectType<{
|
|
3
|
+
id: v.Type<string>;
|
|
4
|
+
name: v.Type<string>;
|
|
5
|
+
ast: v.Type<import("./ast.ts").AST>;
|
|
6
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
7
|
+
error: v.Type<"app">;
|
|
8
|
+
id: v.Type<string>;
|
|
9
|
+
name: v.Type<string>;
|
|
10
|
+
message: v.Optional<string>;
|
|
11
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
12
|
+
}, undefined>, v.ObjectType<{
|
|
13
|
+
error: v.Type<"parse">;
|
|
14
|
+
id: v.Type<string>;
|
|
15
|
+
name: v.Type<string>;
|
|
16
|
+
message: v.Type<string>;
|
|
17
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
18
|
+
}, undefined>]>]>;
|
|
19
|
+
export type QueryResult = v.Infer<typeof queryResultSchema>;
|
|
20
|
+
export declare const queryResponseBodySchema: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
21
|
+
id: v.Type<string>;
|
|
22
|
+
name: v.Type<string>;
|
|
23
|
+
ast: v.Type<import("./ast.ts").AST>;
|
|
24
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
25
|
+
error: v.Type<"app">;
|
|
26
|
+
id: v.Type<string>;
|
|
27
|
+
name: v.Type<string>;
|
|
28
|
+
message: v.Optional<string>;
|
|
29
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
30
|
+
}, undefined>, v.ObjectType<{
|
|
31
|
+
error: v.Type<"parse">;
|
|
32
|
+
id: v.Type<string>;
|
|
33
|
+
name: v.Type<string>;
|
|
34
|
+
message: v.Type<string>;
|
|
35
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
36
|
+
}, undefined>]>]>>;
|
|
37
|
+
export type QueryResponseBody = v.Infer<typeof queryResponseBodySchema>;
|
|
38
|
+
export declare const querySuccessSchema: v.ObjectType<{
|
|
39
|
+
kind: v.Type<"QueryResponse">;
|
|
40
|
+
userID: v.Optional<string | null>;
|
|
41
|
+
queries: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
42
|
+
id: v.Type<string>;
|
|
43
|
+
name: v.Type<string>;
|
|
44
|
+
ast: v.Type<import("./ast.ts").AST>;
|
|
45
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
46
|
+
error: v.Type<"app">;
|
|
47
|
+
id: v.Type<string>;
|
|
48
|
+
name: v.Type<string>;
|
|
49
|
+
message: v.Optional<string>;
|
|
50
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
51
|
+
}, undefined>, v.ObjectType<{
|
|
52
|
+
error: v.Type<"parse">;
|
|
53
|
+
id: v.Type<string>;
|
|
54
|
+
name: v.Type<string>;
|
|
55
|
+
message: v.Type<string>;
|
|
56
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
57
|
+
}, undefined>]>]>>;
|
|
58
|
+
}, undefined>;
|
|
59
|
+
export type QuerySuccess = v.Infer<typeof querySuccessSchema>;
|
|
60
|
+
export declare const queryResponseSchema: v.UnionType<[v.ObjectType<{
|
|
61
|
+
kind: v.Type<"QueryResponse">;
|
|
62
|
+
userID: v.Optional<string | null>;
|
|
63
|
+
queries: v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
64
|
+
id: v.Type<string>;
|
|
65
|
+
name: v.Type<string>;
|
|
66
|
+
ast: v.Type<import("./ast.ts").AST>;
|
|
67
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
68
|
+
error: v.Type<"app">;
|
|
69
|
+
id: v.Type<string>;
|
|
70
|
+
name: v.Type<string>;
|
|
71
|
+
message: v.Optional<string>;
|
|
72
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
73
|
+
}, undefined>, v.ObjectType<{
|
|
74
|
+
error: v.Type<"parse">;
|
|
75
|
+
id: v.Type<string>;
|
|
76
|
+
name: v.Type<string>;
|
|
77
|
+
message: v.Type<string>;
|
|
78
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
79
|
+
}, undefined>]>]>>;
|
|
80
|
+
}, undefined>, v.UnionType<[v.ObjectType<Omit<{
|
|
81
|
+
kind: v.Type<"TransformFailed">;
|
|
82
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
83
|
+
queryIDs: v.ArrayType<v.Type<string>>;
|
|
84
|
+
message: v.Type<string>;
|
|
85
|
+
}, "reason" | "origin"> & {
|
|
86
|
+
origin: v.Type<"server">;
|
|
87
|
+
reason: v.Type<"parse" | "database" | "internal">;
|
|
88
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
89
|
+
kind: v.Type<"TransformFailed">;
|
|
90
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
91
|
+
queryIDs: v.ArrayType<v.Type<string>>;
|
|
92
|
+
message: v.Type<string>;
|
|
93
|
+
}, "reason" | "status" | "origin" | "bodyPreview"> & {
|
|
94
|
+
origin: v.Type<"zeroCache">;
|
|
95
|
+
reason: v.Type<"http">;
|
|
96
|
+
status: v.Type<number>;
|
|
97
|
+
bodyPreview: v.Optional<string>;
|
|
98
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
99
|
+
kind: v.Type<"TransformFailed">;
|
|
100
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
101
|
+
queryIDs: v.ArrayType<v.Type<string>>;
|
|
102
|
+
message: v.Type<string>;
|
|
103
|
+
}, "reason" | "origin"> & {
|
|
104
|
+
origin: v.Type<"zeroCache">;
|
|
105
|
+
reason: v.Type<"parse" | "internal" | "timeout">;
|
|
106
|
+
}, undefined>]>, v.UnionType<[v.TupleType<[v.Type<"transformed">, v.ArrayType<v.UnionType<[v.ObjectType<{
|
|
107
|
+
id: v.Type<string>;
|
|
108
|
+
name: v.Type<string>;
|
|
109
|
+
ast: v.Type<import("./ast.ts").AST>;
|
|
110
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
111
|
+
error: v.Type<"app">;
|
|
112
|
+
id: v.Type<string>;
|
|
113
|
+
name: v.Type<string>;
|
|
114
|
+
message: v.Optional<string>;
|
|
115
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
116
|
+
}, undefined>, v.ObjectType<{
|
|
117
|
+
error: v.Type<"parse">;
|
|
118
|
+
id: v.Type<string>;
|
|
119
|
+
name: v.Type<string>;
|
|
120
|
+
message: v.Type<string>;
|
|
121
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
122
|
+
}, undefined>]>]>>]>, v.TupleType<[v.Type<"transformFailed">, v.UnionType<[v.ObjectType<Omit<{
|
|
123
|
+
kind: v.Type<"TransformFailed">;
|
|
124
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
125
|
+
queryIDs: v.ArrayType<v.Type<string>>;
|
|
126
|
+
message: v.Type<string>;
|
|
127
|
+
}, "reason" | "origin"> & {
|
|
128
|
+
origin: v.Type<"server">;
|
|
129
|
+
reason: v.Type<"parse" | "database" | "internal">;
|
|
130
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
131
|
+
kind: v.Type<"TransformFailed">;
|
|
132
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
133
|
+
queryIDs: v.ArrayType<v.Type<string>>;
|
|
134
|
+
message: v.Type<string>;
|
|
135
|
+
}, "reason" | "status" | "origin" | "bodyPreview"> & {
|
|
136
|
+
origin: v.Type<"zeroCache">;
|
|
137
|
+
reason: v.Type<"http">;
|
|
138
|
+
status: v.Type<number>;
|
|
139
|
+
bodyPreview: v.Optional<string>;
|
|
140
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
141
|
+
kind: v.Type<"TransformFailed">;
|
|
142
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
143
|
+
queryIDs: v.ArrayType<v.Type<string>>;
|
|
144
|
+
message: v.Type<string>;
|
|
145
|
+
}, "reason" | "origin"> & {
|
|
146
|
+
origin: v.Type<"zeroCache">;
|
|
147
|
+
reason: v.Type<"parse" | "internal" | "timeout">;
|
|
148
|
+
}, undefined>]>]>]>]>;
|
|
149
|
+
export type QueryResponse = v.Infer<typeof queryResponseSchema>;
|
|
150
|
+
//# sourceMappingURL=query-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-server.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/query-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAQhD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;iBAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;kBAA6B,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;aAI7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAK/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { valita_exports } from "../../shared/src/valita.js";
|
|
2
|
+
import { transformFailedBodySchema } from "./error.js";
|
|
3
|
+
import { erroredQuerySchema, transformResponseMessageSchema, transformedQuerySchema } from "./custom-queries.js";
|
|
4
|
+
//#region ../zero-protocol/src/query-server.ts
|
|
5
|
+
var queryResultSchema = valita_exports.union(transformedQuerySchema, erroredQuerySchema);
|
|
6
|
+
var queryResponseBodySchema = valita_exports.array(queryResultSchema);
|
|
7
|
+
var querySuccessSchema = valita_exports.object({
|
|
8
|
+
kind: valita_exports.literal("QueryResponse"),
|
|
9
|
+
userID: valita_exports.string().nullable().optional(),
|
|
10
|
+
queries: queryResponseBodySchema
|
|
11
|
+
});
|
|
12
|
+
var queryResponseSchema = valita_exports.union(querySuccessSchema, transformFailedBodySchema, transformResponseMessageSchema);
|
|
13
|
+
//#endregion
|
|
14
|
+
export { queryResponseSchema };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=query-server.js.map
|