@rocicorp/zero 0.10.2024123000 → 0.10.2025010500

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 (63) hide show
  1. package/out/{chunk-NWHD4LHL.js → chunk-VLJ76GO7.js} +202 -183
  2. package/out/{chunk-NWHD4LHL.js.map → chunk-VLJ76GO7.js.map} +4 -4
  3. package/out/react.js.map +1 -1
  4. package/out/solid.js +26 -8
  5. package/out/solid.js.map +2 -2
  6. package/out/zero-advanced/src/mod.d.ts +1 -1
  7. package/out/zero-advanced/src/mod.d.ts.map +1 -1
  8. package/out/zero-cache/src/config/zero-config.d.ts +20 -0
  9. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  10. package/out/zero-cache/src/config/zero-config.js +19 -0
  11. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  12. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  13. package/out/zero-cache/src/server/change-streamer.js +1 -1
  14. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  15. package/out/zero-cache/src/server/multi/config.d.ts +10 -0
  16. package/out/zero-cache/src/server/multi/config.d.ts.map +1 -1
  17. package/out/zero-cache/src/server/multi/tenant-dispatcher.js +1 -1
  18. package/out/zero-cache/src/server/multi/tenant-dispatcher.js.map +1 -1
  19. package/out/zero-cache/src/services/change-streamer/pg/change-source.d.ts +2 -1
  20. package/out/zero-cache/src/services/change-streamer/pg/change-source.d.ts.map +1 -1
  21. package/out/zero-cache/src/services/change-streamer/pg/change-source.js +16 -4
  22. package/out/zero-cache/src/services/change-streamer/pg/change-source.js.map +1 -1
  23. package/out/zero-cache/src/services/change-streamer/pg/initial-sync.d.ts +5 -1
  24. package/out/zero-cache/src/services/change-streamer/pg/initial-sync.d.ts.map +1 -1
  25. package/out/zero-cache/src/services/change-streamer/pg/initial-sync.js +8 -11
  26. package/out/zero-cache/src/services/change-streamer/pg/initial-sync.js.map +1 -1
  27. package/out/zero-cache/src/services/change-streamer/pg/sync-schema.d.ts +2 -1
  28. package/out/zero-cache/src/services/change-streamer/pg/sync-schema.d.ts.map +1 -1
  29. package/out/zero-cache/src/services/change-streamer/pg/sync-schema.js +2 -2
  30. package/out/zero-cache/src/services/change-streamer/pg/sync-schema.js.map +1 -1
  31. package/out/zero-cache/src/services/dispatcher/websocket-handoff.d.ts.map +1 -1
  32. package/out/zero-cache/src/services/dispatcher/websocket-handoff.js +16 -2
  33. package/out/zero-cache/src/services/dispatcher/websocket-handoff.js.map +1 -1
  34. package/out/zero-cache/src/types/processes.d.ts.map +1 -1
  35. package/out/zero-cache/src/types/processes.js +7 -2
  36. package/out/zero-cache/src/types/processes.js.map +1 -1
  37. package/out/zero-protocol/src/ast.d.ts +2 -7
  38. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  39. package/out/zero-protocol/src/ast.js +1 -0
  40. package/out/zero-protocol/src/ast.js.map +1 -1
  41. package/out/zero-react/src/use-query.d.ts +3 -3
  42. package/out/zero-react/src/use-query.d.ts.map +1 -1
  43. package/out/zero-schema/src/permissions.d.ts +8 -3
  44. package/out/zero-schema/src/permissions.d.ts.map +1 -1
  45. package/out/zero-solid/src/solid-view.d.ts +4 -2
  46. package/out/zero-solid/src/solid-view.d.ts.map +1 -1
  47. package/out/zero-solid/src/use-query.d.ts +9 -1
  48. package/out/zero-solid/src/use-query.d.ts.map +1 -1
  49. package/out/zero.js +1 -1
  50. package/out/zql/src/builder/builder.d.ts.map +1 -1
  51. package/out/zql/src/builder/builder.js +11 -1
  52. package/out/zql/src/builder/builder.js.map +1 -1
  53. package/out/zql/src/query/expression.d.ts +9 -6
  54. package/out/zql/src/query/expression.d.ts.map +1 -1
  55. package/out/zql/src/query/expression.js +12 -5
  56. package/out/zql/src/query/expression.js.map +1 -1
  57. package/out/zql/src/query/query-impl.d.ts +4 -4
  58. package/out/zql/src/query/query-impl.d.ts.map +1 -1
  59. package/out/zql/src/query/query-impl.js +2 -1
  60. package/out/zql/src/query/query-impl.js.map +1 -1
  61. package/out/zql/src/query/query.d.ts +5 -9
  62. package/out/zql/src/query/query.d.ts.map +1 -1
  63. package/package.json +1 -1
