@rocicorp/zero 0.22.2025071900 → 0.22.2025072500
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/{chunk-A6LHZQIK.js → chunk-CPTFADYI.js} +2 -2
- package/out/{chunk-IQCMHXK7.js → chunk-ROYQ5GXF.js} +191 -124
- package/out/{chunk-IQCMHXK7.js.map → chunk-ROYQ5GXF.js.map} +4 -4
- package/out/otel/src/enabled.d.ts +5 -0
- package/out/otel/src/enabled.d.ts.map +1 -0
- package/out/otel/src/enabled.js +16 -0
- package/out/otel/src/enabled.js.map +1 -0
- package/out/react.js +1 -1
- package/out/solid.js +2 -2
- package/out/zero/package.json +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +2 -2
- package/out/zero-cache/src/config/zero-config.js +5 -5
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.js +21 -17
- package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
- package/out/zero-cache/src/server/logging.d.ts.map +1 -1
- package/out/zero-cache/src/server/logging.js +3 -3
- package/out/zero-cache/src/server/logging.js.map +1 -1
- package/out/zero-cache/src/server/otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/otel-start.js +24 -18
- package/out/zero-cache/src/server/otel-start.js.map +1 -1
- package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
- package/out/zero-cache/src/server/syncer.js +1 -1
- package/out/zero-cache/src/server/syncer.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 +12 -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 +10 -0
- 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 +21 -2
- 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 -1
- 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 +4 -2
- package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.d.ts.map +1 -1
- package/out/zero-cache/src/services/litestream/commands.js +50 -23
- package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +42 -3
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +14 -1
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-handler.js +28 -0
- package/out/zero-cache/src/services/view-syncer/client-handler.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +46 -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.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +26 -37
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +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 +5 -0
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-client/src/client/mutation-tracker.d.ts +7 -2
- package/out/zero-client/src/client/mutation-tracker.d.ts.map +1 -1
- package/out/zero-client/src/client/zero-poke-handler.d.ts +6 -2
- package/out/zero-client/src/client/zero-poke-handler.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-protocol/src/down.d.ts +18 -0
- package/out/zero-protocol/src/down.d.ts.map +1 -1
- package/out/zero-protocol/src/mutations-patch.d.ts +65 -0
- package/out/zero-protocol/src/mutations-patch.d.ts.map +1 -0
- package/out/zero-protocol/src/mutations-patch.js +16 -0
- package/out/zero-protocol/src/mutations-patch.js.map +1 -0
- package/out/zero-protocol/src/poke.d.ts +36 -0
- package/out/zero-protocol/src/poke.d.ts.map +1 -1
- package/out/zero-protocol/src/poke.js +3 -0
- package/out/zero-protocol/src/poke.js.map +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
- package/out/zero-protocol/src/protocol-version.js +3 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/push.d.ts +8 -3
- package/out/zero-protocol/src/push.d.ts.map +1 -1
- package/out/zero-protocol/src/push.js +7 -3
- package/out/zero-protocol/src/push.js.map +1 -1
- package/out/zero-protocol/src/up.d.ts +4 -1
- package/out/zero-protocol/src/up.d.ts.map +1 -1
- package/out/zero-protocol/src/up.js +2 -2
- package/out/zero-protocol/src/up.js.map +1 -1
- package/out/zero.js +2 -2
- package/package.json +1 -1
- /package/out/{chunk-A6LHZQIK.js.map → chunk-CPTFADYI.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clientToServer,
|
|
3
3
|
mapEntries
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ROYQ5GXF.js";
|
|
5
5
|
import {
|
|
6
6
|
AbstractQuery,
|
|
7
7
|
ExpressionBuilder,
|
|
@@ -356,4 +356,4 @@ export {
|
|
|
356
356
|
named,
|
|
357
357
|
namedWithContext
|
|
358
358
|
};
|
|
359
|
-
//# sourceMappingURL=chunk-
|
|
359
|
+
//# sourceMappingURL=chunk-CPTFADYI.js.map
|
|
@@ -5988,116 +5988,6 @@ var errorMessageSchema = valita_exports.tuple([
|
|
|
5988
5988
|
errorBodySchema
|
|
5989
5989
|
]);
|
|
5990
5990
|
|
|
5991
|
-
// ../zero-protocol/src/row-patch.ts
|
|
5992
|
-
var putOpSchema2 = valita_exports.object({
|
|
5993
|
-
op: valita_exports.literal("put"),
|
|
5994
|
-
tableName: valita_exports.string(),
|
|
5995
|
-
value: rowSchema
|
|
5996
|
-
});
|
|
5997
|
-
var updateOpSchema = valita_exports.object({
|
|
5998
|
-
op: valita_exports.literal("update"),
|
|
5999
|
-
tableName: valita_exports.string(),
|
|
6000
|
-
id: primaryKeyValueRecordSchema,
|
|
6001
|
-
merge: jsonObjectSchema.optional(),
|
|
6002
|
-
constrain: valita_exports.array(valita_exports.string()).optional()
|
|
6003
|
-
});
|
|
6004
|
-
var delOpSchema2 = valita_exports.object({
|
|
6005
|
-
op: valita_exports.literal("del"),
|
|
6006
|
-
tableName: valita_exports.string(),
|
|
6007
|
-
id: primaryKeyValueRecordSchema
|
|
6008
|
-
});
|
|
6009
|
-
var clearOpSchema2 = valita_exports.object({
|
|
6010
|
-
op: valita_exports.literal("clear")
|
|
6011
|
-
});
|
|
6012
|
-
var rowPatchOpSchema = valita_exports.union(
|
|
6013
|
-
putOpSchema2,
|
|
6014
|
-
updateOpSchema,
|
|
6015
|
-
delOpSchema2,
|
|
6016
|
-
clearOpSchema2
|
|
6017
|
-
);
|
|
6018
|
-
var rowsPatchSchema = valita_exports.array(rowPatchOpSchema);
|
|
6019
|
-
|
|
6020
|
-
// ../zero-protocol/src/version.ts
|
|
6021
|
-
var versionSchema = valita_exports.string();
|
|
6022
|
-
var nullableVersionSchema = valita_exports.union(versionSchema, valita_exports.null());
|
|
6023
|
-
|
|
6024
|
-
// ../zero-protocol/src/poke.ts
|
|
6025
|
-
var pokeStartBodySchema = valita_exports.object({
|
|
6026
|
-
pokeID: valita_exports.string(),
|
|
6027
|
-
// We always specify a Version as our cookie, but Replicache starts clients
|
|
6028
|
-
// with initial cookie `null`, before the first request. So we have to be
|
|
6029
|
-
// able to send a base cookie with value `null` to match that state.
|
|
6030
|
-
baseCookie: nullableVersionSchema,
|
|
6031
|
-
/**
|
|
6032
|
-
* This field is always set if the poke contains a `rowsPatch`.
|
|
6033
|
-
* It may be absent for patches that only update clients and queries.
|
|
6034
|
-
*/
|
|
6035
|
-
schemaVersions: valita_exports.object({
|
|
6036
|
-
minSupportedVersion: valita_exports.number(),
|
|
6037
|
-
maxSupportedVersion: valita_exports.number()
|
|
6038
|
-
}).optional(),
|
|
6039
|
-
timestamp: valita_exports.number().optional()
|
|
6040
|
-
});
|
|
6041
|
-
var pokePartBodySchema = valita_exports.object({
|
|
6042
|
-
pokeID: valita_exports.string(),
|
|
6043
|
-
// Changes to last mutation id by client id.
|
|
6044
|
-
lastMutationIDChanges: valita_exports.record(valita_exports.number()).optional(),
|
|
6045
|
-
// Patches to the desired query sets by client id.
|
|
6046
|
-
desiredQueriesPatches: valita_exports.record(queriesPatchSchema).optional(),
|
|
6047
|
-
// Patches to the set of queries for which entities are sync'd in
|
|
6048
|
-
// rowsPatch.
|
|
6049
|
-
gotQueriesPatch: queriesPatchSchema.optional(),
|
|
6050
|
-
// Patches to the rows set.
|
|
6051
|
-
rowsPatch: rowsPatchSchema.optional()
|
|
6052
|
-
});
|
|
6053
|
-
var pokeEndBodySchema = valita_exports.object({
|
|
6054
|
-
pokeID: valita_exports.string(),
|
|
6055
|
-
// Note: This should be ignored (and may be empty) if cancel === `true`.
|
|
6056
|
-
cookie: versionSchema,
|
|
6057
|
-
// If `true`, the poke with id `pokeID` should be discarded without
|
|
6058
|
-
// applying it.
|
|
6059
|
-
cancel: valita_exports.boolean().optional()
|
|
6060
|
-
});
|
|
6061
|
-
var pokeStartMessageSchema = valita_exports.tuple([
|
|
6062
|
-
valita_exports.literal("pokeStart"),
|
|
6063
|
-
pokeStartBodySchema
|
|
6064
|
-
]);
|
|
6065
|
-
var pokePartMessageSchema = valita_exports.tuple([
|
|
6066
|
-
valita_exports.literal("pokePart"),
|
|
6067
|
-
pokePartBodySchema
|
|
6068
|
-
]);
|
|
6069
|
-
var pokeEndMessageSchema = valita_exports.tuple([
|
|
6070
|
-
valita_exports.literal("pokeEnd"),
|
|
6071
|
-
pokeEndBodySchema
|
|
6072
|
-
]);
|
|
6073
|
-
|
|
6074
|
-
// ../zero-protocol/src/pong.ts
|
|
6075
|
-
var pongBodySchema = valita_exports.object({});
|
|
6076
|
-
var pongMessageSchema = valita_exports.tuple([valita_exports.literal("pong"), pongBodySchema]);
|
|
6077
|
-
|
|
6078
|
-
// ../zero-protocol/src/pull.ts
|
|
6079
|
-
var pullRequestBodySchema = valita_exports.object({
|
|
6080
|
-
clientGroupID: valita_exports.string(),
|
|
6081
|
-
cookie: nullableVersionSchema,
|
|
6082
|
-
requestID: valita_exports.string()
|
|
6083
|
-
});
|
|
6084
|
-
var pullResponseBodySchema = valita_exports.object({
|
|
6085
|
-
cookie: versionSchema,
|
|
6086
|
-
// Matches pullRequestBodySchema requestID that initiated this response
|
|
6087
|
-
requestID: valita_exports.string(),
|
|
6088
|
-
lastMutationIDChanges: valita_exports.record(valita_exports.number())
|
|
6089
|
-
// Pull is currently only used for mutation recovery which does not use
|
|
6090
|
-
// the patch so we save work by not computing the patch.
|
|
6091
|
-
});
|
|
6092
|
-
var pullRequestMessageSchema = valita_exports.tuple([
|
|
6093
|
-
valita_exports.literal("pull"),
|
|
6094
|
-
pullRequestBodySchema
|
|
6095
|
-
]);
|
|
6096
|
-
var pullResponseMessageSchema = valita_exports.tuple([
|
|
6097
|
-
valita_exports.literal("pull"),
|
|
6098
|
-
pullResponseBodySchema
|
|
6099
|
-
]);
|
|
6100
|
-
|
|
6101
5991
|
// ../zero-protocol/src/mutation-type-enum.ts
|
|
6102
5992
|
var CRUD = "crud";
|
|
6103
5993
|
var Custom = "custom";
|
|
@@ -6116,7 +6006,7 @@ var upsertOpSchema = valita_exports.object({
|
|
|
6116
6006
|
primaryKey: primaryKeySchema,
|
|
6117
6007
|
value: rowSchema
|
|
6118
6008
|
});
|
|
6119
|
-
var
|
|
6009
|
+
var updateOpSchema = valita_exports.object({
|
|
6120
6010
|
op: valita_exports.literal("update"),
|
|
6121
6011
|
tableName: valita_exports.string(),
|
|
6122
6012
|
primaryKey: primaryKeySchema,
|
|
@@ -6133,7 +6023,7 @@ var deleteOpSchema = valita_exports.object({
|
|
|
6133
6023
|
var crudOpSchema = valita_exports.union(
|
|
6134
6024
|
insertOpSchema,
|
|
6135
6025
|
upsertOpSchema,
|
|
6136
|
-
|
|
6026
|
+
updateOpSchema,
|
|
6137
6027
|
deleteOpSchema
|
|
6138
6028
|
);
|
|
6139
6029
|
var crudArgSchema = valita_exports.object({
|
|
@@ -6187,7 +6077,10 @@ var mutationOkSchema = valita_exports.object({
|
|
|
6187
6077
|
data: jsonSchema.optional()
|
|
6188
6078
|
});
|
|
6189
6079
|
var mutationErrorSchema = valita_exports.union(appErrorSchema, zeroErrorSchema);
|
|
6190
|
-
var mutationResultSchema = valita_exports.union(
|
|
6080
|
+
var mutationResultSchema = valita_exports.union(
|
|
6081
|
+
mutationOkSchema,
|
|
6082
|
+
mutationErrorSchema
|
|
6083
|
+
);
|
|
6191
6084
|
var mutationResponseSchema = valita_exports.object({
|
|
6192
6085
|
id: mutationIDSchema,
|
|
6193
6086
|
result: mutationResultSchema
|
|
@@ -6231,6 +6124,10 @@ var pushResponseMessageSchema = valita_exports.tuple([
|
|
|
6231
6124
|
valita_exports.literal("pushResponse"),
|
|
6232
6125
|
pushResponseSchema
|
|
6233
6126
|
]);
|
|
6127
|
+
var ackMutationResponsesMessageSchema = valita_exports.tuple([
|
|
6128
|
+
valita_exports.literal("ackMutationResponses"),
|
|
6129
|
+
mutationIDSchema
|
|
6130
|
+
]);
|
|
6234
6131
|
var pushParamsSchema = valita_exports.object({
|
|
6235
6132
|
schema: valita_exports.string(),
|
|
6236
6133
|
appID: valita_exports.string()
|
|
@@ -6250,6 +6147,126 @@ function mapCRUD(arg, map) {
|
|
|
6250
6147
|
};
|
|
6251
6148
|
}
|
|
6252
6149
|
|
|
6150
|
+
// ../zero-protocol/src/mutations-patch.ts
|
|
6151
|
+
var putOpSchema2 = valita_exports.object({
|
|
6152
|
+
op: valita_exports.literal("put"),
|
|
6153
|
+
mutation: mutationResponseSchema
|
|
6154
|
+
});
|
|
6155
|
+
var patchOpSchema2 = putOpSchema2;
|
|
6156
|
+
var mutationsPatchSchema = valita_exports.array(patchOpSchema2);
|
|
6157
|
+
|
|
6158
|
+
// ../zero-protocol/src/row-patch.ts
|
|
6159
|
+
var putOpSchema3 = valita_exports.object({
|
|
6160
|
+
op: valita_exports.literal("put"),
|
|
6161
|
+
tableName: valita_exports.string(),
|
|
6162
|
+
value: rowSchema
|
|
6163
|
+
});
|
|
6164
|
+
var updateOpSchema2 = valita_exports.object({
|
|
6165
|
+
op: valita_exports.literal("update"),
|
|
6166
|
+
tableName: valita_exports.string(),
|
|
6167
|
+
id: primaryKeyValueRecordSchema,
|
|
6168
|
+
merge: jsonObjectSchema.optional(),
|
|
6169
|
+
constrain: valita_exports.array(valita_exports.string()).optional()
|
|
6170
|
+
});
|
|
6171
|
+
var delOpSchema2 = valita_exports.object({
|
|
6172
|
+
op: valita_exports.literal("del"),
|
|
6173
|
+
tableName: valita_exports.string(),
|
|
6174
|
+
id: primaryKeyValueRecordSchema
|
|
6175
|
+
});
|
|
6176
|
+
var clearOpSchema2 = valita_exports.object({
|
|
6177
|
+
op: valita_exports.literal("clear")
|
|
6178
|
+
});
|
|
6179
|
+
var rowPatchOpSchema = valita_exports.union(
|
|
6180
|
+
putOpSchema3,
|
|
6181
|
+
updateOpSchema2,
|
|
6182
|
+
delOpSchema2,
|
|
6183
|
+
clearOpSchema2
|
|
6184
|
+
);
|
|
6185
|
+
var rowsPatchSchema = valita_exports.array(rowPatchOpSchema);
|
|
6186
|
+
|
|
6187
|
+
// ../zero-protocol/src/version.ts
|
|
6188
|
+
var versionSchema = valita_exports.string();
|
|
6189
|
+
var nullableVersionSchema = valita_exports.union(versionSchema, valita_exports.null());
|
|
6190
|
+
|
|
6191
|
+
// ../zero-protocol/src/poke.ts
|
|
6192
|
+
var pokeStartBodySchema = valita_exports.object({
|
|
6193
|
+
pokeID: valita_exports.string(),
|
|
6194
|
+
// We always specify a Version as our cookie, but Replicache starts clients
|
|
6195
|
+
// with initial cookie `null`, before the first request. So we have to be
|
|
6196
|
+
// able to send a base cookie with value `null` to match that state.
|
|
6197
|
+
baseCookie: nullableVersionSchema,
|
|
6198
|
+
/**
|
|
6199
|
+
* This field is always set if the poke contains a `rowsPatch`.
|
|
6200
|
+
* It may be absent for patches that only update clients and queries.
|
|
6201
|
+
*/
|
|
6202
|
+
schemaVersions: valita_exports.object({
|
|
6203
|
+
minSupportedVersion: valita_exports.number(),
|
|
6204
|
+
maxSupportedVersion: valita_exports.number()
|
|
6205
|
+
}).optional(),
|
|
6206
|
+
timestamp: valita_exports.number().optional()
|
|
6207
|
+
});
|
|
6208
|
+
var pokePartBodySchema = valita_exports.object({
|
|
6209
|
+
pokeID: valita_exports.string(),
|
|
6210
|
+
// Changes to last mutation id by client id.
|
|
6211
|
+
lastMutationIDChanges: valita_exports.record(valita_exports.number()).optional(),
|
|
6212
|
+
// Patches to the desired query sets by client id.
|
|
6213
|
+
desiredQueriesPatches: valita_exports.record(queriesPatchSchema).optional(),
|
|
6214
|
+
// Patches to the set of queries for which entities are sync'd in
|
|
6215
|
+
// rowsPatch.
|
|
6216
|
+
gotQueriesPatch: queriesPatchSchema.optional(),
|
|
6217
|
+
// Patches to the rows set.
|
|
6218
|
+
rowsPatch: rowsPatchSchema.optional(),
|
|
6219
|
+
// Mutation results patch
|
|
6220
|
+
mutationsPatch: mutationsPatchSchema.optional()
|
|
6221
|
+
});
|
|
6222
|
+
var pokeEndBodySchema = valita_exports.object({
|
|
6223
|
+
pokeID: valita_exports.string(),
|
|
6224
|
+
// Note: This should be ignored (and may be empty) if cancel === `true`.
|
|
6225
|
+
cookie: versionSchema,
|
|
6226
|
+
// If `true`, the poke with id `pokeID` should be discarded without
|
|
6227
|
+
// applying it.
|
|
6228
|
+
cancel: valita_exports.boolean().optional()
|
|
6229
|
+
});
|
|
6230
|
+
var pokeStartMessageSchema = valita_exports.tuple([
|
|
6231
|
+
valita_exports.literal("pokeStart"),
|
|
6232
|
+
pokeStartBodySchema
|
|
6233
|
+
]);
|
|
6234
|
+
var pokePartMessageSchema = valita_exports.tuple([
|
|
6235
|
+
valita_exports.literal("pokePart"),
|
|
6236
|
+
pokePartBodySchema
|
|
6237
|
+
]);
|
|
6238
|
+
var pokeEndMessageSchema = valita_exports.tuple([
|
|
6239
|
+
valita_exports.literal("pokeEnd"),
|
|
6240
|
+
pokeEndBodySchema
|
|
6241
|
+
]);
|
|
6242
|
+
|
|
6243
|
+
// ../zero-protocol/src/pong.ts
|
|
6244
|
+
var pongBodySchema = valita_exports.object({});
|
|
6245
|
+
var pongMessageSchema = valita_exports.tuple([valita_exports.literal("pong"), pongBodySchema]);
|
|
6246
|
+
|
|
6247
|
+
// ../zero-protocol/src/pull.ts
|
|
6248
|
+
var pullRequestBodySchema = valita_exports.object({
|
|
6249
|
+
clientGroupID: valita_exports.string(),
|
|
6250
|
+
cookie: nullableVersionSchema,
|
|
6251
|
+
requestID: valita_exports.string()
|
|
6252
|
+
});
|
|
6253
|
+
var pullResponseBodySchema = valita_exports.object({
|
|
6254
|
+
cookie: versionSchema,
|
|
6255
|
+
// Matches pullRequestBodySchema requestID that initiated this response
|
|
6256
|
+
requestID: valita_exports.string(),
|
|
6257
|
+
lastMutationIDChanges: valita_exports.record(valita_exports.number())
|
|
6258
|
+
// Pull is currently only used for mutation recovery which does not use
|
|
6259
|
+
// the patch so we save work by not computing the patch.
|
|
6260
|
+
});
|
|
6261
|
+
var pullRequestMessageSchema = valita_exports.tuple([
|
|
6262
|
+
valita_exports.literal("pull"),
|
|
6263
|
+
pullRequestBodySchema
|
|
6264
|
+
]);
|
|
6265
|
+
var pullResponseMessageSchema = valita_exports.tuple([
|
|
6266
|
+
valita_exports.literal("pull"),
|
|
6267
|
+
pullResponseBodySchema
|
|
6268
|
+
]);
|
|
6269
|
+
|
|
6253
6270
|
// ../zero-protocol/src/down.ts
|
|
6254
6271
|
var downstreamSchema = valita_exports.union(
|
|
6255
6272
|
connectedMessageSchema,
|
|
@@ -6265,7 +6282,7 @@ var downstreamSchema = valita_exports.union(
|
|
|
6265
6282
|
);
|
|
6266
6283
|
|
|
6267
6284
|
// ../zero-protocol/src/protocol-version.ts
|
|
6268
|
-
var PROTOCOL_VERSION =
|
|
6285
|
+
var PROTOCOL_VERSION = 24;
|
|
6269
6286
|
var MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 18;
|
|
6270
6287
|
assert(MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION);
|
|
6271
6288
|
|
|
@@ -8557,7 +8574,7 @@ function makeMessage(message, context, logLevel) {
|
|
|
8557
8574
|
}
|
|
8558
8575
|
|
|
8559
8576
|
// ../zero-client/src/client/version.ts
|
|
8560
|
-
var version2 = "0.22.
|
|
8577
|
+
var version2 = "0.22.2025072500";
|
|
8561
8578
|
|
|
8562
8579
|
// ../zero-client/src/client/log-options.ts
|
|
8563
8580
|
var LevelFilterLogSink = class {
|
|
@@ -8869,10 +8886,15 @@ var MutationTracker = class {
|
|
|
8869
8886
|
#allMutationsAppliedListeners;
|
|
8870
8887
|
#lc;
|
|
8871
8888
|
#limboMutations;
|
|
8889
|
+
// This is only used in the new code path that processes
|
|
8890
|
+
// mutation responses that arrive via the `poke` protocol.
|
|
8891
|
+
// The old code path will be removed in the release after
|
|
8892
|
+
// the one containing mutation-responses-via-poke.
|
|
8893
|
+
#ackMutations;
|
|
8872
8894
|
#clientID;
|
|
8873
8895
|
#largestOutstandingMutationID;
|
|
8874
8896
|
#currentMutationID;
|
|
8875
|
-
constructor(lc) {
|
|
8897
|
+
constructor(lc, ackMutations) {
|
|
8876
8898
|
this.#lc = lc.withContext("MutationTracker");
|
|
8877
8899
|
this.#outstandingMutations = /* @__PURE__ */ new Map();
|
|
8878
8900
|
this.#ephemeralIDsByMutationID = /* @__PURE__ */ new Map();
|
|
@@ -8880,6 +8902,7 @@ var MutationTracker = class {
|
|
|
8880
8902
|
this.#limboMutations = /* @__PURE__ */ new Set();
|
|
8881
8903
|
this.#largestOutstandingMutationID = 0;
|
|
8882
8904
|
this.#currentMutationID = 0;
|
|
8905
|
+
this.#ackMutations = ackMutations;
|
|
8883
8906
|
}
|
|
8884
8907
|
set clientID(clientID) {
|
|
8885
8908
|
this.#clientID = clientID;
|
|
@@ -8913,6 +8936,28 @@ var MutationTracker = class {
|
|
|
8913
8936
|
this.#settleMutation(id, entry, "reject", e);
|
|
8914
8937
|
}
|
|
8915
8938
|
}
|
|
8939
|
+
/**
|
|
8940
|
+
* Used when zero-cache pokes down mutation results.
|
|
8941
|
+
*/
|
|
8942
|
+
processMutationResponses(patches) {
|
|
8943
|
+
try {
|
|
8944
|
+
for (const patch of patches) {
|
|
8945
|
+
if (patch.mutation.id.clientID !== this.#clientID) {
|
|
8946
|
+
continue;
|
|
8947
|
+
}
|
|
8948
|
+
if ("error" in patch.mutation.result) {
|
|
8949
|
+
this.#processMutationError(patch.mutation.id, patch.mutation.result);
|
|
8950
|
+
} else {
|
|
8951
|
+
this.#processMutationOk(patch.mutation.id, patch.mutation.result);
|
|
8952
|
+
}
|
|
8953
|
+
}
|
|
8954
|
+
} finally {
|
|
8955
|
+
const last = patches[patches.length - 1];
|
|
8956
|
+
if (last) {
|
|
8957
|
+
this.#ackMutations(last.mutation.id);
|
|
8958
|
+
}
|
|
8959
|
+
}
|
|
8960
|
+
}
|
|
8916
8961
|
processPushResponse(response) {
|
|
8917
8962
|
if ("error" in response) {
|
|
8918
8963
|
this.#lc.error?.(
|
|
@@ -9063,7 +9108,7 @@ var MutationTracker = class {
|
|
|
9063
9108
|
if ("error" in mutation.result) {
|
|
9064
9109
|
this.#processMutationError(mutation.id, mutation.result);
|
|
9065
9110
|
} else {
|
|
9066
|
-
this.#processMutationOk(mutation.
|
|
9111
|
+
this.#processMutationOk(mutation.id, mutation.result);
|
|
9067
9112
|
}
|
|
9068
9113
|
}
|
|
9069
9114
|
}
|
|
@@ -9085,7 +9130,7 @@ var MutationTracker = class {
|
|
|
9085
9130
|
assert(entry && entry.mutationID === mid.id);
|
|
9086
9131
|
this.#settleMutation(ephemeralID, entry, "reject", error);
|
|
9087
9132
|
}
|
|
9088
|
-
#processMutationOk(
|
|
9133
|
+
#processMutationOk(mid, result) {
|
|
9089
9134
|
assert(
|
|
9090
9135
|
mid.clientID === this.#clientID,
|
|
9091
9136
|
"received mutation for the wrong client"
|
|
@@ -9628,14 +9673,16 @@ var PokeHandler = class {
|
|
|
9628
9673
|
#pokeLock = new Lock3();
|
|
9629
9674
|
#schema;
|
|
9630
9675
|
#serverToClient;
|
|
9676
|
+
#mutationTracker;
|
|
9631
9677
|
#raf = getBrowserGlobalMethod("requestAnimationFrame") ?? rafFallback;
|
|
9632
|
-
constructor(replicachePoke, onPokeError, clientID, schema, lc) {
|
|
9678
|
+
constructor(replicachePoke, onPokeError, clientID, schema, lc, mutationTracker) {
|
|
9633
9679
|
this.#replicachePoke = replicachePoke;
|
|
9634
9680
|
this.#onPokeError = onPokeError;
|
|
9635
9681
|
this.#clientID = clientID;
|
|
9636
9682
|
this.#schema = schema;
|
|
9637
9683
|
this.#serverToClient = serverToClient(schema.tables);
|
|
9638
9684
|
this.#lc = lc.withContext("PokeHandler");
|
|
9685
|
+
this.#mutationTracker = mutationTracker;
|
|
9639
9686
|
}
|
|
9640
9687
|
handlePokeStart(pokeStart) {
|
|
9641
9688
|
if (this.#receivingPoke) {
|
|
@@ -9726,6 +9773,15 @@ var PokeHandler = class {
|
|
|
9726
9773
|
lc.debug?.("poking replicache");
|
|
9727
9774
|
await this.#replicachePoke(merged);
|
|
9728
9775
|
lc.debug?.("poking replicache took", performance.now() - start);
|
|
9776
|
+
this.#mutationTracker.processMutationResponses(
|
|
9777
|
+
merged.mutationResults ?? []
|
|
9778
|
+
);
|
|
9779
|
+
if (!("error" in merged.pullResponse)) {
|
|
9780
|
+
const lmid = merged.pullResponse.lastMutationIDChanges[this.#clientID];
|
|
9781
|
+
if (lmid !== void 0) {
|
|
9782
|
+
this.#mutationTracker.lmidAdvanced(lmid);
|
|
9783
|
+
}
|
|
9784
|
+
}
|
|
9729
9785
|
} catch (e) {
|
|
9730
9786
|
this.#handlePokeError(e);
|
|
9731
9787
|
}
|
|
@@ -9754,6 +9810,7 @@ function mergePokes(pokeBuffer, schema, serverToClient2) {
|
|
|
9754
9810
|
const { cookie } = lastPoke.pokeEnd;
|
|
9755
9811
|
const mergedPatch = [];
|
|
9756
9812
|
const mergedLastMutationIDChanges = {};
|
|
9813
|
+
const mutationResults = [];
|
|
9757
9814
|
let prevPokeEnd = void 0;
|
|
9758
9815
|
for (const pokeAccumulator of pokeBuffer) {
|
|
9759
9816
|
if (prevPokeEnd && pokeAccumulator.pokeStart.baseCookie && pokeAccumulator.pokeStart.baseCookie > prevPokeEnd.cookie) {
|
|
@@ -9800,9 +9857,12 @@ function mergePokes(pokeBuffer, schema, serverToClient2) {
|
|
|
9800
9857
|
);
|
|
9801
9858
|
}
|
|
9802
9859
|
}
|
|
9860
|
+
if (pokePart.mutationsPatch) {
|
|
9861
|
+
mutationResults.push(...pokePart.mutationsPatch);
|
|
9862
|
+
}
|
|
9803
9863
|
}
|
|
9804
9864
|
}
|
|
9805
|
-
|
|
9865
|
+
const ret = {
|
|
9806
9866
|
baseCookie,
|
|
9807
9867
|
pullResponse: {
|
|
9808
9868
|
lastMutationIDChanges: mergedLastMutationIDChanges,
|
|
@@ -9810,6 +9870,10 @@ function mergePokes(pokeBuffer, schema, serverToClient2) {
|
|
|
9810
9870
|
cookie
|
|
9811
9871
|
}
|
|
9812
9872
|
};
|
|
9873
|
+
if (mutationResults.length > 0) {
|
|
9874
|
+
ret.mutationResults = mutationResults;
|
|
9875
|
+
}
|
|
9876
|
+
return ret;
|
|
9813
9877
|
}
|
|
9814
9878
|
function queryPatchOpToReplicachePatchOp(op, toKey) {
|
|
9815
9879
|
switch (op.op) {
|
|
@@ -10150,7 +10214,10 @@ var Zero = class _Zero {
|
|
|
10150
10214
|
}
|
|
10151
10215
|
};
|
|
10152
10216
|
const lc = new ZeroLogContext(logOptions.logLevel, {}, logSink);
|
|
10153
|
-
this.#mutationTracker = new MutationTracker(
|
|
10217
|
+
this.#mutationTracker = new MutationTracker(
|
|
10218
|
+
lc,
|
|
10219
|
+
(upTo) => this.#send(["ackMutationResponses", upTo])
|
|
10220
|
+
);
|
|
10154
10221
|
if (options.mutators) {
|
|
10155
10222
|
for (const [namespaceOrKey, mutatorOrMutators] of Object.entries(
|
|
10156
10223
|
options.mutators
|
|
@@ -10330,7 +10397,8 @@ var Zero = class _Zero {
|
|
|
10330
10397
|
() => this.#onPokeError(),
|
|
10331
10398
|
rep.clientID,
|
|
10332
10399
|
schema,
|
|
10333
|
-
this.#lc
|
|
10400
|
+
this.#lc,
|
|
10401
|
+
this.#mutationTracker
|
|
10334
10402
|
);
|
|
10335
10403
|
this.#visibilityWatcher = getDocumentVisibilityWatcher(
|
|
10336
10404
|
getBrowserGlobal("document"),
|
|
@@ -10862,7 +10930,6 @@ var Zero = class _Zero {
|
|
|
10862
10930
|
#handlePokeEnd(_lc, pokeMessage) {
|
|
10863
10931
|
this.#abortPingTimeout();
|
|
10864
10932
|
this.#pokeHandler.handlePokeEnd(pokeMessage[1]);
|
|
10865
|
-
this.#mutationTracker.lmidAdvanced(this.#lastMutationIDReceived);
|
|
10866
10933
|
}
|
|
10867
10934
|
#onPokeError() {
|
|
10868
10935
|
const lc = this.#lc;
|
|
@@ -11371,4 +11438,4 @@ export {
|
|
|
11371
11438
|
update_needed_reason_type_enum_exports,
|
|
11372
11439
|
Zero
|
|
11373
11440
|
};
|
|
11374
|
-
//# sourceMappingURL=chunk-
|
|
11441
|
+
//# sourceMappingURL=chunk-ROYQ5GXF.js.map
|