@rocicorp/zero 0.13.2025020501 → 0.13.2025020700

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 (33) hide show
  1. package/out/{chunk-453TFLSU.js → chunk-FVVIM6TT.js} +27 -37
  2. package/out/chunk-FVVIM6TT.js.map +7 -0
  3. package/out/replicache/src/sync/patch.d.ts.map +1 -1
  4. package/out/solid.js +1 -1
  5. package/out/zero-cache/src/config/zero-config.d.ts +20 -0
  6. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  7. package/out/zero-cache/src/config/zero-config.js +14 -0
  8. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  9. package/out/zero-cache/src/server/multi/config.d.ts +10 -0
  10. package/out/zero-cache/src/server/multi/config.d.ts.map +1 -1
  11. package/out/zero-cache/src/services/change-source/pg/schema/published.d.ts.map +1 -1
  12. package/out/zero-cache/src/services/change-source/pg/schema/published.js +7 -1
  13. package/out/zero-cache/src/services/change-source/pg/schema/published.js.map +1 -1
  14. package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts.map +1 -1
  15. package/out/zero-cache/src/services/change-source/pg/schema/shard.js +3 -1
  16. package/out/zero-cache/src/services/change-source/pg/schema/shard.js.map +1 -1
  17. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +2 -2
  18. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
  19. package/out/zero-cache/src/services/view-syncer/cvr-store.js +7 -2
  20. package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
  21. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  22. package/out/zero-cache/src/services/view-syncer/view-syncer.js +8 -9
  23. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  24. package/out/zero-client/src/client/context.d.ts.map +1 -1
  25. package/out/zero-client/src/client/ivm-source-repo.d.ts +0 -1
  26. package/out/zero-client/src/client/ivm-source-repo.d.ts.map +1 -1
  27. package/out/zero-client/src/client/keys.d.ts +1 -0
  28. package/out/zero-client/src/client/keys.d.ts.map +1 -1
  29. package/out/zero-client/src/client/zero.d.ts +1 -1
  30. package/out/zero-client/src/client/zero.d.ts.map +1 -1
  31. package/out/zero.js +1 -1
  32. package/package.json +1 -2
  33. package/out/chunk-453TFLSU.js.map +0 -7
@@ -5000,26 +5000,29 @@ var CookieMismatch = 2;
5000
5000
  // ../replicache/src/sync/patch.ts
