effect-zero 0.5.0 → 0.6.0-beta.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.
Files changed (76) hide show
  1. package/README.md +56 -38
  2. package/dist/client-transaction.d.ts +11 -9
  3. package/dist/client-transaction.d.ts.map +1 -1
  4. package/dist/client-transaction.js +4 -1
  5. package/dist/client-transaction.js.map +1 -1
  6. package/dist/client.d.ts +68 -66
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +7 -10
  9. package/dist/client.js.map +1 -1
  10. package/dist/client.test.d.ts +2 -0
  11. package/dist/client.test.d.ts.map +1 -0
  12. package/dist/client.test.js +19 -0
  13. package/dist/client.test.js.map +1 -0
  14. package/dist/internal/server-synchronization-context.d.ts.map +1 -1
  15. package/dist/internal/server-synchronization-context.js +2 -2
  16. package/dist/internal/server-synchronization-context.js.map +1 -1
  17. package/dist/internal/server.d.ts +13 -28
  18. package/dist/internal/server.d.ts.map +1 -1
  19. package/dist/internal/server.js +5 -19
  20. package/dist/internal/server.js.map +1 -1
  21. package/dist/internal/server.test.js +5 -3
  22. package/dist/internal/server.test.js.map +1 -1
  23. package/dist/server-transaction.d.ts +82 -109
  24. package/dist/server-transaction.d.ts.map +1 -1
  25. package/dist/server-transaction.js +26 -74
  26. package/dist/server-transaction.js.map +1 -1
  27. package/dist/server.d.ts +207 -354
  28. package/dist/server.d.ts.map +1 -1
  29. package/dist/server.js +60 -80
  30. package/dist/server.js.map +1 -1
  31. package/dist/types/ast.d.ts +4 -0
  32. package/dist/types/ast.d.ts.map +1 -0
  33. package/dist/types/ast.js +4 -0
  34. package/dist/types/ast.js.map +1 -0
  35. package/dist/types/{queries.d.ts → custom-queries.d.ts} +19 -1
  36. package/dist/types/custom-queries.d.ts.map +1 -0
  37. package/dist/types/{queries.js → custom-queries.js} +5 -6
  38. package/dist/types/custom-queries.js.map +1 -0
  39. package/dist/types/mutate-server.d.ts +160 -0
  40. package/dist/types/mutate-server.d.ts.map +1 -0
  41. package/dist/types/mutate-server.js +29 -0
  42. package/dist/types/mutate-server.js.map +1 -0
  43. package/dist/types/mutation-id.d.ts +7 -0
  44. package/dist/types/mutation-id.d.ts.map +1 -0
  45. package/dist/types/mutation-id.js +8 -0
  46. package/dist/types/mutation-id.js.map +1 -0
  47. package/dist/types/mutation.d.ts +79 -0
  48. package/dist/types/mutation.d.ts.map +1 -0
  49. package/dist/types/mutation.js +125 -0
  50. package/dist/types/mutation.js.map +1 -0
  51. package/dist/types/push.d.ts +100 -85
  52. package/dist/types/push.d.ts.map +1 -1
  53. package/dist/types/push.js +7 -134
  54. package/dist/types/push.js.map +1 -1
  55. package/dist/types/query-server.d.ts +144 -0
  56. package/dist/types/query-server.d.ts.map +1 -0
  57. package/dist/types/query-server.js +19 -0
  58. package/dist/types/query-server.js.map +1 -0
  59. package/dist/types.test.js +4 -4
  60. package/dist/types.test.js.map +1 -1
  61. package/package.json +35 -5
  62. package/src/client-transaction.ts +5 -1
  63. package/src/client.ts +14 -15
  64. package/src/internal/server-synchronization-context.ts +37 -39
  65. package/src/internal/server.ts +8 -31
  66. package/src/server-transaction.ts +55 -101
  67. package/src/server.ts +147 -151
  68. package/src/types/ast.ts +4 -0
  69. package/src/types/{queries.ts → custom-queries.ts} +4 -6
  70. package/src/types/mutate-server.ts +37 -0
  71. package/src/types/mutation-id.ts +10 -0
  72. package/src/types/mutation.ts +155 -0
  73. package/src/types/push.ts +7 -167
  74. package/src/types/query-server.ts +27 -0
  75. package/dist/types/queries.d.ts.map +0 -1
  76. package/dist/types/queries.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ import * as Schema from "effect/Schema";
