@agility/content-sync 1.1.6 → 1.1.8
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/agility-sync-sdk.node.js +918 -8211
- package/package.json +6 -4
- package/src/sync-client.js +10 -5
- package/src/util.js +2 -1
- package/test/_syncClients.config.js +5 -4
- package/webpack.config.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agility/content-sync",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "JavaScript SDK for synchronizing content from Agility CMS",
|
|
5
5
|
"main": "dist/agility-sync-sdk.node.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,14 +17,16 @@
|
|
|
17
17
|
"contributors": [
|
|
18
18
|
"Joel Varty",
|
|
19
19
|
"James Vidler",
|
|
20
|
-
"Joshua Isaac"
|
|
20
|
+
"Joshua Isaac",
|
|
21
|
+
"Kevin Tran",
|
|
22
|
+
"Aaron Taylor"
|
|
21
23
|
],
|
|
22
24
|
"bugs": {
|
|
23
25
|
"url": "https://github.com/agility/agility-sync-sdk/issues"
|
|
24
26
|
},
|
|
25
27
|
"homepage": "https://github.com/agility/agility-sync-sdk#readme",
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@agility/content-fetch": "^
|
|
29
|
+
"@agility/content-fetch": "^2.0.8",
|
|
28
30
|
"dotenv": "^8.2.0",
|
|
29
31
|
"proper-lockfile": "^4.1.2"
|
|
30
32
|
},
|
|
@@ -43,4 +45,4 @@
|
|
|
43
45
|
"webpack": "^4.29.6",
|
|
44
46
|
"webpack-cli": "^3.2.3"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
package/src/sync-client.js
CHANGED
|
@@ -7,16 +7,16 @@ import runSync from './methods/runSync'
|
|
|
7
7
|
import storeInterface from './store-interface'
|
|
8
8
|
import storeInterfaceFileSystem from './store-interface-filesystem'
|
|
9
9
|
|
|
10
|
-
function getSyncClient
|
|
10
|
+
function getSyncClient(userConfig) {
|
|
11
11
|
validateConfigParams(userConfig);
|
|
12
12
|
return createSyncClient(userConfig);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function validateConfigParams(configParams) {
|
|
16
16
|
|
|
17
|
-
if(!configParams.guid || configParams.guid.length == 0) {
|
|
17
|
+
if (!configParams.guid || configParams.guid.length == 0) {
|
|
18
18
|
throw new TypeError('You must provide an guid.');
|
|
19
|
-
} else if(!configParams.apiKey || configParams.apiKey.length == 0) {
|
|
19
|
+
} else if (!configParams.apiKey || configParams.apiKey.length == 0) {
|
|
20
20
|
throw new TypeError('You must provide an access token.');
|
|
21
21
|
} else {
|
|
22
22
|
return;
|
|
@@ -24,6 +24,7 @@ function validateConfigParams(configParams) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const defaultConfig = {
|
|
27
|
+
region: null,
|
|
27
28
|
baseUrl: null,
|
|
28
29
|
isPreview: false,
|
|
29
30
|
guid: null,
|
|
@@ -31,6 +32,7 @@ const defaultConfig = {
|
|
|
31
32
|
languages: [],
|
|
32
33
|
channels: [],
|
|
33
34
|
debug: false,
|
|
35
|
+
logLevel: 'warning',
|
|
34
36
|
store: {
|
|
35
37
|
interface: storeInterfaceFileSystem,
|
|
36
38
|
options: {
|
|
@@ -46,12 +48,15 @@ function createSyncClient(userConfig) {
|
|
|
46
48
|
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
process.env.AGILITY_LOG_LEVEL = config.logLevel;
|
|
52
|
+
|
|
49
53
|
const agilityClient = agility.getApi({
|
|
50
54
|
guid: config.guid,
|
|
51
55
|
apiKey: config.apiKey,
|
|
52
56
|
isPreview: config.isPreview,
|
|
53
57
|
debug: config.debug,
|
|
54
|
-
baseUrl: config.baseUrl
|
|
58
|
+
baseUrl: config.baseUrl,
|
|
59
|
+
region: config.region
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
|
|
@@ -72,4 +77,4 @@ function createSyncClient(userConfig) {
|
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
export default { getSyncClient }
|
|
80
|
+
export default { getSyncClient }
|
package/src/util.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
const asyncForEach = async (array, callback) => {
|
|
2
3
|
for (let index = 0; index < array.length; index++) {
|
|
3
4
|
await callback(array[index], index, array);
|
|
@@ -8,7 +9,7 @@ const asyncForEach = async (array, callback) => {
|
|
|
8
9
|
const getLogLevel = () => {
|
|
9
10
|
const logLevel = (process.env.AGILITY_LOG_LEVEL || 'warning').toLowerCase();
|
|
10
11
|
|
|
11
|
-
if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error') {
|
|
12
|
+
if (logLevel !== 'debug' && logLevel !== 'info' && logLevel !== 'warning' && logLevel !== 'error' && logLevel !== 'none') {
|
|
12
13
|
return 'warning';
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -14,10 +14,11 @@ function createSyncClient() {
|
|
|
14
14
|
guid: guid,
|
|
15
15
|
apiKey: apiKeyFetch,
|
|
16
16
|
isPreview: false,
|
|
17
|
-
|
|
17
|
+
logLevel: 'info',
|
|
18
|
+
channels: ['website'],
|
|
18
19
|
languages: ['en-us'],
|
|
19
20
|
baseUrl: "https://api-dev.aglty.io"
|
|
20
|
-
|
|
21
|
+
});
|
|
21
22
|
|
|
22
23
|
return syncClient;
|
|
23
24
|
}
|
|
@@ -27,7 +28,7 @@ function createSyncClientUsingConsoleStore() {
|
|
|
27
28
|
guid: guid,
|
|
28
29
|
apiKey: apiKeyFetch,
|
|
29
30
|
isPreview: false,
|
|
30
|
-
channels: [
|
|
31
|
+
channels: ['website'],
|
|
31
32
|
languages: ['en-us'],
|
|
32
33
|
store: {
|
|
33
34
|
interface: storeInterfaceConsole,
|
|
@@ -44,7 +45,7 @@ function createPreviewSyncClient() {
|
|
|
44
45
|
guid: guid,
|
|
45
46
|
apiKey: apiKeyPreview,
|
|
46
47
|
isPreview: true,
|
|
47
|
-
channels: [
|
|
48
|
+
channels: ['website'],
|
|
48
49
|
languages: ['en-us'],
|
|
49
50
|
baseUrl: "https://api-dev.aglty.io"
|
|
50
51
|
});
|
package/webpack.config.js
CHANGED
|
@@ -23,6 +23,17 @@ const nodeConfig = {
|
|
|
23
23
|
test: /\.js$/,
|
|
24
24
|
exclude: /node_modules/,
|
|
25
25
|
use: ['babel-loader'],
|
|
26
|
+
},
|
|
27
|
+
// JavaScript
|
|
28
|
+
{
|
|
29
|
+
test: /\.js$/,
|
|
30
|
+
exclude: /node_modules\/(?!@agility\/content-fetch)/, // Transpile @agility/content-fetch
|
|
31
|
+
use: {
|
|
32
|
+
loader: 'babel-loader',
|
|
33
|
+
options: {
|
|
34
|
+
presets: ['@babel/preset-env'], // Ensure compatibility with modern syntax
|
|
35
|
+
}
|
|
36
|
+
}
|
|
26
37
|
}
|
|
27
38
|
]
|
|
28
39
|
},
|