@rocicorp/zero 0.18.2025031800 → 0.18.2025031804

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.
@@ -7154,7 +7154,7 @@ var ReplicacheImpl = class {
7154
7154
  /** The URL to use when doing a push request. */
7155
7155
  pushURL;
7156
7156
  /** The authorization token used when doing a push request. */
7157
- auth;
7157
+ #auth;
7158
7158
  /** The name of the Replicache database. Populated by {@link ReplicacheOptions#name}. */
7159
7159
  name;
7160
7160
  #subscriptions;
@@ -7173,6 +7173,15 @@ var ReplicacheImpl = class {
7173
7173
  get idbName() {
7174
7174
  return makeIDBName(this.name, this.schemaVersion);
7175
7175
  }
7176
+ set auth(auth) {
7177
+ if (this.#zero) {
7178
+ this.#zero.auth = auth;
7179
+ }
7180
+ this.#auth = auth;
7181
+ }
7182
+ get auth() {
7183
+ return this.#auth;
7184
+ }
7176
7185
  /** The schema version of the data understood by this application. */
7177
7186
  schemaVersion;
7178
7187
  get #idbDatabase() {
@@ -7334,7 +7343,7 @@ var ReplicacheImpl = class {
7334
7343
  }
7335
7344
  } = implOptions;
7336
7345
  this.#zero = implOptions.zero;
7337
- this.auth = auth ?? "";
7346
+ this.#auth = auth ?? "";
7338
7347
  this.pullURL = pullURL;
7339
7348
  this.pushURL = pushURL;
7340
7349
  this.name = name;
@@ -10128,6 +10137,8 @@ var Take = class {
10128
10137
  #limit;
10129
10138
  #partitionKey;
10130
10139
  #partitionKeyComparator;
10140
+ // Fetch overlay needed for some split push cases.
10141
+ #rowHiddenFromFetch;
10131
10142
  #output = throwOutput;
10132
10143
  constructor(input, storage, limit, partitionKey) {
10133
10144
  assert(limit >= 0);
@@ -10163,6 +10174,12 @@ var Take = class {
10163
10174
  if (this.getSchema().compareRows(takeState.bound, inputNode.row) < 0) {
10164
10175
  return;
10165
10176
  }
10177
+ if (this.#rowHiddenFromFetch && this.getSchema().compareRows(
10178
+ this.#rowHiddenFromFetch,
10179
+ inputNode.row
10180
+ ) === 0) {
10181
+ continue;
10182
+ }
10166
10183
  yield inputNode;
10167
10184
  }
10168
10185
  return;
@@ -10305,14 +10322,16 @@ var Take = class {
10305
10322
  type: "remove",
10306
10323
  node: boundNode
10307
10324
  };
10308
- this.#output.push(change);
10309
10325
  this.#setTakeState(
10310
10326
  takeStateKey,
10311
10327
  takeState.size,
10312
10328
  beforeBoundNode === void 0 || compareRows(change.node.row, beforeBoundNode.row) > 0 ? change.node.row : beforeBoundNode.row,
10313
10329
  maxBound
10314
10330
  );
10315
- this.#output.push(removeChange);
10331
+ this.#withRowHiddenFromFetch(change.node.row, () => {
10332
+ this.#output.push(removeChange);
10333
+ });
10334
+ this.#output.push(change);
10316
10335
  } else if (change.type === "remove") {
10317
10336
  if (takeState.bound === void 0) {
10318
10337
  return;
@@ -10483,19 +10502,21 @@ var Take = class {
10483
10502
  }),
10484
10503
  2
10485
10504
  );
10486
- this.#output.push({
10487
- type: "add",
10488
- node: change.node
10489
- });
10490
10505
  this.#setTakeState(
10491
10506
  takeStateKey,
10492
10507
  takeState.size,
10493
10508
  newBoundNode.row,
10494
10509
  maxBound
10495
10510
  );
10511
+ this.#withRowHiddenFromFetch(change.node.row, () => {
10512
+ this.#output.push({
10513
+ type: "remove",
10514
+ node: oldBoundNode
10515
+ });
10516
+ });
10496
10517
  this.#output.push({
10497
- type: "remove",
10498
- node: oldBoundNode
10518
+ type: "add",
10519
+ node: change.node
10499
10520
  });
10500
10521
  return;
10501
10522
  }
@@ -10539,6 +10560,14 @@ var Take = class {
10539
10560
  }