2
+ export declare const Mutation: Schema.Union<readonly [Schema.Struct<{
3
+ readonly type: Schema.Literal<"crud">;
4
+ readonly id: Schema.Number;
5
+ readonly clientID: Schema.String;
6
+ readonly name: Schema.Literal<"_zero_crud">;
7
+ readonly args: Schema.Tuple<readonly [Schema.Struct<{
8
+ readonly ops: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
9
+ readonly op: Schema.Literal<"insert">;
10
+ readonly tableName: Schema.String;
11
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
12
+ readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
13
+ }>, Schema.Struct<{
14
+ readonly op: Schema.Literal<"upsert">;
15
+ readonly tableName: Schema.String;
16
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
17
+ readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
18
+ }>, Schema.Struct<{
19
+ readonly op: Schema.Literal<"update">;
20
+ readonly tableName: Schema.String;
21
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
22
+ readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
23
+ }>, Schema.Struct<{
24
+ readonly op: Schema.Literal<"delete">;
25
+ readonly tableName: Schema.String;
26
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
27
+ readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
28
+ }>]>>;
29
+ }>]>;
30
+ readonly timestamp: Schema.Number;
31
+ }>, Schema.Struct<{
32
+ readonly type: Schema.Literal<"custom">;
33
+ readonly id: Schema.Number;
34
+ readonly clientID: Schema.String;
35
+ readonly name: Schema.String;
36
+ readonly args: Schema.$Array<Schema.Unknown>;
37
+ readonly timestamp: Schema.Number;
38
+ }>]>;
39
+ export type Mutation = typeof Mutation.Type;
40
+ export declare const AppError: Schema.Struct<{
41
+ readonly error: Schema.Literal<"app">;
42
+ readonly message: Schema.optional<Schema.String>;
43
+ readonly details: Schema.optional<Schema.Unknown>;
44
+ }>;
45
+ export type AppError = typeof AppError.Type;
46
+ export declare const ZeroError: Schema.Struct<{
47
+ readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
48
+ readonly details: Schema.optional<Schema.Unknown>;
49
+ }>;
50
+ export type ZeroError = typeof ZeroError.Type;
51
+ export declare const MutationResult: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
52
+ readonly error: Schema.Literal<"app">;
53
+ readonly message: Schema.optional<Schema.String>;
54
+ readonly details: Schema.optional<Schema.Unknown>;
55
+ }>, Schema.Struct<{
56
+ readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
57
+ readonly details: Schema.optional<Schema.Unknown>;
58
+ }>]>, Schema.Struct<{
59
+ readonly data: Schema.optional<Schema.Unknown>;
60
+ }>]>;
61
+ export type MutationResult = typeof MutationResult.Type;
62
+ export declare const MutationResponse: Schema.Struct<{
63
+ readonly id: Schema.Struct<{
64
+ readonly id: Schema.Number;
65
+ readonly clientID: Schema.String;
66
+ }>;
67
+ readonly result: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
68
+ readonly error: Schema.Literal<"app">;
69
+ readonly message: Schema.optional<Schema.String>;
70
+ readonly details: Schema.optional<Schema.Unknown>;
71
+ }>, Schema.Struct<{
72
+ readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
73
+ readonly details: Schema.optional<Schema.Unknown>;
74
+ }>]>, Schema.Struct<{
75
+ readonly data: Schema.optional<Schema.Unknown>;
76
+ }>]>;
77
+ }>;
78
+ export type MutationResponse = typeof MutationResponse.Type;
79
+ //# sourceMappingURL=mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../src/types/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAiHxC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA+C,CAAC;AACrE,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,eAAO,MAAM,QAAQ;;;;EAKnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,eAAO,MAAM,SAAS;;;EAOpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAS9C,eAAO,MAAM,cAAc;;;;;;;;;IAIzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAExD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC"}
@@ -0,0 +1,125 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { JsonSchema } from "./common.js";
3
+ import { MutationId } from "./mutation-id.js";
4
+ // The code below was converted to Effect Schema from:
5
+ // https://github.com/rocicorp/mono/blob/74273167af5d15ed07045e04165cb04d3983d44f/packages/zero-protocol/src/mutation.ts
6
+ const PrimaryKey = Schema.NonEmptyArray(Schema.String);
7
+ const PrimaryKeyValue = Schema.Union([Schema.String, Schema.Number, Schema.Boolean]);
8
+ const PrimaryKeyValueRecord = Schema.Record(Schema.String, PrimaryKeyValue);
9
+ const Value = Schema.Union([JsonSchema, Schema.Undefined]);
10
+ const Row = Schema.Record(Schema.String, Value);
11
+ const CRUD_MUTATION_NAME = "_zero_crud";
12
+ // biome-ignore lint/correctness/noUnusedVariables: borrowed code
13
+ const CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
14
+ // biome-ignore lint/correctness/noUnusedVariables: borrowed code
15
+ const CleanupResultsArg = Schema.Union([
16
+ // Legacy format (no type field) - treat as single
17
+ Schema.Struct({
18
+ clientGroupID: Schema.String,
19
+ clientID: Schema.String,
20
+ upToMutationID: Schema.Number,
21
+ }),
22
+ // Explicit single: delete up to a specific mutation ID for one client
23
+ Schema.Struct({
24
+ type: Schema.Literal("single"),
25
+ clientGroupID: Schema.String,
26
+ clientID: Schema.String,
27
+ upToMutationID: Schema.Number,
28
+ }),
29
+ // Bulk: delete all mutations for multiple clients
30
+ Schema.Struct({
31
+ type: Schema.Literal("bulk"),
32
+ clientGroupID: Schema.String,
33
+ clientIDs: Schema.NonEmptyArray(Schema.String),
34
+ }),
35
+ ]);
36
+ /**
37
+ * Inserts if entity with id does not already exist.
38
+ */
39
+ const InsertOp = Schema.Struct({
40
+ op: Schema.Literal("insert"),
41
+ tableName: Schema.String,
42
+ primaryKey: PrimaryKey,
43
+ value: Row,
44
+ });
45
+ /**
46
+ * Upsert semantics. Inserts if entity with id does not already exist,
47
+ * otherwise updates existing entity with id.
48
+ */
49
+ const UpsertOp = Schema.Struct({
50
+ op: Schema.Literal("upsert"),
51
+ tableName: Schema.String,
52
+ primaryKey: PrimaryKey,
53
+ value: Row,
54
+ });
55
+ /**
56
+ * Updates if entity with id exists, otherwise does nothing.
57
+ */
58
+ const UpdateOp = Schema.Struct({
59
+ op: Schema.Literal("update"),
60
+ tableName: Schema.String,
61
+ primaryKey: PrimaryKey,
62
+ // Partial value with at least the primary key fields
63
+ value: Row,
64
+ });
65
+ /**
66
+ * Deletes entity with id if it exists, otherwise does nothing.
67
+ */
68
+ const DeleteOp = Schema.Struct({
69
+ op: Schema.Literal("delete"),
70
+ tableName: Schema.String,
71
+ primaryKey: PrimaryKey,
72
+ // Partial value representing the primary key
73
+ value: PrimaryKeyValueRecord,
74
+ });
75
+ const CrudOp = Schema.Union([InsertOp, UpsertOp, UpdateOp, DeleteOp]);
76
+ const CrudArg = Schema.Struct({
77
+ ops: Schema.Array(CrudOp),
78
+ });
79
+ const CrudArgs = Schema.Tuple([CrudArg]);
80
+ const CrudMutation = Schema.Struct({
81
+ type: Schema.Literal("crud"),
82
+ id: Schema.Number,
83
+ clientID: Schema.String,
84
+ name: Schema.Literal(CRUD_MUTATION_NAME),
85
+ args: CrudArgs,
86
+ timestamp: Schema.Number,
87
+ });
88
+ const CustomMutation = Schema.Struct({
89
+ type: Schema.Literal("custom"),
90
+ id: Schema.Number,
91
+ clientID: Schema.String,
92
+ name: Schema.String,
93
+ args: Schema.Array(JsonSchema),
94
+ timestamp: Schema.Number,
95
+ });
96
+ export const Mutation = Schema.Union([CrudMutation, CustomMutation]);
97
+ export const AppError = Schema.Struct({
98
+ error: Schema.Literal("app"),
99
+ // The user can return any additional data here
100
+ message: Schema.optional(Schema.String),
101
+ details: Schema.optional(JsonSchema),
102
+ });
103
+ export const ZeroError = Schema.Struct({
104
+ error: Schema.Literals([
105
+ /** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */
106
+ "oooMutation",
107
+ "alreadyProcessed",
108
+ ]),
109
+ details: Schema.optional(JsonSchema),
110
+ });
111
+ const MutationOk = Schema.Struct({
112
+ // The user can return any additional data here
113
+ data: Schema.optional(JsonSchema),
114
+ });
115
+ const MutationError = Schema.Union([AppError, ZeroError]);
116
+ export const MutationResult = Schema.Union([
117
+ // We flip the original order here as otherwise values of type MutationError would get parsed as MutationOk with empty `data`
118
+ MutationError,
119
+ MutationOk,
120
+ ]);
121
+ export const MutationResponse = Schema.Struct({
122
+ id: MutationId,
123
+ result: MutationResult,
124
+ });
125
+ //# sourceMappingURL=mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation.js","sourceRoot":"","sources":["../../src/types/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,sDAAsD;AACtD,wHAAwH;AAExH,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAErF,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC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AE,SAAS,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;IACzC,6HAA6H;IAC7H,aAAa;IACb,UAAU;CACX,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,UAAU;IACd,MAAM,EAAE,cAAc;CACvB,CAAC,CAAC"}
@@ -1,42 +1,4 @@
1
1
  import * as Schema from "effect/Schema";
