@journeyapps-solutions/cc-util-sync-collective 0.0.11 → 0.0.13
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/lib/index.js +7 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -132,12 +132,13 @@ class SyncCollective {
|
|
|
132
132
|
assert(options.operation, `${NAME} - options.operation not provided`);
|
|
133
133
|
assert(options.objectToSync, `${NAME} - options.objectToSync not provided.`);
|
|
134
134
|
|
|
135
|
-
let
|
|
136
|
-
_object.api_user = _this2.config.endpoint_api_user;
|
|
137
|
-
|
|
138
|
-
let _url = SyncUtilSlave.buildUrl(_object, _this2.config.url, _this2.config.collective);
|
|
135
|
+
let _url = SyncUtilSlave.buildUrl(options.objectToSync, _this2.config.url, _this2.config.collective);
|
|
139
136
|
let _header = SyncUtilSlave.buildHeader(_this2.config.api_user, _this2.config.api_pass);
|
|
140
|
-
let _body = SyncUtilSlave.buildJsonBody(
|
|
137
|
+
let _body = SyncUtilSlave.buildJsonBody(options.objectToSync, _this2.config.collective);
|
|
138
|
+
|
|
139
|
+
//We need to set the api_user
|
|
140
|
+
let _tableName = SyncUtilSlave.buildTableName(options.objectToSync, _this2.config.collective);
|
|
141
|
+
_body[_tableName].api_user = _this2.config.endpoint_api_user;
|
|
141
142
|
|
|
142
143
|
console.log(`${NAME} - Syncing Object [id:${options.objectToSync}]`);
|
|
143
144
|
console.log(`${NAME} - URL - ` + _url);
|
|
@@ -180,7 +181,7 @@ class SyncCollective {
|
|
|
180
181
|
|
|
181
182
|
console.log("Object did not exists, creating object");
|
|
182
183
|
operation = _this3.operations.create;
|
|
183
|
-
_response = yield fetch(
|
|
184
|
+
_response = yield fetch(url, {
|
|
184
185
|
method: operation,
|
|
185
186
|
headers: header,
|
|
186
187
|
body: JSON.stringify(body)
|
package/package.json
CHANGED