5001
5001
  async function apply(lc, dbWrite, patch) {
5002
5002
  const ret = [];
5003
+ function pushChangeOrAdd(key, oldValue, newValue) {
5004
+ if (oldValue === void 0) {
5005
+ ret.push({
5006
+ op: "add",
5007
+ key,
5008
+ newValue
5009
+ });
5010
+ } else {
5011
+ ret.push({
5012
+ op: "change",
5013
+ key,
5014
+ oldValue,
5015
+ newValue
5016
+ });
5017
+ }
5018
+ }
5003
5019
  for (const p of patch) {
5004
5020
  switch (p.op) {
5005
5021
  case "put": {
5006
5022
  const existing = await dbWrite.get(p.key);
5007
5023
  const frozen = deepFreeze(p.value);
5024
+ pushChangeOrAdd(p.key, existing, frozen);
5008
5025
  await dbWrite.put(lc, p.key, frozen);
5009
- if (existing === void 0) {
5010
- ret.push({
5011
- op: "add",
5012
- key: p.key,
5013
- newValue: frozen
5014
- });
5015
- } else {
5016
- ret.push({
5017
- op: "change",
5018
- key: p.key,
5019
- oldValue: existing,
5020
- newValue: frozen
5021
- });
5022
- }
5023
5026
  break;
5024
5027
  }
5025
5028
  case "update": {
@@ -5040,21 +5043,8 @@ async function apply(lc, dbWrite, patch) {
5040
5043
  addToEntries(p.merge);
5041
5044
  }
5042
5045
  const frozen = deepFreeze(Object.fromEntries(entries));
5046
+ pushChangeOrAdd(p.key, existing, frozen);
5043
5047
  await dbWrite.put(lc, p.key, frozen);
5044
- if (existing === void 0) {
5045
- ret.push({
5046
- op: "add",
5047
- key: p.key,
5048
- newValue: frozen
5049
- });
5050
- } else {
5051
- ret.push({
5052
- op: "change",
5053
- key: p.key,
5054
- oldValue: existing,
5055
- newValue: frozen
5056
- });
5057
- }
5058
5048
  break;
5059
5049
  }
5060
5050
  case "del": {
@@ -13083,6 +13073,10 @@ function toPrimaryKeyString(tableName, primaryKey, value) {
13083
13073
  const idSegment = h128(str);
13084
13074
  return ENTITIES_KEY_PREFIX + tableName + "/" + idSegment;
13085
13075
  }
13076
+ function sourceNameFromKey(key) {
13077
+ const slash = key.indexOf("/", ENTITIES_KEY_PREFIX.length);
13078
+ return key.slice(ENTITIES_KEY_PREFIX.length, slash);
13079
+ }
13086
13080
 
13087
13081
  // ../zero-client/src/client/ivm-source-repo.ts
13088
13082
  var IVMSourceRepo = class {
@@ -13126,7 +13120,7 @@ var IVMSourceRepo = class {
13126
13120
  if (!entry[0].startsWith(ENTITIES_KEY_PREFIX)) {
13127
13121
  break;
13128
13122
  }
13129
- const name = nameFromKey(entry[0]);
13123
+ const name = sourceNameFromKey(entry[0]);
13130
13124
  const source = must(syncSources.getSource(name));
13131
13125
  source.push({
13132
13126
  type: "add",
@@ -13145,7 +13139,7 @@ var IVMSourceRepo = class {
13145
13139
  if (!key.startsWith(ENTITIES_KEY_PREFIX)) {
13146
13140
  continue;
13147
13141
  }
13148
- const name = nameFromKey(key);
13142
+ const name = sourceNameFromKey(key);
13149
13143
  const source = must(this.#sync.getSource(name));
13150
13144
  switch (patch.op) {
13151
13145
  case "del":
@@ -13173,10 +13167,6 @@ var IVMSourceRepo = class {
13173
13167
  this.#rebase = must(this.#sync).fork();
13174
13168
  };
13175
13169
  };
13176
- function nameFromKey(key) {
13177
- const slash = key.indexOf("/", ENTITIES_KEY_PREFIX.length);
13178
- return key.slice(ENTITIES_KEY_PREFIX.length, slash);
13179
- }
13180
13170
  var IVMSourceBranch = class _IVMSourceBranch {
13181
13171
  #sources;
13182
13172
  #tables;
@@ -13270,7 +13260,7 @@ var ZeroContext = class {
13270
13260
  for (const diff2 of changes) {
13271
13261
  const { key } = diff2;
13272
13262
  assert(key.startsWith(ENTITIES_KEY_PREFIX));
13273
- const name = nameFromKey(key);
13263
+ const name = sourceNameFromKey(key);
13274
13264
  const source = this.getSource(name);
13275
13265
  if (!source) {
13276
13266
  continue;
@@ -13888,7 +13878,7 @@ function makeMessage(message, context, logLevel) {
13888
13878
  }
13889
13879
 
13890
13880
  // ../zero-client/src/client/version.ts
13891
- var version2 = "0.13.2025020501";
13881
+ var version2 = "0.13.2025020700";
13892
13882
 
13893
13883
  // ../zero-client/src/client/log-options.ts
13894
13884
  var LevelFilterLogSink = class {
@@ -16000,4 +15990,4 @@ export {
16000
15990
  escapeLike,
16001
15991
  Zero
16002
15992
  };
16003
- //# sourceMappingURL=chunk-453TFLSU.js.map
15993
+ //# sourceMappingURL=chunk-FVVIM6TT.js.map