@cimplify/sdk 0.16.2 → 0.17.0

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 (37) hide show
  1. package/dist/advanced.d.mts +2 -2
  2. package/dist/advanced.d.ts +2 -2
  3. package/dist/advanced.js +90 -2906
  4. package/dist/advanced.mjs +3 -2886
  5. package/dist/chunk-FLPI2VVJ.js +72 -0
  6. package/dist/chunk-G6KNFYJD.mjs +687 -0
  7. package/dist/chunk-GFKBH7R2.mjs +2759 -0
  8. package/dist/chunk-J65U5SED.js +714 -0
  9. package/dist/chunk-LM3CJ4L7.mjs +69 -0
  10. package/dist/chunk-OITG2SEN.js +692 -0
  11. package/dist/chunk-OVM5YWM5.mjs +674 -0
  12. package/dist/chunk-REPTMTQ4.js +2810 -0
  13. package/dist/chunk-S6TU55KP.js +170 -0
  14. package/dist/chunk-WDIMISRC.mjs +166 -0
  15. package/dist/{client-DTTtSSmQ.d.ts → client-BaolRdB4.d.mts} +3 -3
  16. package/dist/{client-Cb7r8u6t.d.mts → client-C59R79gx.d.ts} +3 -3
  17. package/dist/index.d.mts +4 -4
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +401 -4412
  20. package/dist/index.mjs +5 -4317
  21. package/dist/{payment-Dvd7nRmk.d.mts → payment-C6ULw3K-.d.mts} +1 -1
  22. package/dist/{payment-Dvd7nRmk.d.ts → payment-C6ULw3K-.d.ts} +1 -1
  23. package/dist/{price-DrfhwHpw.d.ts → price-Bd6JBV8W.d.ts} +1 -1
  24. package/dist/{price-BDZNXiLS.d.mts → price-CbR6DCt0.d.mts} +1 -1
  25. package/dist/react.d.mts +12 -7
  26. package/dist/react.d.ts +12 -7
  27. package/dist/react.js +377 -3961
  28. package/dist/react.mjs +326 -3913
  29. package/dist/utils.d.mts +2 -2
  30. package/dist/utils.d.ts +2 -2
  31. package/dist/utils.js +122 -720
  32. package/dist/utils.mjs +2 -694
  33. package/package.json +1 -1
  34. package/registry/add-on-selector.json +1 -1
  35. package/registry/checkout-page.json +1 -1
  36. package/registry/composite-selector.json +1 -1
  37. package/registry/product-grid.json +1 -1
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ // src/query/builder.ts
4
+ function escapeQueryValue(value) {
5
+ return value.replace(/'/g, "\\'");
6
+ }
7
+ var QueryBuilder = class {
8
+ constructor(entity) {
9
+ this.filters = [];
10
+ this.modifiers = [];
11
+ this.pathSegments = [];
12
+ this.entity = entity;
13
+ }
14
+ path(segment) {
15
+ this.pathSegments.push(segment);
16
+ return this;
17
+ }
18
+ where(field, op, value) {
19
+ const v = typeof value === "string" ? `'${escapeQueryValue(value)}'` : value;
20
+ if (op === "contains" || op === "startsWith") {
21
+ this.filters.push(`@.${field} ${op} ${v}`);
22
+ } else {
23
+ this.filters.push(`@.${field}${op}${v}`);
24
+ }
25
+ return this;
26
+ }
27
+ and(field, op, value) {
28
+ return this.where(field, op, value);
29
+ }
30
+ sort(field, order = "asc") {
31
+ this.modifiers.push(`sort(${field},${order})`);
32
+ return this;
33
+ }
34
+ limit(n) {
35
+ this.modifiers.push(`limit(${n})`);
36
+ return this;
37
+ }
38
+ offset(n) {
39
+ this.modifiers.push(`offset(${n})`);
40
+ return this;
41
+ }
42
+ count() {
43
+ this.modifiers.push("count");
44
+ return this;
45
+ }
46
+ enriched() {
47
+ this.modifiers.push("enriched");
48
+ return this;
49
+ }
50
+ build() {
51
+ let query2 = this.entity;
52
+ if (this.pathSegments.length > 0) {
53
+ query2 += "." + this.pathSegments.join(".");
54
+ }
55
+ if (this.filters.length > 0) {
56
+ query2 += `[?(${this.filters.join(" && ")})]`;
57
+ }
58
+ for (const mod of this.modifiers) {
59
+ query2 += `#${mod}`;
60
+ }
61
+ return query2;
62
+ }
63
+ toString() {
64
+ return this.build();
65
+ }
66
+ };
67
+ function query(entity) {
68
+ return new QueryBuilder(entity);
69
+ }
70
+
71
+ exports.QueryBuilder = QueryBuilder;
72
+ exports.query = query;