@builtbystack/sq-shopify-theme-sdk 0.0.2 → 0.0.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Qe = Object.defineProperty;
|
|
2
2
|
var Je = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
3
|
+
var Ne = (e, t, n) => (Je(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
4
|
function Xe(e, t) {
|
|
5
5
|
for (var n = 0; n < t.length; n++) {
|
|
6
6
|
const r = t[n];
|
|
@@ -64,16 +64,16 @@ function de(e, t) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function st(e) {
|
|
67
|
-
return
|
|
67
|
+
return ke(
|
|
68
68
|
e.source,
|
|
69
69
|
de(e.source, e.start)
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, c = t.line + s, u = t.line === 1 ? n : 0,
|
|
72
|
+
function ke(e, t) {
|
|
73
|
+
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, c = t.line + s, u = t.line === 1 ? n : 0, h = t.column + u, d = `${e.name}:${c}:${h}
|
|
74
74
|
`, y = r.split(/\r\n|[\n\r]/g), E = y[i];
|
|
75
75
|
if (E.length > 120) {
|
|
76
|
-
const T = Math.floor(
|
|
76
|
+
const T = Math.floor(h / 80), A = h % 80, m = [];
|
|
77
77
|
for (let x = 0; x < E.length; x += 80)
|
|
78
78
|
m.push(E.slice(x, x + 80));
|
|
79
79
|
return d + Ae([
|
|
@@ -87,7 +87,7 @@ function we(e, t) {
|
|
|
87
87
|
// Lines specified like this: ["prefix", "string"],
|
|
88
88
|
[`${c - 1} |`, y[i - 1]],
|
|
89
89
|
[`${c} |`, E],
|
|
90
|
-
["|", "^".padStart(
|
|
90
|
+
["|", "^".padStart(h)],
|
|
91
91
|
[`${c + 1} |`, y[i + 1]]
|
|
92
92
|
]);
|
|
93
93
|
}
|
|
@@ -148,14 +148,14 @@ class ve extends Error {
|
|
|
148
148
|
*/
|
|
149
149
|
constructor(t, ...n) {
|
|
150
150
|
var r, i, s;
|
|
151
|
-
const { nodes: c, source: u, positions:
|
|
151
|
+
const { nodes: c, source: u, positions: h, path: d, originalError: y, extensions: E } = ot(n);
|
|
152
152
|
super(t), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = y ?? void 0, this.nodes = xe(
|
|
153
153
|
Array.isArray(c) ? c : c ? [c] : void 0
|
|
154
154
|
);
|
|
155
155
|
const T = xe(
|
|
156
156
|
(r = this.nodes) === null || r === void 0 ? void 0 : r.map((m) => m.loc).filter((m) => m != null)
|
|
157
157
|
);
|
|
158
|
-
this.source = u ?? (T == null || (i = T[0]) === null || i === void 0 ? void 0 : i.source), this.positions =
|
|
158
|
+
this.source = u ?? (T == null || (i = T[0]) === null || i === void 0 ? void 0 : i.source), this.positions = h ?? (T == null ? void 0 : T.map((m) => m.start)), this.locations = h && u ? h.map((m) => de(u, m)) : T == null ? void 0 : T.map((m) => de(m.source, m.start));
|
|
159
159
|
const A = nt(
|
|
160
160
|
y == null ? void 0 : y.extensions
|
|
161
161
|
) ? y == null ? void 0 : y.extensions : void 0;
|
|
@@ -203,7 +203,7 @@ class ve extends Error {
|
|
|
203
203
|
for (const n of this.locations)
|
|
204
204
|
t += `
|
|
205
205
|
|
|
206
|
-
` +
|
|
206
|
+
` + ke(this.source, n);
|
|
207
207
|
return t;
|
|
208
208
|
}
|
|
209
209
|
toJSON() {
|
|
@@ -405,8 +405,8 @@ function lt(e) {
|
|
|
405
405
|
let n = Number.MAX_SAFE_INTEGER, r = null, i = -1;
|
|
406
406
|
for (let c = 0; c < e.length; ++c) {
|
|
407
407
|
var s;
|
|
408
|
-
const u = e[c],
|
|
409
|
-
|
|
408
|
+
const u = e[c], h = ht(u);
|
|
409
|
+
h !== u.length && (r = (s = r) !== null && s !== void 0 ? s : c, i = c, c !== 0 && h < n && (n = h));
|
|
410
410
|
}
|
|
411
411
|
return e.map((c, u) => u === 0 ? c : c.slice(n)).slice(
|
|
412
412
|
(t = r) !== null && t !== void 0 ? t : 0,
|
|
@@ -420,7 +420,7 @@ function ht(e) {
|
|
|
420
420
|
return t;
|
|
421
421
|
}
|
|
422
422
|
function pt(e, t) {
|
|
423
|
-
const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((A) => A.length === 0 || ye(A.charCodeAt(0))), c = n.endsWith('\\"""'), u = e.endsWith('"') && !c,
|
|
423
|
+
const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((A) => A.length === 0 || ye(A.charCodeAt(0))), c = n.endsWith('\\"""'), u = e.endsWith('"') && !c, h = e.endsWith("\\"), d = u || h, y = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
424
424
|
(!i || e.length > 70 || d || s || c);
|
|
425
425
|
let E = "";
|
|
426
426
|
const T = i && ye(e.charCodeAt(0));
|
|
@@ -649,8 +649,8 @@ function Tt(e, t) {
|
|
|
649
649
|
return c += n.slice(s, i), b(e, a.STRING, t, i + 1, c);
|
|
650
650
|
if (u === 92) {
|
|
651
651
|
c += n.slice(s, i);
|
|
652
|
-
const
|
|
653
|
-
c +=
|
|
652
|
+
const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? vt(e, i) : gt(e, i) : Nt(e, i);
|
|
653
|
+
c += h.value, i += h.size, s = i;
|
|
654
654
|
continue;
|
|
655
655
|
}
|
|
656
656
|
if (u === 10 || u === 13)
|
|
@@ -696,7 +696,7 @@ function vt(e, t) {
|
|
|
696
696
|
)}".`
|
|
697
697
|
);
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function gt(e, t) {
|
|
700
700
|
const n = e.source.body, r = Ie(n, t + 2);
|
|
701
701
|
if (V(r))
|
|
702
702
|
return {
|
|
@@ -723,7 +723,7 @@ function Ie(e, t) {
|
|
|
723
723
|
function $(e) {
|
|
724
724
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function Nt(e, t) {
|
|
727
727
|
const n = e.source.body;
|
|
728
728
|
switch (n.charCodeAt(t + 1)) {
|
|
729
729
|
case 34:
|
|
@@ -780,28 +780,28 @@ function gt(e, t) {
|
|
|
780
780
|
function At(e, t) {
|
|
781
781
|
const n = e.source.body, r = n.length;
|
|
782
782
|
let i = e.lineStart, s = t + 3, c = s, u = "";
|
|
783
|
-
const
|
|
783
|
+
const h = [];
|
|
784
784
|
for (; s < r; ) {
|
|
785
785
|
const d = n.charCodeAt(s);
|
|
786
786
|
if (d === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
787
|
-
u += n.slice(c, s),
|
|
787
|
+
u += n.slice(c, s), h.push(u);
|
|
788
788
|
const y = b(
|
|
789
789
|
e,
|
|
790
790
|
a.BLOCK_STRING,
|
|
791
791
|
t,
|
|
792
792
|
s + 3,
|
|
793
793
|
// Return a string of the lines joined with U+000A.
|
|
794
|
-
lt(
|
|
794
|
+
lt(h).join(`
|
|
795
795
|
`)
|
|
796
796
|
);
|
|
797
|
-
return e.line +=
|
|
797
|
+
return e.line += h.length - 1, e.lineStart = i, y;
|
|
798
798
|
}
|
|
799
799
|
if (d === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
800
800
|
u += n.slice(c, s), c = s + 1, s += 4;
|
|
801
801
|
continue;
|
|
802
802
|
}
|
|
803
803
|
if (d === 10 || d === 13) {
|
|
804
|
-
u += n.slice(c, s),
|
|
804
|
+
u += n.slice(c, s), h.push(u), d === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", c = s, i = s;
|
|
805
805
|
continue;
|
|
806
806
|
}
|
|
807
807
|
if (V(d))
|
|
@@ -839,7 +839,7 @@ function xt(e, t) {
|
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
841
|
const bt = 10, Ue = 2;
|
|
842
|
-
function
|
|
842
|
+
function ge(e) {
|
|
843
843
|
return se(e, []);
|
|
844
844
|
}
|
|
845
845
|
function se(e, t) {
|
|
@@ -873,7 +873,7 @@ function Ot(e) {
|
|
|
873
873
|
}
|
|
874
874
|
function _t(e, t) {
|
|
875
875
|
const n = Object.entries(e);
|
|
876
|
-
return n.length === 0 ? "{}" : t.length > Ue ? "[" +
|
|
876
|
+
return n.length === 0 ? "{}" : t.length > Ue ? "[" + Ct(e) + "]" : "{ " + n.map(
|
|
877
877
|
([i, s]) => i + ": " + se(s, t)
|
|
878
878
|
).join(", ") + " }";
|
|
879
879
|
}
|
|
@@ -887,7 +887,7 @@ function Dt(e, t) {
|
|
|
887
887
|
i.push(se(e[s], t));
|
|
888
888
|
return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function Ct(e) {
|
|
891
891
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
892
892
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
893
893
|
const n = e.constructor.name;
|
|
@@ -896,7 +896,7 @@ function St(e) {
|
|
|
896
896
|
}
|
|
897
897
|
return t;
|
|
898
898
|
}
|
|
899
|
-
const
|
|
899
|
+
const St = (
|
|
900
900
|
/* c8 ignore next 6 */
|
|
901
901
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
902
902
|
globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function(t, n) {
|
|
@@ -911,7 +911,7 @@ const Ct = (
|
|
|
911
911
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (r = t.constructor) === null || r === void 0 ? void 0 : r.name
|
|
912
912
|
);
|
|
913
913
|
if (i === s) {
|
|
914
|
-
const c =
|
|
914
|
+
const c = ge(t);
|
|
915
915
|
throw new Error(`Cannot use ${i} "${c}" from another module or realm.
|
|
916
916
|
|
|
917
917
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -934,7 +934,7 @@ class Ve {
|
|
|
934
934
|
line: 1,
|
|
935
935
|
column: 1
|
|
936
936
|
}) {
|
|
937
|
-
typeof t == "string" || W(!1, `Body must be a string. Received: ${
|
|
937
|
+
typeof t == "string" || W(!1, `Body must be a string. Received: ${ge(t)}.`), this.body = t, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || W(
|
|
938
938
|
!1,
|
|
939
939
|
"line in locationOffset is 1-indexed and must be positive."
|
|
940
940
|
), this.locationOffset.column > 0 || W(
|
|
@@ -946,15 +946,15 @@ class Ve {
|
|
|
946
946
|
return "Source";
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
return
|
|
949
|
+
function wt(e) {
|
|
950
|
+
return St(e, Ve);
|
|
951
951
|
}
|
|
952
952
|
function qe(e, t) {
|
|
953
|
-
return new
|
|
953
|
+
return new kt(e, t).parseDocument();
|
|
954
954
|
}
|
|
955
|
-
class
|
|
955
|
+
class kt {
|
|
956
956
|
constructor(t, n = {}) {
|
|
957
|
-
const r =
|
|
957
|
+
const r = wt(t) ? t : new Ve(t);
|
|
958
958
|
this._lexer = new dt(r), this._options = n, this._tokenCounter = 0;
|
|
959
959
|
}
|
|
960
960
|
/**
|
|
@@ -2236,57 +2236,57 @@ const Pt = [
|
|
|
2236
2236
|
], Bt = Object.freeze({});
|
|
2237
2237
|
function Mt(e, t, n = Le) {
|
|
2238
2238
|
const r = /* @__PURE__ */ new Map();
|
|
2239
|
-
for (const
|
|
2240
|
-
r.set(
|
|
2241
|
-
let i, s = Array.isArray(e), c = [e], u = -1,
|
|
2239
|
+
for (const C of Object.values(f))
|
|
2240
|
+
r.set(C, Ut(t, C));
|
|
2241
|
+
let i, s = Array.isArray(e), c = [e], u = -1, h = [], d = e, y, E;
|
|
2242
2242
|
const T = [], A = [];
|
|
2243
2243
|
do {
|
|
2244
2244
|
u++;
|
|
2245
|
-
const
|
|
2246
|
-
if (
|
|
2245
|
+
const C = u === c.length, Y = C && h.length !== 0;
|
|
2246
|
+
if (C) {
|
|
2247
2247
|
if (y = A.length === 0 ? void 0 : T[T.length - 1], d = E, E = A.pop(), Y)
|
|
2248
2248
|
if (s) {
|
|
2249
2249
|
d = d.slice();
|
|
2250
|
-
let
|
|
2251
|
-
for (const [P, z] of
|
|
2252
|
-
const Q = P -
|
|
2253
|
-
z === null ? (d.splice(Q, 1),
|
|
2250
|
+
let S = 0;
|
|
2251
|
+
for (const [P, z] of h) {
|
|
2252
|
+
const Q = P - S;
|
|
2253
|
+
z === null ? (d.splice(Q, 1), S++) : d[Q] = z;
|
|
2254
2254
|
}
|
|
2255
2255
|
} else {
|
|
2256
2256
|
d = Object.defineProperties(
|
|
2257
2257
|
{},
|
|
2258
2258
|
Object.getOwnPropertyDescriptors(d)
|
|
2259
2259
|
);
|
|
2260
|
-
for (const [
|
|
2261
|
-
d[
|
|
2260
|
+
for (const [S, P] of h)
|
|
2261
|
+
d[S] = P;
|
|
2262
2262
|
}
|
|
2263
|
-
u = i.index, c = i.keys,
|
|
2263
|
+
u = i.index, c = i.keys, h = i.edits, s = i.inArray, i = i.prev;
|
|
2264
2264
|
} else if (E) {
|
|
2265
2265
|
if (y = s ? u : c[u], d = E[y], d == null)
|
|
2266
2266
|
continue;
|
|
2267
2267
|
T.push(y);
|
|
2268
2268
|
}
|
|
2269
|
-
let
|
|
2269
|
+
let k;
|
|
2270
2270
|
if (!Array.isArray(d)) {
|
|
2271
2271
|
var m, x;
|
|
2272
|
-
be(d) || W(!1, `Invalid AST Node: ${
|
|
2273
|
-
const
|
|
2274
|
-
if (
|
|
2272
|
+
be(d) || W(!1, `Invalid AST Node: ${ge(d)}.`);
|
|
2273
|
+
const S = C ? (m = r.get(d.kind)) === null || m === void 0 ? void 0 : m.leave : (x = r.get(d.kind)) === null || x === void 0 ? void 0 : x.enter;
|
|
2274
|
+
if (k = S == null ? void 0 : S.call(t, d, y, E, T, A), k === Bt)
|
|
2275
2275
|
break;
|
|
2276
|
-
if (
|
|
2277
|
-
if (!
|
|
2276
|
+
if (k === !1) {
|
|
2277
|
+
if (!C) {
|
|
2278
2278
|
T.pop();
|
|
2279
2279
|
continue;
|
|
2280
2280
|
}
|
|
2281
|
-
} else if (
|
|
2282
|
-
if (be(
|
|
2283
|
-
d =
|
|
2281
|
+
} else if (k !== void 0 && (h.push([y, k]), !C))
|
|
2282
|
+
if (be(k))
|
|
2283
|
+
d = k;
|
|
2284
2284
|
else {
|
|
2285
2285
|
T.pop();
|
|
2286
2286
|
continue;
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
|
-
if (
|
|
2289
|
+
if (k === void 0 && Y && h.push([y, d]), C)
|
|
2290
2290
|
T.pop();
|
|
2291
2291
|
else {
|
|
2292
2292
|
var D;
|
|
@@ -2294,12 +2294,12 @@ function Mt(e, t, n = Le) {
|
|
|
2294
2294
|
inArray: s,
|
|
2295
2295
|
index: u,
|
|
2296
2296
|
keys: c,
|
|
2297
|
-
edits:
|
|
2297
|
+
edits: h,
|
|
2298
2298
|
prev: i
|
|
2299
|
-
}, s = Array.isArray(d), c = s ? d : (D = n[d.kind]) !== null && D !== void 0 ? D : [], u = -1,
|
|
2299
|
+
}, s = Array.isArray(d), c = s ? d : (D = n[d.kind]) !== null && D !== void 0 ? D : [], u = -1, h = [], E && A.push(E), E = d;
|
|
2300
2300
|
}
|
|
2301
2301
|
} while (i !== void 0);
|
|
2302
|
-
return
|
|
2302
|
+
return h.length !== 0 ? h[h.length - 1][1] : e;
|
|
2303
2303
|
}
|
|
2304
2304
|
function Ut(e, t) {
|
|
2305
2305
|
const n = e[t];
|
|
@@ -2323,17 +2323,17 @@ const qt = 80, jt = {
|
|
|
2323
2323
|
},
|
|
2324
2324
|
// Document
|
|
2325
2325
|
Document: {
|
|
2326
|
-
leave: (e) =>
|
|
2326
|
+
leave: (e) => p(e.definitions, `
|
|
2327
2327
|
|
|
2328
2328
|
`)
|
|
2329
2329
|
},
|
|
2330
2330
|
OperationDefinition: {
|
|
2331
2331
|
leave(e) {
|
|
2332
|
-
const t =
|
|
2332
|
+
const t = g("(", p(e.variableDefinitions, ", "), ")"), n = p(
|
|
2333
2333
|
[
|
|
2334
2334
|
e.operation,
|
|
2335
|
-
|
|
2336
|
-
|
|
2335
|
+
p([e.name, t]),
|
|
2336
|
+
p(e.directives, " ")
|
|
2337
2337
|
],
|
|
2338
2338
|
" "
|
|
2339
2339
|
);
|
|
@@ -2341,19 +2341,19 @@ const qt = 80, jt = {
|
|
|
2341
2341
|
}
|
|
2342
2342
|
},
|
|
2343
2343
|
VariableDefinition: {
|
|
2344
|
-
leave: ({ variable: e, type: t, defaultValue: n, directives: r }) => e + ": " + t +
|
|
2344
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: r }) => e + ": " + t + g(" = ", n) + g(" ", p(r, " "))
|
|
2345
2345
|
},
|
|
2346
2346
|
SelectionSet: {
|
|
2347
|
-
leave: ({ selections: e }) =>
|
|
2347
|
+
leave: ({ selections: e }) => w(e)
|
|
2348
2348
|
},
|
|
2349
2349
|
Field: {
|
|
2350
2350
|
leave({ alias: e, name: t, arguments: n, directives: r, selectionSet: i }) {
|
|
2351
|
-
const s =
|
|
2352
|
-
let c = s +
|
|
2353
|
-
return c.length > qt && (c = s +
|
|
2354
|
-
`, Z(
|
|
2351
|
+
const s = g("", e, ": ") + t;
|
|
2352
|
+
let c = s + g("(", p(n, ", "), ")");
|
|
2353
|
+
return c.length > qt && (c = s + g(`(
|
|
2354
|
+
`, Z(p(n, `
|
|
2355
2355
|
`)), `
|
|
2356
|
-
)`)),
|
|
2356
|
+
)`)), p([c, p(r, " "), i], " ");
|
|
2357
2357
|
}
|
|
2358
2358
|
},
|
|
2359
2359
|
Argument: {
|
|
@@ -2361,14 +2361,14 @@ const qt = 80, jt = {
|
|
|
2361
2361
|
},
|
|
2362
2362
|
// Fragments
|
|
2363
2363
|
FragmentSpread: {
|
|
2364
|
-
leave: ({ name: e, directives: t }) => "..." + e +
|
|
2364
|
+
leave: ({ name: e, directives: t }) => "..." + e + g(" ", p(t, " "))
|
|
2365
2365
|
},
|
|
2366
2366
|
InlineFragment: {
|
|
2367
|
-
leave: ({ typeCondition: e, directives: t, selectionSet: n }) =>
|
|
2367
|
+
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => p(
|
|
2368
2368
|
[
|
|
2369
2369
|
"...",
|
|
2370
|
-
|
|
2371
|
-
|
|
2370
|
+
g("on ", e),
|
|
2371
|
+
p(t, " "),
|
|
2372
2372
|
n
|
|
2373
2373
|
],
|
|
2374
2374
|
" "
|
|
@@ -2377,7 +2377,7 @@ const qt = 80, jt = {
|
|
|
2377
2377
|
FragmentDefinition: {
|
|
2378
2378
|
leave: ({ name: e, typeCondition: t, variableDefinitions: n, directives: r, selectionSet: i }) => (
|
|
2379
2379
|
// or removed in the future.
|
|
2380
|
-
`fragment ${e}${
|
|
2380
|
+
`fragment ${e}${g("(", p(n, ", "), ")")} on ${t} ${g("", p(r, " "), " ")}` + i
|
|
2381
2381
|
)
|
|
2382
2382
|
},
|
|
2383
2383
|
// Value
|
|
@@ -2400,17 +2400,17 @@ const qt = 80, jt = {
|
|
|
2400
2400
|
leave: ({ value: e }) => e
|
|
2401
2401
|
},
|
|
2402
2402
|
ListValue: {
|
|
2403
|
-
leave: ({ values: e }) => "[" +
|
|
2403
|
+
leave: ({ values: e }) => "[" + p(e, ", ") + "]"
|
|
2404
2404
|
},
|
|
2405
2405
|
ObjectValue: {
|
|
2406
|
-
leave: ({ fields: e }) => "{" +
|
|
2406
|
+
leave: ({ fields: e }) => "{" + p(e, ", ") + "}"
|
|
2407
2407
|
},
|
|
2408
2408
|
ObjectField: {
|
|
2409
2409
|
leave: ({ name: e, value: t }) => e + ": " + t
|
|
2410
2410
|
},
|
|
2411
2411
|
// Directive
|
|
2412
2412
|
Directive: {
|
|
2413
|
-
leave: ({ name: e, arguments: t }) => "@" + e +
|
|
2413
|
+
leave: ({ name: e, arguments: t }) => "@" + e + g("(", p(t, ", "), ")")
|
|
2414
2414
|
},
|
|
2415
2415
|
// Type
|
|
2416
2416
|
NamedType: {
|
|
@@ -2424,148 +2424,148 @@ const qt = 80, jt = {
|
|
|
2424
2424
|
},
|
|
2425
2425
|
// Type System Definitions
|
|
2426
2426
|
SchemaDefinition: {
|
|
2427
|
-
leave: ({ description: e, directives: t, operationTypes: n }) =>
|
|
2428
|
-
`) +
|
|
2427
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => g("", e, `
|
|
2428
|
+
`) + p(["schema", p(t, " "), w(n)], " ")
|
|
2429
2429
|
},
|
|
2430
2430
|
OperationTypeDefinition: {
|
|
2431
2431
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
2432
2432
|
},
|
|
2433
2433
|
ScalarTypeDefinition: {
|
|
2434
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
2435
|
-
`) +
|
|
2434
|
+
leave: ({ description: e, name: t, directives: n }) => g("", e, `
|
|
2435
|
+
`) + p(["scalar", t, p(n, " ")], " ")
|
|
2436
2436
|
},
|
|
2437
2437
|
ObjectTypeDefinition: {
|
|
2438
|
-
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) =>
|
|
2439
|
-
`) +
|
|
2438
|
+
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) => g("", e, `
|
|
2439
|
+
`) + p(
|
|
2440
2440
|
[
|
|
2441
2441
|
"type",
|
|
2442
2442
|
t,
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2443
|
+
g("implements ", p(n, " & ")),
|
|
2444
|
+
p(r, " "),
|
|
2445
|
+
w(i)
|
|
2446
2446
|
],
|
|
2447
2447
|
" "
|
|
2448
2448
|
)
|
|
2449
2449
|
},
|
|
2450
2450
|
FieldDefinition: {
|
|
2451
|
-
leave: ({ description: e, name: t, arguments: n, type: r, directives: i }) =>
|
|
2452
|
-
`) + t + (Oe(n) ?
|
|
2453
|
-
`, Z(
|
|
2451
|
+
leave: ({ description: e, name: t, arguments: n, type: r, directives: i }) => g("", e, `
|
|
2452
|
+
`) + t + (Oe(n) ? g(`(
|
|
2453
|
+
`, Z(p(n, `
|
|
2454
2454
|
`)), `
|
|
2455
|
-
)`) :
|
|
2455
|
+
)`) : g("(", p(n, ", "), ")")) + ": " + r + g(" ", p(i, " "))
|
|
2456
2456
|
},
|
|
2457
2457
|
InputValueDefinition: {
|
|
2458
|
-
leave: ({ description: e, name: t, type: n, defaultValue: r, directives: i }) =>
|
|
2459
|
-
`) +
|
|
2460
|
-
[t + ": " + n,
|
|
2458
|
+
leave: ({ description: e, name: t, type: n, defaultValue: r, directives: i }) => g("", e, `
|
|
2459
|
+
`) + p(
|
|
2460
|
+
[t + ": " + n, g("= ", r), p(i, " ")],
|
|
2461
2461
|
" "
|
|
2462
2462
|
)
|
|
2463
2463
|
},
|
|
2464
2464
|
InterfaceTypeDefinition: {
|
|
2465
|
-
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) =>
|
|
2466
|
-
`) +
|
|
2465
|
+
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) => g("", e, `
|
|
2466
|
+
`) + p(
|
|
2467
2467
|
[
|
|
2468
2468
|
"interface",
|
|
2469
2469
|
t,
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2470
|
+
g("implements ", p(n, " & ")),
|
|
2471
|
+
p(r, " "),
|
|
2472
|
+
w(i)
|
|
2473
2473
|
],
|
|
2474
2474
|
" "
|
|
2475
2475
|
)
|
|
2476
2476
|
},
|
|
2477
2477
|
UnionTypeDefinition: {
|
|
2478
|
-
leave: ({ description: e, name: t, directives: n, types: r }) =>
|
|
2479
|
-
`) +
|
|
2480
|
-
["union", t,
|
|
2478
|
+
leave: ({ description: e, name: t, directives: n, types: r }) => g("", e, `
|
|
2479
|
+
`) + p(
|
|
2480
|
+
["union", t, p(n, " "), g("= ", p(r, " | "))],
|
|
2481
2481
|
" "
|
|
2482
2482
|
)
|
|
2483
2483
|
},
|
|
2484
2484
|
EnumTypeDefinition: {
|
|
2485
|
-
leave: ({ description: e, name: t, directives: n, values: r }) =>
|
|
2486
|
-
`) +
|
|
2485
|
+
leave: ({ description: e, name: t, directives: n, values: r }) => g("", e, `
|
|
2486
|
+
`) + p(["enum", t, p(n, " "), w(r)], " ")
|
|
2487
2487
|
},
|
|
2488
2488
|
EnumValueDefinition: {
|
|
2489
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
2490
|
-
`) +
|
|
2489
|
+
leave: ({ description: e, name: t, directives: n }) => g("", e, `
|
|
2490
|
+
`) + p([t, p(n, " ")], " ")
|
|
2491
2491
|
},
|
|
2492
2492
|
InputObjectTypeDefinition: {
|
|
2493
|
-
leave: ({ description: e, name: t, directives: n, fields: r }) =>
|
|
2494
|
-
`) +
|
|
2493
|
+
leave: ({ description: e, name: t, directives: n, fields: r }) => g("", e, `
|
|
2494
|
+
`) + p(["input", t, p(n, " "), w(r)], " ")
|
|
2495
2495
|
},
|
|
2496
2496
|
DirectiveDefinition: {
|
|
2497
|
-
leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) =>
|
|
2498
|
-
`) + "directive @" + t + (Oe(n) ?
|
|
2499
|
-
`, Z(
|
|
2497
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) => g("", e, `
|
|
2498
|
+
`) + "directive @" + t + (Oe(n) ? g(`(
|
|
2499
|
+
`, Z(p(n, `
|
|
2500
2500
|
`)), `
|
|
2501
|
-
)`) :
|
|
2501
|
+
)`) : g("(", p(n, ", "), ")")) + (r ? " repeatable" : "") + " on " + p(i, " | ")
|
|
2502
2502
|
},
|
|
2503
2503
|
SchemaExtension: {
|
|
2504
|
-
leave: ({ directives: e, operationTypes: t }) =>
|
|
2505
|
-
["extend schema",
|
|
2504
|
+
leave: ({ directives: e, operationTypes: t }) => p(
|
|
2505
|
+
["extend schema", p(e, " "), w(t)],
|
|
2506
2506
|
" "
|
|
2507
2507
|
)
|
|
2508
2508
|
},
|
|
2509
2509
|
ScalarTypeExtension: {
|
|
2510
|
-
leave: ({ name: e, directives: t }) =>
|
|
2510
|
+
leave: ({ name: e, directives: t }) => p(["extend scalar", e, p(t, " ")], " ")
|
|
2511
2511
|
},
|
|
2512
2512
|
ObjectTypeExtension: {
|
|
2513
|
-
leave: ({ name: e, interfaces: t, directives: n, fields: r }) =>
|
|
2513
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: r }) => p(
|
|
2514
2514
|
[
|
|
2515
2515
|
"extend type",
|
|
2516
2516
|
e,
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2517
|
+
g("implements ", p(t, " & ")),
|
|
2518
|
+
p(n, " "),
|
|
2519
|
+
w(r)
|
|
2520
2520
|
],
|
|
2521
2521
|
" "
|
|
2522
2522
|
)
|
|
2523
2523
|
},
|
|
2524
2524
|
InterfaceTypeExtension: {
|
|
2525
|
-
leave: ({ name: e, interfaces: t, directives: n, fields: r }) =>
|
|
2525
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: r }) => p(
|
|
2526
2526
|
[
|
|
2527
2527
|
"extend interface",
|
|
2528
2528
|
e,
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2529
|
+
g("implements ", p(t, " & ")),
|
|
2530
|
+
p(n, " "),
|
|
2531
|
+
w(r)
|
|
2532
2532
|
],
|
|
2533
2533
|
" "
|
|
2534
2534
|
)
|
|
2535
2535
|
},
|
|
2536
2536
|
UnionTypeExtension: {
|
|
2537
|
-
leave: ({ name: e, directives: t, types: n }) =>
|
|
2537
|
+
leave: ({ name: e, directives: t, types: n }) => p(
|
|
2538
2538
|
[
|
|
2539
2539
|
"extend union",
|
|
2540
2540
|
e,
|
|
2541
|
-
|
|
2542
|
-
|
|
2541
|
+
p(t, " "),
|
|
2542
|
+
g("= ", p(n, " | "))
|
|
2543
2543
|
],
|
|
2544
2544
|
" "
|
|
2545
2545
|
)
|
|
2546
2546
|
},
|
|
2547
2547
|
EnumTypeExtension: {
|
|
2548
|
-
leave: ({ name: e, directives: t, values: n }) =>
|
|
2548
|
+
leave: ({ name: e, directives: t, values: n }) => p(["extend enum", e, p(t, " "), w(n)], " ")
|
|
2549
2549
|
},
|
|
2550
2550
|
InputObjectTypeExtension: {
|
|
2551
|
-
leave: ({ name: e, directives: t, fields: n }) =>
|
|
2551
|
+
leave: ({ name: e, directives: t, fields: n }) => p(["extend input", e, p(t, " "), w(n)], " ")
|
|
2552
2552
|
}
|
|
2553
2553
|
};
|
|
2554
|
-
function
|
|
2554
|
+
function p(e, t = "") {
|
|
2555
2555
|
var n;
|
|
2556
2556
|
return (n = e == null ? void 0 : e.filter((r) => r).join(t)) !== null && n !== void 0 ? n : "";
|
|
2557
2557
|
}
|
|
2558
|
-
function
|
|
2559
|
-
return
|
|
2560
|
-
`, Z(
|
|
2558
|
+
function w(e) {
|
|
2559
|
+
return g(`{
|
|
2560
|
+
`, Z(p(e, `
|
|
2561
2561
|
`)), `
|
|
2562
2562
|
}`);
|
|
2563
2563
|
}
|
|
2564
|
-
function
|
|
2564
|
+
function g(e, t, n = "") {
|
|
2565
2565
|
return t != null && t !== "" ? e + t + n : "";
|
|
2566
2566
|
}
|
|
2567
2567
|
function Z(e) {
|
|
2568
|
-
return
|
|
2568
|
+
return g(" ", e.replace(/\n/g, `
|
|
2569
2569
|
`));
|
|
2570
2570
|
}
|
|
2571
2571
|
function Oe(e) {
|
|
@@ -2631,7 +2631,7 @@ var me = { exports: {} };
|
|
|
2631
2631
|
formData: "FormData" in s,
|
|
2632
2632
|
arrayBuffer: "ArrayBuffer" in s
|
|
2633
2633
|
};
|
|
2634
|
-
function
|
|
2634
|
+
function h(o) {
|
|
2635
2635
|
return o && DataView.prototype.isPrototypeOf(o);
|
|
2636
2636
|
}
|
|
2637
2637
|
if (u.arrayBuffer)
|
|
@@ -2721,7 +2721,7 @@ var me = { exports: {} };
|
|
|
2721
2721
|
};
|
|
2722
2722
|
});
|
|
2723
2723
|
}
|
|
2724
|
-
function
|
|
2724
|
+
function C(o) {
|
|
2725
2725
|
var l = new FileReader(), v = D(l);
|
|
2726
2726
|
return l.readAsArrayBuffer(o), v;
|
|
2727
2727
|
}
|
|
@@ -2729,12 +2729,12 @@ var me = { exports: {} };
|
|
|
2729
2729
|
var l = new FileReader(), v = D(l);
|
|
2730
2730
|
return l.readAsText(o), v;
|
|
2731
2731
|
}
|
|
2732
|
-
function
|
|
2732
|
+
function k(o) {
|
|
2733
2733
|
for (var l = new Uint8Array(o), v = new Array(l.length), _ = 0; _ < l.length; _++)
|
|
2734
2734
|
v[_] = String.fromCharCode(l[_]);
|
|
2735
2735
|
return v.join("");
|
|
2736
2736
|
}
|
|
2737
|
-
function
|
|
2737
|
+
function S(o) {
|
|
2738
2738
|
if (o.slice)
|
|
2739
2739
|
return o.slice(0);
|
|
2740
2740
|
var l = new Uint8Array(o.byteLength);
|
|
@@ -2742,7 +2742,7 @@ var me = { exports: {} };
|
|
|
2742
2742
|
}
|
|
2743
2743
|
function P() {
|
|
2744
2744
|
return this.bodyUsed = !1, this._initBody = function(o) {
|
|
2745
|
-
this._bodyInit = o, o ? typeof o == "string" ? this._bodyText = o : u.blob && Blob.prototype.isPrototypeOf(o) ? this._bodyBlob = o : u.formData && FormData.prototype.isPrototypeOf(o) ? this._bodyFormData = o : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) ? this._bodyText = o.toString() : u.arrayBuffer && u.blob &&
|
|
2745
|
+
this._bodyInit = o, o ? typeof o == "string" ? this._bodyText = o : u.blob && Blob.prototype.isPrototypeOf(o) ? this._bodyBlob = o : u.formData && FormData.prototype.isPrototypeOf(o) ? this._bodyFormData = o : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) ? this._bodyText = o.toString() : u.arrayBuffer && u.blob && h(o) ? (this._bodyArrayBuffer = S(o.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : u.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(o) || y(o)) ? this._bodyArrayBuffer = S(o) : this._bodyText = o = Object.prototype.toString.call(o) : this._bodyText = "", this.headers.get("content-type") || (typeof o == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
2746
2746
|
}, u.blob && (this.blob = function() {
|
|
2747
2747
|
var o = x(this);
|
|
2748
2748
|
if (o)
|
|
@@ -2755,7 +2755,7 @@ var me = { exports: {} };
|
|
|
2755
2755
|
throw new Error("could not read FormData body as blob");
|
|
2756
2756
|
return Promise.resolve(new Blob([this._bodyText]));
|
|
2757
2757
|
}, this.arrayBuffer = function() {
|
|
2758
|
-
return this._bodyArrayBuffer ? x(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(
|
|
2758
|
+
return this._bodyArrayBuffer ? x(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(C);
|
|
2759
2759
|
}), this.text = function() {
|
|
2760
2760
|
var o = x(this);
|
|
2761
2761
|
if (o)
|
|
@@ -2763,7 +2763,7 @@ var me = { exports: {} };
|
|
|
2763
2763
|
if (this._bodyBlob)
|
|
2764
2764
|
return Y(this._bodyBlob);
|
|
2765
2765
|
if (this._bodyArrayBuffer)
|
|
2766
|
-
return Promise.resolve(
|
|
2766
|
+
return Promise.resolve(k(this._bodyArrayBuffer));
|
|
2767
2767
|
if (this._bodyFormData)
|
|
2768
2768
|
throw new Error("could not read FormData body as text");
|
|
2769
2769
|
return Promise.resolve(this._bodyText);
|
|
@@ -2798,18 +2798,18 @@ var me = { exports: {} };
|
|
|
2798
2798
|
var l = new FormData();
|
|
2799
2799
|
return o.trim().split("&").forEach(function(v) {
|
|
2800
2800
|
if (v) {
|
|
2801
|
-
var _ = v.split("="), O = _.shift().replace(/\+/g, " "),
|
|
2802
|
-
l.append(decodeURIComponent(O), decodeURIComponent(
|
|
2801
|
+
var _ = v.split("="), O = _.shift().replace(/\+/g, " "), N = _.join("=").replace(/\+/g, " ");
|
|
2802
|
+
l.append(decodeURIComponent(O), decodeURIComponent(N));
|
|
2803
2803
|
}
|
|
2804
2804
|
}), l;
|
|
2805
2805
|
}
|
|
2806
2806
|
function Ye(o) {
|
|
2807
2807
|
var l = new m(), v = o.replace(/\r?\n[\t ]+/g, " ");
|
|
2808
2808
|
return v.split(/\r?\n/).forEach(function(_) {
|
|
2809
|
-
var O = _.split(":"),
|
|
2810
|
-
if (
|
|
2809
|
+
var O = _.split(":"), N = O.shift().trim();
|
|
2810
|
+
if (N) {
|
|
2811
2811
|
var J = O.join(":").trim();
|
|
2812
|
-
l.append(
|
|
2812
|
+
l.append(N, J);
|
|
2813
2813
|
}
|
|
2814
2814
|
}), l;
|
|
2815
2815
|
}
|
|
@@ -2848,30 +2848,30 @@ var me = { exports: {} };
|
|
|
2848
2848
|
var O = new L(o, l);
|
|
2849
2849
|
if (O.signal && O.signal.aborted)
|
|
2850
2850
|
return _(new c.DOMException("Aborted", "AbortError"));
|
|
2851
|
-
var
|
|
2851
|
+
var N = new XMLHttpRequest();
|
|
2852
2852
|
function J() {
|
|
2853
|
-
|
|
2853
|
+
N.abort();
|
|
2854
2854
|
}
|
|
2855
|
-
|
|
2855
|
+
N.onload = function() {
|
|
2856
2856
|
var q = {
|
|
2857
|
-
status:
|
|
2858
|
-
statusText:
|
|
2859
|
-
headers: Ye(
|
|
2857
|
+
status: N.status,
|
|
2858
|
+
statusText: N.statusText,
|
|
2859
|
+
headers: Ye(N.getAllResponseHeaders() || "")
|
|
2860
2860
|
};
|
|
2861
|
-
q.url = "responseURL" in
|
|
2862
|
-
var ce = "response" in
|
|
2861
|
+
q.url = "responseURL" in N ? N.responseURL : q.headers.get("X-Request-URL");
|
|
2862
|
+
var ce = "response" in N ? N.response : N.responseText;
|
|
2863
2863
|
v(new R(ce, q));
|
|
2864
|
-
},
|
|
2864
|
+
}, N.onerror = function() {
|
|
2865
2865
|
_(new TypeError("Network request failed"));
|
|
2866
|
-
},
|
|
2866
|
+
}, N.ontimeout = function() {
|
|
2867
2867
|
_(new TypeError("Network request failed"));
|
|
2868
|
-
},
|
|
2868
|
+
}, N.onabort = function() {
|
|
2869
2869
|
_(new c.DOMException("Aborted", "AbortError"));
|
|
2870
|
-
},
|
|
2871
|
-
|
|
2872
|
-
}), O.signal && (O.signal.addEventListener("abort", J),
|
|
2873
|
-
|
|
2874
|
-
}),
|
|
2870
|
+
}, N.open(O.method, O.url, !0), O.credentials === "include" ? N.withCredentials = !0 : O.credentials === "omit" && (N.withCredentials = !1), "responseType" in N && u.blob && (N.responseType = "blob"), O.headers.forEach(function(q, ce) {
|
|
2871
|
+
N.setRequestHeader(ce, q);
|
|
2872
|
+
}), O.signal && (O.signal.addEventListener("abort", J), N.onreadystatechange = function() {
|
|
2873
|
+
N.readyState === 4 && O.signal.removeEventListener("abort", J);
|
|
2874
|
+
}), N.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
|
|
2875
2875
|
});
|
|
2876
2876
|
}
|
|
2877
2877
|
return ae.polyfill = !0, s.fetch || (s.fetch = ae, s.Headers = m, s.Request = L, s.Response = R), c.Headers = m, c.Request = L, c.Response = R, c.fetch = ae, Object.defineProperty(c, "__esModule", { value: !0 }), c;
|
|
@@ -2902,7 +2902,7 @@ const K = /* @__PURE__ */ Gt(te), Ht = /* @__PURE__ */ Xe({
|
|
|
2902
2902
|
}), r), []);
|
|
2903
2903
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
2904
2904
|
}, zt = (e) => async (t) => {
|
|
2905
|
-
const { url: n, query: r, variables: i, operationName: s, fetch: c, fetchOptions: u, middleware:
|
|
2905
|
+
const { url: n, query: r, variables: i, operationName: s, fetch: c, fetchOptions: u, middleware: h } = t, d = { ...t.headers };
|
|
2906
2906
|
let y = "", E;
|
|
2907
2907
|
e === "POST" ? (E = Jt(r, i, s, u.jsonSerializer), typeof E == "string" && (d["Content-Type"] = "application/json")) : y = Yt({
|
|
2908
2908
|
query: r,
|
|
@@ -2917,16 +2917,16 @@ const K = /* @__PURE__ */ Gt(te), Ht = /* @__PURE__ */ Xe({
|
|
|
2917
2917
|
...u
|
|
2918
2918
|
};
|
|
2919
2919
|
let A = n, m = T;
|
|
2920
|
-
if (
|
|
2921
|
-
const x = await Promise.resolve(
|
|
2922
|
-
A = D, m =
|
|
2920
|
+
if (h) {
|
|
2921
|
+
const x = await Promise.resolve(h({ ...T, url: n, operationName: s, variables: i })), { url: D, ...C } = x;
|
|
2922
|
+
A = D, m = C;
|
|
2923
2923
|
}
|
|
2924
2924
|
return y && (A = `${A}?${y}`), await c(A, m);
|
|
2925
2925
|
};
|
|
2926
2926
|
class Qt {
|
|
2927
2927
|
constructor(t, n = {}) {
|
|
2928
2928
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...r) => {
|
|
2929
|
-
const [i, s, c] = r, u = et(i, s, c), { headers:
|
|
2929
|
+
const [i, s, c] = r, u = et(i, s, c), { headers: h, fetch: d = K, method: y = "POST", requestMiddleware: E, responseMiddleware: T, ...A } = this.requestConfig, { url: m } = this;
|
|
2930
2930
|
u.signal !== void 0 && (A.signal = u.signal);
|
|
2931
2931
|
const { operationName: x } = le(u.query);
|
|
2932
2932
|
return he({
|
|
@@ -2934,7 +2934,7 @@ class Qt {
|
|
|
2934
2934
|
query: u.query,
|
|
2935
2935
|
variables: u.variables,
|
|
2936
2936
|
headers: {
|
|
2937
|
-
...B(pe(
|
|
2937
|
+
...B(pe(h)),
|
|
2938
2938
|
...B(u.requestHeaders)
|
|
2939
2939
|
},
|
|
2940
2940
|
operationName: x,
|
|
@@ -2948,7 +2948,7 @@ class Qt {
|
|
|
2948
2948
|
};
|
|
2949
2949
|
}
|
|
2950
2950
|
async request(t, ...n) {
|
|
2951
|
-
const [r, i] = n, s = Ke(t, r, i), { headers: c, fetch: u = K, method:
|
|
2951
|
+
const [r, i] = n, s = Ke(t, r, i), { headers: c, fetch: u = K, method: h = "POST", requestMiddleware: d, responseMiddleware: y, ...E } = this.requestConfig, { url: T } = this;
|
|
2952
2952
|
s.signal !== void 0 && (E.signal = s.signal);
|
|
2953
2953
|
const { query: A, operationName: m } = le(s.document);
|
|
2954
2954
|
return he({
|
|
@@ -2961,7 +2961,7 @@ class Qt {
|
|
|
2961
2961
|
},
|
|
2962
2962
|
operationName: m,
|
|
2963
2963
|
fetch: u,
|
|
2964
|
-
method:
|
|
2964
|
+
method: h,
|
|
2965
2965
|
fetchOptions: E,
|
|
2966
2966
|
middleware: d
|
|
2967
2967
|
}).then((x) => (y && y(x), x.data)).catch((x) => {
|
|
@@ -2972,7 +2972,7 @@ class Qt {
|
|
|
2972
2972
|
batchRequests(t, n) {
|
|
2973
2973
|
const r = tt(t, n), { headers: i, ...s } = this.requestConfig;
|
|
2974
2974
|
r.signal !== void 0 && (s.signal = r.signal);
|
|
2975
|
-
const c = r.documents.map(({ document:
|
|
2975
|
+
const c = r.documents.map(({ document: h }) => le(h).query), u = r.documents.map(({ variables: h }) => h);
|
|
2976
2976
|
return he({
|
|
2977
2977
|
url: this.url,
|
|
2978
2978
|
query: c,
|
|
@@ -2987,8 +2987,8 @@ class Qt {
|
|
|
2987
2987
|
method: this.requestConfig.method || "POST",
|
|
2988
2988
|
fetchOptions: s,
|
|
2989
2989
|
middleware: this.requestConfig.requestMiddleware
|
|
2990
|
-
}).then((
|
|
2991
|
-
throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(
|
|
2990
|
+
}).then((h) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(h), h.data)).catch((h) => {
|
|
2991
|
+
throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(h), h;
|
|
2992
2992
|
});
|
|
2993
2993
|
}
|
|
2994
2994
|
setHeaders(t) {
|
|
@@ -3009,8 +3009,8 @@ class Qt {
|
|
|
3009
3009
|
}
|
|
3010
3010
|
}
|
|
3011
3011
|
const he = async (e) => {
|
|
3012
|
-
const { query: t, variables: n, fetchOptions: r } = e, i = zt(We(e.method ?? "post")), s = Array.isArray(e.query), c = await i(e), u = await Xt(c, r.jsonSerializer ?? Te),
|
|
3013
|
-
if (c.ok && d &&
|
|
3012
|
+
const { query: t, variables: n, fetchOptions: r } = e, i = zt(We(e.method ?? "post")), s = Array.isArray(e.query), c = await i(e), u = await Xt(c, r.jsonSerializer ?? Te), h = Array.isArray(u) ? !u.some(({ data: y }) => !y) : !!u.data, d = Array.isArray(u) || !u.errors || Array.isArray(u.errors) && !u.errors.length || r.errorPolicy === "all" || r.errorPolicy === "ignore";
|
|
3013
|
+
if (c.ok && d && h) {
|
|
3014
3014
|
const { errors: y, ...E } = (Array.isArray(u), u), T = r.errorPolicy === "ignore" ? E : u;
|
|
3015
3015
|
return {
|
|
3016
3016
|
...s ? { data: T } : T,
|
|
@@ -3033,7 +3033,7 @@ const he = async (e) => {
|
|
|
3033
3033
|
return i.stringify({ query: e, variables: t, operationName: n });
|
|
3034
3034
|
if (typeof t < "u" && !Array.isArray(t))
|
|
3035
3035
|
throw new Error("Cannot create request body with given variable type, array expected");
|
|
3036
|
-
const s = e.reduce((c, u,
|
|
3036
|
+
const s = e.reduce((c, u, h) => (c.push({ query: u, variables: t ? t[h] : void 0 }), c), []);
|
|
3037
3037
|
return i.stringify(s);
|
|
3038
3038
|
}, Xt = async (e, t) => {
|
|
3039
3039
|
let n;
|
|
@@ -3127,18 +3127,18 @@ var j = {
|
|
|
3127
3127
|
})(U || (U = {}));
|
|
3128
3128
|
U.default = U;
|
|
3129
3129
|
const oe = U;
|
|
3130
|
-
var Se;
|
|
3131
|
-
(function(e) {
|
|
3132
|
-
e.CreatedAt = "CREATED_AT";
|
|
3133
|
-
})(Se || (Se = {}));
|
|
3134
3130
|
var Ce;
|
|
3135
3131
|
(function(e) {
|
|
3136
3132
|
e.CreatedAt = "CREATED_AT";
|
|
3137
3133
|
})(Ce || (Ce = {}));
|
|
3138
|
-
var
|
|
3134
|
+
var Se;
|
|
3135
|
+
(function(e) {
|
|
3136
|
+
e.CreatedAt = "CREATED_AT";
|
|
3137
|
+
})(Se || (Se = {}));
|
|
3138
|
+
var we;
|
|
3139
3139
|
(function(e) {
|
|
3140
3140
|
e.Invalid = "INVALID", e.Public = "PUBLIC", e.TenantUser = "TENANT_USER";
|
|
3141
|
-
})(
|
|
3141
|
+
})(we || (we = {}));
|
|
3142
3142
|
const on = oe`
|
|
3143
3143
|
query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
3144
3144
|
locationAvailabilities(
|
|
@@ -3207,7 +3207,7 @@ function hn(e, t = ln) {
|
|
|
3207
3207
|
}
|
|
3208
3208
|
class dn {
|
|
3209
3209
|
constructor(t) {
|
|
3210
|
-
|
|
3210
|
+
Ne(this, "api");
|
|
3211
3211
|
this.api = hn(new Qt(`${t}/apps/sq-api`, {
|
|
3212
3212
|
headers: {
|
|
3213
3213
|
"X-SQ-CLIENT": "ShopifyAppProxy"
|
|
@@ -3219,7 +3219,7 @@ class dn {
|
|
|
3219
3219
|
*
|
|
3220
3220
|
* @param {string} sku 在庫一覧を取得したい商品のSKU。
|
|
3221
3221
|
* @param {number} [first] 取得してくる個数。デフォルトは250。
|
|
3222
|
-
* @param {string} [
|
|
3222
|
+
* @param {string} [after] ページングの値。指定しない場合先頭から取得してくる。
|
|
3223
3223
|
* @param {boolean} [isReverse] 並び順。デフォルトはfalse。
|
|
3224
3224
|
*/
|
|
3225
3225
|
async getLocationAvailabilities(t, n, r, i) {
|
|
@@ -3269,6 +3269,46 @@ class dn {
|
|
|
3269
3269
|
pointsPending: t.purchasingCustomer.pointsPending
|
|
3270
3270
|
} : null;
|
|
3271
3271
|
}
|
|
3272
|
+
/**
|
|
3273
|
+
* getLocations は ShopifyIntegration に紐づく LocationGroup の Location の一覧を取得します。
|
|
3274
|
+
*
|
|
3275
|
+
* @param {number} [first] 取得してくる個数。デフォルトは250。
|
|
3276
|
+
* @param {string} [after] ページングの値。指定しない場合先頭から取得してくる。
|
|
3277
|
+
* @param {boolean} [isReverse] 並び順。デフォルトはfalse。
|
|
3278
|
+
*/
|
|
3279
|
+
async getLocations(t, n, r) {
|
|
3280
|
+
const i = await this.api.GetLocations({ first: t, after: n, isReverse: r });
|
|
3281
|
+
return {
|
|
3282
|
+
nodes: i.locations.nodes.map((s) => ({
|
|
3283
|
+
id: s.id,
|
|
3284
|
+
name: s.name
|
|
3285
|
+
})) ?? [],
|
|
3286
|
+
pageInfo: i.locations.pageInfo ?? null
|
|
3287
|
+
};
|
|
3288
|
+
}
|
|
3289
|
+
/**
|
|
3290
|
+
* getPurchasingCustomerDiscounts は購入者の割引情報を返します。
|
|
3291
|
+
*
|
|
3292
|
+
* @param {number} [first] 取得してくる個数。デフォルトは250。
|
|
3293
|
+
* @param {string} [after] ページングの値。指定しない場合先頭から取得してくる。
|
|
3294
|
+
* @param {boolean} [isReverse] 並び順。デフォルトはfalse。
|
|
3295
|
+
*/
|
|
3296
|
+
async getPurchasingCustomerDiscounts(t, n, r) {
|
|
3297
|
+
var s, c, u;
|
|
3298
|
+
const i = await this.api.GetPurchasingCustomerDiscounts({ first: t, after: n, isReverse: r });
|
|
3299
|
+
return {
|
|
3300
|
+
id: ((s = i.purchasingCustomer) == null ? void 0 : s.id) ?? "",
|
|
3301
|
+
nodes: ((c = i.purchasingCustomer) == null ? void 0 : c.discounts.nodes.map((h) => ({
|
|
3302
|
+
id: h.id,
|
|
3303
|
+
title: h.title,
|
|
3304
|
+
description: h.description,
|
|
3305
|
+
code: h.code,
|
|
3306
|
+
createdAt: new Date(h.createdAt),
|
|
3307
|
+
updatedAt: new Date(h.updatedAt)
|
|
3308
|
+
}))) ?? [],
|
|
3309
|
+
pageInfo: ((u = i.purchasingCustomer) == null ? void 0 : u.discounts.pageInfo) ?? null
|
|
3310
|
+
};
|
|
3311
|
+
}
|
|
3272
3312
|
}
|
|
3273
3313
|
export {
|
|
3274
3314
|
dn as SDK
|