2
- export declare const Mutation: Schema.Union<readonly [Schema.Struct<{
3
- readonly type: Schema.Literal<"crud">;
4
- readonly id: Schema.Number;
5
- readonly clientID: Schema.String;
6
- readonly name: Schema.Literal<"_zero_crud">;
7
- readonly args: Schema.Tuple<readonly [Schema.Struct<{
8
- readonly ops: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
9
- readonly op: Schema.Literal<"insert">;
10
- readonly tableName: Schema.String;
11
- readonly primaryKey: Schema.$Array<Schema.String>;
12
- readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
13
- }>, Schema.Struct<{
14
- readonly op: Schema.Literal<"upsert">;
15
- readonly tableName: Schema.String;
16
- readonly primaryKey: Schema.$Array<Schema.String>;
17
- readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
18
- }>, Schema.Struct<{
19
- readonly op: Schema.Literal<"update">;
20
- readonly tableName: Schema.String;
21
- readonly primaryKey: Schema.$Array<Schema.String>;
22
- readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
23
- }>, Schema.Struct<{
24
- readonly op: Schema.Literal<"delete">;
25
- readonly tableName: Schema.String;
26
- readonly primaryKey: Schema.$Array<Schema.String>;
27
- readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
28
- }>]>>;
29
- }>]>;
30
- readonly timestamp: Schema.Number;
31
- }>, Schema.Struct<{
32
- readonly type: Schema.Literal<"custom">;
33
- readonly id: Schema.Number;
34
- readonly clientID: Schema.String;
35
- readonly name: Schema.String;
36
- readonly args: Schema.$Array<Schema.Unknown>;
37
- readonly timestamp: Schema.Number;
38
- }>]>;
39
- export type Mutation = typeof Mutation.Type;
40
2
  export declare const PushBody: Schema.Struct<{
41
3
  readonly clientGroupID: Schema.String;
42
4
  readonly mutations: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -48,22 +10,22 @@ export declare const PushBody: Schema.Struct<{
48
10
  readonly ops: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
49
11
  readonly op: Schema.Literal<"insert">;
50
12
  readonly tableName: Schema.String;
51
- readonly primaryKey: Schema.$Array<Schema.String>;
13
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
52
14
  readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
53
15
  }>, Schema.Struct<{
54
16
  readonly op: Schema.Literal<"upsert">;
55
17
  readonly tableName: Schema.String;
56
- readonly primaryKey: Schema.$Array<Schema.String>;
18
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
57
19
  readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
58
20
  }>, Schema.Struct<{
59
21
  readonly op: Schema.Literal<"update">;
60
22
  readonly tableName: Schema.String;
61
- readonly primaryKey: Schema.$Array<Schema.String>;
23
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
62
24
  readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Unknown, Schema.Undefined]>>;
63
25
  }>, Schema.Struct<{
64
26
  readonly op: Schema.Literal<"delete">;
65
27
  readonly tableName: Schema.String;
66
- readonly primaryKey: Schema.$Array<Schema.String>;
28
+ readonly primaryKey: Schema.NonEmptyArray<Schema.String>;
67
29
  readonly value: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
68
30
  }>]>>;
