@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
@@ -36,7 +36,6 @@
36
36
  ]
37
37
  },
38
38
  "minItems": 1,
39
- "maxItems": 100,
40
39
  "description": "list of recipient id/object to run workflow for. At least 1 user is required"
41
40
  },
42
41
  "data": {
@@ -60,27 +59,6 @@
60
59
  "type": "string",
61
60
  "minLength": 1
62
61
  },
63
- "mobile_number_pattern": {
64
- "type": "string",
65
- "minLength": 8,
66
- "pattern": "^\\+[0-9\\s]+",
67
- "message": {
68
- "required": "Either a mobile-number or an array of mobile-numbers. e.g [\"+41446681800\"]",
69
- "pattern": "number must start with + and must contain country code. e.g. +41446681800"
70
- }
71
- },
72
- "email_pattern": {
73
- "type": "string",
74
- "format": "email",
75
- "pattern": "^\\S+@\\S+\\.\\S+$",
76
- "description": "email of an user",
77
- "minLength": 6,
78
- "maxLength": 127,
79
- "message": {
80
- "required": "",
81
- "pattern": "value in email format required. e.g. user@example.com"
82
- }
83
- },
84
62
  "slack_setting": {
85
63
  "type": "object",
86
64
  "properties": {
@@ -108,7 +86,7 @@
108
86
  }
109
87
  },
110
88
  "email": {
111
- "$ref": "#/definitions/email_pattern"
89
+ "$ref": "#/definitions/non_empty_string"
112
90
  },
113
91
  "incoming_webhook": {
114
92
  "type": "object",
@@ -235,25 +213,25 @@
235
213
  },
236
214
  "$email": {
237
215
  "oneOf": [
238
- { "$ref": "#/definitions/email_pattern" },
216
+ { "$ref": "#/definitions/non_empty_string" },
239
217
  {
240
218
  "type": "array",
241
219
  "uniqueItems": false,
242
220
  "maxItems": 10,
243
221
  "minItems": 1,
244
- "items": { "$ref": "#/definitions/email_pattern" }
222
+ "items": { "$ref": "#/definitions/non_empty_string" }
245
223
  }
246
224
  ]
247
225
  },
248
226
  "$sms": {
249
227
  "oneOf": [
250
- { "$ref": "#/definitions/mobile_number_pattern" },
228
+ { "$ref": "#/definitions/non_empty_string" },
251
229
  {
252
230
  "type": "array",
253
231
  "uniqueItems": false,
254
232
  "maxItems": 10,
255
233
  "minItems": 1,
256
- "items": { "$ref": "#/definitions/mobile_number_pattern" }
234
+ "items": { "$ref": "#/definitions/non_empty_string" }
257
235
  }
258
236
  ]
259
237
  },
@@ -283,13 +261,13 @@
283
261
  },
284
262
  "$whatsapp": {
285
263
  "oneOf": [
286
- { "$ref": "#/definitions/mobile_number_pattern" },
264
+ { "$ref": "#/definitions/non_empty_string" },
287
265
  {
288
266
  "type": "array",
289
267
  "uniqueItems": false,
290
268
  "maxItems": 10,
291
269
  "minItems": 1,
292
- "items": { "$ref": "#/definitions/mobile_number_pattern" }
270
+ "items": { "$ref": "#/definitions/non_empty_string" }
293
271
  }
294
272
  ]
295
273
  },
