@janbox/contentful-marketplace-sdk 1.0.12 → 1.0.13
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/entries/blog-collection.d.ts +3 -0
- package/dist/entries/blog.d.ts +2 -2
- package/dist/index.cjs +15 -0
- package/dist/index.js +256 -241
- package/package.json +1 -1
|
@@ -2,6 +2,9 @@ import { TypeBlogCollectionSkeleton, GraphQLAsset } from '../types';
|
|
|
2
2
|
import { Entry } from 'contentful';
|
|
3
3
|
type BlogCollectionEntry = Entry<TypeBlogCollectionSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
4
4
|
type BlogCollectionCategoryGraphQLItem = {
|
|
5
|
+
sys: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
5
8
|
title: string;
|
|
6
9
|
slug: string;
|
|
7
10
|
};
|
package/dist/entries/blog.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ type BlogPostCategoryGraphQLItem = {
|
|
|
15
15
|
export type BlogPostGraphQLItem = {
|
|
16
16
|
sys: GraphQLEntrySys;
|
|
17
17
|
featuredImage: GraphQLAsset | null;
|
|
18
|
-
} & Pick<BlogPostEntry["fields"], "title" | "shortDescription" | "slug">;
|
|
19
|
-
export interface BlogPostDetailGraphQLItem extends BlogPostGraphQLItem {
|
|
20
18
|
categoriesCollection: {
|
|
21
19
|
items: BlogPostCategoryGraphQLItem[];
|
|
22
20
|
} | null;
|
|
21
|
+
} & Pick<BlogPostEntry["fields"], "title" | "shortDescription" | "slug">;
|
|
22
|
+
export interface BlogPostDetailGraphQLItem extends BlogPostGraphQLItem {
|
|
23
23
|
author: {
|
|
24
24
|
name: string;
|
|
25
25
|
avatar: GraphQLAsset | null;
|
package/dist/index.cjs
CHANGED
|
@@ -60,6 +60,12 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
60
60
|
title
|
|
61
61
|
shortDescription
|
|
62
62
|
slug
|
|
63
|
+
categoriesCollection {
|
|
64
|
+
items {
|
|
65
|
+
title
|
|
66
|
+
slug
|
|
67
|
+
}
|
|
68
|
+
}
|
|
63
69
|
featuredImage {
|
|
64
70
|
url
|
|
65
71
|
width
|
|
@@ -92,6 +98,12 @@ query${g} {
|
|
|
92
98
|
title
|
|
93
99
|
shortDescription
|
|
94
100
|
slug
|
|
101
|
+
categoriesCollection {
|
|
102
|
+
items {
|
|
103
|
+
title
|
|
104
|
+
slug
|
|
105
|
+
}
|
|
106
|
+
}
|
|
95
107
|
featuredImage {
|
|
96
108
|
url
|
|
97
109
|
width
|
|
@@ -248,6 +260,9 @@ query${u} {
|
|
|
248
260
|
id
|
|
249
261
|
}
|
|
250
262
|
category {
|
|
263
|
+
sys {
|
|
264
|
+
id
|
|
265
|
+
}
|
|
251
266
|
title
|
|
252
267
|
slug
|
|
253
268
|
}
|
package/dist/index.js
CHANGED
|
@@ -54,17 +54,17 @@ function Mt(t) {
|
|
|
54
54
|
}
|
|
55
55
|
var zt = ft ? Mt : lt;
|
|
56
56
|
function S(t, e, r) {
|
|
57
|
-
for (var a = zt(t), s = 0,
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
60
|
-
e[
|
|
57
|
+
for (var a = zt(t), s = 0, n = a.length, i = void 0, o = void 0; s < n; ++s)
|
|
58
|
+
if (i = a[s], !(i === "callee" || i === "caller")) {
|
|
59
|
+
if (o = It(t, i), !o) {
|
|
60
|
+
e[i] = r.copier(t[i], r);
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
|
-
!
|
|
63
|
+
!o.get && !o.set && (o.value = r.copier(o.value, r));
|
|
64
64
|
try {
|
|
65
|
-
Rt(e,
|
|
65
|
+
Rt(e, i, o);
|
|
66
66
|
} catch {
|
|
67
|
-
e[
|
|
67
|
+
e[i] = o.value;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return e;
|
|
@@ -113,8 +113,8 @@ function Gt(t, e) {
|
|
|
113
113
|
e.cache.set(t, r);
|
|
114
114
|
for (var a in t)
|
|
115
115
|
ut.call(t, a) && (r[a] = e.copier(t[a], e));
|
|
116
|
-
for (var s = Q(t),
|
|
117
|
-
|
|
116
|
+
for (var s = Q(t), n = 0, i = s.length, o = void 0; n < i; ++n)
|
|
117
|
+
o = s[n], Dt.call(t, o) && (r[o] = e.copier(t[o], e));
|
|
118
118
|
return r;
|
|
119
119
|
}
|
|
120
120
|
var Ut = ft ? Gt : Ft;
|
|
@@ -193,23 +193,23 @@ function Zt(t) {
|
|
|
193
193
|
}
|
|
194
194
|
function yt(t) {
|
|
195
195
|
var e = F({}, mt, t), r = Zt(e), a = r.Array, s = r.Object;
|
|
196
|
-
function i
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
199
|
-
if (
|
|
200
|
-
return
|
|
201
|
-
if (
|
|
202
|
-
return s(
|
|
203
|
-
if (Ht(
|
|
204
|
-
return a(
|
|
205
|
-
var l = r[xt(
|
|
206
|
-
return l ? l(
|
|
196
|
+
function n(i, o) {
|
|
197
|
+
if (o.prototype = o.Constructor = void 0, !i || typeof i != "object")
|
|
198
|
+
return i;
|
|
199
|
+
if (o.cache.has(i))
|
|
200
|
+
return o.cache.get(i);
|
|
201
|
+
if (o.prototype = Yt(i), o.Constructor = o.prototype && o.prototype.constructor, !o.Constructor || o.Constructor === Object)
|
|
202
|
+
return s(i, o);
|
|
203
|
+
if (Ht(i))
|
|
204
|
+
return a(i, o);
|
|
205
|
+
var l = r[xt(i)];
|
|
206
|
+
return l ? l(i, o) : typeof i.then == "function" ? i : s(i, o);
|
|
207
207
|
}
|
|
208
|
-
return function(
|
|
209
|
-
return
|
|
208
|
+
return function(o) {
|
|
209
|
+
return n(o, {
|
|
210
210
|
Constructor: void 0,
|
|
211
211
|
cache: jt(),
|
|
212
|
-
copier:
|
|
212
|
+
copier: n,
|
|
213
213
|
prototype: void 0
|
|
214
214
|
});
|
|
215
215
|
};
|
|
@@ -219,7 +219,7 @@ function te(t) {
|
|
|
219
219
|
}
|
|
220
220
|
te({});
|
|
221
221
|
yt({});
|
|
222
|
-
var
|
|
222
|
+
var C = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, j = { exports: {} }, G;
|
|
223
223
|
function ee() {
|
|
224
224
|
if (G) return j.exports;
|
|
225
225
|
G = 1;
|
|
@@ -242,7 +242,7 @@ function ee() {
|
|
|
242
242
|
r = s;
|
|
243
243
|
}
|
|
244
244
|
})();
|
|
245
|
-
function
|
|
245
|
+
function n(p) {
|
|
246
246
|
if (e === setTimeout)
|
|
247
247
|
return setTimeout(p, 0);
|
|
248
248
|
if ((e === a || !e) && setTimeout)
|
|
@@ -257,7 +257,7 @@ function ee() {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function i(p) {
|
|
261
261
|
if (r === clearTimeout)
|
|
262
262
|
return clearTimeout(p);
|
|
263
263
|
if ((r === s || !r) && clearTimeout)
|
|
@@ -272,20 +272,20 @@ function ee() {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
var
|
|
275
|
+
var o = [], l = !1, c, u = -1;
|
|
276
276
|
function f() {
|
|
277
|
-
!l || !c || (l = !1, c.length ?
|
|
277
|
+
!l || !c || (l = !1, c.length ? o = c.concat(o) : u = -1, o.length && g());
|
|
278
278
|
}
|
|
279
279
|
function g() {
|
|
280
280
|
if (!l) {
|
|
281
|
-
var p =
|
|
281
|
+
var p = n(f);
|
|
282
282
|
l = !0;
|
|
283
|
-
for (var d =
|
|
284
|
-
for (c =
|
|
283
|
+
for (var d = o.length; d; ) {
|
|
284
|
+
for (c = o, o = []; ++u < d; )
|
|
285
285
|
c && c[u].run();
|
|
286
|
-
u = -1, d =
|
|
286
|
+
u = -1, d = o.length;
|
|
287
287
|
}
|
|
288
|
-
c = null, l = !1,
|
|
288
|
+
c = null, l = !1, i(p);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
t.nextTick = function(p) {
|
|
@@ -293,7 +293,7 @@ function ee() {
|
|
|
293
293
|
if (arguments.length > 1)
|
|
294
294
|
for (var b = 1; b < arguments.length; b++)
|
|
295
295
|
d[b - 1] = arguments[b];
|
|
296
|
-
|
|
296
|
+
o.push(new h(p, d)), o.length === 1 && !l && n(g);
|
|
297
297
|
};
|
|
298
298
|
function h(p, d) {
|
|
299
299
|
this.fun = p, this.array = d;
|
|
@@ -320,11 +320,11 @@ var q, U;
|
|
|
320
320
|
function re() {
|
|
321
321
|
if (U) return q;
|
|
322
322
|
U = 1;
|
|
323
|
-
var t = typeof
|
|
323
|
+
var t = typeof C == "object" && C && C.Object === Object && C;
|
|
324
324
|
return q = t, q;
|
|
325
325
|
}
|
|
326
326
|
var T, K;
|
|
327
|
-
function
|
|
327
|
+
function ie() {
|
|
328
328
|
if (K) return T;
|
|
329
329
|
K = 1;
|
|
330
330
|
var t = re(), e = typeof self == "object" && self && self.Object === Object && self, r = t || e || Function("return this")();
|
|
@@ -334,28 +334,28 @@ var _, W;
|
|
|
334
334
|
function dt() {
|
|
335
335
|
if (W) return _;
|
|
336
336
|
W = 1;
|
|
337
|
-
var t =
|
|
337
|
+
var t = ie(), e = t.Symbol;
|
|
338
338
|
return _ = e, _;
|
|
339
339
|
}
|
|
340
340
|
var P, J;
|
|
341
|
-
function
|
|
341
|
+
function oe() {
|
|
342
342
|
if (J) return P;
|
|
343
343
|
J = 1;
|
|
344
344
|
var t = dt(), e = Object.prototype, r = e.hasOwnProperty, a = e.toString, s = t ? t.toStringTag : void 0;
|
|
345
|
-
function i
|
|
346
|
-
var
|
|
345
|
+
function n(i) {
|
|
346
|
+
var o = r.call(i, s), l = i[s];
|
|
347
347
|
try {
|
|
348
|
-
|
|
348
|
+
i[s] = void 0;
|
|
349
349
|
var c = !0;
|
|
350
350
|
} catch {
|
|
351
351
|
}
|
|
352
|
-
var u = a.call(
|
|
353
|
-
return c && (
|
|
352
|
+
var u = a.call(i);
|
|
353
|
+
return c && (o ? i[s] = l : delete i[s]), u;
|
|
354
354
|
}
|
|
355
|
-
return P =
|
|
355
|
+
return P = n, P;
|
|
356
356
|
}
|
|
357
357
|
var x, H;
|
|
358
|
-
function
|
|
358
|
+
function ne() {
|
|
359
359
|
if (H) return x;
|
|
360
360
|
H = 1;
|
|
361
361
|
var t = Object.prototype, e = t.toString;
|
|
@@ -368,11 +368,11 @@ var R, Y;
|
|
|
368
368
|
function bt() {
|
|
369
369
|
if (Y) return R;
|
|
370
370
|
Y = 1;
|
|
371
|
-
var t = dt(), e =
|
|
372
|
-
function o
|
|
373
|
-
return
|
|
371
|
+
var t = dt(), e = oe(), r = ne(), a = "[object Null]", s = "[object Undefined]", n = t ? t.toStringTag : void 0;
|
|
372
|
+
function i(o) {
|
|
373
|
+
return o == null ? o === void 0 ? s : a : n && n in Object(o) ? e(o) : r(o);
|
|
374
374
|
}
|
|
375
|
-
return R =
|
|
375
|
+
return R = i, R;
|
|
376
376
|
}
|
|
377
377
|
var I, X;
|
|
378
378
|
function se() {
|
|
@@ -395,8 +395,8 @@ function ae() {
|
|
|
395
395
|
if (tt) return M;
|
|
396
396
|
tt = 1;
|
|
397
397
|
var t = bt(), e = se(), r = $t(), a = "[object String]";
|
|
398
|
-
function s(
|
|
399
|
-
return typeof
|
|
398
|
+
function s(n) {
|
|
399
|
+
return typeof n == "string" || !e(n) && r(n) && t(n) == a;
|
|
400
400
|
}
|
|
401
401
|
return M = s, M;
|
|
402
402
|
}
|
|
@@ -419,49 +419,49 @@ function ce() {
|
|
|
419
419
|
var t = le(), e = t(Object.getPrototypeOf, Object);
|
|
420
420
|
return E = e, E;
|
|
421
421
|
}
|
|
422
|
-
var L,
|
|
422
|
+
var L, it;
|
|
423
423
|
function ue() {
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
var t = bt(), e = ce(), r = $t(), a = "[object Object]", s = Function.prototype,
|
|
424
|
+
if (it) return L;
|
|
425
|
+
it = 1;
|
|
426
|
+
var t = bt(), e = ce(), r = $t(), a = "[object Object]", s = Function.prototype, n = Object.prototype, i = s.toString, o = n.hasOwnProperty, l = i.call(Object);
|
|
427
427
|
function c(u) {
|
|
428
428
|
if (!r(u) || t(u) != a)
|
|
429
429
|
return !1;
|
|
430
430
|
var f = e(u);
|
|
431
431
|
if (f === null)
|
|
432
432
|
return !0;
|
|
433
|
-
var g =
|
|
434
|
-
return typeof g == "function" && g instanceof g &&
|
|
433
|
+
var g = o.call(f, "constructor") && f.constructor;
|
|
434
|
+
return typeof g == "function" && g instanceof g && i.call(g) == l;
|
|
435
435
|
}
|
|
436
436
|
return L = c, L;
|
|
437
437
|
}
|
|
438
438
|
ue();
|
|
439
|
-
var
|
|
440
|
-
new Array(4).fill(String.fromCodePoint(
|
|
441
|
-
Object.fromEntries(Object.entries(Ct).map((t) => t.reverse()));
|
|
439
|
+
var Ct = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, wt = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 };
|
|
440
|
+
new Array(4).fill(String.fromCodePoint(wt[0])).join("");
|
|
442
441
|
Object.fromEntries(Object.entries(wt).map((t) => t.reverse()));
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
Object.fromEntries(Object.entries(Ct).map((t) => t.reverse()));
|
|
443
|
+
`${Object.values(Ct).map((t) => `\\u{${t.toString(16)}}`).join("")}`;
|
|
444
|
+
var V, ot;
|
|
445
445
|
function fe() {
|
|
446
|
-
if (
|
|
447
|
-
|
|
446
|
+
if (ot) return V;
|
|
447
|
+
ot = 1;
|
|
448
448
|
var t = Object.prototype.hasOwnProperty, e = Object.prototype.toString;
|
|
449
449
|
return V = function(r, a, s) {
|
|
450
450
|
if (e.call(a) !== "[object Function]")
|
|
451
451
|
throw new TypeError("iterator must be a function");
|
|
452
|
-
var
|
|
453
|
-
if (
|
|
454
|
-
for (var
|
|
455
|
-
a.call(s, r[
|
|
452
|
+
var n = r.length;
|
|
453
|
+
if (n === +n)
|
|
454
|
+
for (var i = 0; i < n; i++)
|
|
455
|
+
a.call(s, r[i], i, r);
|
|
456
456
|
else
|
|
457
|
-
for (var
|
|
458
|
-
t.call(r,
|
|
457
|
+
for (var o in r)
|
|
458
|
+
t.call(r, o) && a.call(s, r[o], o, r);
|
|
459
459
|
}, V;
|
|
460
460
|
}
|
|
461
|
-
var N,
|
|
461
|
+
var N, nt;
|
|
462
462
|
function ge() {
|
|
463
|
-
if (
|
|
464
|
-
|
|
463
|
+
if (nt) return N;
|
|
464
|
+
nt = 1;
|
|
465
465
|
var t = fe();
|
|
466
466
|
N = e;
|
|
467
467
|
function e(r, a, s) {
|
|
@@ -469,53 +469,53 @@ function ge() {
|
|
|
469
469
|
return e.set(r, a, s);
|
|
470
470
|
if (arguments.length === 2)
|
|
471
471
|
return e.get(r, a);
|
|
472
|
-
var
|
|
473
|
-
for (var
|
|
474
|
-
e.hasOwnProperty(
|
|
475
|
-
return
|
|
472
|
+
var n = e.bind(e, r);
|
|
473
|
+
for (var i in e)
|
|
474
|
+
e.hasOwnProperty(i) && (n[i] = e[i].bind(n, r));
|
|
475
|
+
return n;
|
|
476
476
|
}
|
|
477
477
|
return e.get = function(r, a) {
|
|
478
|
-
for (var s = Array.isArray(a) ? a : e.parse(a),
|
|
479
|
-
var
|
|
480
|
-
if (!(typeof r == "object" &&
|
|
481
|
-
throw new Error("Invalid reference token: " +
|
|
482
|
-
r = r[
|
|
478
|
+
for (var s = Array.isArray(a) ? a : e.parse(a), n = 0; n < s.length; ++n) {
|
|
479
|
+
var i = s[n];
|
|
480
|
+
if (!(typeof r == "object" && i in r))
|
|
481
|
+
throw new Error("Invalid reference token: " + i);
|
|
482
|
+
r = r[i];
|
|
483
483
|
}
|
|
484
484
|
return r;
|
|
485
485
|
}, e.set = function(r, a, s) {
|
|
486
|
-
var
|
|
487
|
-
if (
|
|
486
|
+
var n = Array.isArray(a) ? a : e.parse(a), i = n[0];
|
|
487
|
+
if (n.length === 0)
|
|
488
488
|
throw Error("Can not set the root object");
|
|
489
|
-
for (var
|
|
490
|
-
var l =
|
|
491
|
-
typeof l != "string" && typeof l != "number" && (l = String(l)), !(l === "__proto__" || l === "constructor" || l === "prototype") && (l === "-" && Array.isArray(r) && (l = r.length),
|
|
489
|
+
for (var o = 0; o < n.length - 1; ++o) {
|
|
490
|
+
var l = n[o];
|
|
491
|
+
typeof l != "string" && typeof l != "number" && (l = String(l)), !(l === "__proto__" || l === "constructor" || l === "prototype") && (l === "-" && Array.isArray(r) && (l = r.length), i = n[o + 1], l in r || (i.match(/^(\d+|-)$/) ? r[l] = [] : r[l] = {}), r = r[l]);
|
|
492
492
|
}
|
|
493
|
-
return
|
|
493
|
+
return i === "-" && Array.isArray(r) && (i = r.length), r[i] = s, this;
|
|
494
494
|
}, e.remove = function(r, a) {
|
|
495
|
-
var s = Array.isArray(a) ? a : e.parse(a),
|
|
496
|
-
if (
|
|
495
|
+
var s = Array.isArray(a) ? a : e.parse(a), n = s[s.length - 1];
|
|
496
|
+
if (n === void 0)
|
|
497
497
|
throw new Error('Invalid JSON pointer for remove: "' + a + '"');
|
|
498
|
-
var
|
|
499
|
-
if (Array.isArray(
|
|
500
|
-
var
|
|
501
|
-
if (
|
|
502
|
-
throw new Error('Invalid array index: "' +
|
|
503
|
-
Array.prototype.splice.call(
|
|
498
|
+
var i = e.get(r, s.slice(0, -1));
|
|
499
|
+
if (Array.isArray(i)) {
|
|
500
|
+
var o = +n;
|
|
501
|
+
if (n === "" && isNaN(o))
|
|
502
|
+
throw new Error('Invalid array index: "' + n + '"');
|
|
503
|
+
Array.prototype.splice.call(i, o, 1);
|
|
504
504
|
} else
|
|
505
|
-
delete
|
|
505
|
+
delete i[n];
|
|
506
506
|
}, e.dict = function(r, a) {
|
|
507
507
|
var s = {};
|
|
508
|
-
return e.walk(r, function(
|
|
509
|
-
s[
|
|
508
|
+
return e.walk(r, function(n, i) {
|
|
509
|
+
s[i] = n;
|
|
510
510
|
}, a), s;
|
|
511
511
|
}, e.walk = function(r, a, s) {
|
|
512
|
-
var
|
|
513
|
-
s = s || function(
|
|
514
|
-
var
|
|
515
|
-
return
|
|
516
|
-
}, (function o
|
|
517
|
-
t(
|
|
518
|
-
|
|
512
|
+
var n = [];
|
|
513
|
+
s = s || function(i) {
|
|
514
|
+
var o = Object.prototype.toString.call(i);
|
|
515
|
+
return o === "[object Object]" || o === "[object Array]";
|
|
516
|
+
}, (function i(o) {
|
|
517
|
+
t(o, function(l, c) {
|
|
518
|
+
n.push(String(c)), s(l) ? i(l) : a(l, e.compile(n)), n.pop();
|
|
519
519
|
});
|
|
520
520
|
})(r);
|
|
521
521
|
}, e.has = function(r, a) {
|
|
@@ -540,26 +540,26 @@ function ge() {
|
|
|
540
540
|
}, N;
|
|
541
541
|
}
|
|
542
542
|
ge();
|
|
543
|
-
var
|
|
543
|
+
var w = { exports: {} }, st;
|
|
544
544
|
function pe() {
|
|
545
545
|
return st || (st = 1, (function(t, e) {
|
|
546
546
|
e = t.exports = r, e.getSerialize = a;
|
|
547
|
-
function r(s, i, o
|
|
548
|
-
return JSON.stringify(s, a(
|
|
547
|
+
function r(s, n, i, o) {
|
|
548
|
+
return JSON.stringify(s, a(n, o), i);
|
|
549
549
|
}
|
|
550
|
-
function a(s,
|
|
551
|
-
var
|
|
552
|
-
return
|
|
553
|
-
return
|
|
550
|
+
function a(s, n) {
|
|
551
|
+
var i = [], o = [];
|
|
552
|
+
return n == null && (n = function(l, c) {
|
|
553
|
+
return i[0] === c ? "[Circular ~]" : "[Circular ~." + o.slice(0, i.indexOf(c)).join(".") + "]";
|
|
554
554
|
}), function(l, c) {
|
|
555
|
-
if (
|
|
556
|
-
var u =
|
|
557
|
-
~u ?
|
|
558
|
-
} else
|
|
555
|
+
if (i.length > 0) {
|
|
556
|
+
var u = i.indexOf(this);
|
|
557
|
+
~u ? i.splice(u + 1) : i.push(this), ~u ? o.splice(u, 1 / 0, l) : o.push(l), ~i.indexOf(c) && (c = n.call(this, l, c));
|
|
558
|
+
} else i.push(c);
|
|
559
559
|
return s == null ? c : s.call(this, l, c);
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
|
-
})(
|
|
562
|
+
})(w, w.exports)), w.exports;
|
|
563
563
|
}
|
|
564
564
|
pe();
|
|
565
565
|
class y {
|
|
@@ -577,8 +577,8 @@ class y {
|
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
579
|
static async graphqlQuery(e, r = {}) {
|
|
580
|
-
const { space: a, accessToken: s, environment:
|
|
581
|
-
`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${
|
|
580
|
+
const { space: a, accessToken: s, environment: n = "master" } = this.clientParams, i = await fetch(
|
|
581
|
+
`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${n}`,
|
|
582
582
|
{
|
|
583
583
|
method: "POST",
|
|
584
584
|
headers: {
|
|
@@ -588,19 +588,19 @@ class y {
|
|
|
588
588
|
body: JSON.stringify({ query: e, variables: r })
|
|
589
589
|
}
|
|
590
590
|
);
|
|
591
|
-
if (!
|
|
592
|
-
const l = await
|
|
591
|
+
if (!i.ok) {
|
|
592
|
+
const l = await i.text();
|
|
593
593
|
throw new Error(
|
|
594
|
-
`GraphQL request failed: ${
|
|
594
|
+
`GraphQL request failed: ${i.status} ${i.statusText}
|
|
595
595
|
${l}`
|
|
596
596
|
);
|
|
597
597
|
}
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
598
|
+
const o = await i.json();
|
|
599
|
+
if (o.errors)
|
|
600
600
|
throw new Error(
|
|
601
|
-
`GraphQL errors: ${JSON.stringify(
|
|
601
|
+
`GraphQL errors: ${JSON.stringify(o.errors, null, 2)}`
|
|
602
602
|
);
|
|
603
|
-
return
|
|
603
|
+
return o.data;
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
const he = async ({
|
|
@@ -609,20 +609,20 @@ const he = async ({
|
|
|
609
609
|
size: r = 20,
|
|
610
610
|
platform: a,
|
|
611
611
|
marketCode: s,
|
|
612
|
-
locale:
|
|
612
|
+
locale: n
|
|
613
613
|
}) => {
|
|
614
|
-
const
|
|
614
|
+
const i = Math.max(1, Math.floor(e)), o = Math.max(1, Math.floor(r)), l = [
|
|
615
615
|
"$slot: String!",
|
|
616
616
|
"$limit: Int!",
|
|
617
617
|
"$skip: Int!"
|
|
618
618
|
], c = {
|
|
619
619
|
slot: t,
|
|
620
|
-
limit:
|
|
621
|
-
skip: (
|
|
620
|
+
limit: o,
|
|
621
|
+
skip: (i - 1) * o
|
|
622
622
|
}, u = ["{ slot: $slot }"];
|
|
623
623
|
a && (l.push("$platform: String!"), c.platform = a, u.push("{ platform_contains_some: [$platform] }")), s && (l.push("$marketCode: String!"), c.marketCode = s, u.push(
|
|
624
624
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
625
|
-
)),
|
|
625
|
+
)), n && (l.push("$locale: String!"), c.locale = n, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
626
626
|
const f = `(${l.join(", ")})`, g = `(
|
|
627
627
|
limit: $limit
|
|
628
628
|
skip: $skip
|
|
@@ -673,9 +673,9 @@ query${f} {
|
|
|
673
673
|
...c
|
|
674
674
|
});
|
|
675
675
|
return {
|
|
676
|
-
page:
|
|
676
|
+
page: i,
|
|
677
677
|
total: m.total,
|
|
678
|
-
size:
|
|
678
|
+
size: o,
|
|
679
679
|
items: m.items
|
|
680
680
|
};
|
|
681
681
|
};
|
|
@@ -693,9 +693,9 @@ const me = async ({
|
|
|
693
693
|
collectionId: r,
|
|
694
694
|
categoryId: a,
|
|
695
695
|
page: s = 1,
|
|
696
|
-
size:
|
|
696
|
+
size: n = 20
|
|
697
697
|
} = {}) => {
|
|
698
|
-
const
|
|
698
|
+
const i = Math.max(1, Math.floor(s)), o = Math.max(1, Math.floor(n));
|
|
699
699
|
if (r) {
|
|
700
700
|
const d = `
|
|
701
701
|
query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
@@ -712,6 +712,12 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
712
712
|
title
|
|
713
713
|
shortDescription
|
|
714
714
|
slug
|
|
715
|
+
categoriesCollection {
|
|
716
|
+
items {
|
|
717
|
+
title
|
|
718
|
+
slug
|
|
719
|
+
}
|
|
720
|
+
}
|
|
715
721
|
featuredImage {
|
|
716
722
|
url
|
|
717
723
|
width
|
|
@@ -725,21 +731,21 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
725
731
|
}
|
|
726
732
|
`, { blogCollectionCollection: b } = await y.graphqlQuery(d, {
|
|
727
733
|
collectionId: r,
|
|
728
|
-
limit:
|
|
729
|
-
skip: (
|
|
734
|
+
limit: o,
|
|
735
|
+
skip: (i - 1) * o
|
|
730
736
|
}), k = b.items.at(0);
|
|
731
737
|
if (!k)
|
|
732
738
|
throw new $();
|
|
733
739
|
return {
|
|
734
|
-
page:
|
|
740
|
+
page: i,
|
|
735
741
|
total: k.postsCollection?.total ?? 0,
|
|
736
|
-
size:
|
|
742
|
+
size: o,
|
|
737
743
|
items: k.postsCollection?.items ?? []
|
|
738
744
|
};
|
|
739
745
|
}
|
|
740
746
|
const l = ["$limit: Int!", "$skip: Int!"], c = {
|
|
741
|
-
limit:
|
|
742
|
-
skip: (
|
|
747
|
+
limit: o,
|
|
748
|
+
skip: (i - 1) * o
|
|
743
749
|
}, u = ["limit: $limit", "skip: $skip"], f = [];
|
|
744
750
|
t && (l.push("$marketCode: String!"), c.marketCode = t, f.push(
|
|
745
751
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
@@ -765,6 +771,12 @@ query${g} {
|
|
|
765
771
|
title
|
|
766
772
|
shortDescription
|
|
767
773
|
slug
|
|
774
|
+
categoriesCollection {
|
|
775
|
+
items {
|
|
776
|
+
title
|
|
777
|
+
slug
|
|
778
|
+
}
|
|
779
|
+
}
|
|
768
780
|
featuredImage {
|
|
769
781
|
url
|
|
770
782
|
width
|
|
@@ -778,9 +790,9 @@ query${g} {
|
|
|
778
790
|
...c
|
|
779
791
|
});
|
|
780
792
|
return {
|
|
781
|
-
page:
|
|
793
|
+
page: i,
|
|
782
794
|
total: p.total,
|
|
783
|
-
size:
|
|
795
|
+
size: o,
|
|
784
796
|
items: p.items
|
|
785
797
|
};
|
|
786
798
|
}, ye = async ({
|
|
@@ -789,26 +801,26 @@ query${g} {
|
|
|
789
801
|
marketCode: r,
|
|
790
802
|
locale: a
|
|
791
803
|
}) => {
|
|
792
|
-
const s = [],
|
|
804
|
+
const s = [], n = {}, i = [];
|
|
793
805
|
if (t)
|
|
794
|
-
s.push("$id: String!"),
|
|
806
|
+
s.push("$id: String!"), n.id = t, i.push("{ sys: { id: $id } }");
|
|
795
807
|
else if (e)
|
|
796
|
-
s.push("$slug: String!"),
|
|
808
|
+
s.push("$slug: String!"), n.slug = e, i.push("{ slug: $slug }");
|
|
797
809
|
else
|
|
798
810
|
throw new Error("Either id or slug is required.");
|
|
799
|
-
r && (s.push("$marketCode: String!"),
|
|
811
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, i.push(
|
|
800
812
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
801
|
-
)), a && (s.push("$locale: String!"),
|
|
802
|
-
const
|
|
813
|
+
)), a && (s.push("$locale: String!"), n.locale = a, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
814
|
+
const o = `(${s.join(", ")})`, l = `(
|
|
803
815
|
limit: 1
|
|
804
816
|
where: {
|
|
805
817
|
AND: [
|
|
806
|
-
${
|
|
818
|
+
${i.join(`
|
|
807
819
|
`)}
|
|
808
820
|
]
|
|
809
821
|
}
|
|
810
822
|
)`, c = `
|
|
811
|
-
query${
|
|
823
|
+
query${o} {
|
|
812
824
|
blogPostCollection${l} {
|
|
813
825
|
items {
|
|
814
826
|
sys {
|
|
@@ -868,7 +880,7 @@ query${n} {
|
|
|
868
880
|
}
|
|
869
881
|
}
|
|
870
882
|
`, { blogPostCollection: u } = await y.graphqlQuery(c, {
|
|
871
|
-
...
|
|
883
|
+
...n
|
|
872
884
|
}), f = u.items.at(0);
|
|
873
885
|
if (!f)
|
|
874
886
|
throw new $();
|
|
@@ -879,19 +891,19 @@ query${n} {
|
|
|
879
891
|
page: r = 1,
|
|
880
892
|
size: a = 20
|
|
881
893
|
} = {}) => {
|
|
882
|
-
const s = Math.max(1, Math.floor(r)),
|
|
883
|
-
limit:
|
|
884
|
-
skip: (s - 1) *
|
|
894
|
+
const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), i = ["$limit: Int!", "$skip: Int!"], o = {
|
|
895
|
+
limit: n,
|
|
896
|
+
skip: (s - 1) * n
|
|
885
897
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
886
|
-
t && (
|
|
898
|
+
t && (i.push("$marketCode: String!"), o.marketCode = t, c.push(
|
|
887
899
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
888
|
-
)), e && (
|
|
900
|
+
)), e && (i.push("$locale: String!"), o.locale = e, c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), c.length && l.push(`where: {
|
|
889
901
|
AND: [
|
|
890
902
|
${c.join(`
|
|
891
903
|
`)}
|
|
892
904
|
]
|
|
893
905
|
}`);
|
|
894
|
-
const u =
|
|
906
|
+
const u = i.length ? `(${i.join(", ")})` : "", f = l.length ? `(
|
|
895
907
|
${l.join(`
|
|
896
908
|
`)}
|
|
897
909
|
)` : "", g = `
|
|
@@ -908,12 +920,12 @@ query${u} {
|
|
|
908
920
|
}
|
|
909
921
|
}
|
|
910
922
|
`, { blogCategoryCollection: h } = await y.graphqlQuery(g, {
|
|
911
|
-
...
|
|
923
|
+
...o
|
|
912
924
|
});
|
|
913
925
|
return {
|
|
914
926
|
page: s,
|
|
915
927
|
total: h.total,
|
|
916
|
-
size:
|
|
928
|
+
size: n,
|
|
917
929
|
items: h.items
|
|
918
930
|
};
|
|
919
931
|
}, be = async ({
|
|
@@ -922,26 +934,26 @@ query${u} {
|
|
|
922
934
|
marketCode: r,
|
|
923
935
|
locale: a
|
|
924
936
|
}) => {
|
|
925
|
-
const s = [],
|
|
937
|
+
const s = [], n = {}, i = [];
|
|
926
938
|
if (t)
|
|
927
|
-
s.push("$id: String!"),
|
|
939
|
+
s.push("$id: String!"), n.id = t, i.push("{ sys: { id: $id } }");
|
|
928
940
|
else if (e)
|
|
929
|
-
s.push("$slug: String!"),
|
|
941
|
+
s.push("$slug: String!"), n.slug = e, i.push("{ slug: $slug }");
|
|
930
942
|
else
|
|
931
943
|
throw new Error("Either id or slug is required.");
|
|
932
|
-
r && (s.push("$marketCode: String!"),
|
|
944
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, i.push(
|
|
933
945
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
934
|
-
)), a && (s.push("$locale: String!"),
|
|
935
|
-
const
|
|
946
|
+
)), a && (s.push("$locale: String!"), n.locale = a, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
947
|
+
const o = `(${s.join(", ")})`, l = `(
|
|
936
948
|
limit: 1
|
|
937
949
|
where: {
|
|
938
950
|
AND: [
|
|
939
|
-
${
|
|
951
|
+
${i.join(`
|
|
940
952
|
`)}
|
|
941
953
|
]
|
|
942
954
|
}
|
|
943
955
|
)`, c = `
|
|
944
|
-
query${
|
|
956
|
+
query${o} {
|
|
945
957
|
blogCategoryCollection${l} {
|
|
946
958
|
items {
|
|
947
959
|
sys {
|
|
@@ -971,7 +983,7 @@ query${n} {
|
|
|
971
983
|
}
|
|
972
984
|
}
|
|
973
985
|
`, { blogCategoryCollection: u } = await y.graphqlQuery(c, {
|
|
974
|
-
...
|
|
986
|
+
...n
|
|
975
987
|
}), f = u.items.at(0);
|
|
976
988
|
if (!f)
|
|
977
989
|
throw new $();
|
|
@@ -982,19 +994,19 @@ query${n} {
|
|
|
982
994
|
page: r = 1,
|
|
983
995
|
size: a = 20
|
|
984
996
|
} = {}) => {
|
|
985
|
-
const s = Math.max(1, Math.floor(r)),
|
|
986
|
-
limit:
|
|
987
|
-
skip: (s - 1) *
|
|
997
|
+
const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), i = ["$limit: Int!", "$skip: Int!"], o = {
|
|
998
|
+
limit: n,
|
|
999
|
+
skip: (s - 1) * n
|
|
988
1000
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
989
|
-
t && (
|
|
1001
|
+
t && (i.push("$marketCode: String!"), o.marketCode = t, c.push(
|
|
990
1002
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
991
|
-
)), e && (
|
|
1003
|
+
)), e && (i.push("$locale: String!"), o.locale = e, c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), c.length && l.push(`where: {
|
|
992
1004
|
AND: [
|
|
993
1005
|
${c.join(`
|
|
994
1006
|
`)}
|
|
995
1007
|
]
|
|
996
1008
|
}`);
|
|
997
|
-
const u =
|
|
1009
|
+
const u = i.length ? `(${i.join(", ")})` : "", f = l.length ? `(
|
|
998
1010
|
${l.join(`
|
|
999
1011
|
`)}
|
|
1000
1012
|
)` : "", g = `
|
|
@@ -1009,6 +1021,9 @@ query${u} {
|
|
|
1009
1021
|
id
|
|
1010
1022
|
}
|
|
1011
1023
|
category {
|
|
1024
|
+
sys {
|
|
1025
|
+
id
|
|
1026
|
+
}
|
|
1012
1027
|
title
|
|
1013
1028
|
slug
|
|
1014
1029
|
}
|
|
@@ -1022,28 +1037,28 @@ query${u} {
|
|
|
1022
1037
|
}
|
|
1023
1038
|
}
|
|
1024
1039
|
`, { blogCollectionCollection: h } = await y.graphqlQuery(g, {
|
|
1025
|
-
...
|
|
1040
|
+
...o
|
|
1026
1041
|
});
|
|
1027
1042
|
return {
|
|
1028
1043
|
page: s,
|
|
1029
1044
|
total: h.total,
|
|
1030
|
-
size:
|
|
1045
|
+
size: n,
|
|
1031
1046
|
items: h.items
|
|
1032
1047
|
};
|
|
1033
|
-
},
|
|
1048
|
+
}, Ce = async ({
|
|
1034
1049
|
page: t = 1,
|
|
1035
1050
|
size: e = 20,
|
|
1036
1051
|
marketCode: r,
|
|
1037
1052
|
locale: a
|
|
1038
1053
|
} = {}) => {
|
|
1039
|
-
const s = Math.max(1, Math.floor(t)),
|
|
1040
|
-
limit:
|
|
1041
|
-
skip: (s - 1) *
|
|
1054
|
+
const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), i = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1055
|
+
limit: n,
|
|
1056
|
+
skip: (s - 1) * n
|
|
1042
1057
|
}, l = [];
|
|
1043
|
-
r && (
|
|
1058
|
+
r && (i.push("$marketCode: String!"), o.marketCode = r, l.push(
|
|
1044
1059
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1045
|
-
)), a && (
|
|
1046
|
-
const c = `(${
|
|
1060
|
+
)), a && (i.push("$locale: String!"), o.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1061
|
+
const c = `(${i.join(", ")})`, u = l.length ? `(
|
|
1047
1062
|
limit: $limit
|
|
1048
1063
|
skip: $skip
|
|
1049
1064
|
where: {
|
|
@@ -1092,27 +1107,27 @@ query${c} {
|
|
|
1092
1107
|
}
|
|
1093
1108
|
}
|
|
1094
1109
|
`, { brandCollectionCollection: g } = await y.graphqlQuery(f, {
|
|
1095
|
-
...
|
|
1110
|
+
...o
|
|
1096
1111
|
});
|
|
1097
1112
|
return {
|
|
1098
1113
|
page: s,
|
|
1099
1114
|
total: g.total,
|
|
1100
|
-
size:
|
|
1115
|
+
size: n,
|
|
1101
1116
|
items: g.items
|
|
1102
1117
|
};
|
|
1103
|
-
},
|
|
1118
|
+
}, we = async ({
|
|
1104
1119
|
marketCode: t,
|
|
1105
1120
|
locale: e,
|
|
1106
1121
|
page: r = 1,
|
|
1107
1122
|
size: a = 20
|
|
1108
1123
|
} = {}) => {
|
|
1109
|
-
const s = Math.max(1, Math.floor(r)),
|
|
1110
|
-
limit:
|
|
1111
|
-
skip: (s - 1) *
|
|
1124
|
+
const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), i = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1125
|
+
limit: n,
|
|
1126
|
+
skip: (s - 1) * n
|
|
1112
1127
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
1113
|
-
t && (
|
|
1128
|
+
t && (i.push("$marketCode: String!"), o.marketCode = t, c.push(
|
|
1114
1129
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1115
|
-
)), e && (
|
|
1130
|
+
)), e && (i.push("$locale: String!"), o.locale = e, c.push(
|
|
1116
1131
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1117
1132
|
)), c.length && l.push(`where: {
|
|
1118
1133
|
AND: [
|
|
@@ -1120,7 +1135,7 @@ query${c} {
|
|
|
1120
1135
|
`)}
|
|
1121
1136
|
]
|
|
1122
1137
|
}`);
|
|
1123
|
-
const u =
|
|
1138
|
+
const u = i.length ? `(${i.join(", ")})` : "", f = l.length ? `(
|
|
1124
1139
|
${l.join(`
|
|
1125
1140
|
`)}
|
|
1126
1141
|
)` : "", g = `
|
|
@@ -1147,12 +1162,12 @@ query${u} {
|
|
|
1147
1162
|
}
|
|
1148
1163
|
}
|
|
1149
1164
|
`, { documentationCategoryCollection: h } = await y.graphqlQuery(g, {
|
|
1150
|
-
...
|
|
1165
|
+
...o
|
|
1151
1166
|
});
|
|
1152
1167
|
return {
|
|
1153
1168
|
page: s,
|
|
1154
1169
|
total: h.total,
|
|
1155
|
-
size:
|
|
1170
|
+
size: n,
|
|
1156
1171
|
items: h.items
|
|
1157
1172
|
};
|
|
1158
1173
|
}, ve = async ({
|
|
@@ -1161,28 +1176,28 @@ query${u} {
|
|
|
1161
1176
|
marketCode: r,
|
|
1162
1177
|
locale: a
|
|
1163
1178
|
}) => {
|
|
1164
|
-
const s = [],
|
|
1179
|
+
const s = [], n = {}, i = [];
|
|
1165
1180
|
if (t)
|
|
1166
|
-
s.push("$id: String!"),
|
|
1181
|
+
s.push("$id: String!"), n.id = t, i.push("{ sys: { id: $id } }");
|
|
1167
1182
|
else if (e)
|
|
1168
|
-
s.push("$slug: String!"),
|
|
1183
|
+
s.push("$slug: String!"), n.slug = e, i.push("{ slug: $slug }");
|
|
1169
1184
|
else
|
|
1170
1185
|
throw new Error("Either id or slug is required.");
|
|
1171
|
-
r && (s.push("$marketCode: String!"),
|
|
1186
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, i.push(
|
|
1172
1187
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1173
|
-
)), a && (s.push("$locale: String!"),
|
|
1188
|
+
)), a && (s.push("$locale: String!"), n.locale = a, i.push(
|
|
1174
1189
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1175
1190
|
));
|
|
1176
|
-
const
|
|
1191
|
+
const o = `(${s.join(", ")})`, l = `(
|
|
1177
1192
|
limit: 1
|
|
1178
1193
|
where: {
|
|
1179
1194
|
AND: [
|
|
1180
|
-
${
|
|
1195
|
+
${i.join(`
|
|
1181
1196
|
`)}
|
|
1182
1197
|
]
|
|
1183
1198
|
}
|
|
1184
1199
|
)`, c = `
|
|
1185
|
-
query${
|
|
1200
|
+
query${o} {
|
|
1186
1201
|
documentationCategoryCollection${l} {
|
|
1187
1202
|
items {
|
|
1188
1203
|
sys {
|
|
@@ -1204,7 +1219,7 @@ query${n} {
|
|
|
1204
1219
|
}
|
|
1205
1220
|
}
|
|
1206
1221
|
`, { documentationCategoryCollection: u } = await y.graphqlQuery(c, {
|
|
1207
|
-
...
|
|
1222
|
+
...n
|
|
1208
1223
|
}), f = u.items.at(0);
|
|
1209
1224
|
if (!f)
|
|
1210
1225
|
throw new $();
|
|
@@ -1216,21 +1231,21 @@ query${n} {
|
|
|
1216
1231
|
page: a = 1,
|
|
1217
1232
|
size: s = 20
|
|
1218
1233
|
} = {}) => {
|
|
1219
|
-
const
|
|
1220
|
-
limit:
|
|
1221
|
-
skip: (
|
|
1234
|
+
const n = Math.max(1, Math.floor(a)), i = Math.max(1, Math.floor(s)), o = ["$limit: Int!", "$skip: Int!"], l = {
|
|
1235
|
+
limit: i,
|
|
1236
|
+
skip: (n - 1) * i
|
|
1222
1237
|
}, c = ["limit: $limit", "skip: $skip"], u = [];
|
|
1223
|
-
t && (
|
|
1238
|
+
t && (o.push("$marketCode: String!"), l.marketCode = t, u.push(
|
|
1224
1239
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1225
|
-
)), e && (
|
|
1240
|
+
)), e && (o.push("$locale: String!"), l.locale = e, u.push(
|
|
1226
1241
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1227
|
-
)), r && (
|
|
1242
|
+
)), r && (o.push("$categorySlug: String!"), l.categorySlug = r, u.push("{ category: { slug: $categorySlug } }")), u.length && c.push(`where: {
|
|
1228
1243
|
AND: [
|
|
1229
1244
|
${u.join(`
|
|
1230
1245
|
`)}
|
|
1231
1246
|
]
|
|
1232
1247
|
}`);
|
|
1233
|
-
const f =
|
|
1248
|
+
const f = o.length ? `(${o.join(", ")})` : "", g = c.length ? `(
|
|
1234
1249
|
${c.join(`
|
|
1235
1250
|
`)}
|
|
1236
1251
|
)` : "", h = `
|
|
@@ -1267,9 +1282,9 @@ query${f} {
|
|
|
1267
1282
|
...l
|
|
1268
1283
|
});
|
|
1269
1284
|
return {
|
|
1270
|
-
page:
|
|
1285
|
+
page: n,
|
|
1271
1286
|
total: m.total,
|
|
1272
|
-
size:
|
|
1287
|
+
size: i,
|
|
1273
1288
|
items: m.items
|
|
1274
1289
|
};
|
|
1275
1290
|
}, ke = async ({
|
|
@@ -1278,28 +1293,28 @@ query${f} {
|
|
|
1278
1293
|
marketCode: r,
|
|
1279
1294
|
locale: a
|
|
1280
1295
|
}) => {
|
|
1281
|
-
const s = [],
|
|
1296
|
+
const s = [], n = {}, i = [];
|
|
1282
1297
|
if (t)
|
|
1283
|
-
s.push("$id: String!"),
|
|
1298
|
+
s.push("$id: String!"), n.id = t, i.push("{ sys: { id: $id } }");
|
|
1284
1299
|
else if (e)
|
|
1285
|
-
s.push("$slug: String!"),
|
|
1300
|
+
s.push("$slug: String!"), n.slug = e, i.push("{ slug: $slug }");
|
|
1286
1301
|
else
|
|
1287
1302
|
throw new Error("Either id or slug is required.");
|
|
1288
|
-
r && (s.push("$marketCode: String!"),
|
|
1303
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, i.push(
|
|
1289
1304
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1290
|
-
)), a && (s.push("$locale: String!"),
|
|
1305
|
+
)), a && (s.push("$locale: String!"), n.locale = a, i.push(
|
|
1291
1306
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1292
1307
|
));
|
|
1293
|
-
const
|
|
1308
|
+
const o = `(${s.join(", ")})`, l = `(
|
|
1294
1309
|
limit: 1
|
|
1295
1310
|
where: {
|
|
1296
1311
|
AND: [
|
|
1297
|
-
${
|
|
1312
|
+
${i.join(`
|
|
1298
1313
|
`)}
|
|
1299
1314
|
]
|
|
1300
1315
|
}
|
|
1301
1316
|
)`, c = `
|
|
1302
|
-
query${
|
|
1317
|
+
query${o} {
|
|
1303
1318
|
documentationArticleCollection${l} {
|
|
1304
1319
|
items {
|
|
1305
1320
|
sys {
|
|
@@ -1352,7 +1367,7 @@ query${n} {
|
|
|
1352
1367
|
}
|
|
1353
1368
|
}
|
|
1354
1369
|
`, { documentationArticleCollection: u } = await y.graphqlQuery(c, {
|
|
1355
|
-
...
|
|
1370
|
+
...n
|
|
1356
1371
|
}), f = u.items.at(0);
|
|
1357
1372
|
if (!f)
|
|
1358
1373
|
throw new $();
|
|
@@ -1363,14 +1378,14 @@ query${n} {
|
|
|
1363
1378
|
marketCode: r,
|
|
1364
1379
|
locale: a
|
|
1365
1380
|
} = {}) => {
|
|
1366
|
-
const s = Math.max(1, Math.floor(t)),
|
|
1367
|
-
limit:
|
|
1368
|
-
skip: (s - 1) *
|
|
1381
|
+
const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), i = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1382
|
+
limit: n,
|
|
1383
|
+
skip: (s - 1) * n
|
|
1369
1384
|
}, l = [];
|
|
1370
|
-
r && (
|
|
1385
|
+
r && (i.push("$marketCode: String!"), o.marketCode = r, l.push(
|
|
1371
1386
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1372
|
-
)), a && (
|
|
1373
|
-
const c =
|
|
1387
|
+
)), a && (i.push("$locale: String!"), o.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1388
|
+
const c = i.length ? `(${i.join(", ")})` : "", u = l.length ? `(
|
|
1374
1389
|
limit: $limit
|
|
1375
1390
|
skip: $skip
|
|
1376
1391
|
order: order_ASC
|
|
@@ -1412,13 +1427,13 @@ query${c} {
|
|
|
1412
1427
|
`, { hyperlinkCollectionCollection: g } = await y.graphqlQuery(
|
|
1413
1428
|
f,
|
|
1414
1429
|
{
|
|
1415
|
-
...
|
|
1430
|
+
...o
|
|
1416
1431
|
}
|
|
1417
1432
|
);
|
|
1418
1433
|
return {
|
|
1419
1434
|
page: s,
|
|
1420
1435
|
total: g.total,
|
|
1421
|
-
size:
|
|
1436
|
+
size: n,
|
|
1422
1437
|
items: g.items
|
|
1423
1438
|
};
|
|
1424
1439
|
}, Oe = async ({
|
|
@@ -1427,14 +1442,14 @@ query${c} {
|
|
|
1427
1442
|
marketCode: r,
|
|
1428
1443
|
locale: a
|
|
1429
1444
|
} = {}) => {
|
|
1430
|
-
const s = Math.max(1, Math.floor(t)),
|
|
1431
|
-
limit:
|
|
1432
|
-
skip: (s - 1) *
|
|
1445
|
+
const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), i = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1446
|
+
limit: n,
|
|
1447
|
+
skip: (s - 1) * n
|
|
1433
1448
|
}, l = [];
|
|
1434
|
-
r && (
|
|
1449
|
+
r && (i.push("$marketCode: String!"), o.marketCode = r, l.push(
|
|
1435
1450
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1436
|
-
)), a && (
|
|
1437
|
-
const c = `(${
|
|
1451
|
+
)), a && (i.push("$locale: String!"), o.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1452
|
+
const c = `(${i.join(", ")})`, u = l.length ? `(
|
|
1438
1453
|
limit: $limit
|
|
1439
1454
|
skip: $skip
|
|
1440
1455
|
where: {
|
|
@@ -1461,12 +1476,12 @@ query${c} {
|
|
|
1461
1476
|
}
|
|
1462
1477
|
}
|
|
1463
1478
|
`, { keywordCollectionCollection: g } = await y.graphqlQuery(f, {
|
|
1464
|
-
...
|
|
1479
|
+
...o
|
|
1465
1480
|
});
|
|
1466
1481
|
return {
|
|
1467
1482
|
page: s,
|
|
1468
1483
|
total: g.total,
|
|
1469
|
-
size:
|
|
1484
|
+
size: n,
|
|
1470
1485
|
items: g.items
|
|
1471
1486
|
};
|
|
1472
1487
|
};
|
|
@@ -1478,10 +1493,10 @@ export {
|
|
|
1478
1493
|
$e as getBlogCollections,
|
|
1479
1494
|
ye as getBlogPostDetail,
|
|
1480
1495
|
me as getBlogPosts,
|
|
1481
|
-
|
|
1496
|
+
Ce as getBrandCollections,
|
|
1482
1497
|
ke as getDocArticleDetail,
|
|
1483
1498
|
Se as getDocArticles,
|
|
1484
|
-
|
|
1499
|
+
we as getDocCategories,
|
|
1485
1500
|
ve as getDocCategoryDetail,
|
|
1486
1501
|
Ae as getHyperlinkCollections,
|
|
1487
1502
|
Oe as getKeywordCollections
|