69
31
  }>]>;
@@ -85,47 +47,108 @@ export declare const PushBody: Schema.Struct<{
85
47
  * and should not be included in push messages.
86
48
  */
87
49
  readonly auth: Schema.optional<Schema.String>;
50
+ /** W3C traceparent header for distributed tracing. */
51
+ readonly traceparent: Schema.optional<Schema.String>;
88
52
  }>;
89
53
  export type PushBody = typeof PushBody.Type;
90
- export declare const AppError: Schema.Struct<{
91
- readonly error: Schema.Literal<"app">;
92
- readonly message: Schema.optional<Schema.String>;
93
- readonly details: Schema.optional<Schema.Unknown>;
94
- }>;
95
- export type AppError = typeof AppError.Type;
96
- export declare const ZeroError: Schema.Struct<{
97
- readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
98
- readonly details: Schema.optional<Schema.Unknown>;
99
- }>;
100
- export type ZeroError = typeof ZeroError.Type;
101
- export declare const MutationResult: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
102
- readonly error: Schema.Literal<"app">;
103
- readonly message: Schema.optional<Schema.String>;
104
- readonly details: Schema.optional<Schema.Unknown>;
54
+ /**
55
+ * @deprecated push errors are now represented as ['error', { ... }] messages
56
+ */
57
+ export declare const PushError: Schema.Union<readonly [Schema.Struct<{
58
+ /** @deprecated */
59
+ readonly error: Schema.Literal<"unsupportedPushVersion">;
60
+ /** @deprecated */
61
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
62
+ readonly id: Schema.Number;
63
+ readonly clientID: Schema.String;
64
+ }>>>;
105
65
  }>, Schema.Struct<{
106
- readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
107
- readonly details: Schema.optional<Schema.Unknown>;
108
- }>]>, Schema.Struct<{
109
- readonly data: Schema.optional<Schema.Unknown>;
66
+ /** @deprecated */
67
+ readonly error: Schema.Literal<"unsupportedSchemaVersion">;
68
+ /** @deprecated */
69
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
70
+ readonly id: Schema.Number;
71
+ readonly clientID: Schema.String;
72
+ }>>>;
73
+ }>, Schema.Struct<{
74
+ /** @deprecated */
75
+ readonly error: Schema.Literal<"http">;
76
+ /** @deprecated */
77
+ readonly status: Schema.Number;
78
+ /** @deprecated */
79
+ readonly details: Schema.String;
80
+ /** @deprecated */
81
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
82
+ readonly id: Schema.Number;
83
+ readonly clientID: Schema.String;
84
+ }>>>;
85
+ }>, Schema.Struct<{
86
+ /** @deprecated */
87
+ readonly error: Schema.Literal<"zeroPusher">;
88
+ /** @deprecated */
89
+ readonly details: Schema.String;
90
+ /** @deprecated */
91
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
92
+ readonly id: Schema.Number;
93
+ readonly clientID: Schema.String;
94
+ }>>>;
110
95
  }>]>;
