@suprsend/node-sdk 1.11.1 → 1.13.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.
Files changed (48) hide show
  1. package/dist/constants.js +2 -8
  2. package/dist/event.js +2 -2
  3. package/dist/events_bulk.js +2 -2
  4. package/dist/index.js +25 -2
  5. package/dist/object_edit.js +352 -0
  6. package/dist/object_edit_internal_helper.js +395 -0
  7. package/dist/objects_api.js +527 -0
  8. package/dist/request_json/workflow.json +7 -29
  9. package/dist/request_json/workflow_trigger.json +7 -29
  10. package/dist/subscriber.js +12 -28
  11. package/dist/subscriber_helper.js +40 -363
  12. package/dist/subscriber_list.js +2 -2
  13. package/dist/user_edit.js +412 -0
  14. package/dist/user_edit_internal_helper.js +363 -0
  15. package/dist/users_api.js +535 -0
  16. package/dist/users_edit_bulk.js +312 -0
  17. package/dist/workflow.js +2 -2
  18. package/dist/workflow_request.js +2 -2
  19. package/dist/workflow_trigger_bulk.js +2 -2
  20. package/dist/workflows_bulk.js +2 -2
  21. package/package.json +1 -1
  22. package/src/constants.js +0 -4
  23. package/src/event.js +4 -5
  24. package/src/events_bulk.js +3 -5
  25. package/src/index.js +9 -1
  26. package/src/object_edit.js +308 -0
  27. package/src/object_edit_internal_helper.js +332 -0
  28. package/src/objects_api.js +320 -0
  29. package/src/request_json/workflow.json +7 -29
  30. package/src/request_json/workflow_trigger.json +7 -29
  31. package/src/subscriber.js +10 -21
  32. package/src/subscriber_helper.js +41 -365
  33. package/src/subscriber_list.js +4 -4
  34. package/src/user_edit.js +360 -0
  35. package/src/user_edit_internal_helper.js +297 -0
  36. package/src/users_api.js +301 -0
  37. package/src/users_edit_bulk.js +211 -0
  38. package/src/workflow.js +4 -5
  39. package/src/workflow_request.js +4 -4
  40. package/src/workflow_trigger_bulk.js +2 -4
  41. package/src/workflows_bulk.js +3 -5
  42. package/types/index.d.ts +168 -13
  43. package/dist/language_codes.js +0 -197
  44. package/dist/object.js +0 -919
  45. package/dist/object_helper.js +0 -659
  46. package/src/language_codes.js +0 -188
  47. package/src/object.js +0 -621
  48. package/src/object_helper.js +0 -593
