@rocicorp/zero 0.23.2025090400 → 0.23.2025090402

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 (40) hide show
  1. package/out/{chunk-LCK57CQL.js → chunk-2IK4AWFW.js} +28 -19
  2. package/out/chunk-2IK4AWFW.js.map +7 -0
  3. package/out/{chunk-6QYVZALS.js → chunk-Q2AQC47T.js} +2 -2
  4. package/out/react.js +1 -1
  5. package/out/solid.js +2 -2
  6. package/out/zero/package.json +1 -1
  7. package/out/zero-cache/src/custom/fetch.d.ts +1 -2
  8. package/out/zero-cache/src/custom/fetch.d.ts.map +1 -1
  9. package/out/zero-cache/src/custom/fetch.js +6 -8
  10. package/out/zero-cache/src/custom/fetch.js.map +1 -1
  11. package/out/zero-cache/src/custom-queries/transform-query.d.ts +2 -3
  12. package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +1 -1
  13. package/out/zero-cache/src/custom-queries/transform-query.js +3 -6
  14. package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
  15. package/out/zero-cache/src/services/mutagen/pusher.d.ts +3 -2
  16. package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
  17. package/out/zero-cache/src/services/mutagen/pusher.js +6 -25
  18. package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
  19. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +0 -1
  20. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  21. package/out/zero-cache/src/services/view-syncer/view-syncer.js +3 -20
  22. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  23. package/out/zero-cache/src/workers/syncer-ws-message-handler.js +1 -1
  24. package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
  25. package/out/zero-client/src/client/options.d.ts +12 -8
  26. package/out/zero-client/src/client/options.d.ts.map +1 -1
  27. package/out/zero-client/src/client/zero.d.ts +2 -1
  28. package/out/zero-client/src/client/zero.d.ts.map +1 -1
  29. package/out/zero-protocol/src/connect.d.ts +32 -4
  30. package/out/zero-protocol/src/connect.d.ts.map +1 -1
  31. package/out/zero-protocol/src/connect.js +17 -2
  32. package/out/zero-protocol/src/connect.js.map +1 -1
  33. package/out/zero-protocol/src/up.d.ts +8 -2
  34. package/out/zero-protocol/src/up.d.ts.map +1 -1
  35. package/out/zero-schema/src/builder/schema-builder.js +1 -1
  36. package/out/zero-schema/src/builder/schema-builder.js.map +1 -1
  37. package/out/zero.js +2 -2
  38. package/package.json +1 -1
  39. package/out/chunk-LCK57CQL.js.map +0 -7
  40. /package/out/{chunk-6QYVZALS.js.map → chunk-Q2AQC47T.js.map} +0 -0
@@ -1777,7 +1777,7 @@ function clientSchemaFrom(schema) {
1777
1777
  serverName2 ?? name2,
1778
1778
  { type }
1779
1779
  ]),
1780
- primaryKey: [...primaryKey]
1780
+ primaryKey: primaryKey.map((k) => columns[k].serverName ?? k)
1781
1781
  }
1782
1782
  ]
1783
1783
  )
@@ -5982,14 +5982,29 @@ var connectedMessageSchema = valita_exports.tuple([
5982
5982
  valita_exports.literal("connected"),
5983
5983
  connectedBodySchema
5984
5984
  ]);