111
- export type MutationResult = typeof MutationResult.Type;
112
- export declare const MutationResponse: Schema.Struct<{
113
- readonly id: Schema.Struct<{
96
+ export declare const PushResponseBody: Schema.Union<readonly [Schema.Struct<{
97
+ readonly mutations: Schema.$Array<Schema.Struct<{
98
+ readonly id: Schema.Struct<{
99
+ readonly id: Schema.Number;
100
+ readonly clientID: Schema.String;
101
+ }>;
102
+ readonly result: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
103
+ readonly error: Schema.Literal<"app">;
104
+ readonly message: Schema.optional<Schema.String>;
105
+ readonly details: Schema.optional<Schema.Unknown>;
106
+ }>, Schema.Struct<{
107
+ readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
108
+ readonly details: Schema.optional<Schema.Unknown>;
109
+ }>]>, Schema.Struct<{
110
+ readonly data: Schema.optional<Schema.Unknown>;
111
+ }>]>;
112
+ }>>;
113
+ }>, Schema.Union<readonly [Schema.Struct<{
114
+ /** @deprecated */
115
+ readonly error: Schema.Literal<"unsupportedPushVersion">;
116
+ /** @deprecated */
117
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
114
118
  readonly id: Schema.Number;
115
119
  readonly clientID: Schema.String;
116
- }>;
117
- readonly result: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
118
- readonly error: Schema.Literal<"app">;
119
- readonly message: Schema.optional<Schema.String>;
120
- readonly details: Schema.optional<Schema.Unknown>;
121
- }>, Schema.Struct<{
122
- readonly error: Schema.Literals<readonly ["oooMutation", "alreadyProcessed"]>;
123
- readonly details: Schema.optional<Schema.Unknown>;
124
- }>]>, Schema.Struct<{
125
- readonly data: Schema.optional<Schema.Unknown>;
126
- }>]>;
127
- }>;
128
- export type MutationResponse = typeof MutationResponse.Type;
120
+ }>>>;
121
+ }>, Schema.Struct<{
122
+ /** @deprecated */
123
+ readonly error: Schema.Literal<"unsupportedSchemaVersion">;
124
+ /** @deprecated */
125
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
126
+ readonly id: Schema.Number;
127
+ readonly clientID: Schema.String;
128
+ }>>>;
129
+ }>, Schema.Struct<{
130
+ /** @deprecated */
131
+ readonly error: Schema.Literal<"http">;
132
+ /** @deprecated */
133
+ readonly status: Schema.Number;
134
+ /** @deprecated */
135
+ readonly details: Schema.String;
136
+ /** @deprecated */
137
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
138
+ readonly id: Schema.Number;
139
+ readonly clientID: Schema.String;
140
+ }>>>;
141
+ }>, Schema.Struct<{
142
+ /** @deprecated */
143
+ readonly error: Schema.Literal<"zeroPusher">;
144
+ /** @deprecated */
145
+ readonly details: Schema.String;
146
+ /** @deprecated */
147
+ readonly mutationIDs: Schema.optional<Schema.$Array<Schema.Struct<{
148
+ readonly id: Schema.Number;
149
+ readonly clientID: Schema.String;
150
+ }>>>;
151
+ }>]>]>;
129
152
  export declare const PushResponse: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
