@agility/content-fetch 2.0.0-rc5 → 2.0.0-rc7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/.jsdoc.json +28 -28
  2. package/.nyc_output/713b1ec2-05ec-4b67-8061-b6cad0a45ad5.json +1 -0
  3. package/.yarn/cache/@esbuild-darwin-arm64-npm-0.19.0-c451044481-8.zip +0 -0
  4. package/.yarn/cache/fsevents-patch-2882183fbf-8.zip +0 -0
  5. package/.yarn/install-state.gz +0 -0
  6. package/LICENSE +21 -21
  7. package/README.md +108 -108
  8. package/build.js +26 -26
  9. package/coverage/base.css +223 -0
  10. package/coverage/block-navigation.js +79 -0
  11. package/coverage/index.html +123 -0
  12. package/coverage/prettify.css +1 -0
  13. package/coverage/prettify.js +2 -0
  14. package/coverage/sort-arrow-sprite.png +0 -0
  15. package/coverage/sorter.js +170 -0
  16. package/coverage/src/api-client.js.html +549 -0
  17. package/coverage/src/content-fetch.js.html +336 -0
  18. package/coverage/src/index.html +123 -0
  19. package/coverage/src/methods/getContentItem.js.html +285 -0
  20. package/coverage/src/methods/getContentList.js.html +486 -0
  21. package/coverage/src/methods/getGallery.js.html +243 -0
  22. package/coverage/src/methods/getPage.js.html +273 -0
  23. package/coverage/src/methods/getSitemapFlat.js.html +240 -0
  24. package/coverage/src/methods/getSitemapNested.js.html +231 -0
  25. package/coverage/src/methods/getSyncContent.js.html +258 -0
  26. package/coverage/src/methods/getSyncPages.js.html +258 -0
  27. package/coverage/src/methods/getUrlRedirections.js.html +339 -0
  28. package/coverage/src/methods/index.html +201 -0
  29. package/coverage/src/methods/syncContentItems.js.html +186 -0
  30. package/coverage/src/methods/syncPageItems.js.html +186 -0
  31. package/coverage/src/types/FilterLogicOperator.js.html +129 -0
  32. package/coverage/src/types/FilterOperator.js.html +156 -0
  33. package/coverage/src/types/SortDirection.js.html +129 -0
  34. package/coverage/src/types/index.html +123 -0
  35. package/coverage/src/utils.js.html +330 -0
  36. package/dist/agility-content-fetch.browser.js +420 -0
  37. package/dist/agility-content-fetch.node.js +10978 -0
  38. package/dist/api-client.js +316 -0
  39. package/dist/index.js +7 -0
  40. package/dist/methods/getContentItem.js +49 -0
  41. package/dist/methods/getContentList.js +94 -0
  42. package/dist/methods/getGallery.js +39 -0
  43. package/dist/methods/getPage.js +47 -0
  44. package/dist/methods/getSitemapFlat.js +26 -0
  45. package/dist/methods/getSitemapNested.js +23 -0
  46. package/dist/methods/getSyncContent.js +26 -0
  47. package/dist/methods/getSyncPages.js +26 -0
  48. package/dist/methods/getUrlRedirections.js +50 -0
  49. package/dist/types/Client.js +2 -0
  50. package/dist/types/Config.js +2 -0
  51. package/dist/types/ContentItem.js +2 -0
  52. package/dist/types/ContentList.js +9 -0
  53. package/dist/types/ContentZone.js +2 -0
  54. package/dist/types/EnvConfig.js +2 -0
  55. package/dist/types/Filter.js +10 -0
  56. package/dist/types/FilterLogicOperator.js +13 -0
  57. package/dist/types/FilterOperator.js +30 -0
  58. package/dist/types/Gallery.js +12 -0
  59. package/dist/types/MediaItem.js +13 -0
  60. package/dist/types/MediaItemMetaData.js +12 -0
  61. package/dist/types/Page.js +20 -0
  62. package/dist/types/SEO.js +11 -0
  63. package/dist/types/SitemapFlat.js +10 -0
  64. package/dist/types/SitemapFlatItem.js +17 -0
  65. package/dist/types/SitemapNested.js +7 -0
  66. package/dist/types/SitemapNestedItem.js +2 -0
  67. package/dist/types/SitemapVisibility.js +9 -0
  68. package/dist/types/SortDirection.js +13 -0
  69. package/dist/types/SyncContent.js +9 -0
  70. package/dist/types/SyncPages.js +9 -0
  71. package/dist/types/SystemProperties.js +11 -0
  72. package/dist/types/UrlRedirection.js +11 -0
  73. package/dist/types/UrlRedirectionResponse.js +9 -0
  74. package/dist/types/index.js +10 -0
  75. package/dist/utils.js +81 -0
  76. package/jest.config.js +5 -5
  77. package/package.json +60 -60
  78. package/tsconfig.json +14 -14
  79. package/.yarn/cache/@esbuild-win32-x64-npm-0.19.0-2341ee400c-8.zip +0 -0
  80. package/.yarn/cache/@types-axios-npm-0.14.0-42f41917ea-12a230b940.zip +0 -0
  81. package/.yarn/cache/axios-npm-1.4.0-4d7ce8ca3e-7fb6a4313b.zip +0 -0
  82. package/.yarn/cache/proxy-from-env-npm-1.1.0-c13d07f26b-ed7fcc2ba0.zip +0 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var utils_1 = require("../utils");
