@rocicorp/zero 0.23.2025090100 → 0.23.2025090400
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-FMWNU2YJ.js → chunk-6QYVZALS.js} +2 -2
- package/out/{chunk-6USDOK3X.js → chunk-LCK57CQL.js} +44 -41
- package/out/chunk-LCK57CQL.js.map +7 -0
- package/out/react-native.js +68 -85
- package/out/react-native.js.map +2 -2
- package/out/react.js +1 -1
- package/out/replicache/src/expo/store.d.ts +2 -3
- package/out/replicache/src/expo/store.d.ts.map +1 -1
- package/out/replicache/src/kv/sqlite-store.d.ts +1 -8
- package/out/replicache/src/kv/sqlite-store.d.ts.map +1 -1
- package/out/replicache/src/persist/collect-idb-databases.d.ts.map +1 -1
- package/out/solid.js +2 -2
- package/out/zero/package.json +1 -1
- package/out/zero-cache/src/custom/fetch.d.ts +2 -1
- package/out/zero-cache/src/custom/fetch.d.ts.map +1 -1
- package/out/zero-cache/src/custom/fetch.js +8 -6
- package/out/zero-cache/src/custom/fetch.js.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.d.ts +3 -2
- package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.js +6 -3
- package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
- package/out/zero-cache/src/db/lite-tables.d.ts.map +1 -1
- package/out/zero-cache/src/db/lite-tables.js +1 -0
- package/out/zero-cache/src/db/lite-tables.js.map +1 -1
- package/out/zero-cache/src/db/specs.d.ts +5 -0
- package/out/zero-cache/src/db/specs.d.ts.map +1 -1
- package/out/zero-cache/src/db/specs.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +2 -3
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.js +25 -6
- package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.js +10 -1
- package/out/zero-cache/src/services/view-syncer/client-schema.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +1 -0
- 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 +20 -3
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js +1 -1
- package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
- package/out/zero-client/src/client/options.d.ts +8 -12
- package/out/zero-client/src/client/options.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.d.ts +1 -2
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-protocol/src/client-schema.d.ts +2 -0
- package/out/zero-protocol/src/client-schema.d.ts.map +1 -1
- package/out/zero-protocol/src/client-schema.js +9 -4
- package/out/zero-protocol/src/client-schema.js.map +1 -1
- package/out/zero-protocol/src/connect.d.ts +6 -32
- package/out/zero-protocol/src/connect.d.ts.map +1 -1
- package/out/zero-protocol/src/connect.js +2 -17
- package/out/zero-protocol/src/connect.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 +2 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/up.d.ts +3 -8
- package/out/zero-protocol/src/up.d.ts.map +1 -1
- package/out/zero-schema/src/builder/schema-builder.d.ts.map +1 -1
- package/out/zero-schema/src/builder/schema-builder.js +2 -1
- package/out/zero-schema/src/builder/schema-builder.js.map +1 -1
- package/out/zero.js +2 -2
- package/package.json +1 -1
- package/out/chunk-6USDOK3X.js.map +0 -7
- /package/out/{chunk-FMWNU2YJ.js.map → chunk-6QYVZALS.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clientToServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LCK57CQL.js";
|
|
4
4
|
import {
|
|
5
5
|
AbstractQuery,
|
|
6
6
|
ExpressionBuilder,
|
|
@@ -346,4 +346,4 @@ export {
|
|
|
346
346
|
withValidation,
|
|
347
347
|
createBuilder
|
|
348
348
|
};
|
|
349
|
-
//# sourceMappingURL=chunk-
|
|
349
|
+
//# sourceMappingURL=chunk-6QYVZALS.js.map
|
|
@@ -1415,8 +1415,7 @@ async function dropAllDatabases(opts) {
|
|
|
1415
1415
|
const store = new IDBDatabasesStore(kvStoreProvider.create);
|
|
1416
1416
|
const databases = await store.getDatabases();
|
|
1417
1417
|
const dbNames = Object.values(databases).map((db) => db.name);
|
|
1418
|
-
|
|
1419
|
-
return result;
|
|
1418
|
+
return dropDatabases(store, dbNames, kvStoreProvider.drop);
|
|
1420
1419
|
}
|
|
1421
1420
|
function canDatabaseBeCollectedAndGetDeletedClientIDs(enableMutationRecovery, perdag) {
|
|
1422
1421
|
return withRead(perdag, async (read) => {
|
|
@@ -1679,7 +1678,10 @@ var columnSchemaSchema = valita_exports.object({
|
|
|
1679
1678
|
type: valueTypeSchema
|
|
1680
1679
|
});
|
|
1681
1680
|
var tableSchemaSchema = valita_exports.object({
|
|
1682
|
-
columns: valita_exports.record(columnSchemaSchema)
|
|
1681
|
+
columns: valita_exports.record(columnSchemaSchema),
|
|
1682
|
+
// TODO: Make this non-optional when bumping the
|
|
1683
|
+
// MIN_SERVER_SUPPORTED_SYNC_PROTOCOL to 30+.
|
|
1684
|
+
primaryKey: valita_exports.array(valita_exports.string()).optional()
|
|
1683
1685
|
});
|
|
1684
1686
|
var clientSchemaSchema = valita_exports.object({
|
|
1685
1687
|
tables: valita_exports.record(tableSchemaSchema)
|
|
@@ -1691,7 +1693,13 @@ function normalizeClientSchema(schema) {
|
|
|
1691
1693
|
schema.tables,
|
|
1692
1694
|
(tables) => tables.sort(keyCmp).map(([name, table2]) => [
|
|
1693
1695
|
name,
|
|
1694
|
-
{
|
|
1696
|
+
{
|
|
1697
|
+
columns: mapAllEntries(table2.columns, (e) => e.sort(keyCmp)),
|
|
1698
|
+
primaryKey: must(
|
|
1699
|
+
table2.primaryKey,
|
|
1700
|
+
`new clients always specify a primaryKey`
|
|
1701
|
+
).sort()
|
|
1702
|
+
}
|
|
1695
1703
|
])
|
|
1696
1704
|
)
|
|
1697
1705
|
};
|
|
@@ -1760,15 +1768,19 @@ function checkRelationship(relationships, tableName, tables) {
|
|
|
1760
1768
|
}
|
|
1761
1769
|
function clientSchemaFrom(schema) {
|
|
1762
1770
|
const client = {
|
|
1763
|
-
tables: mapEntries(
|
|
1764
|
-
|
|
1765
|
-
{
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
{ type }
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1771
|
+
tables: mapEntries(
|
|
1772
|
+
schema.tables,
|
|
1773
|
+
(name, { serverName, columns, primaryKey }) => [
|
|
1774
|
+
serverName ?? name,
|
|
1775
|
+
{
|
|
1776
|
+
columns: mapEntries(columns, (name2, { serverName: serverName2, type }) => [
|
|
1777
|
+
serverName2 ?? name2,
|
|
1778
|
+
{ type }
|
|
1779
|
+
]),
|
|
1780
|
+
primaryKey: [...primaryKey]
|
|
1781
|
+
}
|
|
1782
|
+
]
|
|
1783
|
+
)
|
|
1772
1784
|
};
|
|
1773
1785
|
const clientSchema = normalizeClientSchema(client);
|
|
1774
1786
|
const hash = h64(JSON.stringify(clientSchema)).toString(36);
|
|
@@ -5970,29 +5982,14 @@ var connectedMessageSchema = valita_exports.tuple([
|
|
|
5970
5982
|
valita_exports.literal("connected"),
|
|
5971
5983
|
connectedBodySchema
|
|
5972
5984
|
]);
|
|
5973
|
-
var userQueryMutateParamsSchema = valita_exports.object({
|
|
5974
|
-
/**
|
|
5975
|
-
* A client driven URL to send queries or mutations to.
|
|
5976
|
-
* This URL must match one of the URLs set in the zero config.
|
|
5977
|
-
*
|
|
5978
|
-
* E.g., Given the following environment variable:
|
|
5979
|
-
* ZERO_GET_QUERIES_URL=[https://*.example.com/query]
|
|
5980
|
-
*
|
|
5981
|
-
* Then this URL could be:
|
|
5982
|
-
* https://myapp.example.com/query
|
|
5983
|
-
*/
|
|
5984
|
-
url: valita_exports.string().optional(),
|
|
5985
|
-
// The query string to use for query or mutation calls.
|
|
5986
|
-
queryParams: valita_exports.record(valita_exports.string()).optional()
|
|
5987
|
-
});
|
|
5988
5985
|
var initConnectionBodySchema = valita_exports.object({
|
|
5989
5986
|
desiredQueriesPatch: upQueriesPatchSchema,
|
|
5990
5987
|
clientSchema: clientSchemaSchema.optional(),
|
|
5991
5988
|
deleted: deleteClientsBodySchema.optional(),
|
|
5992
5989
|
// parameters to configure the mutate endpoint
|
|
5993
|
-
|
|
5990
|
+
userPushURL: valita_exports.string().optional(),
|
|
5994
5991
|
// parameters to configure the query endpoint
|
|
5995
|
-
|
|
5992
|
+
userQueryURL: valita_exports.string().optional(),
|
|
5996
5993
|
/**
|
|
5997
5994
|
* `activeClients` is an optional array of client IDs that are currently active
|
|
5998
5995
|
* in the client group. This is used to inform the server about the clients
|
|
@@ -6364,7 +6361,7 @@ var downstreamSchema = valita_exports.union(
|
|
|
6364
6361
|
);
|
|
6365
6362
|
|
|
6366
6363
|
// ../zero-protocol/src/protocol-version.ts
|
|
6367
|
-
var PROTOCOL_VERSION =
|
|
6364
|
+
var PROTOCOL_VERSION = 30;
|
|
6368
6365
|
var MIN_SERVER_SUPPORTED_SYNC_PROTOCOL = 18;
|
|
6369
6366
|
assert(MIN_SERVER_SUPPORTED_SYNC_PROTOCOL < PROTOCOL_VERSION);
|
|
6370
6367
|
|
|
@@ -8668,7 +8665,7 @@ function makeMessage(message, context, logLevel) {
|
|
|
8668
8665
|
}
|
|
8669
8666
|
|
|
8670
8667
|
// ../zero-client/src/client/version.ts
|
|
8671
|
-
var version2 = "0.23.
|
|
8668
|
+
var version2 = "0.23.2025090400";
|
|
8672
8669
|
|
|
8673
8670
|
// ../zero-client/src/client/log-options.ts
|
|
8674
8671
|
var LevelFilterLogSink = class {
|
|
@@ -10359,6 +10356,12 @@ var Zero = class _Zero {
|
|
|
10359
10356
|
this.#schema = schema;
|
|
10360
10357
|
const { clientSchema, hash } = clientSchemaFrom(schema);
|
|
10361
10358
|
this.#clientSchema = clientSchema;
|
|
10359
|
+
const nameKey = JSON.stringify({
|
|
10360
|
+
storageKey: this.storageKey,
|
|
10361
|
+
mutateUrl: options.mutateURL ?? "",
|
|
10362
|
+
queryUrl: options.getQueriesURL ?? ""
|
|
10363
|
+
});
|
|
10364
|
+
const hashedKey = h64(nameKey).toString(36);
|
|
10362
10365
|
const replicacheOptions = {
|
|
10363
10366
|
// The schema stored in IDB is dependent upon both the ClientSchema
|
|
10364
10367
|
// and the AST schema (i.e. PROTOCOL_VERSION).
|
|
@@ -10366,7 +10369,7 @@ var Zero = class _Zero {
|
|
|
10366
10369
|
logLevel: logOptions.logLevel,
|
|
10367
10370
|
logSinks: [logOptions.logSink],
|
|
10368
10371
|
mutators: replicacheMutators,
|
|
10369
|
-
name: `zero-${userID}-${
|
|
10372
|
+
name: `zero-${userID}-${hashedKey}`,
|
|
10370
10373
|
pusher: (req, reqID) => this.#pusher(req, reqID),
|
|
10371
10374
|
puller: (req, reqID) => this.#puller(req, reqID),
|
|
10372
10375
|
pushDelay: 0,
|
|
@@ -10883,8 +10886,8 @@ var Zero = class _Zero {
|
|
|
10883
10886
|
// The clientSchema only needs to be sent for the very first request.
|
|
10884
10887
|
// Henceforth it is stored with the CVR and verified automatically.
|
|
10885
10888
|
...this.#connectCookie === null ? { clientSchema } : {},
|
|
10886
|
-
|
|
10887
|
-
|
|
10889
|
+
userPushURL: this.#options.mutateURL,
|
|
10890
|
+
userQueryURL: this.#options.getQueriesURL
|
|
10888
10891
|
}
|
|
10889
10892
|
]);
|
|
10890
10893
|
this.#deletedClients = void 0;
|
|
@@ -10960,8 +10963,8 @@ var Zero = class _Zero {
|
|
|
10960
10963
|
wsid,
|
|
10961
10964
|
this.#options.logLevel === "debug",
|
|
10962
10965
|
lc,
|
|
10963
|
-
this.#options.
|
|
10964
|
-
this.#options.
|
|
10966
|
+
this.#options.mutateURL,
|
|
10967
|
+
this.#options.getQueriesURL,
|
|
10965
10968
|
this.#options.maxHeaderLength,
|
|
10966
10969
|
additionalConnectParams,
|
|
10967
10970
|
await this.#activeClientsManager
|
|
@@ -11476,7 +11479,7 @@ var OnlineManager = class extends Subscribable {
|
|
|
11476
11479
|
return this.#online;
|
|
11477
11480
|
}
|
|
11478
11481
|
};
|
|
11479
|
-
async function createSocket(rep, queryManager, deleteClientsManager, socketOrigin, baseCookie, clientID, clientGroupID, clientSchema, userID, auth, lmid, wsid, debugPerf, lc,
|
|
11482
|
+
async function createSocket(rep, queryManager, deleteClientsManager, socketOrigin, baseCookie, clientID, clientGroupID, clientSchema, userID, auth, lmid, wsid, debugPerf, lc, userPushURL, userQueryURL, maxHeaderLength = 1024 * 8, additionalConnectParams, activeClientsManager) {
|
|
11480
11483
|
const url = new URL(
|
|
11481
11484
|
appendPath(socketOrigin, `/sync/v${PROTOCOL_VERSION}/connect`)
|
|
11482
11485
|
);
|
|
@@ -11515,8 +11518,8 @@ async function createSocket(rep, queryManager, deleteClientsManager, socketOrigi
|
|
|
11515
11518
|
// The clientSchema only needs to be sent for the very first request.
|
|
11516
11519
|
// Henceforth it is stored with the CVR and verified automatically.
|
|
11517
11520
|
...baseCookie === null ? { clientSchema } : {},
|
|
11518
|
-
|
|
11519
|
-
|
|
11521
|
+
userPushURL,
|
|
11522
|
+
userQueryURL,
|
|
11520
11523
|
activeClients: [...activeClients]
|
|
11521
11524
|
}
|
|
11522
11525
|
],
|
|
@@ -11609,4 +11612,4 @@ export {
|
|
|
11609
11612
|
update_needed_reason_type_enum_exports,
|
|
11610
11613
|
Zero
|
|
11611
11614
|
};
|
|
11612
|
-
//# sourceMappingURL=chunk-
|
|
11615
|
+
//# sourceMappingURL=chunk-LCK57CQL.js.map
|