130
153
  readonly mutations: Schema.$Array<Schema.Struct<{
131
154
  readonly id: Schema.Struct<{
@@ -215,12 +238,4 @@ export declare const PushResponse: Schema.Union<readonly [Schema.Union<readonly
215
238
  readonly message: Schema.String;
216
239
  }>]>]>;
217
240
  export type PushResponse = typeof PushResponse.Type;
218
- /**
219
- * The schema for the querystring parameters of the custom push endpoint.
220
- */
221
- export declare const PushParams: Schema.Struct<{
222
- readonly schema: Schema.String;
223
- readonly appID: Schema.String;
224
- }>;
225
- export type PushParams = typeof PushParams.Type;
226
241
  //# sourceMappingURL=push.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/types/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAiHxC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA+C,CAAC;AACrE,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUnB;;;OAGG;;EAEH,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAU5C,eAAO,MAAM,QAAQ;;;;EAKnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,eAAO,MAAM,SAAS;;;EAOpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAS9C,eAAO,MAAM,cAAc;;;;;;;;;IAIzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAExD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC;AA2D5D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;IAjDvB,kBAAkB;;IAElB,kBAAkB;;;;;;IAQlB,kBAAkB;;IAElB,kBAAkB;;;;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;IAQlB,kBAAkB;;IAElB,kBAAkB;;;;;;IAQlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;IAQlB,kBAAkB;;IAElB,kBAAkB;;IAElB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWwD,CAAC;AAC7E,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC"}