@@ -0,0 +1,527 @@
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 = require("./utils");
13
+ var _signature = _interopRequireDefault(require("./signature"));
14
+ var _axios = _interopRequireDefault(require("axios"));
15
+ var _object_edit = _interopRequireDefault(require("./object_edit"));
16
+ var ObjectsApi = /*#__PURE__*/function () {
17
+ function ObjectsApi(config) {
18
+ (0, _classCallCheck2["default"])(this, ObjectsApi);
19
+ this.config = config;
20
+ this.list_url = "".concat(this.config.base_url, "v1/object/");
21
+ this.bulk_url = "".concat(this.config.base_url, "v1/bulk/object/");
22
+ }
23
+ (0, _createClass2["default"])(ObjectsApi, [{
24
+ key: "__get_headers",
25
+ value: function __get_headers() {
26
+ return {
27
+ "Content-Type": "application/json; charset=utf-8",
28
+ "User-Agent": this.config.user_agent,
29
+ Date: new Date().toISOString()
30
+ };
31
+ }
32
+ }, {
33
+ key: "_validate_object_type",
34
+ value: function _validate_object_type(object_type) {
35
+ if (!object_type || !(0, _utils.is_string)(object_type) || !object_type.trim()) {
36
+ throw new _utils.InputValueError("missing object_type");
37
+ }
38
+ return object_type.trim();
39
+ }
40
+ }, {
41
+ key: "_validate_object_id",
42
+ value: function _validate_object_id(object_id) {
43
+ if (!object_id || !(0, _utils.is_string)(object_id) || !object_id.trim()) {
44
+ throw new _utils.InputValueError("missing object_id");
45
+ }
46
+ return object_id.trim();
47
+ }
48
+ }, {
49
+ key: "list",
50
+ value: function () {
51
+ var _list = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(object_type, options) {
52
+ var object_type_encoded, encoded_options, url, headers, sig, response;
53
+ return _regenerator["default"].wrap(function _callee$(_context) {
54
+ while (1) {
55
+ switch (_context.prev = _context.next) {
56
+ case 0:
57
+ object_type = this._validate_object_type(object_type);
58
+ object_type_encoded = encodeURIComponent(object_type);
59
+ encoded_options = options ? new URLSearchParams(options).toString() : "";
60
+ url = "".concat(this.list_url).concat(object_type_encoded, "/").concat(encoded_options ? "?".concat(encoded_options) : "");
61
+ headers = this.__get_headers();
62
+ sig = (0, _signature["default"])(url, "GET", "", headers, this.config.workspace_secret);
63
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(sig);
64
+ _context.prev = 7;
65
+ _context.next = 10;
66
+ return _axios["default"].get(url, {
67
+ headers: headers
68
+ });
69
+ case 10:
70
+ response = _context.sent;
71
+ return _context.abrupt("return", response.data);
72
+ case 14:
73
+ _context.prev = 14;
74
+ _context.t0 = _context["catch"](7);
75
+ throw new _utils.SuprsendApiError(_context.t0);
76
+ case 17:
77
+ case "end":
78
+ return _context.stop();
79
+ }
80
+ }
81
+ }, _callee, this, [[7, 14]]);
82
+ }));
83
+ function list(_x, _x2) {
84
+ return _list.apply(this, arguments);
85
+ }
86
+ return list;
87
+ }()
88
+ }, {
89
+ key: "detail_url",
90
+ value: function detail_url(object_type, object_id) {
91
+ object_type = this._validate_object_type(object_type);
92
+ var object_type_encoded = encodeURIComponent(object_type);
93
+ object_id = this._validate_object_id(object_id);
94
+ var object_id_encoded = encodeURIComponent(object_id);
95
+ return "".concat(this.list_url).concat(object_type_encoded, "/").concat(object_id_encoded, "/");
96
+ }
97
+ }, {
98
+ key: "get",
99
+ value: function () {
100
+ var _get = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(object_type, object_id) {
101
+ var url, headers, signature, response;
102
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
103
+ while (1) {
104
+ switch (_context2.prev = _context2.next) {
105
+ case 0:
106
+ url = this.detail_url(object_type, object_id);
107
+ headers = this.__get_headers();
108
+ signature = (0, _signature["default"])(url, "GET", "", headers, this.config.workspace_secret);
109
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
110
+ _context2.prev = 4;
111
+ _context2.next = 7;
112
+ return _axios["default"].get(url, {
113
+ headers: headers
114
+ });
115
+ case 7:
116
+ response = _context2.sent;
117
+ return _context2.abrupt("return", response.data);
118
+ case 11:
119
+ _context2.prev = 11;
120
+ _context2.t0 = _context2["catch"](4);
121
+ throw new _utils.SuprsendApiError(_context2.t0);
122
+ case 14:
123
+ case "end":
124
+ return _context2.stop();
125
+ }
126
+ }
127
+ }, _callee2, this, [[4, 11]]);
128
+ }));
129
+ function get(_x3, _x4) {
130
+ return _get.apply(this, arguments);
131
+ }
132
+ return get;
133
+ }()
134
+ }, {
135
+ key: "upsert",
136
+ value: function () {
137
+ var _upsert = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(object_type, object_id) {
138
+ var payload,
139
+ url,
140
+ headers,
141
+ content_text,
142
+ signature,
143
+ response,
144
+ _args3 = arguments;
145
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
146
+ while (1) {
147
+ switch (_context3.prev = _context3.next) {
148
+ case 0:
149
+ payload = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
150
+ url = this.detail_url(object_type, object_id);
151
+ payload = payload || {};
152
+ headers = this.__get_headers();
153
+ content_text = JSON.stringify(payload || {});
154
+ signature = (0, _signature["default"])(url, "POST", content_text, headers, this.config.workspace_secret);
155
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
156
+ _context3.prev = 7;
157
+ _context3.next = 10;
158
+ return _axios["default"].post(url, content_text, {
159
+ headers: headers
160
+ });
161
+ case 10:
162
+ response = _context3.sent;
163
+ return _context3.abrupt("return", response.data);
164
+ case 14:
165
+ _context3.prev = 14;
166
+ _context3.t0 = _context3["catch"](7);
167
+ throw new _utils.SuprsendApiError(_context3.t0);
168
+ case 17:
169
+ case "end":
170
+ return _context3.stop();
171
+ }
172
+ }
173
+ }, _callee3, this, [[7, 14]]);
174
+ }));
175
+ function upsert(_x5, _x6) {
176
+ return _upsert.apply(this, arguments);
177
+ }
178
+ return upsert;
179
+ }()
180
+ }, {
181
+ key: "edit",
182
+ value: function () {
183
+ var _edit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(edit_ins_or_object_type, object_id, edit_payload) {
184
+ var payload, url, edit_ins, object_type, content_text, headers, signature, response;
185
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
186
+ while (1) {
187
+ switch (_context4.prev = _context4.next) {
188
+ case 0:
189
+ if (edit_ins_or_object_type instanceof _object_edit["default"]) {
190
+ edit_ins = edit_ins_or_object_type;
191
+ edit_ins.validate_body();
192
+ payload = edit_ins.get_payload();
193
+ url = this.detail_url(edit_ins.object_type, edit_ins.object_id);
194
+ } else {
195
+ object_type = edit_ins_or_object_type;
196
+ payload = edit_payload || {};
197
+ url = this.detail_url(object_type, object_id);
198
+ }
199
+ content_text = JSON.stringify(payload || {});
200
+ headers = this.__get_headers();
201
+ signature = (0, _signature["default"])(url, "PATCH", content_text, headers, this.config.workspace_secret);
202
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
203
+ _context4.prev = 5;
204
+ _context4.next = 8;
205
+ return _axios["default"].patch(url, content_text, {
206
+ headers: headers
207
+ });
208
+ case 8:
209
+ response = _context4.sent;
210
+ return _context4.abrupt("return", response.data);
211
+ case 12:
212
+ _context4.prev = 12;
213
+ _context4.t0 = _context4["catch"](5);
214
+ throw new _utils.SuprsendApiError(_context4.t0);
215
+ case 15:
216
+ case "end":
217
+ return _context4.stop();
218
+ }
219
+ }
220
+ }, _callee4, this, [[5, 12]]);
221
+ }));
222
+ function edit(_x7, _x8, _x9) {
223
+ return _edit.apply(this, arguments);
224
+ }
225
+ return edit;
226
+ }()
227
+ }, {
228
+ key: "delete",
229
+ value: function () {
230
+ var _delete2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(object_type, object_id) {
231
+ var url, headers, signature, response;
232
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
233
+ while (1) {
234
+ switch (_context5.prev = _context5.next) {
235
+ case 0:
236
+ url = this.detail_url(object_type, object_id);
237
+ headers = this.__get_headers();
238
+ signature = (0, _signature["default"])(url, "DELETE", "", headers, this.config.workspace_secret);
239
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
240
+ _context5.prev = 4;
241
+ _context5.next = 7;
242
+ return _axios["default"]["delete"](url, {
243
+ headers: headers
244
+ });
245
+ case 7:
246
+ response = _context5.sent;
247
+ if (!(response.status >= 200 && response.status < 300)) {
248
+ _context5.next = 12;
249
+ break;
250
+ }
251
+ return _context5.abrupt("return", {
252
+ success: true,
253
+ status_code: response.status
254
+ });
255
+ case 12:
256
+ throw new _utils.SuprsendApiError(response.statusText);
257
+ case 13:
258
+ _context5.next = 18;
259
+ break;
260
+ case 15:
261
+ _context5.prev = 15;
262
+ _context5.t0 = _context5["catch"](4);
263
+ throw new _utils.SuprsendApiError(_context5.t0);
264
+ case 18:
265
+ case "end":
266
+ return _context5.stop();
267
+ }
268
+ }
269
+ }, _callee5, this, [[4, 15]]);
270
+ }));
271
+ function _delete(_x10, _x11) {
272
+ return _delete2.apply(this, arguments);
273
+ }
274
+ return _delete;
275
+ }()
276
+ }, {
277
+ key: "bulk_delete",
278
+ value: function () {
279
+ var _bulk_delete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(object_type, payload) {
280
+ var object_type_encoded, url, headers, content_text, signature, response;
281
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
282
+ while (1) {
283
+ switch (_context6.prev = _context6.next) {
284
+ case 0:
285
+ object_type = this._validate_object_type(object_type);
286
+ object_type_encoded = encodeURIComponent(object_type);
287
+ url = "".concat(this.bulk_url).concat(object_type_encoded, "/");
288
+ payload = payload || {};
289
+ headers = this.__get_headers();
290
+ content_text = JSON.stringify(payload);
291
+ signature = (0, _signature["default"])(url, "DELETE", content_text, headers, this.config.workspace_secret);
292
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
293
+ _context6.prev = 8;
294
+ _context6.next = 11;
295
+ return _axios["default"]["delete"](url, {
296
+ headers: headers,
297
+ data: content_text
298
+ });
299
+ case 11:
300
+ response = _context6.sent;
301
+ if (!(response.status >= 200 && response.status < 300)) {
302
+ _context6.next = 16;
303
+ break;
304
+ }
305
+ return _context6.abrupt("return", {
306
+ success: true,
307
+ status_code: response.status
308
+ });
309
+ case 16:
310
+ throw new _utils.SuprsendApiError(response.statusText);
311
+ case 17:
312
+ _context6.next = 22;
313
+ break;
314
+ case 19:
315
+ _context6.prev = 19;
316
+ _context6.t0 = _context6["catch"](8);
317
+ throw new _utils.SuprsendApiError(_context6.t0);
318
+ case 22:
319
+ case "end":
320
+ return _context6.stop();
321
+ }
322
+ }
323
+ }, _callee6, this, [[8, 19]]);
324
+ }));
325
+ function bulk_delete(_x12, _x13) {
326
+ return _bulk_delete.apply(this, arguments);
327
+ }
328
+ return bulk_delete;
329
+ }()
330
+ }, {
331
+ key: "get_subscriptions",
332
+ value: function () {
333
+ var _get_subscriptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(object_type, object_id, options) {
334
+ var encoded_options, _detail_url, url, headers, signature, response;
335
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
336
+ while (1) {
337
+ switch (_context7.prev = _context7.next) {
338
+ case 0:
339
+ encoded_options = options ? new URLSearchParams(options).toString() : "";
340
+ _detail_url = this.detail_url(object_type, object_id);
341
+ url = "".concat(_detail_url, "subscription/").concat(encoded_options ? "?".concat(encoded_options) : "");
342
+ headers = this.__get_headers();
343
+ signature = (0, _signature["default"])(url, "GET", "", headers, this.config.workspace_secret);
344
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
345
+ _context7.prev = 6;
346
+ _context7.next = 9;
347
+ return _axios["default"].get(url, {
348
+ headers: headers
349
+ });
350
+ case 9:
351
+ response = _context7.sent;
352
+ return _context7.abrupt("return", response.data);
353
+ case 13:
354
+ _context7.prev = 13;
355
+ _context7.t0 = _context7["catch"](6);
356
+ throw new _utils.SuprsendApiError(_context7.t0);
357
+ case 16:
358
+ case "end":
359
+ return _context7.stop();
360
+ }
361
+ }
362
+ }, _callee7, this, [[6, 13]]);
363
+ }));
364
+ function get_subscriptions(_x14, _x15, _x16) {
365
+ return _get_subscriptions.apply(this, arguments);
366
+ }
367
+ return get_subscriptions;
368
+ }()
369
+ }, {
370
+ key: "create_subscriptions",
371
+ value: function () {
372
+ var _create_subscriptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(object_type, object_id, payload) {
373
+ var _detail_url, url, content_text, headers, signature, response;
374
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
375
+ while (1) {
376
+ switch (_context8.prev = _context8.next) {
377
+ case 0:
378
+ _detail_url = this.detail_url(object_type, object_id);
379
+ url = "".concat(_detail_url, "subscription/");
380
+ payload = payload || {};
381
+ content_text = JSON.stringify(payload);
382
+ headers = this.__get_headers();
383
+ signature = (0, _signature["default"])(url, "POST", content_text, headers, this.config.workspace_secret);
384
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
385
+ _context8.prev = 7;
386
+ _context8.next = 10;
387
+ return _axios["default"].post(url, content_text, {
388
+ headers: headers
389
+ });
390
+ case 10:
391
+ response = _context8.sent;
392
+ return _context8.abrupt("return", response.data);
393
+ case 14:
394
+ _context8.prev = 14;
395
+ _context8.t0 = _context8["catch"](7);
396
+ throw new _utils.SuprsendApiError(_context8.t0);
397
+ case 17:
398
+ case "end":
399
+ return _context8.stop();
400
+ }
401
+ }
402
+ }, _callee8, this, [[7, 14]]);
403
+ }));
404
+ function create_subscriptions(_x17, _x18, _x19) {
405
+ return _create_subscriptions.apply(this, arguments);
406
+ }
407
+ return create_subscriptions;
408
+ }()
409
+ }, {
410
+ key: "delete_subscriptions",
411
+ value: function () {
412
+ var _delete_subscriptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(object_type, object_id, payload) {
413
+ var _detail_url, url, content_text, headers, signature, response;
414
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
415
+ while (1) {
416
+ switch (_context9.prev = _context9.next) {
417
+ case 0:
418
+ _detail_url = this.detail_url(object_type, object_id);
419
+ url = "".concat(_detail_url, "subscription/");
420
+ payload = payload || {};
421
+ content_text = JSON.stringify(payload);
422
+ headers = this.__get_headers();
423
+ signature = (0, _signature["default"])(url, "DELETE", content_text, headers, this.config.workspace_secret);
424
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
425
+ _context9.prev = 7;
426
+ _context9.next = 10;
427
+ return _axios["default"]["delete"](url, {
428
+ headers: headers,
429
+ data: content_text
430
+ });
431
+ case 10:
432
+ response = _context9.sent;
433
+ if (!(response.status >= 200 && response.status < 300)) {
434
+ _context9.next = 15;
435
+ break;
436
+ }
437
+ return _context9.abrupt("return", {
438
+ success: true,
439
+ status_code: response.status
440
+ });
441
+ case 15:
442
+ throw new _utils.SuprsendApiError(response.statusText);
443
+ case 16:
444
+ _context9.next = 21;
445
+ break;
446
+ case 18:
447
+ _context9.prev = 18;
448
+ _context9.t0 = _context9["catch"](7);
449
+ throw new _utils.SuprsendApiError(_context9.t0);
450
+ case 21:
451
+ case "end":
452
+ return _context9.stop();
453
+ }
454
+ }
455
+ }, _callee9, this, [[7, 18]]);
456
+ }));
457
+ function delete_subscriptions(_x20, _x21, _x22) {
458
+ return _delete_subscriptions.apply(this, arguments);
459
+ }
460
+ return delete_subscriptions;
461
+ }()
462
+ }, {
463
+ key: "get_objects_subscribed_to",
464
+ value: function () {
465
+ var _get_objects_subscribed_to = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(object_type, object_id) {
466
+ var options,
467
+ encoded_options,
468
+ _detail_url,
469
+ url,
470
+ headers,
471
+ signature,
472
+ response,
473
+ _args10 = arguments;
474
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
475
+ while (1) {
476
+ switch (_context10.prev = _context10.next) {
477
+ case 0:
478
+ options = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : null;
479
+ encoded_options = options ? new URLSearchParams(options).toString() : "";
480
+ _detail_url = this.detail_url(object_type, object_id);
481
+ url = "".concat(_detail_url, "subscribed_to/object/").concat(encoded_options ? "?".concat(encoded_options) : "");
482
+ headers = this.__get_headers();
483
+ signature = (0, _signature["default"])(url, "GET", "", headers, this.config.workspace_secret);
484
+ headers["Authorization"] = "".concat(this.config.workspace_key, ":").concat(signature);
485
+ _context10.prev = 7;
486
+ _context10.next = 10;
487
+ return _axios["default"].get(url, {
488
+ headers: headers
489
+ });
490
+ case 10:
491
+ response = _context10.sent;
492
+ return _context10.abrupt("return", response.data);
493
+ case 14:
494
+ _context10.prev = 14;
495
+ _context10.t0 = _context10["catch"](7);
496
+ throw new _utils.SuprsendApiError(_context10.t0);
497
+ case 17:
498
+ case "end":
499
+ return _context10.stop();
500
+ }
501
+ }
502
+ }, _callee10, this, [[7, 14]]);
503
+ }));
504
+ function get_objects_subscribed_to(_x23, _x24) {
505
+ return _get_objects_subscribed_to.apply(this, arguments);
506
+ }
507
+ return get_objects_subscribed_to;
508
+ }()
509
+ }, {
510
+ key: "get_instance",
511
+ value: function get_instance(object_type, object_id) {
512
+ object_type = this._validate_object_type(object_type);
513
+ object_id = this._validate_object_id(object_id);
514
+ return new _object_edit["default"](this.config, object_type, object_id);
515
+ }
516
+ }, {
517
+ key: "get_edit_instance",
518
+ value: function get_edit_instance(object_type, object_id) {
519
+ object_type = this._validate_object_type(object_type);
520
+ object_id = this._validate_object_id(object_id);
521
+ return new _object_edit["default"](this.config, object_type, object_id);
522
+ }
523
+ }]);
524
+ return ObjectsApi;
525
+ }();
526
+ exports["default"] = ObjectsApi;
527
+ module.exports = exports.default;
@@ -51,7 +51,6 @@
51
51
  "type": "array",
