@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.
- package/dist/advanced.d.mts +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +90 -2913
- package/dist/advanced.mjs +3 -2893
- package/dist/chunk-2JI47EYJ.mjs +2786 -0
- package/dist/chunk-DYKFSV77.js +2837 -0
- package/dist/chunk-FLPI2VVJ.js +72 -0
- package/dist/chunk-FTL2SXCG.mjs +674 -0
- package/dist/chunk-KTTQC5HG.mjs +687 -0
- package/dist/chunk-LM3CJ4L7.mjs +69 -0
- package/dist/chunk-MJECWMOY.js +692 -0
- package/dist/chunk-RYQ5IPWX.js +714 -0
- package/dist/chunk-S6TU55KP.js +170 -0
- package/dist/chunk-WDIMISRC.mjs +166 -0
- package/dist/{client-BaolRdB4.d.mts → client-B1UtuyOg.d.ts} +21 -12
- package/dist/{client-C59R79gx.d.ts → client-BFFfuzJr.d.mts} +21 -12
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +401 -4420
- package/dist/index.mjs +5 -4325
- package/dist/{payment-C6ULw3K-.d.mts → payment-D9FTaOse.d.mts} +66 -1
- package/dist/{payment-C6ULw3K-.d.ts → payment-D9FTaOse.d.ts} +66 -1
- package/dist/{price-CbR6DCt0.d.mts → price-9JsPuknm.d.mts} +1 -1
- package/dist/{price-Bd6JBV8W.d.ts → price-BD1iioLh.d.ts} +1 -1
- package/dist/react.d.mts +43 -11
- package/dist/react.d.ts +43 -11
- package/dist/react.js +540 -3981
- package/dist/react.mjs +489 -3933
- package/dist/styles.css +1 -1
- package/dist/utils.d.mts +5 -5
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +122 -721
- package/dist/utils.mjs +2 -695
- package/package.json +1 -1
- package/registry/add-on-selector.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/checkout-page.json +1 -1
- package/registry/composite-selector.json +1 -1
- 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;
|