backendless 7.3.0 → 7.3.2

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.
@@ -133,7 +133,8 @@ var Automations = /*#__PURE__*/function () {
133
133
  }, {
134
134
  key: "activateFlowTriggerById",
135
135
  value: function () {
136
- var _activateFlowTriggerById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(flowId, triggerId, data) {
136
+ var _activateFlowTriggerById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(flowId, triggerId, data, executionId) {
137
+ var query;
137
138
  return _regenerator["default"].wrap(function _callee4$(_context4) {
138
139
  while (1) switch (_context4.prev = _context4.next) {
139
140
  case 0:
@@ -155,17 +156,28 @@ var Automations = /*#__PURE__*/function () {
155
156
  }
156
157
  throw new Error('The "data" argument must be an object.');
157
158
  case 6:
159
+ if (!(executionId !== undefined && (typeof executionId !== 'string' || !executionId))) {
160
+ _context4.next = 8;
161
+ break;
162
+ }
163
+ throw new Error('The "executionId" argument must be a non-empty string.');
164
+ case 8:
165
+ query = {};
166
+ if (executionId) {
167
+ query.executionId = executionId;
168
+ }
158
169
  return _context4.abrupt("return", this.app.request.post({
159
170
  url: "".concat(this.app.urls.automationFlow(), "/").concat(flowId, "/trigger/").concat(triggerId, "/activate"),
160
- data: data || {}
171
+ data: data || {},
172
+ query: query
161
173
  }));
162
- case 7:
174
+ case 11:
163
175
  case "end":
164
176
  return _context4.stop();
165
177
  }
166
178
  }, _callee4, this);
167
179
  }));
168
- function activateFlowTriggerById(_x8, _x9, _x10) {
180
+ function activateFlowTriggerById(_x8, _x9, _x10, _x11) {
169
181
  return _activateFlowTriggerById.apply(this, arguments);
170
182
  }
171
183
  return activateFlowTriggerById;
package/es/index.js CHANGED
@@ -21,6 +21,7 @@ var DEFAULT_PROPS = {
21
21
  appId: null,
22
22
  apiKey: null,
23
23
  serverURL: 'https://api.backendless.com',
24
+ automationServerURL: null,
24
25
  domain: null,
25
26
  apiURI: '/api',
26
27
  debugMode: false,
@@ -235,8 +236,18 @@ var Backendless = /*#__PURE__*/function () {
235
236
  get: function get() {
236
237
  return this.__serverURL;
237
238
  },
238
- set: function set(serverURL) {
239
- this.__serverURL = serverURL;
239
+ set: function set(url) {
240
+ this.__serverURL = url;
241
+ }
242
+
243
+ ///--------automationServerURL-------///
244
+ }, {
245
+ key: "automationServerURL",
246
+ get: function get() {
247
+ return this.__automationServerURL;
248
+ },
249
+ set: function set(url) {
250
+ this.__automationServerURL = url;
240
251
  }
241
252
 
242
253
  ///--------domain-------///
@@ -271,6 +282,17 @@ var Backendless = /*#__PURE__*/function () {
271
282
  set: function set(appPath) {
272
283
  throw new Error("Setting '".concat(appPath, "' value to Backendless.appPath directly is not possible, ") + 'instead you must use Backendless.initApp(APP_ID, API_KEY) for setup the value');
273
284
  }
285
+ }, {
286
+ key: "automationPath",
287
+ get: function get() {
288
+ if (!this.automationServerURL) {
289
+ return this.appPath;
290
+ }
291
+ return [this.automationServerURL, this.appId, this.apiKey].join('/');
292
+ },
293
+ set: function set(automationPath) {
294
+ throw new Error("Setting '".concat(automationPath, "' value to Backendless.automationPath directly is not possible"));
295
+ }
274
296
 
275
297
  ///--------debugMode-------///
276
298
  }, {
package/es/urls.js CHANGED
@@ -22,7 +22,7 @@ var Urls = /*#__PURE__*/function () {
22
22
  }, {
23
23
  key: "automation",
24
24
  value: function automation() {
25
- return "".concat(this.root(), "/automation");
25
+ return "".concat(this.app.automationPath, "/automation");
26
26
  }
27
27
  }, {
28
28
  key: "automationFlow",
@@ -133,7 +133,8 @@ var Automations = /*#__PURE__*/function () {
133
133
  }, {
134
134
  key: "activateFlowTriggerById",
135
135
  value: function () {
136
- var _activateFlowTriggerById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(flowId, triggerId, data) {
136
+ var _activateFlowTriggerById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(flowId, triggerId, data, executionId) {
137
+ var query;
137
138
  return _regenerator["default"].wrap(function _callee4$(_context4) {
138
139
  while (1) switch (_context4.prev = _context4.next) {
139
140
  case 0:
@@ -155,17 +156,28 @@ var Automations = /*#__PURE__*/function () {
155
156
  }
156
157
  throw new Error('The "data" argument must be an object.');
157
158
  case 6:
159
+ if (!(executionId !== undefined && (typeof executionId !== 'string' || !executionId))) {
160
+ _context4.next = 8;
161
+ break;
162
+ }
163
+ throw new Error('The "executionId" argument must be a non-empty string.');
164
+ case 8:
165
+ query = {};
166
+ if (executionId) {
167
+ query.executionId = executionId;
168
+ }
158
169
  return _context4.abrupt("return", this.app.request.post({
159
170
  url: "".concat(this.app.urls.automationFlow(), "/").concat(flowId, "/trigger/").concat(triggerId, "/activate"),
160
- data: data || {}
171
+ data: data || {},
172
+ query: query
161
173
  }));
162
- case 7:
174
+ case 11:
163
175
  case "end":
164
176
  return _context4.stop();
165
177
  }
166
178
  }, _callee4, this);
167
179
  }));
168
- function activateFlowTriggerById(_x8, _x9, _x10) {
180
+ function activateFlowTriggerById(_x8, _x9, _x10, _x11) {
169
181
  return _activateFlowTriggerById.apply(this, arguments);
170
182
  }
171
183
  return activateFlowTriggerById;
package/lib/index.js CHANGED
@@ -21,6 +21,7 @@ var DEFAULT_PROPS = {
21
21
  appId: null,
22
22
  apiKey: null,
23
23
  serverURL: 'https://api.backendless.com',
24
+ automationServerURL: null,
24
25
  domain: null,
25
26
  apiURI: '/api',
26
27
  debugMode: false,
@@ -235,8 +236,18 @@ var Backendless = /*#__PURE__*/function () {
235
236
  get: function get() {
236
237
  return this.__serverURL;
237
238
  },
238
- set: function set(serverURL) {
239
- this.__serverURL = serverURL;
239
+ set: function set(url) {
240
+ this.__serverURL = url;
241
+ }
242
+
243
+ ///--------automationServerURL-------///
244
+ }, {
245
+ key: "automationServerURL",
246
+ get: function get() {
247
+ return this.__automationServerURL;
248
+ },
249
+ set: function set(url) {
250
+ this.__automationServerURL = url;
240
251
  }
241
252
 
242
253
  ///--------domain-------///
@@ -271,6 +282,17 @@ var Backendless = /*#__PURE__*/function () {
271
282
  set: function set(appPath) {
272
283
  throw new Error("Setting '".concat(appPath, "' value to Backendless.appPath directly is not possible, ") + 'instead you must use Backendless.initApp(APP_ID, API_KEY) for setup the value');
273
284
  }
285
+ }, {
286
+ key: "automationPath",
287
+ get: function get() {
288
+ if (!this.automationServerURL) {
289
+ return this.appPath;
290
+ }
291
+ return [this.automationServerURL, this.appId, this.apiKey].join('/');
292
+ },
293
+ set: function set(automationPath) {
294
+ throw new Error("Setting '".concat(automationPath, "' value to Backendless.automationPath directly is not possible"));
295
+ }
274
296
 
275
297
  ///--------debugMode-------///
276
298
  }, {
package/lib/urls.js CHANGED
@@ -22,7 +22,7 @@ var Urls = /*#__PURE__*/function () {
22
22
  }, {
23
23
  key: "automation",
24
24
  value: function automation() {
25
- return "".concat(this.root(), "/automation");
25
+ return "".concat(this.app.automationPath, "/automation");
26
26
  }
27
27
  }, {
28
28
  key: "automationFlow",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backendless",
3
- "version": "7.3.0",
3
+ "version": "7.3.2",
4
4
  "description": "Backendless JavaScript SDK for Node.js and the browser",
5
5
  "browser": "dist/backendless.js",
6
6
  "main": "lib/index.js",
@@ -58,7 +58,7 @@ export default class Automations {
58
58
  })
59
59
  }
60
60
 
61
- async activateFlowTriggerById(flowId, triggerId, data) {
61
+ async activateFlowTriggerById(flowId, triggerId, data, executionId) {
62
62
  if (!flowId || typeof flowId !== 'string') {
63
63
  throw new Error('The "flowId" argument must be provided and must be a string.')
64
64
  }
@@ -71,9 +71,20 @@ export default class Automations {
71
71
  throw new Error('The "data" argument must be an object.')
72
72
  }
73
73
 
74
+ if (executionId !== undefined && (typeof executionId !== 'string' || !executionId)) {
75
+ throw new Error('The "executionId" argument must be a non-empty string.')
76
+ }
77
+
78
+ const query = {}
79
+
80
+ if (executionId) {
81
+ query.executionId = executionId
82
+ }
83
+
74
84
  return this.app.request.post({
75
- url : `${this.app.urls.automationFlow()}/${flowId}/trigger/${triggerId}/activate`,
76
- data: data || {},
85
+ url : `${this.app.urls.automationFlow()}/${flowId}/trigger/${triggerId}/activate`,
86
+ data : data || {},
87
+ query: query,
77
88
  })
78
89
  }
79
90
  }
package/src/index.js CHANGED
@@ -6,14 +6,15 @@ import Utils from './utils'
6
6
  import Expression from './expression'
7
7
 
8
8
  const DEFAULT_PROPS = {
9
- appId : null,
10
- apiKey : null,
11
- serverURL : 'https://api.backendless.com',
12
- domain : null,
13
- apiURI : '/api',
14
- debugMode : false,
15
- standalone : false,
16
- XMLHttpRequest: typeof XMLHttpRequest !== 'undefined'
9
+ appId : null,
10
+ apiKey : null,
11
+ serverURL : 'https://api.backendless.com',
12
+ automationServerURL: null,
13
+ domain : null,
14
+ apiURI : '/api',
15
+ debugMode : false,
16
+ standalone : false,
17
+ XMLHttpRequest : typeof XMLHttpRequest !== 'undefined'
17
18
  ? XMLHttpRequest
18
19
  : undefined,
19
20
  }
@@ -226,8 +227,17 @@ class Backendless {
226
227
  return this.__serverURL
227
228
  }
228
229
 
229
- set serverURL(serverURL) {
230
- this.__serverURL = serverURL
230
+ set serverURL(url) {
231
+ this.__serverURL = url
232
+ }
233
+
234
+ ///--------automationServerURL-------///
235
+ get automationServerURL() {
236
+ return this.__automationServerURL
237
+ }
238
+
239
+ set automationServerURL(url) {
240
+ this.__automationServerURL = url
231
241
  }
232
242
 
233
243
  ///--------domain-------///
@@ -264,6 +274,20 @@ class Backendless {
264
274
  )
265
275
  }
266
276
 
277
+ get automationPath() {
278
+ if (!this.automationServerURL) {
279
+ return this.appPath
280
+ }
281
+
282
+ return [this.automationServerURL, this.appId, this.apiKey].join('/')
283
+ }
284
+
285
+ set automationPath(automationPath) {
286
+ throw new Error(
287
+ `Setting '${automationPath}' value to Backendless.automationPath directly is not possible`
288
+ )
289
+ }
290
+
267
291
  ///--------debugMode-------///
268
292
  get debugMode() {
269
293
  return this.__debugMode
package/src/urls.js CHANGED
@@ -10,7 +10,7 @@ export default class Urls {
10
10
  //automations
11
11
 
12
12
  automation() {
13
- return `${this.root()}/automation`
13
+ return `${this.app.automationPath}/automation`
14
14
  }
15
15
 
16
16
  automationFlow() {