@constructor-io/constructorio-node 4.15.0 → 4.16.0
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/LICENSE +1 -1
- package/package.json +2 -2
- package/src/constructorio.js +17 -6
- package/src/modules/catalog.js +3 -2
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-node",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.0",
|
|
4
4
|
"description": "Constructor.io Node.js client",
|
|
5
5
|
"main": "src/constructorio.js",
|
|
6
6
|
"types": "src/types/constructorio.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "git+https://github.com/Constructor-io/constructorio-node.git"
|
|
24
24
|
},
|
|
25
|
-
"author": "
|
|
25
|
+
"author": "Constructor.io Corporation",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"bugs": {
|
|
28
28
|
"url": "https://github.com/Constructor-io/constructorio-node/issues"
|
package/src/constructorio.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
|
+
/* eslint-disable global-require */
|
|
1
2
|
/* eslint-disable camelcase, no-unneeded-ternary, max-len */
|
|
2
|
-
const nodeFetch = require('./nodeFetch');
|
|
3
3
|
|
|
4
4
|
// Modules
|
|
5
5
|
const Search = require('./modules/search');
|
|
6
6
|
const Browse = require('./modules/browse');
|
|
7
7
|
const Autocomplete = require('./modules/autocomplete');
|
|
8
8
|
const Recommendations = require('./modules/recommendations');
|
|
9
|
-
const Tracker = require('./modules/tracker');
|
|
10
|
-
const Catalog = require('./modules/catalog');
|
|
11
9
|
const Tasks = require('./modules/tasks');
|
|
12
10
|
const Quizzes = require('./modules/quizzes');
|
|
13
11
|
const { version: packageVersion } = require('../package.json');
|
|
14
12
|
const utils = require('./utils/helpers');
|
|
15
13
|
|
|
14
|
+
let nodeFetch;
|
|
15
|
+
let Catalog;
|
|
16
|
+
let Tracker;
|
|
17
|
+
|
|
18
|
+
if (typeof process !== 'undefined' && process.env && process.env.NEXT_RUNTIME !== 'edge') {
|
|
19
|
+
nodeFetch = require('./nodeFetch');
|
|
20
|
+
Catalog = require('./modules/catalog');
|
|
21
|
+
Tracker = require('./modules/tracker');
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
* Class to instantiate the ConstructorIO client.
|
|
18
26
|
*/
|
|
@@ -59,17 +67,20 @@ class ConstructorIO {
|
|
|
59
67
|
securityToken: securityToken || '',
|
|
60
68
|
version: version || global.CLIENT_VERSION || `cio-node-${packageVersion}`,
|
|
61
69
|
serviceUrl: utils.addHTTPSToString(normalizedServiceUrl) || 'https://ac.cnstrc.com',
|
|
62
|
-
fetch: fetch || nodeFetch,
|
|
70
|
+
fetch: fetch || nodeFetch || global.fetch,
|
|
63
71
|
networkParameters: networkParameters || {},
|
|
64
72
|
};
|
|
65
73
|
|
|
74
|
+
if (typeof process !== 'undefined' && process.env && process.env.NEXT_RUNTIME !== 'edge') {
|
|
75
|
+
this.tracker = new Tracker(this.options);
|
|
76
|
+
this.catalog = new Catalog(this.options);
|
|
77
|
+
}
|
|
78
|
+
|
|
66
79
|
// Expose global modules
|
|
67
80
|
this.search = new Search(this.options);
|
|
68
81
|
this.browse = new Browse(this.options);
|
|
69
82
|
this.autocomplete = new Autocomplete(this.options);
|
|
70
83
|
this.recommendations = new Recommendations(this.options);
|
|
71
|
-
this.tracker = new Tracker(this.options);
|
|
72
|
-
this.catalog = new Catalog(this.options);
|
|
73
84
|
this.tasks = new Tasks(this.options);
|
|
74
85
|
this.quizzes = new Quizzes(this.options);
|
|
75
86
|
}
|
package/src/modules/catalog.js
CHANGED
|
@@ -2435,13 +2435,14 @@ class Catalog {
|
|
|
2435
2435
|
*/
|
|
2436
2436
|
async patchCatalogUsingTarArchive(parameters = {}, networkParameters = {}) {
|
|
2437
2437
|
try {
|
|
2438
|
-
const { notification_email, notificationEmail = notification_email } = parameters;
|
|
2438
|
+
const { force, notification_email, notificationEmail = notification_email } = parameters;
|
|
2439
2439
|
const { fetch } = this.options;
|
|
2440
2440
|
const apiKey = this.options && this.options.apiKey;
|
|
2441
2441
|
const controller = new AbortController();
|
|
2442
2442
|
const { signal } = controller;
|
|
2443
2443
|
const { queryParams, formData } = await createQueryParamsAndFormData(parameters);
|
|
2444
|
-
const
|
|
2444
|
+
const operation = force ? 'forcepatchdelta' : 'patchdelta';
|
|
2445
|
+
const formDataWithTarArchive = await addTarArchiveToFormData(parameters, formData, operation, apiKey);
|
|
2445
2446
|
|
|
2446
2447
|
if (notificationEmail) {
|
|
2447
2448
|
queryParams.notification_email = notificationEmail;
|