@@ -1,99 +1,9 @@
1
1
  import * as Schema from "effect/Schema";
2
- import { JsonSchema } from "./common.js";
3
2
  import { PushFailedBody } from "./error.js";
3
+ import { Mutation, MutationResponse } from "./mutation.js";
4
+ import { MutationId } from "./mutation-id.js";
4
5
  // The code below was converted to Effect Schema from:
5
- // https://github.com/rocicorp/mono/blob/8e0f600fb3a9185facf60cfd4971d260b266690e/packages/zero-protocol/src/push.ts
6
- const PrimaryKey = Schema.Array(Schema.String);
7
- const PrimaryKeyValue = Schema.Union([Schema.String, Schema.Number, Schema.Boolean]);
8
- const PrimaryKeyValueRecord = Schema.Record(Schema.String, PrimaryKeyValue);
9
- const Value = Schema.Union([JsonSchema, Schema.Undefined]);
10
- const Row = Schema.Record(Schema.String, Value);
11
- const CRUD_MUTATION_NAME = "_zero_crud";
12
- // biome-ignore lint/correctness/noUnusedVariables: borrowed code
13
- const CLEANUP_RESULTS_MUTATION_NAME = "_zero_cleanupResults";
14
- // biome-ignore lint/correctness/noUnusedVariables: borrowed code
15
- const CleanupResultsArg = Schema.Union([
16
- // Legacy format (no type field) - treat as single
17
- Schema.Struct({
18
- clientGroupID: Schema.String,
19
- clientID: Schema.String,
20
- upToMutationID: Schema.Number,
21
- }),
22
- // Explicit single: delete up to a specific mutation ID for one client
23
- Schema.Struct({
24
- type: Schema.Literal("single"),
25
- clientGroupID: Schema.String,
26
- clientID: Schema.String,
27
- upToMutationID: Schema.Number,
28
- }),
29
- // Bulk: delete all mutations for multiple clients
30
- Schema.Struct({
31
- type: Schema.Literal("bulk"),
32
- clientGroupID: Schema.String,
33
- clientIDs: Schema.NonEmptyArray(Schema.String),
34
- }),
35
- ]);
36
- /**
37
- * Inserts if entity with id does not already exist.
38
- */
39
- const InsertOp = Schema.Struct({
40
- op: Schema.Literal("insert"),
41
- tableName: Schema.String,
42
- primaryKey: PrimaryKey,
43
- value: Row,
44
- });
45
- /**
46
- * Upsert semantics. Inserts if entity with id does not already exist,
47
- * otherwise updates existing entity with id.
48
- */
49
- const UpsertOp = Schema.Struct({
50
- op: Schema.Literal("upsert"),
51
- tableName: Schema.String,
52
- primaryKey: PrimaryKey,
53
- value: Row,
54
- });
55
- /**
56
- * Updates if entity with id exists, otherwise does nothing.
57
- */
58
- const UpdateOp = Schema.Struct({
59
- op: Schema.Literal("update"),
60
- tableName: Schema.String,
61
- primaryKey: PrimaryKey,
62
- // Partial value with at least the primary key fields
63
- value: Row,
64
- });
65
- /**
66
- * Deletes entity with id if it exists, otherwise does nothing.
67
- */
68
- const DeleteOp = Schema.Struct({
69
- op: Schema.Literal("delete"),
70
- tableName: Schema.String,
71
- primaryKey: PrimaryKey,
72
- // Partial value representing the primary key
73
- value: PrimaryKeyValueRecord,
74
- });
75
- const CrudOp = Schema.Union([InsertOp, UpsertOp, UpdateOp, DeleteOp]);
76
- const CrudArg = Schema.Struct({
77
- ops: Schema.Array(CrudOp),
78
- });
79
- const CrudArgs = Schema.Tuple([CrudArg]);
80
- const CrudMutation = Schema.Struct({
81
- type: Schema.Literal("crud"),
82
- id: Schema.Number,
83
- clientID: Schema.String,
84
- name: Schema.Literal(CRUD_MUTATION_NAME),
85
- args: CrudArgs,
86
- timestamp: Schema.Number,
87
- });
88
- const CustomMutation = Schema.Struct({
89
- type: Schema.Literal("custom"),
90
- id: Schema.Number,
91
- clientID: Schema.String,
92
- name: Schema.String,
93
- args: Schema.Array(JsonSchema),
94
- timestamp: Schema.Number,
95
- });
96
- export const Mutation = Schema.Union([CrudMutation, CustomMutation]);
6
+ // https://github.com/rocicorp/mono/blob/74273167af5d15ed07045e04165cb04d3983d44f/packages/zero-protocol/src/push.ts
97
7
  export const PushBody = Schema.Struct({
98
8
  clientGroupID: Schema.String,
99
9
  mutations: Schema.Array(Mutation),
@@ -109,41 +19,11 @@ export const PushBody = Schema.Struct({
109
19
  * and should not be included in push messages.
110
20
  */
111
21
  auth: Schema.optional(Schema.String),
22
+ /** W3C traceparent header for distributed tracing. */
23
+ traceparent: Schema.optional(Schema.String),
112
24
  });
113
25
  // biome-ignore lint/correctness/noUnusedVariables: borrowed code
114
26
  const PushMessage = Schema.Tuple([Schema.Literal("push"), PushBody]);
115
- const MutationId = Schema.Struct({
116
- id: Schema.Number,
117
- clientID: Schema.String,
118
- });
119
- export const AppError = Schema.Struct({
120
- error: Schema.Literal("app"),
121
- // The user can return any additional data here
122
- message: Schema.optional(Schema.String),
123
- details: Schema.optional(JsonSchema),
124
- });
125
- export const ZeroError = Schema.Struct({
126
- error: Schema.Literals([
127
- /** @deprecated push oooMutation errors are now represented as ['error', { ... }] messages */
128
- "oooMutation",
129
- "alreadyProcessed",
130
- ]),
131
- details: Schema.optional(JsonSchema),
132
- });
133
- const MutationOk = Schema.Struct({
134
- // The user can return any additional data here
135
- data: Schema.optional(JsonSchema),
136
- });
137
- const MutationError = Schema.Union([AppError, ZeroError]);
138
- export const MutationResult = Schema.Union([
139
- // We flip the original order here as otherwise values of type MutationError would get parsed as MutationOk with empty `data`
140
- MutationError,
141
- MutationOk,
142
- ]);
143
- export const MutationResponse = Schema.Struct({
144
- id: MutationId,
145
- result: MutationResult,
146
- });
147
27
  const PushOk = Schema.Struct({
148
28
  mutations: Schema.Array(MutationResponse),
149
29
  });
@@ -192,18 +72,11 @@ const ZeroPusherError = Schema.Struct({
192
72
  /**
193
73
  * @deprecated push errors are now represented as ['error', { ... }] messages
194
74
  */
195
- const PushError = Schema.Union([UnsupportedPushVersion, UnsupportedSchemaVersion, HttpError, ZeroPusherError]);
196
- const PushResponseBody = Schema.Union([PushOk, PushError]);
75
+ export const PushError = Schema.Union([UnsupportedPushVersion, UnsupportedSchemaVersion, HttpError, ZeroPusherError]);
76
+ export const PushResponseBody = Schema.Union([PushOk, PushError]);
197
77
  export const PushResponse = Schema.Union([PushResponseBody, PushFailedBody]);
198
78
  // biome-ignore lint/correctness/noUnusedVariables: borrowed code
199
79
  const PushResponseMessage = Schema.Tuple([Schema.Literal("pushResponse"), PushResponseBody]);
200
80
  // biome-ignore lint/correctness/noUnusedVariables: borrowed code
201
81
  const AckMutationResponsesMessage = Schema.Tuple([Schema.Literal("ackMutationResponses"), MutationId]);
202
- /**
203
- * The schema for the querystring parameters of the custom push endpoint.
204
- */
205
- export const PushParams = Schema.Struct({
206
- schema: Schema.String,
207
- appID: Schema.String,
208
- });
209
82
  //# sourceMappingURL=push.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/types/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,sDAAsD;AACtD,oHAAoH;AAEpH,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAE/C,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAErF,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE5E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE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