52
52
  "items": { "$ref": "#/definitions/user_setting" },
53
53
  "minItems": 1,
54
- "maxItems": 100,
55
54
  "description": "user object to run workflow for. At least 1 user is required"
56
55
  },
57
56
  "data": {
@@ -65,27 +64,6 @@
65
64
  "type": "string",
66
65
  "minLength": 2
67
66
  },
68
- "mobile_number_pattern": {
69
- "type": "string",
70
- "minLength": 8,
71
- "pattern": "^\\+[0-9\\s]+",
72
- "message": {
73
- "required": "Either a mobile-number or an array of mobile-numbers. e.g [\"+41446681800\"]",
74
- "pattern": "number must start with + and must contain country code. e.g. +41446681800"
75
- }
76
- },
77
- "email_pattern": {
78
- "type": "string",
79
- "format": "email",
80
- "pattern": "^\\S+@\\S+\\.\\S+$",
81
- "description": "email of an user",
82
- "minLength": 6,
83
- "maxLength": 127,
84
- "message": {
85
- "required": "",
86
- "pattern": "value in email format required. e.g. user@example.com"
87
- }
88
- },
89
67
  "slack_setting": {
90
68
  "type": "object",
91
69
  "properties": {
@@ -113,7 +91,7 @@
113
91
  }
114
92
  },
