@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
|
@@ -35,6 +35,6 @@ var transformFailedMessageSchema = valita_exports.tuple([valita_exports.literal(
|
|
|
35
35
|
var transformOkMessageSchema = valita_exports.tuple([valita_exports.literal("transformed"), transformResponseBodySchema]);
|
|
36
36
|
var transformResponseMessageSchema = valita_exports.union(transformOkMessageSchema, transformFailedMessageSchema);
|
|
37
37
|
//#endregion
|
|
38
|
-
export { transformErrorMessageSchema, transformRequestMessageSchema, transformResponseMessageSchema };
|
|
38
|
+
export { erroredQuerySchema, transformErrorMessageSchema, transformRequestMessageSchema, transformResponseMessageSchema, transformedQuerySchema };
|
|
39
39
|
|
|
40
40
|
//# sourceMappingURL=custom-queries.js.map
|
|
@@ -4,10 +4,10 @@ import { transformErrorMessageSchema } from "./custom-queries.js";
|
|
|
4
4
|
import { deleteClientsMessageSchema } from "./delete-clients.js";
|
|
5
5
|
import { connectedMessageSchema } from "./connect.js";
|
|
6
6
|
import { inspectDownMessageSchema } from "./inspect-down.js";
|
|
7
|
-
import { pushResponseMessageSchema } from "./push.js";
|
|
8
7
|
import { pokeEndMessageSchema, pokePartMessageSchema, pokeStartMessageSchema } from "./poke.js";
|
|
9
8
|
import { pongMessageSchema } from "./pong.js";
|
|
10
9
|
import { pullResponseMessageSchema } from "./pull.js";
|
|
10
|
+
import { pushResponseMessageSchema } from "./push.js";
|
|
11
11
|
//#region ../zero-protocol/src/down.ts
|
|
12
12
|
var downstreamSchema = valita_exports.union(connectedMessageSchema, errorMessageSchema, pongMessageSchema, pokeStartMessageSchema, pokePartMessageSchema, pokeEndMessageSchema, pullResponseMessageSchema, deleteClientsMessageSchema, pushResponseMessageSchema, inspectDownMessageSchema, transformErrorMessageSchema);
|
|
13
13
|
//#endregion
|
|
@@ -77,8 +77,7 @@ export type Rebalance = typeof Rebalance;
|
|
|
77
77
|
*/
|
|
78
78
|
export type Rehome = typeof Rehome;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @deprecated
|
|
80
|
+
* Unauthorized client request.
|
|
82
81
|
*/
|
|
83
82
|
export type Unauthorized = typeof Unauthorized;
|
|
84
83
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-kind-enum.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/error-kind-enum.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AACnE,eAAO,MAAM,kCAAkC,uCACT,CAAC;AACvC,eAAO,MAAM,sCAAsC,2CACT,CAAC;AAC3C,eAAO,MAAM,qCAAqC,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,kCAAkC,GAC5C,OAAO,kCAAkC,CAAC;AAC5C;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAChD,OAAO,sCAAsC,CAAC;AAChD;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC/C,OAAO,qCAAqC,CAAC;AAC/C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AACnD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC;AAC7C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAC3C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AACrD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AACnD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AACzC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AACnC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAC/C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC;AACzE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC;AACvD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-kind-enum.js","names":[],"sources":["../../../../zero-protocol/src/error-kind-enum.ts"],"sourcesContent":["// Note: Metric names depend on these values,\n// so if you add or change on here a corresponding dashboard\n// change will likely be needed.\n\nexport const AuthInvalidated = 'AuthInvalidated';\nexport const ClientNotFound = 'ClientNotFound';\nexport const InvalidConnectionRequest = 'InvalidConnectionRequest';\nexport const InvalidConnectionRequestBaseCookie =\n 'InvalidConnectionRequestBaseCookie';\nexport const InvalidConnectionRequestLastMutationID =\n 'InvalidConnectionRequestLastMutationID';\nexport const InvalidConnectionRequestClientDeleted =\n 'InvalidConnectionRequestClientDeleted';\nexport const InvalidMessage = 'InvalidMessage';\nexport const InvalidPush = 'InvalidPush';\nexport const PushFailed = 'PushFailed';\nexport const MutationFailed = 'MutationFailed';\nexport const MutationRateLimited = 'MutationRateLimited';\nexport const Rebalance = 'Rebalance';\nexport const Rehome = 'Rehome';\nexport const TransformFailed = 'TransformFailed';\nexport const Unauthorized = 'Unauthorized';\nexport const VersionNotSupported = 'VersionNotSupported';\nexport const SchemaVersionNotSupported = 'SchemaVersionNotSupported';\nexport const ServerOverloaded = 'ServerOverloaded';\nexport const Internal = 'Internal';\n\n/**\n * The app rejected the client's auth token (used in CRUD mutators).\n * @deprecated auth errors are now represented as ['error', { ... }] messages\n */\nexport type AuthInvalidated = typeof AuthInvalidated;\n/**\n * zero-cache no longer has CVR state for the client.\n */\nexport type ClientNotFound = typeof ClientNotFound;\n/**\n * Handshake metadata is invalid or incomplete.\n */\nexport type InvalidConnectionRequest = typeof InvalidConnectionRequest;\n/**\n * Client's base cookie is ahead of the replica snapshot.\n */\nexport type InvalidConnectionRequestBaseCookie =\n typeof InvalidConnectionRequestBaseCookie;\n/**\n * Client's last mutation ID is ahead of the replica.\n */\nexport type InvalidConnectionRequestLastMutationID =\n typeof InvalidConnectionRequestLastMutationID;\n/**\n * The server deleted the client.\n */\nexport type InvalidConnectionRequestClientDeleted =\n typeof InvalidConnectionRequestClientDeleted;\n/**\n * Upstream message failed schema validation or JSON parsing.\n */\nexport type InvalidMessage = typeof InvalidMessage;\n/**\n * Push payload could not be applied (version mismatch, out-of-order mutation).\n */\nexport type InvalidPush = typeof InvalidPush;\n/**\n * Push failed during processing.\n */\nexport type PushFailed = typeof PushFailed;\n/**\n * Transform failed during processing.\n */\nexport type TransformFailed = typeof TransformFailed;\n/**\n * CRUD mutator failure.\n * @deprecated\n */\nexport type MutationFailed = typeof MutationFailed;\n/**\n * CRUD mutator rate limit.\n * @deprecated\n */\nexport type MutationRateLimited = typeof MutationRateLimited;\n/**\n * Cache is rebalancing ownership.\n */\nexport type Rebalance = typeof Rebalance;\n/**\n * Replica ownership moved.\n */\nexport type Rehome = typeof Rehome;\n/**\n *
|
|
1
|
+
{"version":3,"file":"error-kind-enum.js","names":[],"sources":["../../../../zero-protocol/src/error-kind-enum.ts"],"sourcesContent":["// Note: Metric names depend on these values,\n// so if you add or change on here a corresponding dashboard\n// change will likely be needed.\n\nexport const AuthInvalidated = 'AuthInvalidated';\nexport const ClientNotFound = 'ClientNotFound';\nexport const InvalidConnectionRequest = 'InvalidConnectionRequest';\nexport const InvalidConnectionRequestBaseCookie =\n 'InvalidConnectionRequestBaseCookie';\nexport const InvalidConnectionRequestLastMutationID =\n 'InvalidConnectionRequestLastMutationID';\nexport const InvalidConnectionRequestClientDeleted =\n 'InvalidConnectionRequestClientDeleted';\nexport const InvalidMessage = 'InvalidMessage';\nexport const InvalidPush = 'InvalidPush';\nexport const PushFailed = 'PushFailed';\nexport const MutationFailed = 'MutationFailed';\nexport const MutationRateLimited = 'MutationRateLimited';\nexport const Rebalance = 'Rebalance';\nexport const Rehome = 'Rehome';\nexport const TransformFailed = 'TransformFailed';\nexport const Unauthorized = 'Unauthorized';\nexport const VersionNotSupported = 'VersionNotSupported';\nexport const SchemaVersionNotSupported = 'SchemaVersionNotSupported';\nexport const ServerOverloaded = 'ServerOverloaded';\nexport const Internal = 'Internal';\n\n/**\n * The app rejected the client's auth token (used in CRUD mutators).\n * @deprecated auth errors are now represented as ['error', { ... }] messages\n */\nexport type AuthInvalidated = typeof AuthInvalidated;\n/**\n * zero-cache no longer has CVR state for the client.\n */\nexport type ClientNotFound = typeof ClientNotFound;\n/**\n * Handshake metadata is invalid or incomplete.\n */\nexport type InvalidConnectionRequest = typeof InvalidConnectionRequest;\n/**\n * Client's base cookie is ahead of the replica snapshot.\n */\nexport type InvalidConnectionRequestBaseCookie =\n typeof InvalidConnectionRequestBaseCookie;\n/**\n * Client's last mutation ID is ahead of the replica.\n */\nexport type InvalidConnectionRequestLastMutationID =\n typeof InvalidConnectionRequestLastMutationID;\n/**\n * The server deleted the client.\n */\nexport type InvalidConnectionRequestClientDeleted =\n typeof InvalidConnectionRequestClientDeleted;\n/**\n * Upstream message failed schema validation or JSON parsing.\n */\nexport type InvalidMessage = typeof InvalidMessage;\n/**\n * Push payload could not be applied (version mismatch, out-of-order mutation).\n */\nexport type InvalidPush = typeof InvalidPush;\n/**\n * Push failed during processing.\n */\nexport type PushFailed = typeof PushFailed;\n/**\n * Transform failed during processing.\n */\nexport type TransformFailed = typeof TransformFailed;\n/**\n * CRUD mutator failure.\n * @deprecated\n */\nexport type MutationFailed = typeof MutationFailed;\n/**\n * CRUD mutator rate limit.\n * @deprecated\n */\nexport type MutationRateLimited = typeof MutationRateLimited;\n/**\n * Cache is rebalancing ownership.\n */\nexport type Rebalance = typeof Rebalance;\n/**\n * Replica ownership moved.\n */\nexport type Rehome = typeof Rehome;\n/**\n * Unauthorized client request.\n */\nexport type Unauthorized = typeof Unauthorized;\n/**\n * Client requested unsupported protocol version.\n */\nexport type VersionNotSupported = typeof VersionNotSupported;\n/**\n * Client schema hash or version is outside zero-cache window.\n */\nexport type SchemaVersionNotSupported = typeof SchemaVersionNotSupported;\n/**\n * zero-cache is overloaded.\n */\nexport type ServerOverloaded = typeof ServerOverloaded;\n/**\n * Unhandled zero-cache exception.\n */\nexport type Internal = typeof Internal;\n"],"mappings":";AAIA,IAAa,kBAAkB;AAC/B,IAAa,iBAAiB;AAC9B,IAAa,2BAA2B;AACxC,IAAa,qCACX;AACF,IAAa,yCACX;AACF,IAAa,wCACX;AACF,IAAa,iBAAiB;AAC9B,IAAa,cAAc;AAC3B,IAAa,aAAa;AAC1B,IAAa,iBAAiB;AAC9B,IAAa,sBAAsB;AACnC,IAAa,YAAY;AACzB,IAAa,SAAS;AACtB,IAAa,kBAAkB;AAC/B,IAAa,eAAe;AAC5B,IAAa,sBAAsB;AACnC,IAAa,4BAA4B;AACzC,IAAa,mBAAmB;AAChC,IAAa,WAAW"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as v from '../../shared/src/valita.ts';
|
|
2
|
+
export declare const mutateSuccessSchema: v.ObjectType<{
|
|
3
|
+
kind: v.Type<"MutateResponse">;
|
|
4
|
+
userID: v.Optional<string | null>;
|
|
5
|
+
mutations: v.ArrayType<v.ObjectType<{
|
|
6
|
+
id: v.ObjectType<{
|
|
7
|
+
id: v.Type<number>;
|
|
8
|
+
clientID: v.Type<string>;
|
|
9
|
+
}, undefined>;
|
|
10
|
+
result: v.UnionType<[v.ObjectType<{
|
|
11
|
+
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
12
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
13
|
+
error: v.Type<"app">;
|
|
14
|
+
message: v.Optional<string>;
|
|
15
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
16
|
+
}, undefined>, v.ObjectType<{
|
|
17
|
+
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
18
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
19
|
+
}, undefined>]>]>;
|
|
20
|
+
}, undefined>>;
|
|
21
|
+
}, undefined>;
|
|
22
|
+
export type MutateSuccess = v.Infer<typeof mutateSuccessSchema>;
|
|
23
|
+
export declare const mutateResponseSchema: v.UnionType<[v.ObjectType<{
|
|
24
|
+
kind: v.Type<"MutateResponse">;
|
|
25
|
+
userID: v.Optional<string | null>;
|
|
26
|
+
mutations: v.ArrayType<v.ObjectType<{
|
|
27
|
+
id: v.ObjectType<{
|
|
28
|
+
id: v.Type<number>;
|
|
29
|
+
clientID: v.Type<string>;
|
|
30
|
+
}, undefined>;
|
|
31
|
+
result: v.UnionType<[v.ObjectType<{
|
|
32
|
+
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
33
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
34
|
+
error: v.Type<"app">;
|
|
35
|
+
message: v.Optional<string>;
|
|
36
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
37
|
+
}, undefined>, v.ObjectType<{
|
|
38
|
+
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
39
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
40
|
+
}, undefined>]>]>;
|
|
41
|
+
}, undefined>>;
|
|
42
|
+
}, undefined>, v.UnionType<[v.ObjectType<Omit<{
|
|
43
|
+
kind: v.Type<"PushFailed">;
|
|
44
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
45
|
+
mutationIDs: v.ArrayType<v.ObjectType<{
|
|
46
|
+
id: v.Type<number>;
|
|
47
|
+
clientID: v.Type<string>;
|
|
48
|
+
}, undefined>>;
|
|
49
|
+
message: v.Type<string>;
|
|
50
|
+
}, "reason" | "origin"> & {
|
|
51
|
+
origin: v.Type<"server">;
|
|
52
|
+
reason: v.Type<"parse" | "database" | "internal" | "oooMutation" | "unsupportedPushVersion">;
|
|
53
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
54
|
+
kind: v.Type<"PushFailed">;
|
|
55
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
56
|
+
mutationIDs: v.ArrayType<v.ObjectType<{
|
|
57
|
+
id: v.Type<number>;
|
|
58
|
+
clientID: v.Type<string>;
|
|
59
|
+
}, undefined>>;
|
|
60
|
+
message: v.Type<string>;
|
|
61
|
+
}, "reason" | "status" | "origin" | "bodyPreview"> & {
|
|
62
|
+
origin: v.Type<"zeroCache">;
|
|
63
|
+
reason: v.Type<"http">;
|
|
64
|
+
status: v.Type<number>;
|
|
65
|
+
bodyPreview: v.Optional<string>;
|
|
66
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
67
|
+
kind: v.Type<"PushFailed">;
|
|
68
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
69
|
+
mutationIDs: v.ArrayType<v.ObjectType<{
|
|
70
|
+
id: v.Type<number>;
|
|
71
|
+
clientID: v.Type<string>;
|
|
72
|
+
}, undefined>>;
|
|
73
|
+
message: v.Type<string>;
|
|
74
|
+
}, "reason" | "origin"> & {
|
|
75
|
+
origin: v.Type<"zeroCache">;
|
|
76
|
+
reason: v.Type<"parse" | "internal" | "timeout">;
|
|
77
|
+
}, undefined>]>, v.UnionType<[v.ObjectType<{
|
|
78
|
+
mutations: v.ArrayType<v.ObjectType<{
|
|
79
|
+
id: v.ObjectType<{
|
|
80
|
+
id: v.Type<number>;
|
|
81
|
+
clientID: v.Type<string>;
|
|
82
|
+
}, undefined>;
|
|
83
|
+
result: v.UnionType<[v.ObjectType<{
|
|
84
|
+
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
85
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
86
|
+
error: v.Type<"app">;
|
|
87
|
+
message: v.Optional<string>;
|
|
88
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
89
|
+
}, undefined>, v.ObjectType<{
|
|
90
|
+
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
91
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
92
|
+
}, undefined>]>]>;
|
|
93
|
+
}, undefined>>;
|
|
94
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
95
|
+
error: v.Type<"unsupportedPushVersion">;
|
|
96
|
+
mutationIDs: v.Optional<{
|
|
97
|
+
id: number;
|
|
98
|
+
clientID: string;
|
|
99
|
+
}[]>;
|
|
100
|
+
}, undefined>, v.ObjectType<{
|
|
101
|
+
error: v.Type<"unsupportedSchemaVersion">;
|
|
102
|
+
mutationIDs: v.Optional<{
|
|
103
|
+
id: number;
|
|
104
|
+
clientID: string;
|
|
105
|
+
}[]>;
|
|
106
|
+
}, undefined>, v.ObjectType<{
|
|
107
|
+
error: v.Type<"http">;
|
|
108
|
+
status: v.Type<number>;
|
|
109
|
+
details: v.Type<string>;
|
|
110
|
+
mutationIDs: v.Optional<{
|
|
111
|
+
id: number;
|
|
112
|
+
clientID: string;
|
|
113
|
+
}[]>;
|
|
114
|
+
}, undefined>, v.ObjectType<{
|
|
115
|
+
error: v.Type<"zeroPusher">;
|
|
116
|
+
details: v.Type<string>;
|
|
117
|
+
mutationIDs: v.Optional<{
|
|
118
|
+
id: number;
|
|
119
|
+
clientID: string;
|
|
120
|
+
}[]>;
|
|
121
|
+
}, undefined>]>, v.UnionType<[v.ObjectType<Omit<{
|
|
122
|
+
kind: v.Type<"PushFailed">;
|
|
123
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
124
|
+
mutationIDs: v.ArrayType<v.ObjectType<{
|
|
125
|
+
id: v.Type<number>;
|
|
126
|
+
clientID: v.Type<string>;
|
|
127
|
+
}, undefined>>;
|
|
128
|
+
message: v.Type<string>;
|
|
129
|
+
}, "reason" | "origin"> & {
|
|
130
|
+
origin: v.Type<"server">;
|
|
131
|
+
reason: v.Type<"parse" | "database" | "internal" | "oooMutation" | "unsupportedPushVersion">;
|
|
132
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
133
|
+
kind: v.Type<"PushFailed">;
|
|
134
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
135
|
+
mutationIDs: v.ArrayType<v.ObjectType<{
|
|
136
|
+
id: v.Type<number>;
|
|
137
|
+
clientID: v.Type<string>;
|
|
138
|
+
}, undefined>>;
|
|
139
|
+
message: v.Type<string>;
|
|
140
|
+
}, "reason" | "status" | "origin" | "bodyPreview"> & {
|
|
141
|
+
origin: v.Type<"zeroCache">;
|
|
142
|
+
reason: v.Type<"http">;
|
|
143
|
+
status: v.Type<number>;
|
|
144
|
+
bodyPreview: v.Optional<string>;
|
|
145
|
+
}, undefined>, v.ObjectType<Omit<{
|
|
146
|
+
kind: v.Type<"PushFailed">;
|
|
147
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
148
|
+
mutationIDs: v.ArrayType<v.ObjectType<{
|
|
149
|
+
id: v.Type<number>;
|
|
150
|
+
clientID: v.Type<string>;
|
|
151
|
+
}, undefined>>;
|
|
152
|
+
message: v.Type<string>;
|
|
153
|
+
}, "reason" | "origin"> & {
|
|
154
|
+
origin: v.Type<"zeroCache">;
|
|
155
|
+
reason: v.Type<"parse" | "internal" | "timeout">;
|
|
156
|
+
}, undefined>]>]>]>;
|
|
157
|
+
export type MutateResponse = v.Infer<typeof mutateResponseSchema>;
|
|
158
|
+
/**
|
|
159
|
+
* The schema for the querystring parameters of the custom mutate endpoint.
|
|
160
|
+
*/
|
|
161
|
+
export declare const mutateParamsSchema: v.ObjectType<{
|
|
162
|
+
schema: v.Type<string>;
|
|
163
|
+
appID: v.Type<string>;
|
|
164
|
+
}, undefined>;
|
|
165
|
+
//# sourceMappingURL=mutate-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutate-server.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/mutate-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAehD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;aAI9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAKhC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;aAG7B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { valita_exports } from "../../shared/src/valita.js";
|
|
2
|
+
import { pushFailedBodySchema } from "./error.js";
|
|
3
|
+
import { mutationResponseSchema } from "./mutation.js";
|
|
4
|
+
import { pushErrorSchema } from "./push.js";
|
|
5
|
+
//#region ../zero-protocol/src/mutate-server.ts
|
|
6
|
+
var legacyPushSuccessSchema = valita_exports.object({ mutations: valita_exports.array(mutationResponseSchema) });
|
|
7
|
+
var legacyPushResponseSchema = valita_exports.union(legacyPushSuccessSchema, pushErrorSchema, pushFailedBodySchema);
|
|
8
|
+
var mutateSuccessSchema = valita_exports.object({
|
|
9
|
+
kind: valita_exports.literal("MutateResponse"),
|
|
10
|
+
userID: valita_exports.string().nullable().optional(),
|
|
11
|
+
mutations: valita_exports.array(mutationResponseSchema)
|
|
12
|
+
});
|
|
13
|
+
var mutateResponseSchema = valita_exports.union(mutateSuccessSchema, pushFailedBodySchema, legacyPushResponseSchema);
|
|
14
|
+
/**
|
|
15
|
+
* The schema for the querystring parameters of the custom mutate endpoint.
|
|
16
|
+
*/
|
|
17
|
+
var mutateParamsSchema = valita_exports.object({
|
|
18
|
+
schema: valita_exports.string(),
|
|
19
|
+
appID: valita_exports.string()
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { mutateParamsSchema, mutateResponseSchema };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=mutate-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutate-server.js","names":[],"sources":["../../../../zero-protocol/src/mutate-server.ts"],"sourcesContent":["import * as v from '../../shared/src/valita.ts';\nimport {pushFailedBodySchema} from './error.ts';\nimport {mutationResponseSchema} from './mutation.ts';\nimport {pushErrorSchema} from './push.ts';\n\nconst legacyPushSuccessSchema = v.object({\n mutations: v.array(mutationResponseSchema),\n});\n\nconst legacyPushResponseSchema = v.union(\n legacyPushSuccessSchema,\n pushErrorSchema,\n pushFailedBodySchema,\n);\n\nexport const mutateSuccessSchema = v.object({\n kind: v.literal('MutateResponse'),\n userID: v.string().nullable().optional(),\n mutations: v.array(mutationResponseSchema),\n});\nexport type MutateSuccess = v.Infer<typeof mutateSuccessSchema>;\n\nexport const mutateResponseSchema = v.union(\n mutateSuccessSchema,\n pushFailedBodySchema,\n // for backwards compatibility\n legacyPushResponseSchema,\n);\nexport type MutateResponse = v.Infer<typeof mutateResponseSchema>;\n\n/**\n * The schema for the querystring parameters of the custom mutate endpoint.\n */\nexport const mutateParamsSchema = v.object({\n schema: v.string(),\n appID: v.string(),\n});\n"],"mappings":";;;;;AAKA,IAAM,0BAA0B,eAAE,OAAO,EACvC,WAAW,eAAE,MAAM,uBAAuB,EAC3C,CAAC;AAEF,IAAM,2BAA2B,eAAE,MACjC,yBACA,iBACA,qBACD;AAED,IAAa,sBAAsB,eAAE,OAAO;CAC1C,MAAM,eAAE,QAAQ,iBAAiB;CACjC,QAAQ,eAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACxC,WAAW,eAAE,MAAM,uBAAuB;CAC3C,CAAC;AAGF,IAAa,uBAAuB,eAAE,MACpC,qBACA,sBAEA,yBACD;;;;AAMD,IAAa,qBAAqB,eAAE,OAAO;CACzC,QAAQ,eAAE,QAAQ;CAClB,OAAO,eAAE,QAAQ;CAClB,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import * as v from '../../shared/src/valita.ts';
|
|
2
|
+
import type { NameMapper } from '../../zero-types/src/name-mapper.ts';
|
|
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>]>;
|
|
175
|
+
declare const mutationOkSchema: v.ObjectType<{
|
|
176
|
+
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
177
|
+
}, undefined>;
|
|
178
|
+
declare const mutationErrorSchema: v.UnionType<[v.ObjectType<{
|
|
179
|
+
error: v.Type<"app">;
|
|
180
|
+
message: v.Optional<string>;
|
|
181
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
182
|
+
}, undefined>, v.ObjectType<{
|
|
183
|
+
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
184
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
185
|
+
}, undefined>]>;
|
|
186
|
+
export declare const mutationResultSchema: v.UnionType<[v.ObjectType<{
|
|
187
|
+
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
188
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
189
|
+
error: v.Type<"app">;
|
|
190
|
+
message: v.Optional<string>;
|
|
191
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
192
|
+
}, undefined>, v.ObjectType<{
|
|
193
|
+
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
194
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
195
|
+
}, undefined>]>]>;
|
|
196
|
+
export declare const mutationResponseSchema: v.ObjectType<{
|
|
197
|
+
id: v.ObjectType<{
|
|
198
|
+
id: v.Type<number>;
|
|
199
|
+
clientID: v.Type<string>;
|
|
200
|
+
}, undefined>;
|
|
201
|
+
result: v.UnionType<[v.ObjectType<{
|
|
202
|
+
data: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
203
|
+
}, undefined>, v.UnionType<[v.ObjectType<{
|
|
204
|
+
error: v.Type<"app">;
|
|
205
|
+
message: v.Optional<string>;
|
|
206
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
207
|
+
}, undefined>, v.ObjectType<{
|
|
208
|
+
error: v.UnionType<[v.Type<"oooMutation">, v.Type<"alreadyProcessed">]>;
|
|
209
|
+
details: v.Optional<import("../../shared/src/json.ts").ReadonlyJSONValue>;
|
|
210
|
+
}, undefined>]>]>;
|
|
211
|
+
}, undefined>;
|
|
212
|
+
export type InsertOp = v.Infer<typeof insertOpSchema>;
|
|
213
|
+
export type UpsertOp = v.Infer<typeof upsertOpSchema>;
|
|
214
|
+
export type UpdateOp = v.Infer<typeof updateOpSchema>;
|
|
215
|
+
export type DeleteOp = v.Infer<typeof deleteOpSchema>;
|
|
216
|
+
export type CRUDOp = v.Infer<typeof crudOpSchema>;
|
|
217
|
+
export type CRUDOpKind = CRUDOp['op'];
|
|
218
|
+
export type CRUDMutationArg = v.Infer<typeof crudArgSchema>;
|
|
219
|
+
export type CRUDMutation = v.Infer<typeof crudMutationSchema>;
|
|
220
|
+
export type CustomMutation = v.Infer<typeof customMutationSchema>;
|
|
221
|
+
export type Mutation = v.Infer<typeof mutationSchema>;
|
|
222
|
+
export type MutationResponse = v.Infer<typeof mutationResponseSchema>;
|
|
223
|
+
export type MutationOk = v.Infer<typeof mutationOkSchema>;
|
|
224
|
+
export type MutationError = v.Infer<typeof mutationErrorSchema>;
|
|
225
|
+
export type MutationResult = v.Infer<typeof mutationResultSchema>;
|
|
226
|
+
export type CleanupResultsArg = v.Infer<typeof cleanupResultsArgSchema>;
|
|
227
|
+
export declare function mapCRUD(arg: CRUDMutationArg, map: NameMapper): CRUDMutationArg;
|
|
228
|
+
export {};
|
|
229
|
+
//# sourceMappingURL=mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../../zero-protocol/src/mutation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AASpE,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAK/C,e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M,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACtC,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,wBAAgB,OAAO,CACrB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,UAAU,GACd,eAAe,CAcjB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
import { mutationIDSchema } from "./mutation-id.js";
|
|
5
|
+
import { CRUD, Custom } from "./mutation-type-enum.js";
|
|
6
|
+
import { primaryKeySchema, primaryKeyValueRecordSchema } from "./primary-key.js";
|
|
7
|
+
//#region ../zero-protocol/src/mutation.ts
|
|
8
|
+
var CRUD_MUTATION_NAME = "_zero_crud";
|
|
9
|
+
var CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
|
|
10
|
+
var cleanupResultsArgSchema = valita_exports.union(valita_exports.object({
|
|
11
|
+
clientGroupID: valita_exports.string(),
|
|
12
|
+
clientID: valita_exports.string(),
|
|
13
|
+
upToMutationID: valita_exports.number()
|
|
14
|
+
}), valita_exports.object({
|
|
15
|
+
type: valita_exports.literal("single"),
|
|
16
|
+
clientGroupID: valita_exports.string(),
|
|
17
|
+
clientID: valita_exports.string(),
|
|
18
|
+
upToMutationID: valita_exports.number()
|
|
19
|
+
}), valita_exports.object({
|
|
20
|
+
type: valita_exports.literal("bulk"),
|
|
21
|
+
clientGroupID: valita_exports.string(),
|
|
22
|
+
clientIDs: valita_exports.tuple([valita_exports.string()]).concat(valita_exports.array(valita_exports.string()))
|
|
23
|
+
}));
|
|
24
|
+
/**
|
|
25
|
+
* Inserts if entity with id does not already exist.
|
|
26
|
+
*/
|
|
27
|
+
var insertOpSchema = valita_exports.object({
|
|
28
|
+
op: valita_exports.literal("insert"),
|
|
29
|
+
tableName: valita_exports.string(),
|
|
30
|
+
primaryKey: primaryKeySchema,
|
|
31
|
+
value: rowSchema
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Upsert semantics. Inserts if entity with id does not already exist,
|
|
35
|
+
* otherwise updates existing entity with id.
|
|
36
|
+
*/
|
|
37
|
+
var upsertOpSchema = valita_exports.object({
|
|
38
|
+
op: valita_exports.literal("upsert"),
|
|
39
|
+
tableName: valita_exports.string(),
|
|
40
|
+
primaryKey: primaryKeySchema,
|
|
41
|
+
value: rowSchema
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Updates if entity with id exists, otherwise does nothing.
|
|
45
|
+
*/
|
|
46
|
+
var updateOpSchema = valita_exports.object({
|
|
47
|
+
op: valita_exports.literal("update"),
|
|
48
|
+
tableName: valita_exports.string(),
|
|
49
|
+
primaryKey: primaryKeySchema,
|
|
50
|
+
value: rowSchema
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Deletes entity with id if it exists, otherwise does nothing.
|
|
54
|
+
*/
|
|
55
|
+
var deleteOpSchema = valita_exports.object({
|
|
56
|
+
op: valita_exports.literal("delete"),
|
|
57
|
+
tableName: valita_exports.string(),
|
|
58
|
+
primaryKey: primaryKeySchema,
|
|
59
|
+
value: primaryKeyValueRecordSchema
|
|
60
|
+
});
|
|
61
|
+
var crudOpSchema = valita_exports.union(insertOpSchema, upsertOpSchema, updateOpSchema, deleteOpSchema);
|
|
62
|
+
var crudArgSchema = valita_exports.object({ ops: valita_exports.array(crudOpSchema) });
|
|
63
|
+
var crudArgsSchema = valita_exports.tuple([crudArgSchema]);
|
|
64
|
+
var crudMutationSchema = valita_exports.object({
|
|
65
|
+
type: valita_exports.literal(CRUD),
|
|
66
|
+
id: valita_exports.number(),
|
|
67
|
+
clientID: valita_exports.string(),
|
|
68
|
+
name: valita_exports.literal(CRUD_MUTATION_NAME),
|
|
69
|
+
args: crudArgsSchema,
|
|
70
|
+
timestamp: valita_exports.number()
|
|
71
|
+
});
|
|
72
|
+
var customMutationSchema = valita_exports.object({
|
|
73
|
+
type: valita_exports.literal(Custom),
|
|
74
|
+
id: valita_exports.number(),
|
|
75
|
+
clientID: valita_exports.string(),
|
|
76
|
+
name: valita_exports.string(),
|
|
77
|
+
args: valita_exports.array(jsonSchema),
|
|
78
|
+
timestamp: valita_exports.number()
|
|
79
|
+
});
|
|
80
|
+
var mutationSchema = valita_exports.union(crudMutationSchema, customMutationSchema);
|
|
81
|
+
var appErrorSchema = valita_exports.object({
|
|
82
|
+
error: valita_exports.literal("app"),
|
|
83
|
+
message: valita_exports.string().optional(),
|
|
84
|
+
details: jsonSchema.optional()
|
|
85
|
+
});
|
|
86
|
+
var zeroErrorSchema = valita_exports.object({
|
|
87
|
+
error: valita_exports.union(
|
|
88
|
+
/** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */
|
|
89
|
+
valita_exports.literal("oooMutation"),
|
|
90
|
+
valita_exports.literal("alreadyProcessed")
|
|
91
|
+
),
|
|
92
|
+
details: jsonSchema.optional()
|
|
93
|
+
});
|
|
94
|
+
var mutationOkSchema = valita_exports.object({ data: jsonSchema.optional() });
|
|
95
|
+
var mutationErrorSchema = valita_exports.union(appErrorSchema, zeroErrorSchema);
|
|
96
|
+
var mutationResultSchema = valita_exports.union(mutationOkSchema, mutationErrorSchema);
|
|
97
|
+
var mutationResponseSchema = valita_exports.object({
|
|
98
|
+
id: mutationIDSchema,
|
|
99
|
+
result: mutationResultSchema
|
|
100
|
+
});
|
|
101
|
+
function mapCRUD(arg, map) {
|
|
102
|
+
return { ops: arg.ops.map(({ op, tableName, primaryKey, value }) => ({
|
|
103
|
+
op,
|
|
104
|
+
tableName: map.tableName(tableName),
|
|
105
|
+
primaryKey: map.columns(tableName, primaryKey),
|
|
106
|
+
value: map.row(tableName, value)
|
|
107
|
+
})) };
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { CLEANUP_RESULTS_MUTATION_NAME, CRUD_MUTATION_NAME, cleanupResultsArgSchema, mapCRUD, mutationResponseSchema, mutationResultSchema, mutationSchema };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.js","names":[],"sources":["../../../../zero-protocol/src/mutation.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 {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\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\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>;\n\nexport type MutationResponse = v.Infer<typeof mutationResponseSchema>;\nexport type MutationOk = v.Infer<typeof mutationOkSchema>;\nexport type MutationError = v.Infer<typeof mutationErrorSchema>;\nexport type MutationResult = v.Infer<typeof mutationResultSchema>;\nexport type CleanupResultsArg = v.Infer<typeof cleanupResultsArgSchema>;\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":";;;;;;;AAWA,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,QA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AmBF,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,6 +1,6 @@
|
|
|
1
1
|
import { valita_exports } from "../../shared/src/valita.js";
|
|
2
2
|
import { mutationIDSchema } from "./mutation-id.js";
|
|
3
|
-
import { mutationResponseSchema } from "./
|
|
3
|
+
import { mutationResponseSchema } from "./mutation.js";
|
|
4
4
|
//#region ../zero-protocol/src/mutations-patch.ts
|
|
5
5
|
/**
|
|
6
6
|
* Mutation results are stored ephemerally in the client
|