@agility/content-sync 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,67 +1,67 @@
1
- import chai from 'chai'
2
- const assert = chai.assert;
3
- const expect = chai.expect;
4
-
5
- import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
-
7
- /*
8
- This file contains static references to content from the instance configured in the apiClient.config file.
9
- */
10
-
11
- const languageCode = 'en-us'
12
-
13
- describe('store.getContentList:', async function() {
14
-
15
- it('should be able to retrieve a list from the store', async function() {
16
- var syncClient = createSyncClient();
17
-
18
- const contentList = await syncClient.store.getContentList({
19
- referenceName: 'posts',
20
- languageCode: languageCode
21
- })
22
-
23
- assert.strictEqual(contentList[0].properties.referenceName, "posts", 'retrieved the content list we asked for')
24
- })
25
-
26
-
27
- it('should be able to expand and page a list from the store', async function() {
28
- var syncClient = createSyncClient();
29
-
30
- const contentList = await syncClient.store.getContentList({
31
- referenceName: 'posts',
32
- languageCode: languageCode,
33
- depth: 2,
34
- take: 1,
35
- skip: 1,
36
- expandAllContentLinks: true
37
- })
38
-
39
- assert.isAtLeast(contentList.totalCount, 1, 'retrieved the totalCount of the content list we asked for')
40
- assert.exists(contentList.items, 'retrieved the items of the content list we asked for')
41
- assert.exists(contentList.items[0].fields, 'retrieved the item of the content list we asked for')
42
- assert.strictEqual(contentList.items.length, 1, 'retrieved only the item of the content list we asked for')
43
-
44
- })
45
-
46
-
47
- it('should be able to expand a nested list with expandAllContentLinks', async function () {
48
- var syncClient = createSyncClient();
49
-
50
- const contentList = await syncClient.store.getContentList({
51
- referenceName: 'listwithnestedcontentlink',
52
- languageCode: languageCode,
53
- depth: 10,
54
- take: 50,
55
- skip: 0,
56
- expandAllContentLinks: true
57
- })
58
-
59
- assert.isAtLeast(contentList.totalCount, 1, 'retrieved the totalCount of the content list we asked for')
60
- assert.exists(contentList.items, 'retrieved the items of the content list we asked for')
61
- assert.exists(contentList.items[0].fields, 'retrieved the item of the content list we asked for')
62
- assert.isAtLeast(contentList.items[0].fields.posts.length, 1, 'expanded the linked cotnent of the posts field')
63
-
64
-
65
- })
66
- });
67
-
1
+ import chai from 'chai'
2
+ const assert = chai.assert;
3
+ const expect = chai.expect;
4
+
5
+ import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
+
7
+ /*
8
+ This file contains static references to content from the instance configured in the apiClient.config file.
9
+ */
10
+
11
+ const languageCode = 'en-us'
12
+
13
+ describe('store.getContentList:', async function() {
14
+
15
+ it('should be able to retrieve a list from the store', async function() {
16
+ var syncClient = createSyncClient();
17
+
18
+ const contentList = await syncClient.store.getContentList({
19
+ referenceName: 'posts',
20
+ languageCode: languageCode
21
+ })
22
+
23
+ assert.strictEqual(contentList[0].properties.referenceName, "posts", 'retrieved the content list we asked for')
24
+ })
25
+
26
+
27
+ it('should be able to expand and page a list from the store', async function() {
28
+ var syncClient = createSyncClient();
29
+
30
+ const contentList = await syncClient.store.getContentList({
31
+ referenceName: 'posts',
32
+ languageCode: languageCode,
33
+ depth: 2,
34
+ take: 1,
35
+ skip: 1,
36
+ expandAllContentLinks: true
37
+ })
38
+
39
+ assert.isAtLeast(contentList.totalCount, 1, 'retrieved the totalCount of the content list we asked for')
40
+ assert.exists(contentList.items, 'retrieved the items of the content list we asked for')
41
+ assert.exists(contentList.items[0].fields, 'retrieved the item of the content list we asked for')
42
+ assert.strictEqual(contentList.items.length, 1, 'retrieved only the item of the content list we asked for')
43
+
44
+ })
45
+
46
+
47
+ it('should be able to expand a nested list with expandAllContentLinks', async function () {
48
+ var syncClient = createSyncClient();
49
+
50
+ const contentList = await syncClient.store.getContentList({
51
+ referenceName: 'listwithnestedcontentlink',
52
+ languageCode: languageCode,
53
+ depth: 10,
54
+ take: 50,
55
+ skip: 0,
56
+ expandAllContentLinks: true
57
+ })
58
+
59
+ assert.isAtLeast(contentList.totalCount, 1, 'retrieved the totalCount of the content list we asked for')
60
+ assert.exists(contentList.items, 'retrieved the items of the content list we asked for')
61
+ assert.exists(contentList.items[0].fields, 'retrieved the item of the content list we asked for')
62
+ assert.isAtLeast(contentList.items[0].fields.posts.length, 1, 'expanded the linked cotnent of the posts field')
63
+
64
+
65
+ })
66
+ });
67
+
@@ -1,25 +1,25 @@
1
- import chai from 'chai'
2
- const assert = chai.assert;
3
- const expect = chai.expect;
4
-
5
- import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
-
7
- /*
8
- This file contains static references to content from the instance configured in the apiClient.config file.
9
- */
10
-
11
- const languageCode = 'en-us'
12
-
13
- describe('store.getPage:', async function() {
14
-
15
- it('should be able to retrieve a page from the store', async function() {
16
- var syncClient = createSyncClient();
17
-
18
- const page = await syncClient.store.getPage({
19
- pageID: 2,
20
- languageCode: languageCode
21
- })
22
- assert.strictEqual(page.pageID, 2, 'retrieved the page we asked for')
23
- })
24
- });
25
-
1
+ import chai from 'chai'
2
+ const assert = chai.assert;
3
+ const expect = chai.expect;
4
+
5
+ import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
+
7
+ /*
8
+ This file contains static references to content from the instance configured in the apiClient.config file.
9
+ */
10
+
11
+ const languageCode = 'en-us'
12
+
13
+ describe('store.getPage:', async function() {
14
+
15
+ it('should be able to retrieve a page from the store', async function() {
16
+ var syncClient = createSyncClient();
17
+
18
+ const page = await syncClient.store.getPage({
19
+ pageID: 2,
20
+ languageCode: languageCode
21
+ })
22
+ assert.strictEqual(page.pageID, 2, 'retrieved the page we asked for')
23
+ })
24
+ });
25
+
@@ -1,26 +1,26 @@
1
- import chai from 'chai'
2
- const assert = chai.assert;
3
- const expect = chai.expect;
4
-
5
- import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
-
7
- /*
8
- This file contains static references to content from the instance configured in the apiClient.config file.
9
- */
10
-
11
- const languageCode = 'en-us'
12
-
13
- describe('store.getUrlRedirections:', async function() {
14
-
15
- it('should be able to retrieve the redirections from the store', async function() {
16
- var syncClient = createSyncClient();
17
-
18
- const redirections = await syncClient.store.getUrlRedirections({
19
- languageCode: languageCode
20
- })
21
-
22
- assert.isArray(redirections.items, 'items should be an array.')
23
- assert.isBoolean(redirections.isUpToDate, 'isUpToDate should be a boolean.')
24
- })
25
- });
26
-
1
+ import chai from 'chai'
2
+ const assert = chai.assert;
3
+ const expect = chai.expect;
4
+
5
+ import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
+
7
+ /*
8
+ This file contains static references to content from the instance configured in the apiClient.config file.
9
+ */
10
+
11
+ const languageCode = 'en-us'
12
+
13
+ describe('store.getUrlRedirections:', async function() {
14
+
15
+ it('should be able to retrieve the redirections from the store', async function() {
16
+ var syncClient = createSyncClient();
17
+
18
+ const redirections = await syncClient.store.getUrlRedirections({
19
+ languageCode: languageCode
20
+ })
21
+
22
+ assert.isArray(redirections.items, 'items should be an array.')
23
+ assert.isBoolean(redirections.isUpToDate, 'isUpToDate should be a boolean.')
24
+ })
25
+ });
26
+
@@ -1,29 +1,29 @@
1
- import chai from 'chai'
2
- const assert = chai.assert;
3
- const expect = chai.expect;
4
-
5
- import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
-
7
- /*
8
- This file contains static references to content from the instance configured in the apiClient.config file.
9
- */
10
-
11
-
12
- const languageCode = 'en-us'
13
- describe('clearSync:', async function() {
14
-
15
- it('should run the clear sync method which should remove local files', async function() {
16
- var sync = createSyncClient();
17
-
18
- await sync.clearSync();
19
-
20
- //test items are no longer there
21
- const contentItem = await sync.store.getContentItem({
22
- contentID: 21,
23
- languageCode: languageCode
24
- })
25
- assert.strictEqual(contentItem, null, 'item that should be there is no longer there')
26
- })
27
-
28
- });
29
-
1
+ import chai from 'chai'
2
+ const assert = chai.assert;
3
+ const expect = chai.expect;
4
+
5
+ import { createSyncClient, createPreviewSyncClient } from './_syncClients.config'
6
+
7
+ /*
8
+ This file contains static references to content from the instance configured in the apiClient.config file.
9
+ */
10
+
11
+
12
+ const languageCode = 'en-us'
13
+ describe('clearSync:', async function() {
14
+
15
+ it('should run the clear sync method which should remove local files', async function() {
16
+ var sync = createSyncClient();
17
+
18
+ await sync.clearSync();
19
+
20
+ //test items are no longer there
21
+ const contentItem = await sync.store.getContentItem({
22
+ contentID: 21,
23
+ languageCode: languageCode
24
+ })
25
+ assert.strictEqual(contentItem, null, 'item that should be there is no longer there')
26
+ })
27
+
28
+ });
29
+
@@ -1,58 +1,58 @@
1
- //import agilitySync from '../dist/agility-sync-sdk.node'
2
- import agilitySync from '../src/sync-client'
3
-
4
- import storeInterfaceConsole from '../src/store-interface-console'
5
-
6
- // Agility Instance = 'Headless Integration Testing' [Dev]
7
- const guid = 'c741222b-1080-45f6-9a7f-982381c5a485';
8
- const apiKeyFetch = 'UnitTestsFetch.2ace650991363fbcffa6776d411d1b0d616b8e3424ce842b81cba7af0039197e';
9
- const apiKeyPreview = 'UnitTestsPreview.69e6bca345ced0b7ca5ab358b351ea5c870790a5945c25d749a865332906b124';
10
-
11
-
12
- function createSyncClient() {
13
- var syncClient = agilitySync.getSyncClient({
14
- guid: guid,
15
- apiKey: apiKeyFetch,
16
- isPreview: false,
17
- channels: [ 'website'],
18
- languages: ['en-us'],
19
- baseUrl: "https://api-dev.aglty.io"
20
- });
21
-
22
- return syncClient;
23
- }
24
-
25
- function createSyncClientUsingConsoleStore() {
26
- var syncClient = agilitySync.getSyncClient({
27
- guid: guid,
28
- apiKey: apiKeyFetch,
29
- isPreview: false,
30
- channels: [ 'website'],
31
- languages: ['en-us'],
32
- store: {
33
- interface: storeInterfaceConsole,
34
- options: {}
35
- },
36
- baseUrl: "https://api-dev.aglty.io"
37
- });
38
- return syncClient;
39
- }
40
-
41
-
42
- function createPreviewSyncClient() {
43
- var syncClient = agilitySync.getSyncClient({
44
- guid: guid,
45
- apiKey: apiKeyPreview,
46
- isPreview: true,
47
- channels: [ 'website'],
48
- languages: ['en-us'],
49
- baseUrl: "https://api-dev.aglty.io"
50
- });
51
- return syncClient;
52
- }
53
-
54
- export {
55
- createSyncClient,
56
- createSyncClientUsingConsoleStore,
57
- createPreviewSyncClient
1
+ //import agilitySync from '../dist/agility-sync-sdk.node'
2
+ import agilitySync from '../src/sync-client'
3
+
4
+ import storeInterfaceConsole from '../src/store-interface-console'
5
+
6
+ // Agility Instance = 'Headless Integration Testing' [Dev]
7
+ const guid = 'c741222b-1080-45f6-9a7f-982381c5a485';
8
+ const apiKeyFetch = 'UnitTestsFetch.2ace650991363fbcffa6776d411d1b0d616b8e3424ce842b81cba7af0039197e';
9
+ const apiKeyPreview = 'UnitTestsPreview.69e6bca345ced0b7ca5ab358b351ea5c870790a5945c25d749a865332906b124';
10
+
11
+
12
+ function createSyncClient() {
13
+ var syncClient = agilitySync.getSyncClient({
14
+ guid: guid,
15
+ apiKey: apiKeyFetch,
16
+ isPreview: false,
17
+ channels: [ 'website'],
18
+ languages: ['en-us'],
19
+ baseUrl: "https://api-dev.aglty.io"
20
+ });
21
+
22
+ return syncClient;
23
+ }
24
+
25
+ function createSyncClientUsingConsoleStore() {
26
+ var syncClient = agilitySync.getSyncClient({
27
+ guid: guid,
28
+ apiKey: apiKeyFetch,
29
+ isPreview: false,
30
+ channels: [ 'website'],
31
+ languages: ['en-us'],
32
+ store: {
33
+ interface: storeInterfaceConsole,
34
+ options: {}
35
+ },
36
+ baseUrl: "https://api-dev.aglty.io"
37
+ });
38
+ return syncClient;
39
+ }
40
+
41
+
42
+ function createPreviewSyncClient() {
43
+ var syncClient = agilitySync.getSyncClient({
44
+ guid: guid,
45
+ apiKey: apiKeyPreview,
46
+ isPreview: true,
47
+ channels: [ 'website'],
48
+ languages: ['en-us'],
49
+ baseUrl: "https://api-dev.aglty.io"
50
+ });
51
+ return syncClient;
52
+ }
53
+
54
+ export {
55
+ createSyncClient,
56
+ createSyncClientUsingConsoleStore,
57
+ createPreviewSyncClient
58
58
  }
package/webpack.config.js CHANGED
@@ -1,33 +1,33 @@
1
- const path = require('path');
2
-
3
-
4
- const nodeConfig = {
5
- target: 'node',
6
- entry: './src/sync-client.js',
7
- output: {
8
- filename: 'agility-sync-sdk.node.js',
9
- path: path.resolve(__dirname, 'dist'),
10
- library: 'agilitySync',
11
- libraryTarget: 'umd',
12
- libraryExport: 'default',
13
- umdNamedDefine: true,
14
- globalObject: 'typeof self !== \'undefined\' ? self : this'
15
- },
16
- optimization: {
17
- minimize: false
18
- },
19
- module: {
20
- rules : [
21
- // JavaScript
22
- {
23
- test: /\.js$/,
24
- exclude: /node_modules/,
25
- use: ['babel-loader'],
26
- }
27
- ]
28
- },
29
- // Plugins
30
- plugins: []
31
- }
32
-
1
+ const path = require('path');
2
+
3
+
4
+ const nodeConfig = {
5
+ target: 'node',
6
+ entry: './src/sync-client.js',
7
+ output: {
8
+ filename: 'agility-sync-sdk.node.js',
9
+ path: path.resolve(__dirname, 'dist'),
10
+ library: 'agilitySync',
11
+ libraryTarget: 'umd',
12
+ libraryExport: 'default',
13
+ umdNamedDefine: true,
14
+ globalObject: 'typeof self !== \'undefined\' ? self : this'
15
+ },
16
+ optimization: {
17
+ minimize: false
18
+ },
19
+ module: {
20
+ rules : [
21
+ // JavaScript
22
+ {
23
+ test: /\.js$/,
24
+ exclude: /node_modules/,
25
+ use: ['babel-loader'],
26
+ }
27
+ ]
28
+ },
29
+ // Plugins
30
+ plugins: []
31
+ }
32
+
33
33
  module.exports = nodeConfig