backendless 7.2.0 → 7.2.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.
- package/backendless.d.ts +14 -0
- package/dist/backendless.js +138 -1
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/automations/index.js +102 -0
- package/es/index.js +8 -0
- package/es/urls.js +17 -0
- package/lib/automations/index.js +102 -0
- package/lib/index.js +8 -0
- package/lib/urls.js +17 -0
- package/package.json +1 -1
- package/src/automations/index.js +45 -0
- package/src/index.js +5 -0
- package/src/urls.js +14 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _utils = _interopRequireDefault(require("../utils"));
|
|
13
|
+
var Automations = /*#__PURE__*/function () {
|
|
14
|
+
function Automations(app) {
|
|
15
|
+
(0, _classCallCheck2["default"])(this, Automations);
|
|
16
|
+
this.app = app;
|
|
17
|
+
}
|
|
18
|
+
(0, _createClass2["default"])(Automations, [{
|
|
19
|
+
key: "activateFlow",
|
|
20
|
+
value: function () {
|
|
21
|
+
var _activateFlow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(flowName, initialData) {
|
|
22
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
if (!(!flowName || typeof flowName !== 'string')) {
|
|
26
|
+
_context.next = 2;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
throw new Error('The "flowName" argument must be provided and must be a string.');
|
|
30
|
+
case 2:
|
|
31
|
+
if (!(initialData !== undefined && !_utils["default"].isObject(initialData))) {
|
|
32
|
+
_context.next = 4;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
throw new Error('The "initialData" argument must be an object with an arbitrary structure.');
|
|
36
|
+
case 4:
|
|
37
|
+
return _context.abrupt("return", this.app.request.post({
|
|
38
|
+
url: "".concat(this.app.urls.automationFlow(), "/activate-by-name"),
|
|
39
|
+
data: {
|
|
40
|
+
name: flowName,
|
|
41
|
+
initialData: initialData
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
case 5:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee, this);
|
|
49
|
+
}));
|
|
50
|
+
function activateFlow(_x, _x2) {
|
|
51
|
+
return _activateFlow.apply(this, arguments);
|
|
52
|
+
}
|
|
53
|
+
return activateFlow;
|
|
54
|
+
}()
|
|
55
|
+
}, {
|
|
56
|
+
key: "activateFlowTrigger",
|
|
57
|
+
value: function () {
|
|
58
|
+
var _activateFlowTrigger = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(flowName, triggerName, data) {
|
|
59
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
60
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
if (!(!flowName || typeof flowName !== 'string')) {
|
|
63
|
+
_context2.next = 2;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
throw new Error('The "flowName" argument must be provided and must be a string.');
|
|
67
|
+
case 2:
|
|
68
|
+
if (!(!triggerName || typeof triggerName !== 'string')) {
|
|
69
|
+
_context2.next = 4;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
throw new Error('The "triggerName" argument must be provided and must be a string.');
|
|
73
|
+
case 4:
|
|
74
|
+
if (!(data !== undefined && !_utils["default"].isObject(data))) {
|
|
75
|
+
_context2.next = 6;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
throw new Error('The "data" argument must be an object with an arbitrary structure.');
|
|
79
|
+
case 6:
|
|
80
|
+
return _context2.abrupt("return", this.app.request.post({
|
|
81
|
+
url: "".concat(this.app.urls.automationFlowTrigger(), "/activate-by-name"),
|
|
82
|
+
query: {
|
|
83
|
+
flowName: flowName,
|
|
84
|
+
triggerName: triggerName
|
|
85
|
+
},
|
|
86
|
+
data: data || {}
|
|
87
|
+
}));
|
|
88
|
+
case 7:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context2.stop();
|
|
91
|
+
}
|
|
92
|
+
}, _callee2, this);
|
|
93
|
+
}));
|
|
94
|
+
function activateFlowTrigger(_x3, _x4, _x5) {
|
|
95
|
+
return _activateFlowTrigger.apply(this, arguments);
|
|
96
|
+
}
|
|
97
|
+
return activateFlowTrigger;
|
|
98
|
+
}()
|
|
99
|
+
}]);
|
|
100
|
+
return Automations;
|
|
101
|
+
}();
|
|
102
|
+
exports["default"] = Automations;
|
package/es/index.js
CHANGED
|
@@ -113,6 +113,9 @@ var SERVICES = {
|
|
|
113
113
|
},
|
|
114
114
|
'Management': function Management() {
|
|
115
115
|
return require('./management')["default"];
|
|
116
|
+
},
|
|
117
|
+
'Automations': function Automations() {
|
|
118
|
+
return require('./automations')["default"];
|
|
116
119
|
}
|
|
117
120
|
};
|
|
118
121
|
var Backendless = /*#__PURE__*/function () {
|
|
@@ -454,6 +457,11 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
454
457
|
get: function get() {
|
|
455
458
|
return this.__getService('Management');
|
|
456
459
|
}
|
|
460
|
+
}, {
|
|
461
|
+
key: "Automations",
|
|
462
|
+
get: function get() {
|
|
463
|
+
return this.__getService('Automations');
|
|
464
|
+
}
|
|
457
465
|
|
|
458
466
|
///-------------- SERVICES -------------///
|
|
459
467
|
///-------------------------------------///
|
package/es/urls.js
CHANGED
|
@@ -18,6 +18,23 @@ var Urls = /*#__PURE__*/function () {
|
|
|
18
18
|
return this.app.appPath;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
//automations
|
|
22
|
+
}, {
|
|
23
|
+
key: "automation",
|
|
24
|
+
value: function automation() {
|
|
25
|
+
return "".concat(this.root(), "/automation");
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "automationFlow",
|
|
29
|
+
value: function automationFlow() {
|
|
30
|
+
return "".concat(this.automation(), "/flow");
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "automationFlowTrigger",
|
|
34
|
+
value: function automationFlowTrigger() {
|
|
35
|
+
return "".concat(this.automationFlow(), "/trigger");
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
//bl
|
|
22
39
|
}, {
|
|
23
40
|
key: "blServices",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _utils = _interopRequireDefault(require("../utils"));
|
|
13
|
+
var Automations = /*#__PURE__*/function () {
|
|
14
|
+
function Automations(app) {
|
|
15
|
+
(0, _classCallCheck2["default"])(this, Automations);
|
|
16
|
+
this.app = app;
|
|
17
|
+
}
|
|
18
|
+
(0, _createClass2["default"])(Automations, [{
|
|
19
|
+
key: "activateFlow",
|
|
20
|
+
value: function () {
|
|
21
|
+
var _activateFlow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(flowName, initialData) {
|
|
22
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
if (!(!flowName || typeof flowName !== 'string')) {
|
|
26
|
+
_context.next = 2;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
throw new Error('The "flowName" argument must be provided and must be a string.');
|
|
30
|
+
case 2:
|
|
31
|
+
if (!(initialData !== undefined && !_utils["default"].isObject(initialData))) {
|
|
32
|
+
_context.next = 4;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
throw new Error('The "initialData" argument must be an object with an arbitrary structure.');
|
|
36
|
+
case 4:
|
|
37
|
+
return _context.abrupt("return", this.app.request.post({
|
|
38
|
+
url: "".concat(this.app.urls.automationFlow(), "/activate-by-name"),
|
|
39
|
+
data: {
|
|
40
|
+
name: flowName,
|
|
41
|
+
initialData: initialData
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
case 5:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee, this);
|
|
49
|
+
}));
|
|
50
|
+
function activateFlow(_x, _x2) {
|
|
51
|
+
return _activateFlow.apply(this, arguments);
|
|
52
|
+
}
|
|
53
|
+
return activateFlow;
|
|
54
|
+
}()
|
|
55
|
+
}, {
|
|
56
|
+
key: "activateFlowTrigger",
|
|
57
|
+
value: function () {
|
|
58
|
+
var _activateFlowTrigger = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(flowName, triggerName, data) {
|
|
59
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
60
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
if (!(!flowName || typeof flowName !== 'string')) {
|
|
63
|
+
_context2.next = 2;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
throw new Error('The "flowName" argument must be provided and must be a string.');
|
|
67
|
+
case 2:
|
|
68
|
+
if (!(!triggerName || typeof triggerName !== 'string')) {
|
|
69
|
+
_context2.next = 4;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
throw new Error('The "triggerName" argument must be provided and must be a string.');
|
|
73
|
+
case 4:
|
|
74
|
+
if (!(data !== undefined && !_utils["default"].isObject(data))) {
|
|
75
|
+
_context2.next = 6;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
throw new Error('The "data" argument must be an object with an arbitrary structure.');
|
|
79
|
+
case 6:
|
|
80
|
+
return _context2.abrupt("return", this.app.request.post({
|
|
81
|
+
url: "".concat(this.app.urls.automationFlowTrigger(), "/activate-by-name"),
|
|
82
|
+
query: {
|
|
83
|
+
flowName: flowName,
|
|
84
|
+
triggerName: triggerName
|
|
85
|
+
},
|
|
86
|
+
data: data || {}
|
|
87
|
+
}));
|
|
88
|
+
case 7:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context2.stop();
|
|
91
|
+
}
|
|
92
|
+
}, _callee2, this);
|
|
93
|
+
}));
|
|
94
|
+
function activateFlowTrigger(_x3, _x4, _x5) {
|
|
95
|
+
return _activateFlowTrigger.apply(this, arguments);
|
|
96
|
+
}
|
|
97
|
+
return activateFlowTrigger;
|
|
98
|
+
}()
|
|
99
|
+
}]);
|
|
100
|
+
return Automations;
|
|
101
|
+
}();
|
|
102
|
+
exports["default"] = Automations;
|
package/lib/index.js
CHANGED
|
@@ -113,6 +113,9 @@ var SERVICES = {
|
|
|
113
113
|
},
|
|
114
114
|
'Management': function Management() {
|
|
115
115
|
return require('./management')["default"];
|
|
116
|
+
},
|
|
117
|
+
'Automations': function Automations() {
|
|
118
|
+
return require('./automations')["default"];
|
|
116
119
|
}
|
|
117
120
|
};
|
|
118
121
|
var Backendless = /*#__PURE__*/function () {
|
|
@@ -454,6 +457,11 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
454
457
|
get: function get() {
|
|
455
458
|
return this.__getService('Management');
|
|
456
459
|
}
|
|
460
|
+
}, {
|
|
461
|
+
key: "Automations",
|
|
462
|
+
get: function get() {
|
|
463
|
+
return this.__getService('Automations');
|
|
464
|
+
}
|
|
457
465
|
|
|
458
466
|
///-------------- SERVICES -------------///
|
|
459
467
|
///-------------------------------------///
|
package/lib/urls.js
CHANGED
|
@@ -18,6 +18,23 @@ var Urls = /*#__PURE__*/function () {
|
|
|
18
18
|
return this.app.appPath;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
//automations
|
|
22
|
+
}, {
|
|
23
|
+
key: "automation",
|
|
24
|
+
value: function automation() {
|
|
25
|
+
return "".concat(this.root(), "/automation");
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "automationFlow",
|
|
29
|
+
value: function automationFlow() {
|
|
30
|
+
return "".concat(this.automation(), "/flow");
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "automationFlowTrigger",
|
|
34
|
+
value: function automationFlowTrigger() {
|
|
35
|
+
return "".concat(this.automationFlow(), "/trigger");
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
//bl
|
|
22
39
|
}, {
|
|
23
40
|
key: "blServices",
|
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Utils from '../utils'
|
|
2
|
+
|
|
3
|
+
export default class Automations {
|
|
4
|
+
constructor(app) {
|
|
5
|
+
this.app = app
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async activateFlow(flowName, initialData) {
|
|
9
|
+
if (!flowName || typeof flowName !== 'string') {
|
|
10
|
+
throw new Error('The "flowName" argument must be provided and must be a string.')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (initialData !== undefined && !Utils.isObject(initialData)) {
|
|
14
|
+
throw new Error('The "initialData" argument must be an object with an arbitrary structure.')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return this.app.request.post({
|
|
18
|
+
url : `${this.app.urls.automationFlow()}/activate-by-name`,
|
|
19
|
+
data: {
|
|
20
|
+
name: flowName,
|
|
21
|
+
initialData,
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async activateFlowTrigger(flowName, triggerName, data) {
|
|
27
|
+
if (!flowName || typeof flowName !== 'string') {
|
|
28
|
+
throw new Error('The "flowName" argument must be provided and must be a string.')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!triggerName || typeof triggerName !== 'string') {
|
|
32
|
+
throw new Error('The "triggerName" argument must be provided and must be a string.')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (data !== undefined && !Utils.isObject(data)) {
|
|
36
|
+
throw new Error('The "data" argument must be an object with an arbitrary structure.')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return this.app.request.post({
|
|
40
|
+
url : `${this.app.urls.automationFlowTrigger()}/activate-by-name`,
|
|
41
|
+
query: { flowName, triggerName },
|
|
42
|
+
data : data || {},
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/index.js
CHANGED
|
@@ -84,6 +84,7 @@ const SERVICES = {
|
|
|
84
84
|
'LocalCache' : () => require('./local-cache').default,
|
|
85
85
|
'UnitOfWork' : () => require('./unit-of-work').default,
|
|
86
86
|
'Management' : () => require('./management').default,
|
|
87
|
+
'Automations' : () => require('./automations').default,
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
class Backendless {
|
|
@@ -427,6 +428,10 @@ class Backendless {
|
|
|
427
428
|
return this.__getService('Management')
|
|
428
429
|
}
|
|
429
430
|
|
|
431
|
+
get Automations() {
|
|
432
|
+
return this.__getService('Automations')
|
|
433
|
+
}
|
|
434
|
+
|
|
430
435
|
///-------------- SERVICES -------------///
|
|
431
436
|
///-------------------------------------///
|
|
432
437
|
|
package/src/urls.js
CHANGED
|
@@ -7,6 +7,20 @@ export default class Urls {
|
|
|
7
7
|
return this.app.appPath
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
//automations
|
|
11
|
+
|
|
12
|
+
automation() {
|
|
13
|
+
return `${this.root()}/automation`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
automationFlow() {
|
|
17
|
+
return `${this.automation()}/flow`
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
automationFlowTrigger() {
|
|
21
|
+
return `${this.automationFlow()}/trigger`
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
//bl
|
|
11
25
|
|
|
12
26
|
blServices() {
|