@@ -50,8 +50,7 @@ var Subscriber = /*#__PURE__*/function () {
50
50
  (0, _classCallCheck2["default"])(this, Subscriber);
51
51
  this.config = config;
52
52
  this.distinct_id = distinct_id;
53
- this.__url = this.__get_url();
54
- this.__super_props = this.__super_properties();
53
+ this.__url = "".concat(this.config.base_url, "event/");
55
54
  this.__errors = [];
56
55
  this.__info = [];
57
56
  this.user_operations = [];
@@ -59,11 +58,6 @@ var Subscriber = /*#__PURE__*/function () {
59
58
  this.__warnings_list = [];
60
59
  }
61
60
  (0, _createClass2["default"])(Subscriber, [{
62
- key: "__get_url",
63
- value: function __get_url() {
64
- return "".concat(this.config.base_url, "event/");
65
- }
66
- }, {
67
61
  key: "__get_headers",
68
62
  value: function __get_headers() {
69
63
  return {
@@ -72,13 +66,6 @@ var Subscriber = /*#__PURE__*/function () {
72
66
  "User-Agent": this.config.user_agent
73
67
  };
74
68
  }
75
- }, {
76
- key: "__super_properties",
77
- value: function __super_properties() {
78
- return {
79
- $ss_sdk_version: this.config.user_agent
80
- };
81
- }
82
69
  }, {
83
70
  key: "get_events",
84
71
  value: function get_events() {
@@ -89,7 +76,9 @@ var Subscriber = /*#__PURE__*/function () {
89
76
  env: this.config.workspace_key,
90
77
  distinct_id: this.distinct_id,
91
78
  $user_operations: this.user_operations,
92
- properties: this.__super_props
79
+ properties: {
80
+ $ss_sdk_version: this.config.user_agent
81
+ }
93
82
  };
94
83
  }
95
84
  }, {
@@ -128,7 +117,8 @@ var Subscriber = /*#__PURE__*/function () {
128
117
  if (is_part_of_bulk) {
129
118
  console.log(err_msg);
130
119
  } else {
131
- throw new _utils.InputValueError(err_msg);
120
+ // throw new InputValueError(err_msg);
121
+ console.log(err_msg);
132
122
  }
133
123
  }
134
124
  return this.__warnings_list;
@@ -413,48 +403,42 @@ var Subscriber = /*#__PURE__*/function () {
413
403
  }
414
404
  }, {
415
405
  key: "add_androidpush",
416
- value: function add_androidpush(push_token) {
417
- var provider = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fcm";
406
+ value: function add_androidpush(push_token, provider) {
418
407
  var caller = "add_androidpush";
419
408
  this._helper._add_androidpush(push_token, provider, caller);
420
409
  this._collect_event();
421
410
  }
422
411
  }, {
423
412
  key: "remove_androidpush",
424
- value: function remove_androidpush(push_token) {
425
- var provider = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fcm";
413
+ value: function remove_androidpush(push_token, provider) {
426
414
  var caller = "remove_androidpush";
427
415
  this._helper._remove_androidpush(push_token, provider, caller);
428
416
  this._collect_event();
429
417
  }
430
418
  }, {
431
419
  key: "add_iospush",
432
- value: function add_iospush(push_token) {
433
- var provider = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "apns";
420
+ value: function add_iospush(push_token, provider) {
434
421
  var caller = "add_iospush";
435
422
  this._helper._add_iospush(push_token, provider, caller);
436
423
  this._collect_event();
437
424
  }
438
425
  }, {
439
426
  key: "remove_iospush",
440
- value: function remove_iospush(push_token) {
441
- var provider = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "apns";
427
+ value: function remove_iospush(push_token, provider) {
442
428
  var caller = "remove_iospush";
443
429
  this._helper._remove_iospush(push_token, provider, caller);
444
430
  this._collect_event();
445
431
  }
446
432
  }, {
447
433
  key: "add_webpush",
448
- value: function add_webpush(push_token) {
449
- var provider = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "vapid";
434
+ value: function add_webpush(push_token, provider) {
450
435
  var caller = "add_webpush";
451
436
  this._helper._add_webpush(push_token, provider, caller);
452
437
  this._collect_event();
453
438
  }
454
439
  }, {
455
440
  key: "remove_webpush",
456
- value: function remove_webpush(push_token) {
457
- var provider = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "vapid";
441
+ value: function remove_webpush(push_token, provider) {
458
442
  var caller = "remove_webpush";
459
443
  this._helper._remove_webpush(push_token, provider, caller);
460
444
  this._collect_event();