@gofynd/fdk-client-javascript 1.6.3 → 1.6.4

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.
@@ -29,11 +29,33 @@ const Joi = require("joi");
29
29
  * @property {number} [id] - The unique identifier for the subscriber event mapping.
30
30
  * @property {number} [event_id] - The ID of the event associated with the subscriber.
31
31
  * @property {number} [subscriber_id] - The ID of the subscriber.
32
+ * @property {FilterSchema} [filters]
33
+ * @property {Object} [reducer] - The reducer property allows users to customize
34
+ * the JSON structure of the webhook payload using JSONPath queries. They can
35
+ * also create new properties by mapping existing ones. Note that it overrides
36
+ * the entire JSON structure of the webhook payload sent via the webhook. See
37
+ * the partner documentation's filter and reducer section for details.
32
38
  * @property {BroadcasterConfig} [broadcaster_config]
33
39
  * @property {string} [created_on] - The date and time when the subscriber event
34
40
  * mapping was created.
35
41
  */
36
42
 
43
+ /**
44
+ * @typedef FilterSchema
45
+ * @property {string} [query] - JSONPath expression that specifies the property
46
+ * in the webhook payload to filter on. This enables targeting specific data
47
+ * within the payload.
48
+ * @property {string} [condition] - JavaScript function used to evaluate the
49
+ * specified property in the webhook payload against a condition. This
50
+ * function determines whether the filter passes based on its return value.
51
+ * @property {string} [logic] - Logical operator used to combine multiple
52
+ * conditions in the `conditions` array. Supported values are `AND` and `OR`.
53
+ * @property {Object[]} [conditions] - An array of filter objects to be
54
+ * evaluated using the specified logical operator. This array will contain
55
+ * more filters including a combination of single condition mode and logical
56
+ * group mode filters.
57
+ */
58
+
37
59
  /**
38
60
  * @typedef EventConfig
39
61
  * @property {number} [id] - The unique identifier for the event configuration.
@@ -355,11 +377,23 @@ class WebhookPlatformModel {
355
377
  id: Joi.number(),
356
378
  event_id: Joi.number(),
357
379
  subscriber_id: Joi.number(),
380
+ filters: WebhookPlatformModel.FilterSchema(),
381
+ reducer: Joi.object().pattern(/\S/, Joi.any()).allow(null, ""),
358
382
  broadcaster_config: WebhookPlatformModel.BroadcasterConfig(),
359
383
  created_on: Joi.string().allow(""),
360
384
  });
361
385
  }
362
386
 
387
+ /** @returns {FilterSchema} */
388
+ static FilterSchema() {
389
+ return Joi.object({
390
+ query: Joi.string().allow(""),
391
+ condition: Joi.string().allow(""),
392
+ logic: Joi.string().allow(""),
393
+ conditions: Joi.array().items(Joi.object().pattern(/\S/, Joi.any())),
394
+ }).allow(null);
395
+ }
396
+
363
397
  /** @returns {EventConfig} */
364
398
  static EventConfig() {
365
399
  return Joi.object({