115
93
  "email": {
116
- "$ref": "#/definitions/email_pattern"
94
+ "$ref": "#/definitions/non_empty_string"
117
95
  },
118
96
  "incoming_webhook": {
119
97
  "type": "object",
@@ -240,25 +218,25 @@
240
218
  },
241
219
  "$email": {
242
220
  "oneOf": [
243
- { "$ref": "#/definitions/email_pattern" },
221
+ { "$ref": "#/definitions/non_empty_string" },
244
222
  {
245
223
  "type": "array",
246
224
  "uniqueItems": false,
247
225
  "maxItems": 10,
248
226
  "minItems": 1,
249
- "items": { "$ref": "#/definitions/email_pattern" }
227
+ "items": { "$ref": "#/definitions/non_empty_string" }
250
228
  }
251
229
  ]
252
230
  },
253
231
  "$sms": {
254
232
  "oneOf": [
255
- { "$ref": "#/definitions/mobile_number_pattern" },
233
+ { "$ref": "#/definitions/non_empty_string" },
256
234
  {
257
235
  "type": "array",
258
236
  "uniqueItems": false,
259
237
  "maxItems": 10,
260
238
  "minItems": 1,
261
- "items": { "$ref": "#/definitions/mobile_number_pattern" }
239
+ "items": { "$ref": "#/definitions/non_empty_string" }
262
240
  }
263
241
  ]
264
242
  },
@@ -304,13 +282,13 @@
304
282
  },
305
283
  "$whatsapp": {
306
284
  "oneOf": [
307
- { "$ref": "#/definitions/mobile_number_pattern" },
285
+ { "$ref": "#/definitions/non_empty_string" },
308
286
  {
309
287
  "type": "array",
310
288
  "uniqueItems": false,
311
289
  "maxItems": 10,
312
290
  "minItems": 1,
313
- "items": { "$ref": "#/definitions/mobile_number_pattern" }
291
+ "items": { "$ref": "#/definitions/non_empty_string" }
314
292
  }
315
293
  ]
316
294
  },