@agility/content-fetch 1.1.1 → 1.1.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.
- package/.vscode/launch.json +35 -0
- package/README.md +1 -1
- package/dist/agility-content-fetch.browser.js +175 -67
- package/dist/agility-content-fetch.node.js +3767 -1046
- package/package.json +7 -2
- package/src/api-client.js +8 -19
- package/src/methods/getContentItem.js +6 -5
- package/src/methods/getContentList.js +16 -15
- package/src/methods/getPage.js +6 -5
- package/src/methods/getSitemapFlat.js +6 -5
- package/src/methods/getSitemapNested.js +6 -5
- package/src/methods/getSyncContent.js +6 -5
- package/src/methods/getSyncPages.js +6 -5
- package/src/types/ContentList.js +1 -1
- package/src/utils.js +2 -2
- package/test/apiClients.config.js +6 -3
- package/test/getContentItem.tests.js +12 -12
- package/test/getContentList.tests.js +26 -27
- package/test/getPage.tests.js +5 -5
- package/test/getSitemapFlat.tests.js +4 -4
- package/test/getSitemapNested.tests.js +4 -4
- package/test/getSyncContentItems.tests.js +1 -1
- package/test/getSyncPageItems.tests.js +1 -1
|
@@ -22,7 +22,7 @@ describe('getContentList:', function() {
|
|
|
22
22
|
var api = createApiClient();
|
|
23
23
|
api.getContentList({
|
|
24
24
|
referenceName: 'posts',
|
|
25
|
-
|
|
25
|
+
locale: 'en-us'
|
|
26
26
|
})
|
|
27
27
|
.then(function(contentList) {
|
|
28
28
|
assert.strictEqual(contentList.items[0].contentID, 15);
|
|
@@ -36,7 +36,7 @@ describe('getContentList:', function() {
|
|
|
36
36
|
var api = createPreviewApiClient();
|
|
37
37
|
api.getContentList({
|
|
38
38
|
referenceName: 'posts',
|
|
39
|
-
|
|
39
|
+
locale: 'en-us'
|
|
40
40
|
})
|
|
41
41
|
.then(function(contentList) {
|
|
42
42
|
assert.strictEqual(contentList.items[0].contentID, 15);
|
|
@@ -51,7 +51,7 @@ describe('getContentList:', function() {
|
|
|
51
51
|
var api = createApiClient();
|
|
52
52
|
api.getContentList({
|
|
53
53
|
someOtherParam: 'posts',
|
|
54
|
-
|
|
54
|
+
locale: 'en-us'
|
|
55
55
|
})
|
|
56
56
|
.then(function(contentList) {
|
|
57
57
|
assert.strictEqual(contentList[0].contentID, 24);
|
|
@@ -63,7 +63,7 @@ describe('getContentList:', function() {
|
|
|
63
63
|
done();
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
it('should throw error if
|
|
66
|
+
it('should throw error if locale param is missing in getContentList', function(done) {
|
|
67
67
|
expect(function() {
|
|
68
68
|
var api = createApiClient();
|
|
69
69
|
api.getContentList({
|
|
@@ -84,7 +84,7 @@ describe('getContentList:', function() {
|
|
|
84
84
|
var api = createApiClient();
|
|
85
85
|
api.getContentList({
|
|
86
86
|
referenceName: 'posts',
|
|
87
|
-
|
|
87
|
+
locale: 'en-us',
|
|
88
88
|
take: 'ten'
|
|
89
89
|
})
|
|
90
90
|
.then(function(contentList) {
|
|
@@ -102,7 +102,7 @@ describe('getContentList:', function() {
|
|
|
102
102
|
var api = createApiClient();
|
|
103
103
|
api.getContentList({
|
|
104
104
|
referenceName: 'posts',
|
|
105
|
-
|
|
105
|
+
locale: 'en-us',
|
|
106
106
|
take: 0
|
|
107
107
|
})
|
|
108
108
|
.then(function(contentList) {
|
|
@@ -115,13 +115,13 @@ describe('getContentList:', function() {
|
|
|
115
115
|
done();
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
it('should throw error if take parameter is a number greater than
|
|
118
|
+
it('should throw error if take parameter is a number greater than 250 in getContentList', function(done) {
|
|
119
119
|
expect(function() {
|
|
120
120
|
var api = createApiClient();
|
|
121
121
|
api.getContentList({
|
|
122
122
|
referenceName: 'posts',
|
|
123
|
-
|
|
124
|
-
take:
|
|
123
|
+
locale: 'en-us',
|
|
124
|
+
take: 251
|
|
125
125
|
})
|
|
126
126
|
.then(function(contentList) {
|
|
127
127
|
assert.strictEqual(contentList[0].contentID, 24);
|
|
@@ -138,7 +138,7 @@ describe('getContentList:', function() {
|
|
|
138
138
|
var api = createApiClient();
|
|
139
139
|
api.getContentList({
|
|
140
140
|
referenceName: 'posts',
|
|
141
|
-
|
|
141
|
+
locale: 'en-us',
|
|
142
142
|
skip: -1
|
|
143
143
|
})
|
|
144
144
|
.then(function(contentList) {
|
|
@@ -156,7 +156,7 @@ describe('getContentList:', function() {
|
|
|
156
156
|
var api = createApiClient();
|
|
157
157
|
api.getContentList({
|
|
158
158
|
referenceName: 'posts',
|
|
159
|
-
|
|
159
|
+
locale: 'en-us',
|
|
160
160
|
skip: 'ten'
|
|
161
161
|
})
|
|
162
162
|
.then(function(contentList) {
|
|
@@ -174,7 +174,7 @@ describe('getContentList:', function() {
|
|
|
174
174
|
var api = createApiClient();
|
|
175
175
|
api.getContentList({
|
|
176
176
|
referenceName: 'posts',
|
|
177
|
-
|
|
177
|
+
locale: 'en-us',
|
|
178
178
|
sort: 'fields.title',
|
|
179
179
|
direction: 'up'
|
|
180
180
|
})
|
|
@@ -192,12 +192,11 @@ describe('getContentList:', function() {
|
|
|
192
192
|
var api = createApiClient();
|
|
193
193
|
api.getContentList({
|
|
194
194
|
referenceName: 'posts',
|
|
195
|
-
|
|
196
|
-
sort: '
|
|
197
|
-
direction: api.types.SortDirections.DESC
|
|
195
|
+
locale: 'en-us',
|
|
196
|
+
sort: 'contentID',
|
|
198
197
|
})
|
|
199
198
|
.then(function(contentList) {
|
|
200
|
-
assert.isTrue(contentList.items[0].contentID
|
|
199
|
+
assert.isTrue(contentList.items[0].contentID < contentList.items[1].contentID);
|
|
201
200
|
done();
|
|
202
201
|
})
|
|
203
202
|
.catch(done);
|
|
@@ -208,7 +207,7 @@ describe('getContentList:', function() {
|
|
|
208
207
|
var api = createApiClient();
|
|
209
208
|
api.getContentList({
|
|
210
209
|
referenceName: 'posts',
|
|
211
|
-
|
|
210
|
+
locale: 'en-us',
|
|
212
211
|
filters: [{operator: api.types.FilterOperators.EQUAL_TO, value: '40'}]
|
|
213
212
|
})
|
|
214
213
|
.then(function(contentList) {
|
|
@@ -224,7 +223,7 @@ describe('getContentList:', function() {
|
|
|
224
223
|
var api = createApiClient();
|
|
225
224
|
api.getContentList({
|
|
226
225
|
referenceName: 'posts',
|
|
227
|
-
|
|
226
|
+
locale: 'en-us',
|
|
228
227
|
filters: [{property: 'properties.versionID', value: '40'}]
|
|
229
228
|
})
|
|
230
229
|
.then(function(contentList) {
|
|
@@ -240,7 +239,7 @@ describe('getContentList:', function() {
|
|
|
240
239
|
var api = createApiClient();
|
|
241
240
|
api.getContentList({
|
|
242
241
|
referenceName: 'posts',
|
|
243
|
-
|
|
242
|
+
locale: 'en-us',
|
|
244
243
|
filters: [{property: 'properties.versionID', operator: api.types.FilterOperators.EQUAL_TO}]
|
|
245
244
|
})
|
|
246
245
|
.then(function(contentList) {
|
|
@@ -256,7 +255,7 @@ describe('getContentList:', function() {
|
|
|
256
255
|
var api = createApiClient();
|
|
257
256
|
api.getContentList({
|
|
258
257
|
referenceName: 'posts',
|
|
259
|
-
|
|
258
|
+
locale: 'en-us',
|
|
260
259
|
filters: [{property: 'properties.versionID', operator: 'xx', value: '40'}]
|
|
261
260
|
})
|
|
262
261
|
.then(function(contentList) {
|
|
@@ -272,7 +271,7 @@ describe('getContentList:', function() {
|
|
|
272
271
|
var api = createApiClient();
|
|
273
272
|
api.getContentList({
|
|
274
273
|
referenceName: 'posts',
|
|
275
|
-
|
|
274
|
+
locale: 'en-us',
|
|
276
275
|
filtersLogicOperator: 'SOME'
|
|
277
276
|
})
|
|
278
277
|
.then(function(contentList) {
|
|
@@ -287,7 +286,7 @@ describe('getContentList:', function() {
|
|
|
287
286
|
var api = createApiClient();
|
|
288
287
|
api.getContentList({
|
|
289
288
|
referenceName: 'posts',
|
|
290
|
-
|
|
289
|
+
locale: 'en-us',
|
|
291
290
|
filters: [{property: 'contentID', operator: api.types.FilterOperators.EQUAL_TO, value: '15'}, {property: 'properties.referenceName', operator: api.types.FilterOperators.LIKE, value: 'posts'}],
|
|
292
291
|
filtersLogicOperator: api.types.FilterLogicOperators.OR
|
|
293
292
|
})
|
|
@@ -303,7 +302,7 @@ describe('getContentList:', function() {
|
|
|
303
302
|
var api = createApiClient();
|
|
304
303
|
api.getContentList({
|
|
305
304
|
referenceName: 'posts',
|
|
306
|
-
|
|
305
|
+
locale: 'en-us',
|
|
307
306
|
filters: [{property: 'contentID', operator: api.types.FilterOperators.EQUAL_TO, value: '16'}, {property: 'properties.referenceName', operator: api.types.FilterOperators.LIKE, value: 'posts'}],
|
|
308
307
|
filtersLogicOperator: api.types.FilterLogicOperators.AND
|
|
309
308
|
})
|
|
@@ -319,7 +318,7 @@ describe('getContentList:', function() {
|
|
|
319
318
|
var api = createApiClient();
|
|
320
319
|
api.getContentList({
|
|
321
320
|
referenceName: 'listwithnestedcontentlink',
|
|
322
|
-
|
|
321
|
+
locale: 'en-us',
|
|
323
322
|
expandAllContentLinks: true
|
|
324
323
|
})
|
|
325
324
|
.then(function(contentList) {
|
|
@@ -333,7 +332,7 @@ describe('getContentList:', function() {
|
|
|
333
332
|
var api = createApiClient();
|
|
334
333
|
api.getContentList({
|
|
335
334
|
referenceName: 'listwithnestedcontentlink',
|
|
336
|
-
|
|
335
|
+
locale: 'en-us',
|
|
337
336
|
expandAllContentLinks: false
|
|
338
337
|
})
|
|
339
338
|
.then(function(contentList) {
|
|
@@ -347,7 +346,7 @@ describe('getContentList:', function() {
|
|
|
347
346
|
var api = createApiClient();
|
|
348
347
|
api.getContentList({
|
|
349
348
|
referenceName: 'listwithnestedcontentlink',
|
|
350
|
-
|
|
349
|
+
locale: 'en-us'
|
|
351
350
|
})
|
|
352
351
|
.then(function(contentList) {
|
|
353
352
|
assert.strictEqual(Array.isArray(contentList.items[0].fields.posts), false);
|
|
@@ -361,7 +360,7 @@ describe('getContentList:', function() {
|
|
|
361
360
|
let referenceName = 'jssdklist';
|
|
362
361
|
api.getContentList({
|
|
363
362
|
referenceName: referenceName,
|
|
364
|
-
|
|
363
|
+
locale: 'en-us'
|
|
365
364
|
})
|
|
366
365
|
.then(function(contentList) {
|
|
367
366
|
assert.strictEqual(contentList.items[0].properties.referenceName, referenceName);
|
package/test/getPage.tests.js
CHANGED
|
@@ -21,7 +21,7 @@ import { createApiClient, createPreviewApiClient, createCatchedApiClient } from
|
|
|
21
21
|
var api = createApiClient();
|
|
22
22
|
api.getPage({
|
|
23
23
|
pageID: 2,
|
|
24
|
-
|
|
24
|
+
locale: 'en-us'
|
|
25
25
|
})
|
|
26
26
|
.then(function(page) {
|
|
27
27
|
assert.strictEqual(page.pageID, 2);
|
|
@@ -34,7 +34,7 @@ import { createApiClient, createPreviewApiClient, createCatchedApiClient } from
|
|
|
34
34
|
var api = createPreviewApiClient();
|
|
35
35
|
api.getPage({
|
|
36
36
|
pageID: 2,
|
|
37
|
-
|
|
37
|
+
locale: 'en-us'
|
|
38
38
|
})
|
|
39
39
|
.then(function(page) {
|
|
40
40
|
assert.strictEqual(page.pageID, 2);
|
|
@@ -48,7 +48,7 @@ import { createApiClient, createPreviewApiClient, createCatchedApiClient } from
|
|
|
48
48
|
var api = createApiClient();
|
|
49
49
|
api.getPage({
|
|
50
50
|
someOtherParam: 1,
|
|
51
|
-
|
|
51
|
+
locale: 'en-us'
|
|
52
52
|
})
|
|
53
53
|
.then(function(page) {
|
|
54
54
|
assert.strictEqual(page.pageID, 2);
|
|
@@ -59,7 +59,7 @@ import { createApiClient, createPreviewApiClient, createCatchedApiClient } from
|
|
|
59
59
|
done();
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
it('should throw error if
|
|
62
|
+
it('should throw error if locale not passed as argument for getPage', function(done) {
|
|
63
63
|
expect(function() {
|
|
64
64
|
var api = createApiClient();
|
|
65
65
|
api.getPage({
|
|
@@ -78,7 +78,7 @@ import { createApiClient, createPreviewApiClient, createCatchedApiClient } from
|
|
|
78
78
|
var api = createApiClient();
|
|
79
79
|
api.getPage({
|
|
80
80
|
pageID: 2,
|
|
81
|
-
|
|
81
|
+
locale: 'en-us',
|
|
82
82
|
expandAllContentLinks: true
|
|
83
83
|
})
|
|
84
84
|
.then(function(page) {
|
|
@@ -18,7 +18,7 @@ describe('getSitemapFlat:', function() {
|
|
|
18
18
|
var api = createApiClient();
|
|
19
19
|
api.getSitemapFlat({
|
|
20
20
|
channelName: 'website',
|
|
21
|
-
|
|
21
|
+
locale: 'en-us'
|
|
22
22
|
})
|
|
23
23
|
.then(function(sitemap) {
|
|
24
24
|
assert.strictEqual(sitemap['/home'].pageID, 2);
|
|
@@ -31,7 +31,7 @@ describe('getSitemapFlat:', function() {
|
|
|
31
31
|
var api = createPreviewApiClient();
|
|
32
32
|
api.getSitemapFlat({
|
|
33
33
|
channelName: 'website',
|
|
34
|
-
|
|
34
|
+
locale: 'en-us'
|
|
35
35
|
})
|
|
36
36
|
.then(function(sitemap) {
|
|
37
37
|
assert.strictEqual(sitemap['/home'].pageID, 2);
|
|
@@ -45,7 +45,7 @@ describe('getSitemapFlat:', function() {
|
|
|
45
45
|
var api = createApiClient();
|
|
46
46
|
api.getSitemapFlat({
|
|
47
47
|
someOtherParam: 1,
|
|
48
|
-
|
|
48
|
+
locale: 'en-us'
|
|
49
49
|
})
|
|
50
50
|
.then(function(sitemap) {
|
|
51
51
|
assert.strictEqual(sitemap['/home'].pageID, 2);
|
|
@@ -56,7 +56,7 @@ describe('getSitemapFlat:', function() {
|
|
|
56
56
|
done();
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
it('should throw error if
|
|
59
|
+
it('should throw error if locale not passed as argument for getSitemapFlat', function(done) {
|
|
60
60
|
expect(function() {
|
|
61
61
|
var api = createApiClient();
|
|
62
62
|
api.getSitemapFlat({
|
|
@@ -18,7 +18,7 @@ describe('getSitemapNested:', function() {
|
|
|
18
18
|
var api = createApiClient();
|
|
19
19
|
api.getSitemapNested({
|
|
20
20
|
channelName: 'website',
|
|
21
|
-
|
|
21
|
+
locale: 'en-us'
|
|
22
22
|
})
|
|
23
23
|
.then(function(sitemap) {
|
|
24
24
|
assert.strictEqual(sitemap[0].pageID, 2);
|
|
@@ -31,7 +31,7 @@ describe('getSitemapNested:', function() {
|
|
|
31
31
|
var api = createPreviewApiClient();
|
|
32
32
|
api.getSitemapNested({
|
|
33
33
|
channelName: 'website',
|
|
34
|
-
|
|
34
|
+
locale: 'en-us'
|
|
35
35
|
})
|
|
36
36
|
.then(function(sitemap) {
|
|
37
37
|
assert.strictEqual(sitemap[0].pageID, 2);
|
|
@@ -45,7 +45,7 @@ describe('getSitemapNested:', function() {
|
|
|
45
45
|
var api = createApiClient();
|
|
46
46
|
api.getSitemapNested({
|
|
47
47
|
someOtherParam: 1,
|
|
48
|
-
|
|
48
|
+
locale: 'en-us'
|
|
49
49
|
})
|
|
50
50
|
.then(function(sitemap) {
|
|
51
51
|
assert.strictEqual(sitemap[0].pageID, 2);
|
|
@@ -56,7 +56,7 @@ describe('getSitemapNested:', function() {
|
|
|
56
56
|
done();
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
it('should throw error if
|
|
59
|
+
it('should throw error if locale not passed as argument for getSitemapNested', function(done) {
|
|
60
60
|
expect(function() {
|
|
61
61
|
var api = createApiClient();
|
|
62
62
|
api.getSitemapNested({
|