@@ -9528,173 +9528,6 @@ function normalizeTables2(tables) {
9528
9528
  return rv;
9529
9529
  }
9530
9530
 
9531
- // ../zql/src/query/expression.ts
9532
- var ExpressionBuilder = class {
9533
- #exists;
9534
- constructor(exists) {
9535
- this.#exists = exists;
9536
- this.exists = this.exists.bind(this);
9537
- }
9538
- get eb() {
9539
- return this;
9540
- }
9541
- cmp(field, opOrValue, value) {
9542
- return cmp(field, opOrValue, value);
9543
- }
9544
- cmpLit(left, op, right) {
9545
- return {
9546
- type: "simple",
9547
- left: isParameter(left) ? left : { type: "literal", value: left },
9548
- right: isParameter(right) ? right : { type: "literal", value: right },
9549
- op
9550
- };
9551
- }
9552
- and = and;
9553
- or = or;
9554
- not = not;
9555
- exists(relationship, cb) {
9556
- return this.#exists(relationship, cb);
9557
- }
9558
- };
9559
- function and(...conditions) {
9560
- const expressions = filterTrue(filterUndefined(conditions));
9561
- if (expressions.length === 1) {
9562
- return expressions[0];
9563
- }
9564
- if (expressions.some(isAlwaysFalse)) {
9565
- return FALSE;
9566
- }
9567
- return { type: "and", conditions: expressions };
9568
- }
9569
- function or(...conditions) {
9570
- const expressions = filterFalse(filterUndefined(conditions));
9571
- if (expressions.length === 1) {
9572
- return expressions[0];
9573
- }
9574
- if (expressions.some(isAlwaysTrue)) {
9575
- return TRUE;
9576
- }
9577
- return { type: "or", conditions: expressions };
9578
- }
9579
- function not(expression) {
9580
- switch (expression.type) {
9581
- case "and":
9582
- return {
9583
- type: "or",
9584
- conditions: expression.conditions.map(not)
9585
- };
9586
- case "or":
9587
- return {
9588
- type: "and",
9589
- conditions: expression.conditions.map(not)
9590
- };
9591
- case "correlatedSubquery":
9592
- return {
9593
- type: "correlatedSubquery",
9594
- related: expression.related,
9595
- op: negateOperator(expression.op)
9596
- };
9597
- case "simple":
9598
- return {
9599
- type: "simple",
9600
- op: negateOperator(expression.op),
9601
- left: expression.left,
9602
- right: expression.right
9603
- };
9604
- }
9605
- }
9606
- function cmp(field, opOrValue, value) {
9607
- let op;
9608
- if (value === void 0) {
9609
- value = opOrValue;
9610
- op = "=";
9611
- } else {
9612
- op = opOrValue;
9613
- }
9614
- return {
9615
- type: "simple",
9616
- left: { type: "column", name: field },
9617
- right: isParameter(value) ? value : { type: "literal", value },
9618
- op
9619
- };
9620
- }
9621
- function isParameter(value) {
9622
- return typeof value === "object" && value?.type === "static";
9623
- }
9624
- var TRUE = {
9625
- type: "and",
9626
- conditions: []
9627
- };
9628
- var FALSE = {
9629
- type: "or",
9630
- conditions: []
9631
- };
9632
- function isAlwaysTrue(condition) {
9633
- return condition.type === "and" && condition.conditions.length === 0;
9634
- }
9635
- function isAlwaysFalse(condition) {
9636
- return condition.type === "or" && condition.conditions.length === 0;
9637
- }
9638
- function flatten(type, conditions) {
9639
- const flattened2 = [];
9640
- for (const c of conditions) {
9641
- if (c.type === type) {
9642
- flattened2.push(...c.conditions);
9643
- } else {
9644
- flattened2.push(c);
9645
- }
9646
- }
9647
- return flattened2;
9648
- }
9649
- var negateSimpleOperatorMap = {
9650
- ["="]: "!=",
9651
- ["!="]: "=",
9652
- ["<"]: ">=",
9653
- [">"]: "<=",
9654
- [">="]: "<",
9655
- ["<="]: ">",
9656
- ["IN"]: "NOT IN",
9657
- ["NOT IN"]: "IN",
9658
- ["LIKE"]: "NOT LIKE",
9659
- ["NOT LIKE"]: "LIKE",
9660
- ["ILIKE"]: "NOT ILIKE",
9661
- ["NOT ILIKE"]: "ILIKE",
9662
- ["IS"]: "IS NOT",
9663
- ["IS NOT"]: "IS"
9664
- };
9665
- var negateOperatorMap = {
9666
- ...negateSimpleOperatorMap,
9667
- ["EXISTS"]: "NOT EXISTS",
9668
- ["NOT EXISTS"]: "EXISTS"
9669
- };
9670
- function negateOperator(op) {
9671
- return must(negateOperatorMap[op]);
9672
- }
9673
- function filterUndefined(array10) {
9674
- return array10.filter((e) => e !== void 0);
9675
- }
9676
- function filterTrue(conditions) {
9677
- return conditions.filter((c) => !isAlwaysTrue(c));
9678
- }
9679
- function filterFalse(conditions) {
9680
- return conditions.filter((c) => !isAlwaysFalse(c));
9681
- }
9682
-
9683
- // ../zql/src/query/query-impl.ts
9684
- import { resolver as resolver7 } from "@rocicorp/resolver";
9685
-
9686
- // ../shared/src/hash.ts
9687
- import { xxHash32 } from "js-xxhash";
9688
- var h64 = (s) => hash(s, 2);
9689
- var h128 = (s) => hash(s, 4);
9690
- function hash(str, words) {
9691
- let hash2 = 0n;
9692
- for (let i = 0; i < words; i++) {
9693
- hash2 = (hash2 << 32n) + BigInt(xxHash32(str, i));
9694
- }
9695
- return hash2;
9696
- }
9697
-
9698
9531
  // ../zero-protocol/src/ast.ts