4
+ function getUrlRedirections(requestParams) {
5
+ validateRequestParams(requestParams);
6
+ var url = "";
7
+ if (requestParams.lastAccessDate) {
8
+ if (!requestParams.lastAccessDate.toISOString) {
9
+ requestParams.lastAccessDate = new Date(requestParams.lastAccessDate);
10
+ }
11
+ url = "/?lastAccessDate=".concat(requestParams.lastAccessDate.toISOString());
12
+ }
13
+ var req = {
14
+ url: url,
15
+ method: 'get',
16
+ baseURL: (0, utils_1.buildRequestUrlPath)(this.config, 'urlredirection'),
17
+ headers: (0, utils_1.buildAuthHeader)(this.config),
18
+ params: {}
19
+ };
20
+ var self = this;
21
+ var promise = new Promise(function (resolve, reject) {
22
+ self.makeRequest(req)
23
+ .then(function (data) {
24
+ if (data == undefined || !data) {
25
+ reject(new Error("The URL redirections could not be retrieved."));
26
+ }
27
+ else {
28
+ resolve(data);
29
+ }
30
+ })
31
+ .catch(function (error) {
32
+ reject(error);
33
+ });
34
+ });
35
+ return promise;
36
+ }
37
+ function validateRequestParams(requestParams) {
38
+ if (requestParams.lastAccessDate) {
39
+ if (!requestParams.lastAccessDate.toISOString) {
40
+ var dt = new Date(requestParams.lastAccessDate);
41
+ if (isNaN(dt.getTime())) {
42
+ throw new TypeError('You must include a valid Datetime for the lastAccessDate.');
43
+ }
44
+ }
45
+ }
46
+ else {
47
+ return;
48
+ }
49
+ }
50
+ exports.default = getUrlRedirections;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a **Content List** in the CMS.
4
+ * @typedef ContentList
5
+ * @memberof AgilityFetch.Types
6
+ * @property {Array.<AgilityFetch.Types.ContentItem>} items - The paginated array of items returned by the request. Default *take* is **10** unless otherwise specified (Maximum allowed it **250**)
7
+ * @property {number} totalCount - The total amount of items in the list. Use this along with *skip* and *take* for pagination.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a **Filter** for filtering lists.
4
+ * @typedef Filter
5
+ * @memberof AgilityFetch.Types
6
+ * @property {string} property - The property to filter the request on.
7
+ * @property {AgilityFetch.Types.FilterOperator} operator - The operator to use for the filter.
8
+ * @property {string} value - The value to compare for the property.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a FilterLogicOperator - Refer to {@link AgilityFetch.Types.FilterLogicOperators} Enum for available Logic Operators.
4
+ * @typedef {string} FilterLogicOperator
5
+ * @memberOf AgilityFetch.Types
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.FilterLogicOperators = void 0;
9
+ var FilterLogicOperators;
10
+ (function (FilterLogicOperators) {
11
+ FilterLogicOperators["AND"] = "AND";
12
+ FilterLogicOperators["OR"] = "OR";
13
+ })(FilterLogicOperators || (exports.FilterLogicOperators = FilterLogicOperators = {}));
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a FilterOperator - Refer to {@link AgilityFetch.Types.FilterOperators} Enum for available Operators.
4
+ * @typedef {string} FilterOperator
5
+ * @memberOf AgilityFetch.Types
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ /**
9
+ * Enum of FilterOperators.
10
+ * @enum {FilterOperator} FilterOperators
11
+ * @memberOf AgilityFetch.Types
12
+ * @readonly
13
+ */
14
+ var FilterOperators = {
15
+ /** Equal To */
16
+ EQUAL_TO: "eq",
17
+ /** Not Equal To */
18
+ NOT_EQUAL_TO: "ne",
19
+ /** Less Than */
20
+ LESS_THAN: "lt",
21
+ /** Less Than or Equal To */
22
+ LESS_THAN_OR_EQUAL_TO: "lte",
23
+ /** Greater Than */
24
+ GREATER_THAN: "gt",
25
+ /** Greater Than or Equal To */
26
+ GREATER_THAN_OR_EQUAL_TO: "gte",
27
+ /** Like (string only) */
28
+ LIKE: "like"
29
+ };
30
+ exports.default = FilterOperators;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a **Gallery** in the CMS
4
+ * @typedef Gallery
5
+ * @memberof AgilityFetch.Types
6
+ * @property {number} galleryID - The unique ID of the gallery.
7
+ * @property {string} name - The name of the gallery.
8
+ * @property {string} description - The description of the gallery.
9
+ * @property {number} count - The count of media items in the gallery.
10
+ * @property {Array<AgilityFetch.Types.MediaItem>} media - Array of media items in the gallery.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a **MediaItem** in the CMS
4
+ * @typedef MediaItem
5
+ * @memberof AgilityFetch.Types
6
+ * @property {number} mediaID - The unique ID of the media item.
7
+ * @property {string} fileName - The file name of the media item.
8
+ * @property {string} url - The url of the media item.
9
+ * @property {number} size - The size of the media item in bytes.
10
+ * @property {date} modifiedOn - The last modified date and time of the media item.
11
+ * @property {AgilityFetch.Types.MediaItemMetaData} metaData - Meta data for the media item.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a **MediaItemMetaData** in the CMS
4
+ * @typedef MediaItemMetaData
5
+ * @memberof AgilityFetch.Types
6
+ * @property {string} Title - The title meta data of the media item.
7
+ * @property {string} Description - The description meta data of the media item.
8
+ * @property {string} LinkUrl - The link url meta data of the media item.
9
+ * @property {string} pixelHeight - The height in pixels of the media item.
10
+ * @property {string} pixelWidth - The width in pixels of the media item.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a **Page** in the CMS.
4
+ * @typedef Page
5
+ * @memberof AgilityFetch.Types
6
+ * @property {number} pageID - The unique ID of the page in this language.
7
+ * @property {string} name - The friendly url slug for the page - this is used to make up the URL.
8
+ * @property {string} path - The url path for this page.
9
+ * @property {string} title - The page title for the page, used for SEO and appears in the browser bar/tab.
10
+ * @property {string} menuText - And alternate text field, often used in dynamic menu generation.
11
+ * @property {string} pageType - The type of page. Valid values include *static*, *dynamic*, *dynamic_node*, *link*, and *folder*.
12
+ * @property {string} templateName - The name of the Page Template this page uses.
13
+ * @property {boolean} securePage - This value represents whether this page should be secured within the website.
14
+ * @property {AgilityFetch.Types.SystemProperties} properties The system properties of this page item.
15
+ * @property {Object.<string, AgilityFetch.Types.ContentZone>} zones - Contains a dictionary of content zones for this page and the modules in each zone.
16
+ * @property {string} [redirectUrl] - If this page is a *link*, then this property will show the intended destination redirect.
17
+ * @property {number} [dynamicItemContentID] - If this page is a dynamic page, then this property will show the associated contentID of the dynamic content item.
18
+ * @property {AgilityFetch.Types.SitemapVisibility} visible - Object that contains properties pertaining to the intended visibility of this page for seo and menus.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Defines the SEO properties for a content item.
4
+ * @interface SEOProperties
5
+ * @property {string} metaDescription - The meta description for the content item.
6
+ * @property {string} metaKeywords - The meta keywords for the content item.
7
+ * @property {string} metaHTML - The meta HTML for the content item.
8
+ * @property {boolean} menuVisible - Whether the content item should be visible in the menu.
9
+ * @property {boolean} sitemapVisible - Whether the content item should be visible in the sitemap.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Define the SitemapFlatItem interface if necessary
4
+ // interface SitemapFlatItem {
5
+ // // Define properties of AgilityFetch.Types.SitemapFlatItem if needed
6
+ // // For example:
7
+ // pageID: number;
8
+ // title: string;
9
+ // // ... other properties
10
+ // }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Represents an item in a sitemap response
4
+ * @typedef {Object} SitemapFlatItem
5
+ * @memberof AgilityFetch.Types
6
+ * @property {number} pageID - The unique ID of the page in Agility in this language.
7
+ * @property {string} title - A human-friendly title for the page, typically used for SEO and displayed in the browser tab/bar.
8
+ * @property {string} name - The URL friendly name of the page.
9
+ * @property {string} path - The URL path of the page.
10
+ * @property {string} menuText - An alternate page title, often used when generating dynamic menus.
11
+ * @property {string} pageType - Describes what type of page this is - values include *static*, *dynamic*, *dynamic_node*, *folder*, and *link*
12
+ * @property {AgilityFetch.Types.SystemProperties} properties - The system properties of this page item.
13
+ * @property {string} [redirectUrl] - If this page is a *link*, then this property will show the intended destination redirect.
14
+ * @property {number} [dynamicItemContentID] - If this page is a dynamic page, then this property will show the associated contentID of the dynamic content item.
15
+ * @property {AgilityFetch.Types.SitemapVisibility} visible - Object that contains properties pertaining to the intended visibility of this page for seo and menus.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * A dictionary/map of all page routes. The key of this dictionary is the page path for a page.
4
+ * @typedef {Array.<AgilityFetch.Types.SitemapNestedItem>} SitemapNested - The array of pages for the sitemap.
5
+ * @memberof AgilityFetch.Types
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a page's visibility.
4
+ * @typedef SitemapVisibility
5
+ * @memberof AgilityFetch.Types
6
+ * @property {boolean} menu - If set to true, this page should be hidden from menus.
7
+ * @property {boolean} sitemap - If set to true, this page should be hidden from the sitemap and not accessible by robots.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Defines a Sort Direction - Refer to {@link AgilityFetch.Types.SortDirections} Enum for available Sort Directions.
4
+ * @typedef {string} SortDirection
5
+ * @memberOf AgilityFetch.Types
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.SortDirections = void 0;
9
+ var SortDirections;
10
+ (function (SortDirections) {
11
+ SortDirections["ASC"] = "asc";
12
+ SortDirections["DESC"] = "desc";
13
+ })(SortDirections || (exports.SortDirections = SortDirections = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Defines **Sync Content** response.
4
+ * @typedef SyncContent
5
+ * @memberof AgilityFetch.Types
6
+ * @property {number} syncToken - The sync token to be used in the next call as a continuation token for syncing content. If this is empty, you are up to date.
7
+ * @property {Array.<AgilityFetch.Types.ContentItem>} items - The paginated array of items returned by the request.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Defines **Sync Pages** response.
4
+ * @typedef SyncPages
5
+ * @memberof AgilityFetch.Types
6
+ * @property {number} syncToken - The sync token to be used in the next call as a continuation token for syncing content. If this is empty, you are up to date.
7
+ * @property {Array.<AgilityFetch.Types.Page>} items - The paginated array of items returned by the request.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Defines the common **System Properties** of pages and content items in the CMS.
4
+ * @typedef SystemProperties
5
+ * @memberof AgilityFetch.Types
6
+ * @property {datetime} created - The date/time this item was created.
7
+ * @property {datetime} modified - The date/time this item was last modified.
8
+ * @property {number} state - The **state** of this content item. **1** = *Staging*, **2** = *Published*, **3** = *Deleted*, **4** = *Approved*, **5** = *AwaitingApproval*, **6** = *Declined*, **7** = *Unpublished*
9
+ * @property {number} versionID - The unique versionID of this content item.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Defines **URL Redirection** .
4
+ * @typedef URLRedirection
5
+ * @memberof AgilityFetch.Types
6
+ * @property {Number} id - The id of this URL Redirection
7
+ * @property {String} originUrl - The URL to redirect from
8
+ * @property {String} destinationUrl - The URL to redirect to
9
+ * @property {Number} statusCode - Either a 301 or 302 status code for the redirect
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Defines **URL Redirection** response.
4
+ * @typedef URLRedirectionResponse
5
+ * @memberof AgilityFetch.Types
6
+ * @property {Array} syncToken - The sync token to be used in the next call as a continuation token for syncing content. If this is empty, you are up to date.
7
+ * @property {Array.<AgilityFetch.Types.Page>} items - The paginated array of items returned by the request.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FilterLogicOperators = exports.FilterOperators = void 0;
7
+ var FilterOperator_1 = __importDefault(require("./FilterOperator"));
8
+ exports.FilterOperators = FilterOperator_1.default;
9
+ var FilterLogicOperator_1 = require("./FilterLogicOperator");
10
+ Object.defineProperty(exports, "FilterLogicOperators", { enumerable: true, get: function () { return FilterLogicOperator_1.FilterLogicOperators; } });
package/dist/utils.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.logDebug = exports.logError = exports.isHttps = exports.buildRequestUrlPath = exports.buildAuthHeader = exports.buildPathUrl = void 0;
15
+ function logError(consoleMessage) {
16
+ console.error('\x1b[41m%s\x1b[0m', consoleMessage);
17
+ }
18
+ exports.logError = logError;
19
+ function logDebug(consoleMessage) {
20
+ console.log('\x1b[33m%s\x1b[0m', consoleMessage);
21
+ }
22
+ exports.logDebug = logDebug;
23
+ function buildRequestUrlPath(config, locale) {
24
+ var apiFetchOrPreview = '';
25
+ if (config.isPreview === true || config.isPreview === 'true') {
26
+ apiFetchOrPreview = 'preview';
27
+ }
28
+ else {
29
+ apiFetchOrPreview = 'fetch';
30
+ }
31
+ var urlPath = "".concat(config.baseUrl, "/").concat(apiFetchOrPreview, "/").concat(locale);
32
+ return urlPath;
33
+ }
34
+ exports.buildRequestUrlPath = buildRequestUrlPath;
35
+ function buildPathUrl(contentType, referenceName, skip, take, sort, direction, filters, filtersLogicOperator, contentLinkDepth, expandAllContentLinks) {
36
+ var url = "/".concat(contentType, "/").concat(referenceName, "?contentLinkDepth=").concat(contentLinkDepth, "&");
37
+ filtersLogicOperator = filtersLogicOperator ? " ".concat(filtersLogicOperator, " ") : ' AND ';
38
+ if (sort) {
39
+ url += "sort=".concat(sort, "&");
40
+ if (direction) {
41
+ url += "direction=".concat(direction, "&");
42
+ }
43
+ }
44
+ if (skip) {
45
+ url += "skip=".concat(skip, "&");
46
+ }
47
+ if (take) {
48
+ url += "take=".concat(take, "&");
49
+ }
50
+ if (filters && filters.length > 0) {
51
+ url += 'filter=';
52
+ for (var i = 0; i < filters.length; i++) {
53
+ var filter = filters[i];
54
+ url += "".concat(filter.property, "[").concat(filter.operator, "]").concat(filter.value) + (i < filters.length - 1 ? filtersLogicOperator : '');
55
+ }
56
+ url += '&';
57
+ }
58
+ if (expandAllContentLinks) {
59
+ url += "expandAllContentLinks=".concat(expandAllContentLinks, "&");
60
+ }
61
+ return url;
62
+ }
63
+ exports.buildPathUrl = buildPathUrl;
64
+ function buildAuthHeader(config) {
65
+ var defaultAuthHeaders = {
66
+ APIKey: config.apiKey,
67
+ Guid: ''
68
+ };
69
+ if (config.requiresGuidInHeaders) {
70
+ defaultAuthHeaders.Guid = config.guid;
71
+ }
72
+ return __assign(__assign({}, defaultAuthHeaders), config.headers);
73
+ }
74
+ exports.buildAuthHeader = buildAuthHeader;
75
+ function isHttps(url) {
76
+ if (!url.toLowerCase().startsWith('https://')) {
77
+ return false;
78
+ }
79
+ return true;
80
+ }
81
+ exports.isHttps = isHttps;
package/jest.config.js CHANGED
@@ -1,6 +1,6 @@
1
- module.exports = {
2
- preset: "ts-jest",
3
- testEnvironment: "node",
4
- testMatch: ["<rootDir>/test/**/*.tests.ts"],
5
- };
1
+ module.exports = {
2
+ preset: "ts-jest",
3
+ testEnvironment: "node",
4
+ testMatch: ["<rootDir>/test/**/*.tests.ts"],
5
+ };
6
6
 
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "@agility/content-fetch",
3
- "version": "2.0.0-rc5",
4
- "description": "JavaScript library for the Agility Fetch API (node and browser)",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/agility/agility-content-fetch-js-sdk.git"
8
- },
9
- "bugs": {
10
- "url": "https://github.com/agility/agility-content-fetch-js-sdk.git/issues"
11
- },
12
- "homepage": "https://github.com/agility/agility-content-fetch-js-sdk.git#readme",
13
- "main": "./dist/browser.js",
14
- "module": "./dist/browser.js",
15
- "types": "./dist/index.d.ts",
16
- "engines": {
17
- "node": ">= 18.0.0"
18
- },
19
- "scripts": {
20
- "clean": "rimraf dist",
21
- "build": "node build.js",
22
- "prepare": "yarn build",
23
- "test": "jest",
24
- "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
25
- },
26
- "exports": {
27
- "import": "./dist/browser.js",
28
- "require": "./dist/browser.js"
29
- },
30
- "keywords": [
31
- "typescript",
32
- "agility",
33
- "cms",
34
- "headlesscms",
35
- "fetch-sdk"
36
- ],
37
- "author": "Agility CMS",
38
- "contributors": [
39
- "Kevin Tran",
40
- "James Vidler",
41
- "Joel Varty",
42
- "Joshua Isaac"
43
- ],
44
- "license": "MIT",
45
- "dependencies": {
46
- "axios": "^0.27.2"
47
- },
48
- "devDependencies": {
49
- "@types/jest": "^29.5.3",
50
- "@types/node": "^18.11.9",
51
- "agility-jsdoc-template": "1.0.3",
52
- "esbuild": "^0.19.0",
53
- "jest": "^29.6.2",
54
- "npm-dts": "^1.3.12",
55
- "rimraf": "^5.0.1",
56
- "ts-jest": "^29.1.1",
57
- "typescript": "^5.1.6"
58
- },
59
- "packageManager": "yarn@3.6.1"
60
- }
1
+ {
2
+ "name": "@agility/content-fetch",
3
+ "version": "2.0.0-rc7",
4
+ "description": "JavaScript library for the Agility Fetch API (node and browser)",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/agility/agility-content-fetch-js-sdk.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/agility/agility-content-fetch-js-sdk.git/issues"
11
+ },
12
+ "homepage": "https://github.com/agility/agility-content-fetch-js-sdk.git#readme",
13
+ "module": "./dist/browser.js",
14
+ "main": "./dist/node.js",
15
+ "types": "./dist/index.d.ts",
16
+ "engines": {
17
+ "node": ">= 18.0.0"
18
+ },
19
+ "scripts": {
20
+ "clean": "rimraf dist",
21
+ "build": "node build.js",
22
+ "prepare": "yarn build",
23
+ "test": "jest",
24
+ "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
25
+ },
26
+ "exports": {
27
+ "import": "./dist/browser.js",
28
+ "require": "./dist/node.js"
29
+ },
30
+ "keywords": [
31
+ "typescript",
32
+ "agility",
33
+ "cms",
34
+ "headlesscms",
35
+ "fetch-sdk"
36
+ ],
37
+ "author": "Agility CMS",
38
+ "contributors": [
39
+ "Kevin Tran",
40
+ "James Vidler",
41
+ "Joel Varty",
42
+ "Joshua Isaac"
43
+ ],
44
+ "license": "MIT",
45
+ "dependencies": {
46
+ "axios": "^0.27.2"
47
+ },
48
+ "devDependencies": {
49
+ "@types/jest": "^29.5.3",
50
+ "@types/node": "^18.11.9",
51
+ "agility-jsdoc-template": "1.0.3",
52
+ "esbuild": "^0.19.0",
53
+ "jest": "^29.6.2",
54
+ "npm-dts": "^1.3.12",
55
+ "rimraf": "^5.0.1",
56
+ "ts-jest": "^29.1.1",
57
+ "typescript": "^5.1.6"
58
+ },
59
+ "packageManager": "yarn@3.6.1"
60
+ }
package/tsconfig.json CHANGED
@@ -1,15 +1,15 @@
1
- {
2
- "compilerOptions": {
3
- "module" : "commonjs",
4
- "allowJs": true,
5
- "declaration": true,
6
- "jsx": "react-jsx",
7
- "target": "es5",
8
- "outDir": "./dist/",
9
- "lib": ["es2016", "dom"],
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "allowSyntheticDefaultImports": true
13
- },
14
- "include": ["src", "src/api-client.ts"]
1
+ {
2
+ "compilerOptions": {
3
+ "module" : "commonjs",
4
+ "allowJs": true,
5
+ "declaration": true,
6
+ "jsx": "react-jsx",
7
+ "target": "es5",
8
+ "outDir": "./dist/",
9
+ "lib": ["es2016", "dom"],
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "allowSyntheticDefaultImports": true
13
+ },
14
+ "include": ["src", "src/api-client.ts"]
15
15
  }