@agility/content-fetch 2.0.2-rc-3 → 2.0.2
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/.nyc_output/713b1ec2-05ec-4b67-8061-b6cad0a45ad5.json +1 -0
- package/coverage/base.css +223 -0
- package/coverage/block-navigation.js +79 -0
- package/coverage/index.html +123 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +170 -0
- package/coverage/src/api-client.js.html +549 -0
- package/coverage/src/content-fetch.js.html +336 -0
- package/coverage/src/index.html +123 -0
- package/coverage/src/methods/getContentItem.js.html +285 -0
- package/coverage/src/methods/getContentList.js.html +486 -0
- package/coverage/src/methods/getGallery.js.html +243 -0
- package/coverage/src/methods/getPage.js.html +273 -0
- package/coverage/src/methods/getSitemapFlat.js.html +240 -0
- package/coverage/src/methods/getSitemapNested.js.html +231 -0
- package/coverage/src/methods/getSyncContent.js.html +258 -0
- package/coverage/src/methods/getSyncPages.js.html +258 -0
- package/coverage/src/methods/getUrlRedirections.js.html +339 -0
- package/coverage/src/methods/index.html +201 -0
- package/coverage/src/methods/syncContentItems.js.html +186 -0
- package/coverage/src/methods/syncPageItems.js.html +186 -0
- package/coverage/src/types/FilterLogicOperator.js.html +129 -0
- package/coverage/src/types/FilterOperator.js.html +156 -0
- package/coverage/src/types/SortDirection.js.html +129 -0
- package/coverage/src/types/index.html +123 -0
- package/coverage/src/utils.js.html +330 -0
- package/dist/api-client.d.ts +0 -3
- package/dist/browser.js +25 -66
- package/dist/node.js +25 -66
- package/dist/types/ContentItemReference.d.ts +5 -0
- package/dist/types/Filter.d.ts +2 -2
- package/package.json +1 -1
- package/dist/agility-content-fetch.node.js +0 -11377
- package/dist/methods/getPageByPath.d.ts +0 -42
package/dist/node.js
CHANGED
|
@@ -230,7 +230,17 @@ function validateRequestParams4(requestParams) {
|
|
|
230
230
|
} else if (!filter.hasOwnProperty("value")) {
|
|
231
231
|
throw new TypeError2(JSON.stringify(filter) + " does not contain 'value'.", validateRequestParams4);
|
|
232
232
|
}
|
|
233
|
-
if ([
|
|
233
|
+
if ([
|
|
234
|
+
"eq",
|
|
235
|
+
"ne",
|
|
236
|
+
"gt",
|
|
237
|
+
"gte",
|
|
238
|
+
"lt",
|
|
239
|
+
"lte",
|
|
240
|
+
"like",
|
|
241
|
+
"in",
|
|
242
|
+
"contains"
|
|
243
|
+
].indexOf(filter.operator.toLowerCase()) < 0) {
|
|
234
244
|
throw new TypeError2(JSON.stringify(filter) + "Operator must be one of ['eq','ne','gt','gte','lt','lte','like', 'in', 'contains'].", validateRequestParams4);
|
|
235
245
|
}
|
|
236
246
|
}
|
|
@@ -277,58 +287,10 @@ var defaultParams3 = {
|
|
|
277
287
|
};
|
|
278
288
|
var getPage_default = getPage;
|
|
279
289
|
|
|
280
|
-
// src/methods/getPageByPath.ts
|
|
281
|
-
function getPageByPath(requestParams) {
|
|
282
|
-
validateRequestParams6(requestParams);
|
|
283
|
-
const { channelName, pagePath } = requestParams;
|
|
284
|
-
requestParams = { ...defaultParams4, ...requestParams };
|
|
285
|
-
const req = {
|
|
286
|
-
url: `/page/${channelName}?path=${pagePath}&contentLinkDepth=${requestParams.contentLinkDepth}&expandAllContentLinks=${requestParams.expandAllContentLinks}`,
|
|
287
|
-
method: "get",
|
|
288
|
-
baseURL: buildRequestUrlPath(
|
|
289
|
-
this.config,
|
|
290
|
-
requestParams.locale || requestParams.languageCode
|
|
291
|
-
),
|
|
292
|
-
headers: buildAuthHeader(this.config),
|
|
293
|
-
params: {}
|
|
294
|
-
};
|
|
295
|
-
return this.makeRequest(req);
|
|
296
|
-
}
|
|
297
|
-
function validateRequestParams6(requestParams) {
|
|
298
|
-
if (!requestParams.languageCode && !requestParams.locale) {
|
|
299
|
-
throw new TypeError2(
|
|
300
|
-
"You must include a locale in your request params.",
|
|
301
|
-
validateRequestParams6
|
|
302
|
-
);
|
|
303
|
-
} else if (!requestParams.pagePath) {
|
|
304
|
-
throw new TypeError2(
|
|
305
|
-
"You must include a page path in your request params.",
|
|
306
|
-
validateRequestParams6
|
|
307
|
-
);
|
|
308
|
-
} else if (!requestParams.channelName) {
|
|
309
|
-
throw new TypeError2(
|
|
310
|
-
"You must include a channel name in your request params.",
|
|
311
|
-
validateRequestParams6
|
|
312
|
-
);
|
|
313
|
-
} else if (requestParams.expandAllContentLinks && typeof requestParams.expandAllContentLinks !== "boolean") {
|
|
314
|
-
throw new TypeError2(
|
|
315
|
-
"ExpandAllContentLinks parameter must be a value of true or false",
|
|
316
|
-
validateRequestParams6
|
|
317
|
-
);
|
|
318
|
-
} else {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
var defaultParams4 = {
|
|
323
|
-
contentLinkDepth: 2,
|
|
324
|
-
expandAllContentLinks: true
|
|
325
|
-
};
|
|
326
|
-
var getPageByPath_default = getPageByPath;
|
|
327
|
-
|
|
328
290
|
// src/methods/getGallery.ts
|
|
329
291
|
function getGallery(requestParams) {
|
|
330
|
-
|
|
331
|
-
requestParams = { ...
|
|
292
|
+
validateRequestParams6(requestParams);
|
|
293
|
+
requestParams = { ...defaultParams4, ...requestParams };
|
|
332
294
|
const req = {
|
|
333
295
|
url: `/${requestParams.galleryID}`,
|
|
334
296
|
method: "get",
|
|
@@ -338,21 +300,21 @@ function getGallery(requestParams) {
|
|
|
338
300
|
};
|
|
339
301
|
return this.makeRequest(req);
|
|
340
302
|
}
|
|
341
|
-
function
|
|
303
|
+
function validateRequestParams6(requestParams) {
|
|
342
304
|
if (!requestParams.galleryID) {
|
|
343
|
-
throw new TypeError2("You must include a galleryID number in your request params.",
|
|
305
|
+
throw new TypeError2("You must include a galleryID number in your request params.", validateRequestParams6);
|
|
344
306
|
} else {
|
|
345
307
|
return;
|
|
346
308
|
}
|
|
347
309
|
}
|
|
348
|
-
var
|
|
310
|
+
var defaultParams4 = {
|
|
349
311
|
contentLinkDepth: 1
|
|
350
312
|
};
|
|
351
313
|
var getGallery_default = getGallery;
|
|
352
314
|
|
|
353
315
|
// src/methods/getUrlRedirections.ts
|
|
354
316
|
function getUrlRedirections(requestParams) {
|
|
355
|
-
|
|
317
|
+
validateRequestParams7(requestParams);
|
|
356
318
|
let url = "";
|
|
357
319
|
if (requestParams.lastAccessDate) {
|
|
358
320
|
if (!requestParams.lastAccessDate.toISOString) {
|
|
@@ -383,12 +345,12 @@ function getUrlRedirections(requestParams) {
|
|
|
383
345
|
});
|
|
384
346
|
return promise;
|
|
385
347
|
}
|
|
386
|
-
function
|
|
348
|
+
function validateRequestParams7(requestParams) {
|
|
387
349
|
if (requestParams.lastAccessDate) {
|
|
388
350
|
if (!requestParams.lastAccessDate.toISOString) {
|
|
389
351
|
let dt = new Date(requestParams.lastAccessDate);
|
|
390
352
|
if (isNaN(dt.getTime())) {
|
|
391
|
-
throw new TypeError2("You must include a valid Datetime for the lastAccessDate.",
|
|
353
|
+
throw new TypeError2("You must include a valid Datetime for the lastAccessDate.", validateRequestParams7);
|
|
392
354
|
}
|
|
393
355
|
}
|
|
394
356
|
} else {
|
|
@@ -399,7 +361,7 @@ var getUrlRedirections_default = getUrlRedirections;
|
|
|
399
361
|
|
|
400
362
|
// src/methods/getSyncContent.ts
|
|
401
363
|
function getSyncContent(requestParams) {
|
|
402
|
-
|
|
364
|
+
validateRequestParams8(requestParams);
|
|
403
365
|
const req = {
|
|
404
366
|
url: `/sync/items?pageSize=${requestParams.pageSize}&syncToken=${requestParams.syncToken}`,
|
|
405
367
|
method: "get",
|
|
@@ -409,11 +371,11 @@ function getSyncContent(requestParams) {
|
|
|
409
371
|
};
|
|
410
372
|
return this.makeRequest(req);
|
|
411
373
|
}
|
|
412
|
-
function
|
|
374
|
+
function validateRequestParams8(requestParams) {
|
|
413
375
|
if (!requestParams.languageCode && !requestParams.locale) {
|
|
414
|
-
throw new TypeError2("You must include a locale in your request params.",
|
|
376
|
+
throw new TypeError2("You must include a locale in your request params.", validateRequestParams8);
|
|
415
377
|
} else if (requestParams.syncToken == void 0 || requestParams.syncToken == null) {
|
|
416
|
-
throw new TypeError2("You must include a syncToken value your request params. Use zero (0) to start a new sync.",
|
|
378
|
+
throw new TypeError2("You must include a syncToken value your request params. Use zero (0) to start a new sync.", validateRequestParams8);
|
|
417
379
|
} else {
|
|
418
380
|
return;
|
|
419
381
|
}
|
|
@@ -422,7 +384,7 @@ var getSyncContent_default = getSyncContent;
|
|
|
422
384
|
|
|
423
385
|
// src/methods/getSyncPages.ts
|
|
424
386
|
function getSyncPages(requestParams) {
|
|
425
|
-
|
|
387
|
+
validateRequestParams9(requestParams);
|
|
426
388
|
const req = {
|
|
427
389
|
url: `/sync/pages?pageSize=${requestParams.pageSize}&syncToken=${requestParams.syncToken}`,
|
|
428
390
|
method: "get",
|
|
@@ -432,7 +394,7 @@ function getSyncPages(requestParams) {
|
|
|
432
394
|
};
|
|
433
395
|
return this.makeRequest(req);
|
|
434
396
|
}
|
|
435
|
-
function
|
|
397
|
+
function validateRequestParams9(requestParams) {
|
|
436
398
|
if (!requestParams.languageCode && !requestParams.locale) {
|
|
437
399
|
throw new TypeError("You must include a locale in your request params.");
|
|
438
400
|
} else if (requestParams.syncToken == void 0 || requestParams.syncToken == null) {
|
|
@@ -549,9 +511,6 @@ var ApiClient = class {
|
|
|
549
511
|
async getPage(params) {
|
|
550
512
|
return getPage_default.call(this, params);
|
|
551
513
|
}
|
|
552
|
-
async getPageByPath(params) {
|
|
553
|
-
return getPageByPath_default.call(this, params);
|
|
554
|
-
}
|
|
555
514
|
async getSitemapFlat(params) {
|
|
556
515
|
return getSitemapFlat_default.call(this, params);
|
|
557
516
|
}
|
package/dist/types/Filter.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export interface Filter {
|
|
10
10
|
property: string;
|
|
11
|
-
operator: FilterOperator | "eq" | "ne" | "gt" | "lt" | "ge" | "le" | "contains";
|
|
11
|
+
operator: FilterOperator | "eq" | "ne" | "gt" | "lt" | "ge" | "le" | "contains" | "like" | "in";
|
|
12
12
|
value: string;
|
|
13
13
|
}
|
|
14
|
-
export type FilterOperator = "eq" | "ne" | "gt" | "lt" | "ge" | "le" | "contains";
|
|
14
|
+
export type FilterOperator = "eq" | "ne" | "gt" | "lt" | "ge" | "le" | "contains" | "like" | "in";
|