9699
9532
  import { compareUTF8 as compareUTF83 } from "compare-utf8";
9700
9533
 
@@ -9723,6 +9556,7 @@ var rowSchema = readonlyRecord(valueSchema);
9723
9556
 
9724
9557
  // ../zero-protocol/src/ast.ts
9725
9558
  var selectorSchema = valita_exports.string();
9559
+ var toStaticParam = Symbol();
9726
9560
  var orderingElementSchema = readonly(
9727
9561
  valita_exports.tuple([selectorSchema, valita_exports.union(valita_exports.literal("asc"), valita_exports.literal("desc"))])
9728
9562
  );
@@ -9965,6 +9799,173 @@ function compareUTF8MaybeNull(a, b) {
9965
9799
  return 0;
9966
9800
  }
9967
9801
 
9802
+ // ../zql/src/query/expression.ts
9803
+ var ExpressionBuilder = class {
9804
+ #exists;
9805
+ constructor(exists) {
9806
+ this.#exists = exists;
9807
+ this.exists = this.exists.bind(this);
9808
+ }
9809
+ get eb() {
9810
+ return this;
9811
+ }
9812
+ cmp(field, opOrValue, value) {
9813
+ return cmp(field, opOrValue, value);
9814
+ }
9815
+ cmpLit(left, op, right) {
9816
+ return {
9817
+ type: "simple",
9818
+ left: isParameterReference(left) ? left[toStaticParam]() : { type: "literal", value: left },
9819
+ right: isParameterReference(right) ? right[toStaticParam]() : { type: "literal", value: right },
9820
+ op
9821
+ };
9822
+ }
9823
+ and = and;
9824
+ or = or;
9825
+ not = not;
9826
+ exists(relationship, cb) {
9827
+ return this.#exists(relationship, cb);
9828
+ }
9829
+ };
9830
+ function and(...conditions) {
9831
+ const expressions = filterTrue(filterUndefined(conditions));
9832
+ if (expressions.length === 1) {
9833
+ return expressions[0];
9834
+ }
9835
+ if (expressions.some(isAlwaysFalse)) {
9836
+ return FALSE;
9837
+ }
9838
+ return { type: "and", conditions: expressions };
9839
+ }
9840
+ function or(...conditions) {
9841
+ const expressions = filterFalse(filterUndefined(conditions));
9842
+ if (expressions.length === 1) {
9843
+ return expressions[0];
9844
+ }
9845
+ if (expressions.some(isAlwaysTrue)) {
9846
+ return TRUE;
9847
+ }
9848
+ return { type: "or", conditions: expressions };
9849
+ }
9850
+ function not(expression) {
9851
+ switch (expression.type) {
9852
+ case "and":
9853
+ return {
9854
+ type: "or",
9855
+ conditions: expression.conditions.map(not)
9856
+ };
9857
+ case "or":
9858
+ return {
9859
+ type: "and",
9860
+ conditions: expression.conditions.map(not)
9861
+ };
9862
+ case "correlatedSubquery":
9863
+ return {
9864
+ type: "correlatedSubquery",
9865
+ related: expression.related,
9866
+ op: negateOperator(expression.op)
9867
+ };
9868
+ case "simple":
9869
+ return {
9870
+ type: "simple",
9871
+ op: negateOperator(expression.op),
9872
+ left: expression.left,
9873
+ right: expression.right
9874
+ };
9875
+ }
9876
+ }
9877
+ function cmp(field, opOrValue, value) {
9878
+ let op;
9879
+ if (value === void 0) {
9880
+ value = opOrValue;
9881
+ op = "=";
9882
+ } else {
9883
+ op = opOrValue;
9884
+ }
9885
+ return {
9886
+ type: "simple",
9887
+ left: { type: "column", name: field },
9888
+ right: isParameterReference(value) ? value[toStaticParam]() : { type: "literal", value },
9889
+ op
9890
+ };
9891
+ }
9892
+ function isParameterReference(value) {
9893
+ return value !== null && typeof value === "object" && value[toStaticParam];
9894
+ }
9895
+ var TRUE = {
9896
+ type: "and",
9897
+ conditions: []
9898
+ };
9899
+ var FALSE = {
9900
+ type: "or",
9901
+ conditions: []
9902
+ };
9903
+ function isAlwaysTrue(condition) {
9904
+ return condition.type === "and" && condition.conditions.length === 0;
9905
+ }
9906
+ function isAlwaysFalse(condition) {
9907
+ return condition.type === "or" && condition.conditions.length === 0;
9908
+ }
9909
+ function flatten(type, conditions) {
9910
+ const flattened2 = [];
9911
+ for (const c of conditions) {
9912
+ if (c.type === type) {
9913
+ flattened2.push(...c.conditions);
9914
+ } else {
9915
+ flattened2.push(c);
9916
+ }
9917
+ }
9918
+ return flattened2;
9919
+ }
9920
+ var negateSimpleOperatorMap = {
9921
+ ["="]: "!=",
9922
+ ["!="]: "=",
9923
+ ["<"]: ">=",
9924
+ [">"]: "<=",
9925
+ [">="]: "<",
9926
+ ["<="]: ">",
9927
+ ["IN"]: "NOT IN",
9928
+ ["NOT IN"]: "IN",
9929
+ ["LIKE"]: "NOT LIKE",
9930
+ ["NOT LIKE"]: "LIKE",
9931
+ ["ILIKE"]: "NOT ILIKE",
9932
+ ["NOT ILIKE"]: "ILIKE",
9933
+ ["IS"]: "IS NOT",
9934
+ ["IS NOT"]: "IS"
9935
+ };
9936
+ var negateOperatorMap = {
9937
+ ...negateSimpleOperatorMap,
9938
+ ["EXISTS"]: "NOT EXISTS",
9939
+ ["NOT EXISTS"]: "EXISTS"
9940
+ };
9941
+ function negateOperator(op) {
9942
+ return must(negateOperatorMap[op]);
9943
+ }
9944
+ function filterUndefined(array10) {
9945
+ return array10.filter((e) => e !== void 0);
9946
+ }
9947
+ function filterTrue(conditions) {
9948
+ return conditions.filter((c) => !isAlwaysTrue(c));
9949
+ }
9950
+ function filterFalse(conditions) {
9951
+ return conditions.filter((c) => !isAlwaysFalse(c));
9952
+ }
9953
+
9954
+ // ../zql/src/query/query-impl.ts
9955
+ import { resolver as resolver7 } from "@rocicorp/resolver";
9956
+
9957
+ // ../shared/src/hash.ts
9958
+ import { xxHash32 } from "js-xxhash";
9959
+ var h64 = (s) => hash(s, 2);
9960
+ var h128 = (s) => hash(s, 4);
9961
+ function hash(str, words) {
9962
+ let hash2 = 0n;
9963
+ for (let i = 0; i < words; i++) {
9964
+ hash2 = (hash2 << 32n) + BigInt(xxHash32(str, i));
9965
+ }
9966
+ return hash2;
9967
+ }
9968
+
9968
9969
  // ../zero-protocol/src/ast-hash.ts