10540
10561
  unreachable();
10541
10562
  }
10563
+ #withRowHiddenFromFetch(row, fn) {
10564
+ this.#rowHiddenFromFetch = row;
10565
+ try {
10566
+ fn();
10567
+ } finally {
10568
+ this.#rowHiddenFromFetch = void 0;
10569
+ }
10570
+ }
10542
10571
  #setTakeState(takeStateKey, size, bound, maxBound) {
10543
10572
  this.#storage.set(takeStateKey, {
10544
10573
  size,
@@ -14085,23 +14114,22 @@ var TransactionImpl = class {
14085
14114
  this.clientID = repTx.clientID;
14086
14115
  this.mutationID = repTx.mutationID;
14087
14116
  this.reason = repTx.reason === "initial" ? "optimistic" : "rebase";
14117
+ const txData = must(
14118
+ castedRepTx[zeroData],
14119
+ "zero was not set on replicache internal options!"
14120
+ );
14088
14121
  this.mutate = makeSchemaCRUD(
14089
14122
  schema,
14090
14123
  repTx,
14091
- must(
14092
- castedRepTx[zeroData],
14093
- "zero was not set on replicache internal options!"
14094
- )
14124
+ txData.ivmSources
14095
14125
  );
14096
14126
  this.query = makeSchemaQuery(
14097
14127
  lc,
14098
14128
  schema,
14099
- must(
14100
- castedRepTx[zeroData],
14101
- "zero was not set on replicache internal options!"
14102
- ),
14129
+ txData.ivmSources,
14103
14130
  slowMaterializeThreshold
14104
14131
  );
14132
+ this.token = txData.token;
14105
14133
  }
14106
14134
  clientID;
14107
14135
  mutationID;
@@ -14109,6 +14137,7 @@ var TransactionImpl = class {
14109
14137
  location = "client";
14110
14138
  mutate;
14111
14139
  query;
14140
+ token;
14112
14141
  };
14113
14142
  function makeReplicacheMutator(lc, mutator, schema, slowMaterializeThreshold) {
14114
14143
  return (repTx, args) => {
@@ -14484,7 +14513,7 @@ function makeMessage(message, context, logLevel) {
14484
14513
  }
14485
14514
 
14486
14515
  // ../zero-client/src/client/version.ts
14487
- var version2 = "0.18.2025031800";
14516
+ var version2 = "0.18.2025031804";
14488
14517
 
14489
14518
  // ../zero-client/src/client/log-options.ts
14490
14519
  var LevelFilterLogSink = class {
@@ -15413,11 +15442,19 @@ var ZeroRep = class {
15413
15442
  #ivmMain;
15414
15443
  #customMutatorsEnabled;
15415
15444
  #store;
15445
+ #auth;
15416
15446
  constructor(context, ivmMain, customMutatorsEnabled) {
15417
15447
  this.#context = context;
15418
15448
  this.#ivmMain = ivmMain;
15419
15449
  this.#customMutatorsEnabled = customMutatorsEnabled;
15420
15450
  }
15451
+ set auth(auth) {
15452
+ if (auth === "") {
15453
+ this.#auth = void 0;
15454
+ } else {
15455
+ this.#auth = auth;
15456
+ }
15457
+ }
15421
15458
  async init(hash2, store) {
15422
15459
  const diffs = [];
15423
15460
  await withRead(store, async (dagRead) => {
@@ -15440,11 +15477,10 @@ var ZeroRep = class {
15440
15477
  if (!this.#customMutatorsEnabled) {
15441
15478
  return;
15442
15479
  }
15443
- return this.#ivmMain.forkToHead(
15444
- must(this.#store),
15445
- desiredHead,
15446
- readOptions
15447
- );
15480
+ return this.#ivmMain.forkToHead(must(this.#store), desiredHead, readOptions).then((branch) => ({
15481
+ ivmSources: branch,
15482
+ token: this.#auth
15483
+ }));
15448
15484
  };
15449
15485
  advance = (expectedHash, newHash, diffs) => {
15450
15486
  this.#context.processChanges(expectedHash, newHash, diffs);
@@ -16789,4 +16825,4 @@ export {
16789
16825
  escapeLike,
16790
16826
  Zero
16791
16827
  };
16792
- //# sourceMappingURL=chunk-FNFCFUNQ.js.map
16828
+ //# sourceMappingURL=chunk-WAEGU73X.js.map