5985
+ var userQueryMutateParamsSchema = valita_exports.object({
5986
+ /**
5987
+ * A client driven URL to send queries or mutations to.
5988
+ * This URL must match one of the URLs set in the zero config.
5989
+ *
5990
+ * E.g., Given the following environment variable:
5991
+ * ZERO_GET_QUERIES_URL=[https://*.example.com/query]
5992
+ *
5993
+ * Then this URL could be:
5994
+ * https://myapp.example.com/query
5995
+ */
5996
+ url: valita_exports.string().optional(),
5997
+ // The query string to use for query or mutation calls.
5998
+ queryParams: valita_exports.record(valita_exports.string()).optional()
5999
+ });
5985
6000
  var initConnectionBodySchema = valita_exports.object({
5986
6001
  desiredQueriesPatch: upQueriesPatchSchema,
5987
6002
  clientSchema: clientSchemaSchema.optional(),
5988
6003
  deleted: deleteClientsBodySchema.optional(),
5989
6004
  // parameters to configure the mutate endpoint
5990
- userPushURL: valita_exports.string().optional(),
6005
+ userPushParams: userQueryMutateParamsSchema.optional(),
5991
6006
  // parameters to configure the query endpoint
5992
- userQueryURL: valita_exports.string().optional(),
6007
+ userQueryParams: userQueryMutateParamsSchema.optional(),
5993
6008
  /**
5994
6009
  * `activeClients` is an optional array of client IDs that are currently active
5995
6010
  * in the client group. This is used to inform the server about the clients
@@ -8665,7 +8680,7 @@ function makeMessage(message, context, logLevel) {
8665
8680
  }
8666
8681
 
8667
8682
  // ../zero-client/src/client/version.ts
8668
- var version2 = "0.23.2025090400";
8683
+ var version2 = "0.23.2025090402";
8669
8684
 
8670
8685
  // ../zero-client/src/client/log-options.ts
8671
8686
  var LevelFilterLogSink = class {
@@ -10356,12 +10371,6 @@ var Zero = class _Zero {
10356
10371
  this.#schema = schema;
10357
10372
  const { clientSchema, hash } = clientSchemaFrom(schema);
10358
10373
  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);
10365
10374
  const replicacheOptions = {
10366
10375
  // The schema stored in IDB is dependent upon both the ClientSchema
10367
10376
  // and the AST schema (i.e. PROTOCOL_VERSION).
@@ -10369,7 +10378,7 @@ var Zero = class _Zero {
10369
10378
  logLevel: logOptions.logLevel,
10370
10379
  logSinks: [logOptions.logSink],
10371
10380
  mutators: replicacheMutators,
10372
- name: `zero-${userID}-${hashedKey}`,
10381
+ name: `zero-${userID}-${this.storageKey}`,
10373
10382
  pusher: (req, reqID) => this.#pusher(req, reqID),
10374
10383
  puller: (req, reqID) => this.#puller(req, reqID),
10375
10384
  pushDelay: 0,
@@ -10886,8 +10895,8 @@ var Zero = class _Zero {
10886
10895
  // The clientSchema only needs to be sent for the very first request.
10887
10896
  // Henceforth it is stored with the CVR and verified automatically.
10888
10897
  ...this.#connectCookie === null ? { clientSchema } : {},
10889
- userPushURL: this.#options.mutateURL,
10890
- userQueryURL: this.#options.getQueriesURL
10898
+ userPushParams: this.#options.mutate ?? this.#options.push,
10899
+ userQueryParams: this.#options.query
10891
10900
  }
10892
10901
  ]);
10893
10902
  this.#deletedClients = void 0;
@@ -10963,8 +10972,8 @@ var Zero = class _Zero {
10963
10972
  wsid,
10964
10973
  this.#options.logLevel === "debug",
10965
10974
  lc,
10966
- this.#options.mutateURL,
10967
- this.#options.getQueriesURL,
10975
+ this.#options.mutate ?? this.#options.push,
10976
+ this.#options.query,
10968
10977
  this.#options.maxHeaderLength,
10969
10978
  additionalConnectParams,
10970
10979
  await this.#activeClientsManager
@@ -11479,7 +11488,7 @@ var OnlineManager = class extends Subscribable {
11479
11488
  return this.#online;
11480
11489
  }
11481
11490
  };
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) {
11491
+ async function createSocket(rep, queryManager, deleteClientsManager, socketOrigin, baseCookie, clientID, clientGroupID, clientSchema, userID, auth, lmid, wsid, debugPerf, lc, userPushParams, userQueryParams, maxHeaderLength = 1024 * 8, additionalConnectParams, activeClientsManager) {
11483
11492
  const url = new URL(
11484
11493
  appendPath(socketOrigin, `/sync/v${PROTOCOL_VERSION}/connect`)
11485
11494
  );
@@ -11518,8 +11527,8 @@ async function createSocket(rep, queryManager, deleteClientsManager, socketOrigi
11518
11527
  // The clientSchema only needs to be sent for the very first request.
11519
11528
  // Henceforth it is stored with the CVR and verified automatically.
11520
11529
  ...baseCookie === null ? { clientSchema } : {},
11521
- userPushURL,
11522
- userQueryURL,
11530
+ userPushParams,
11531
+ userQueryParams,
11523
11532
  activeClients: [...activeClients]
11524
11533
  }
11525
11534
  ],
@@ -11612,4 +11621,4 @@ export {
11612
11621
  update_needed_reason_type_enum_exports,
11613
11622
  Zero
11614
11623
  };
11615
- //# sourceMappingURL=chunk-LCK57CQL.js.map
11624
+ //# sourceMappingURL=chunk-2IK4AWFW.js.map