9969
9970
  var hashCache = /* @__PURE__ */ new WeakMap();
9970
9971
  function hashOfAST(ast) {
@@ -11878,7 +11879,8 @@ function staticParam(anchorClass, field) {
11878
11879
  return {
11879
11880
  type: "static",
11880
11881
  anchor: anchorClass,
11881
- field
11882
+ // for backwards compatibility
11883
+ field: field.length === 1 ? field[0] : field
11882
11884
  };
11883
11885
  }
11884
11886
  var SUBQ_PREFIX = "zsubq_";
@@ -12388,22 +12390,39 @@ function compileCellConfig(cellRules, expressionBuilder) {
12388
12390
  }
12389
12391
  return ret;
12390
12392
  }
12391
- var authDataRef = new Proxy(
12392
- {},
12393
- {
12394
- get(_target, prop, _receiver) {
12395
- return staticParam("authData", prop);
12396
- }
12393
+ var CallTracker = class _CallTracker {
12394
+ #anchor;
12395
+ #path;
12396
+ constructor(anchor, path2) {
12397
+ this.#anchor = anchor;
12398
+ this.#path = path2;
12397
12399
  }
12398
- );
12399
- var preMutationRowRef = new Proxy(
12400
- {},
12401
- {
12402
- get(_target, prop, _receiver) {
12403
- return staticParam("preMutationRow", prop);
12400
+ get(target, prop) {
12401
+ if (prop === toStaticParam) {
12402
+ return target[toStaticParam];
12404
12403
  }
12404
+ assert(typeof prop === "string");
12405
+ const path2 = [...this.#path, prop];
12406
+ return new Proxy(
12407
+ {
12408
+ [toStaticParam]: () => staticParam(this.#anchor, path2)
12409
+ },
12410
+ new _CallTracker(this.#anchor, path2)
12411
+ );
12405
12412
  }
12406
- );
12413
+ };
12414
+ function baseTracker(anchor) {
12415
+ return new Proxy(
12416
+ {
12417
+ [toStaticParam]: () => {
12418
+ throw new Error("no JWT field specified");
12419
+ }
12420
+ },
12421
+ new CallTracker(anchor, [])
12422
+ );
12423
+ }
12424
+ var authDataRef = baseTracker("authData");
12425
+ var preMutationRowRef = baseTracker("preMutationRow");
12407
12426
 
12408
12427
  // ../zero-schema/src/schema.ts
12409
12428
  function createSchema(schema) {
@@ -15447,7 +15466,7 @@ function makeMessage(message, context, logLevel) {
15447
15466
  }
15448
15467
 
15449
15468
  // ../zero-client/src/client/version.ts
15450
- var version2 = "0.10.2024123000+80a3bf";
15469
+ var version2 = "0.10.2025010500+85e3f0";
15451
15470
 
15452
15471
  // ../zero-client/src/client/log-options.ts
15453
15472
  var LevelFilterLogSink = class {
@@ -17478,4 +17497,4 @@ export {
17478
17497
  escapeLike,
17479
17498
  Zero
17480
17499
  };
17481
- //# sourceMappingURL=chunk-NWHD4LHL.js.map
17500
+ //# sourceMappingURL=chunk-VLJ76GO7.js.map