@cimplify/sdk 0.16.3 → 0.18.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 (39) hide show
  1. package/dist/advanced.d.mts +2 -2
  2. package/dist/advanced.d.ts +2 -2
  3. package/dist/advanced.js +90 -2913
  4. package/dist/advanced.mjs +3 -2893
  5. package/dist/chunk-2JI47EYJ.mjs +2786 -0
  6. package/dist/chunk-DYKFSV77.js +2837 -0
  7. package/dist/chunk-FLPI2VVJ.js +72 -0
  8. package/dist/chunk-FTL2SXCG.mjs +674 -0
  9. package/dist/chunk-KTTQC5HG.mjs +687 -0
  10. package/dist/chunk-LM3CJ4L7.mjs +69 -0
  11. package/dist/chunk-MJECWMOY.js +692 -0
  12. package/dist/chunk-RYQ5IPWX.js +714 -0
  13. package/dist/chunk-S6TU55KP.js +170 -0
  14. package/dist/chunk-WDIMISRC.mjs +166 -0
  15. package/dist/{client-BaolRdB4.d.mts → client-B1UtuyOg.d.ts} +21 -12
  16. package/dist/{client-C59R79gx.d.ts → client-BFFfuzJr.d.mts} +21 -12
  17. package/dist/index.d.mts +4 -4
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +401 -4420
  20. package/dist/index.mjs +5 -4325
  21. package/dist/{payment-C6ULw3K-.d.mts → payment-D9FTaOse.d.mts} +66 -1
  22. package/dist/{payment-C6ULw3K-.d.ts → payment-D9FTaOse.d.ts} +66 -1
  23. package/dist/{price-CbR6DCt0.d.mts → price-9JsPuknm.d.mts} +1 -1
  24. package/dist/{price-Bd6JBV8W.d.ts → price-BD1iioLh.d.ts} +1 -1
  25. package/dist/react.d.mts +43 -11
  26. package/dist/react.d.ts +43 -11
  27. package/dist/react.js +540 -3981
  28. package/dist/react.mjs +489 -3933
  29. package/dist/styles.css +1 -1
  30. package/dist/utils.d.mts +5 -5
  31. package/dist/utils.d.ts +5 -5
  32. package/dist/utils.js +122 -721
  33. package/dist/utils.mjs +2 -695
  34. package/package.json +1 -1
  35. package/registry/add-on-selector.json +1 -1
  36. package/registry/catalogue-page.json +1 -1
  37. package/registry/checkout-page.json +1 -1
  38. package/registry/composite-selector.json +1 -1
  39. 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;