@gofynd/fdk-client-javascript 3.18.0 → 3.19.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/sdk/application/Order/OrderApplicationClient.d.ts +11 -0
- package/sdk/application/Order/OrderApplicationClient.js +49 -0
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +1 -1
- package/sdk/application/Payment/PaymentApplicationClient.js +2 -0
- package/sdk/common/utils.d.ts +1 -1
- package/sdk/common/utils.js +1 -0
- package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +46 -0
- package/sdk/partner/Webhook/WebhookPartnerClient.js +334 -0
- package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +222 -1
- package/sdk/partner/Webhook/WebhookPartnerModel.js +165 -0
- package/sdk/partner/Webhook/WebhookPartnerValidator.d.ts +4 -0
- package/sdk/partner/Webhook/WebhookPartnerValidator.js +30 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +4 -4
- package/sdk/platform/Order/OrderPlatformModel.js +4 -4
- package/sdk/platform/User/UserPlatformModel.d.ts +26 -2
- package/sdk/platform/User/UserPlatformModel.js +10 -2
package/README.md
CHANGED
|
@@ -234,7 +234,7 @@ console.log("Active Theme: ", response.information.name);
|
|
|
234
234
|
The above code will log the curl command in the console
|
|
235
235
|
|
|
236
236
|
```bash
|
|
237
|
-
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 3.
|
|
237
|
+
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 3.19.0' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
|
|
238
238
|
Active Theme: Emerge
|
|
239
239
|
```
|
|
240
240
|
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ declare class Order {
|
|
|
9
9
|
getOrders: string;
|
|
10
10
|
getPosOrderById: string;
|
|
11
11
|
getRefundModes: string;
|
|
12
|
+
getRefundModesWithPriceBreakup: string;
|
|
12
13
|
getShipmentBagReasons: string;
|
|
13
14
|
getShipmentById: string;
|
|
14
15
|
getShipmentReasons: string;
|
|
@@ -75,6 +76,16 @@ declare class Order {
|
|
|
75
76
|
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/order/getRefundModes/).
|
|
76
77
|
*/
|
|
77
78
|
getRefundModes({ shipmentId, lineNumbers, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<RefundOptions>;
|
|
79
|
+
/**
|
|
80
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
81
|
+
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
82
|
+
* @returns {Promise<RefundOptions>} - Success response
|
|
83
|
+
* @name getRefundModesWithPriceBreakup
|
|
84
|
+
* @summary: Get refund modes and Refund Price Break for a shipment
|
|
85
|
+
* @description: Returns a list of available refund options for the given company and shipment.
|
|
86
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/order/getRefundModesWithPriceBreakup/).
|
|
87
|
+
*/
|
|
88
|
+
getRefundModesWithPriceBreakup({ shipmentId, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<RefundOptions>;
|
|
78
89
|
/**
|
|
79
90
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
80
91
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
@@ -22,6 +22,8 @@ class Order {
|
|
|
22
22
|
"/service/application/order/v1.0/orders/pos-order/{order_id}",
|
|
23
23
|
getRefundModes:
|
|
24
24
|
"/service/application/order-manage/v1.0/shipment/{shipment_id}/refund/modes",
|
|
25
|
+
getRefundModesWithPriceBreakup:
|
|
26
|
+
"/service/application/order-manage/v1.0/shipment/{shipment_id}/refund/modes",
|
|
25
27
|
getShipmentBagReasons:
|
|
26
28
|
"/service/application/order/v1.0/orders/shipments/{shipment_id}/bags/{bag_id}/reasons",
|
|
27
29
|
getShipmentById:
|
|
@@ -348,6 +350,53 @@ class Order {
|
|
|
348
350
|
return response;
|
|
349
351
|
}
|
|
350
352
|
|
|
353
|
+
/**
|
|
354
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
355
|
+
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
356
|
+
* @returns {Promise<RefundOptions>} - Success response
|
|
357
|
+
* @name getRefundModesWithPriceBreakup
|
|
358
|
+
* @summary: Get refund modes and Refund Price Break for a shipment
|
|
359
|
+
* @description: Returns a list of available refund options for the given company and shipment.
|
|
360
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/order/getRefundModesWithPriceBreakup/).
|
|
361
|
+
*/
|
|
362
|
+
async getRefundModesWithPriceBreakup(
|
|
363
|
+
{ shipmentId, body, requestHeaders } = { requestHeaders: {} },
|
|
364
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
365
|
+
) {
|
|
366
|
+
const errors = validateRequiredParams(arguments[0], ["shipmentId"]);
|
|
367
|
+
if (errors.length > 0) {
|
|
368
|
+
const error = new FDKClientValidationError({
|
|
369
|
+
message: "Missing required field",
|
|
370
|
+
details: errors,
|
|
371
|
+
});
|
|
372
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const query_params = {};
|
|
376
|
+
|
|
377
|
+
const xHeaders = {};
|
|
378
|
+
|
|
379
|
+
const response = await ApplicationAPIClient.execute(
|
|
380
|
+
this._conf,
|
|
381
|
+
"post",
|
|
382
|
+
constructUrl({
|
|
383
|
+
url: this._urls["getRefundModesWithPriceBreakup"],
|
|
384
|
+
params: { shipmentId },
|
|
385
|
+
}),
|
|
386
|
+
query_params,
|
|
387
|
+
body,
|
|
388
|
+
{ ...xHeaders, ...requestHeaders },
|
|
389
|
+
{ responseHeaders }
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
let responseData = response;
|
|
393
|
+
if (responseHeaders) {
|
|
394
|
+
responseData = response[0];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return response;
|
|
398
|
+
}
|
|
399
|
+
|
|
351
400
|
/**
|
|
352
401
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
353
402
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
@@ -306,7 +306,7 @@ declare class Payment {
|
|
|
306
306
|
* @summary: POS payment modes
|
|
307
307
|
* @description: Get available payment methods on the payment page for POS, specifying the aggregator for each option, such as 'CARD powered by Juspay' and 'QR powered by Razorpay'. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/payment/getPosPaymentModeRoutes/).
|
|
308
308
|
*/
|
|
309
|
-
getPosPaymentModeRoutes({ amount, cartId, pincode, orderType, checkoutMode, refresh, cardReference, userDetails, requestHeaders, }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<PaymentModeRouteDetails>;
|
|
309
|
+
getPosPaymentModeRoutes({ amount, cartId, pincode, orderType, checkoutMode, refresh, cardReference, fulfillmentOption, userDetails, requestHeaders, }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<PaymentModeRouteDetails>;
|
|
310
310
|
/**
|
|
311
311
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
312
312
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
@@ -1180,6 +1180,7 @@ class Payment {
|
|
|
1180
1180
|
checkoutMode,
|
|
1181
1181
|
refresh,
|
|
1182
1182
|
cardReference,
|
|
1183
|
+
fulfillmentOption,
|
|
1183
1184
|
userDetails,
|
|
1184
1185
|
requestHeaders,
|
|
1185
1186
|
} = { requestHeaders: {} },
|
|
@@ -1193,6 +1194,7 @@ class Payment {
|
|
|
1193
1194
|
query_params["refresh"] = refresh;
|
|
1194
1195
|
query_params["card_reference"] = cardReference;
|
|
1195
1196
|
query_params["order_type"] = orderType;
|
|
1197
|
+
query_params["fulfillment_option"] = fulfillmentOption;
|
|
1196
1198
|
query_params["user_details"] = userDetails;
|
|
1197
1199
|
|
|
1198
1200
|
const xHeaders = {};
|
package/sdk/common/utils.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export function findBestMatchingLink(allLinks?: any[], pathname?: string): {
|
|
|
7
7
|
value: string;
|
|
8
8
|
params: {};
|
|
9
9
|
};
|
|
10
|
-
export function convertStringToBase64(string: any):
|
|
10
|
+
export function convertStringToBase64(string: any): string;
|
|
11
11
|
export function isBrowser(): boolean;
|
|
12
12
|
export function isNode(): boolean;
|
|
13
13
|
export namespace NAV_TYPE {
|
package/sdk/common/utils.js
CHANGED
|
@@ -52,6 +52,16 @@ declare class Webhook {
|
|
|
52
52
|
* @description: Fetch webhook report filters - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/fetchReportFilters/).
|
|
53
53
|
*/
|
|
54
54
|
fetchReportFilters({ extensionId, startDate, endDate, pageNo, pageSize, requestHeaders }?: WebhookPartnerValidator.FetchReportFiltersParam, { responseHeaders }?: object): Promise<WebhookPartnerModel.FilterReportResult[]>;
|
|
55
|
+
/**
|
|
56
|
+
* @param {WebhookPartnerValidator.DownloadDeliveryReportParam} arg - Arg object.
|
|
57
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
58
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
59
|
+
* @returns {Promise<WebhookPartnerModel.DownloadReportResult>} - Success response
|
|
60
|
+
* @name downloadDeliveryReport
|
|
61
|
+
* @summary: Download webhook delivery report
|
|
62
|
+
* @description: Download webhook delivery report - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/downloadDeliveryReport/).
|
|
63
|
+
*/
|
|
64
|
+
downloadDeliveryReport({ extensionId, body, requestHeaders }?: WebhookPartnerValidator.DownloadDeliveryReportParam, { responseHeaders }?: object): Promise<WebhookPartnerModel.DownloadReportResult>;
|
|
55
65
|
/**
|
|
56
66
|
* @param {WebhookPartnerValidator.CancelReportDownloadParam} arg - Arg object.
|
|
57
67
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -105,5 +115,41 @@ declare class Webhook {
|
|
|
105
115
|
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/updateSubscriber/).
|
|
106
116
|
*/
|
|
107
117
|
updateSubscriber({ extensionId, subscriberId, body, requestHeaders }?: WebhookPartnerValidator.UpdateSubscriberParam, { responseHeaders }?: object): Promise<WebhookPartnerModel.SubscriberUpdateResult>;
|
|
118
|
+
/**
|
|
119
|
+
* @param {WebhookPartnerValidator.ValidateFilterConfigurationParam} arg - Arg object.
|
|
120
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
121
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
122
|
+
* @returns {Promise<WebhookPartnerModel.FilterValidationResult>} - Success response
|
|
123
|
+
* @name validateFilterConfiguration
|
|
124
|
+
* @summary: Validate filter configuration.
|
|
125
|
+
* @description: Validate a filter configuration against sample payload data.
|
|
126
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/validateFilterConfiguration/).
|
|
127
|
+
*/
|
|
128
|
+
validateFilterConfiguration({ extensionId, body, requestHeaders }?: WebhookPartnerValidator.ValidateFilterConfigurationParam, { responseHeaders }?: object): Promise<WebhookPartnerModel.FilterValidationResult>;
|
|
129
|
+
/**
|
|
130
|
+
* @param {WebhookPartnerValidator.ValidateReducerConfigurationParam} arg -
|
|
131
|
+
* Arg object.
|
|
132
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
133
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
134
|
+
* @returns {Promise<WebhookPartnerModel.ReducerValidationResult>} - Success response
|
|
135
|
+
* @name validateReducerConfiguration
|
|
136
|
+
* @summary: Validate reducer configuration.
|
|
137
|
+
* @description: Validate a reducer configuration against sample payload data.
|
|
138
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/validateReducerConfiguration/).
|
|
139
|
+
*/
|
|
140
|
+
validateReducerConfiguration({ extensionId, body, requestHeaders }?: WebhookPartnerValidator.ValidateReducerConfigurationParam, { responseHeaders }?: object): Promise<WebhookPartnerModel.ReducerValidationResult>;
|
|
141
|
+
/**
|
|
142
|
+
* @param {WebhookPartnerValidator.SaveFilterReducerConfigurationParam} arg
|
|
143
|
+
* - Arg object.
|
|
144
|
+
*
|
|
145
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
146
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
147
|
+
* @returns {Promise<WebhookPartnerModel.FilterReducerSaveResult>} - Success response
|
|
148
|
+
* @name saveFilterReducerConfiguration
|
|
149
|
+
* @summary: Save filter or reducer configuration.
|
|
150
|
+
* @description: Save filter and/or reducer configuration for a subscriber event mapping.
|
|
151
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/saveFilterReducerConfiguration/).
|
|
152
|
+
*/
|
|
153
|
+
saveFilterReducerConfiguration({ extensionId, companyId, subscriberId, body, requestHeaders }?: WebhookPartnerValidator.SaveFilterReducerConfigurationParam, { responseHeaders }?: object): Promise<WebhookPartnerModel.FilterReducerSaveResult>;
|
|
108
154
|
}
|
|
109
155
|
import WebhookPartnerModel = require("./WebhookPartnerModel");
|
|
@@ -438,6 +438,85 @@ class Webhook {
|
|
|
438
438
|
return response;
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
+
/**
|
|
442
|
+
* @param {WebhookPartnerValidator.DownloadDeliveryReportParam} arg - Arg object.
|
|
443
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
444
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
445
|
+
* @returns {Promise<WebhookPartnerModel.DownloadReportResult>} - Success response
|
|
446
|
+
* @name downloadDeliveryReport
|
|
447
|
+
* @summary: Download webhook delivery report
|
|
448
|
+
* @description: Download webhook delivery report - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/downloadDeliveryReport/).
|
|
449
|
+
*/
|
|
450
|
+
async downloadDeliveryReport(
|
|
451
|
+
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
452
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
453
|
+
) {
|
|
454
|
+
const { error } = WebhookPartnerValidator.downloadDeliveryReport().validate(
|
|
455
|
+
{
|
|
456
|
+
extensionId,
|
|
457
|
+
body,
|
|
458
|
+
},
|
|
459
|
+
{ abortEarly: false, allowUnknown: true }
|
|
460
|
+
);
|
|
461
|
+
if (error) {
|
|
462
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Showing warrnings if extra unknown parameters are found
|
|
466
|
+
const {
|
|
467
|
+
error: warrning,
|
|
468
|
+
} = WebhookPartnerValidator.downloadDeliveryReport().validate(
|
|
469
|
+
{
|
|
470
|
+
extensionId,
|
|
471
|
+
body,
|
|
472
|
+
},
|
|
473
|
+
{ abortEarly: false, allowUnknown: false }
|
|
474
|
+
);
|
|
475
|
+
if (warrning) {
|
|
476
|
+
Logger({
|
|
477
|
+
level: "WARN",
|
|
478
|
+
message: `Parameter Validation warrnings for partner > Webhook > downloadDeliveryReport \n ${warrning}`,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const query_params = {};
|
|
483
|
+
|
|
484
|
+
const response = await PartnerAPIClient.execute(
|
|
485
|
+
this.config,
|
|
486
|
+
"post",
|
|
487
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/download`,
|
|
488
|
+
query_params,
|
|
489
|
+
body,
|
|
490
|
+
requestHeaders,
|
|
491
|
+
{ responseHeaders }
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
let responseData = response;
|
|
495
|
+
if (responseHeaders) {
|
|
496
|
+
responseData = response[0];
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const {
|
|
500
|
+
error: res_error,
|
|
501
|
+
} = WebhookPartnerModel.DownloadReportResult().validate(responseData, {
|
|
502
|
+
abortEarly: false,
|
|
503
|
+
allowUnknown: true,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
if (res_error) {
|
|
507
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
508
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
509
|
+
} else {
|
|
510
|
+
Logger({
|
|
511
|
+
level: "WARN",
|
|
512
|
+
message: `Response Validation Warnings for partner > Webhook > downloadDeliveryReport \n ${res_error}`,
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return response;
|
|
518
|
+
}
|
|
519
|
+
|
|
441
520
|
/**
|
|
442
521
|
* @param {WebhookPartnerValidator.CancelReportDownloadParam} arg - Arg object.
|
|
443
522
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -834,5 +913,260 @@ class Webhook {
|
|
|
834
913
|
|
|
835
914
|
return response;
|
|
836
915
|
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* @param {WebhookPartnerValidator.ValidateFilterConfigurationParam} arg - Arg object.
|
|
919
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
920
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
921
|
+
* @returns {Promise<WebhookPartnerModel.FilterValidationResult>} - Success response
|
|
922
|
+
* @name validateFilterConfiguration
|
|
923
|
+
* @summary: Validate filter configuration.
|
|
924
|
+
* @description: Validate a filter configuration against sample payload data.
|
|
925
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/validateFilterConfiguration/).
|
|
926
|
+
*/
|
|
927
|
+
async validateFilterConfiguration(
|
|
928
|
+
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
929
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
930
|
+
) {
|
|
931
|
+
const {
|
|
932
|
+
error,
|
|
933
|
+
} = WebhookPartnerValidator.validateFilterConfiguration().validate(
|
|
934
|
+
{
|
|
935
|
+
extensionId,
|
|
936
|
+
body,
|
|
937
|
+
},
|
|
938
|
+
{ abortEarly: false, allowUnknown: true }
|
|
939
|
+
);
|
|
940
|
+
if (error) {
|
|
941
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// Showing warrnings if extra unknown parameters are found
|
|
945
|
+
const {
|
|
946
|
+
error: warrning,
|
|
947
|
+
} = WebhookPartnerValidator.validateFilterConfiguration().validate(
|
|
948
|
+
{
|
|
949
|
+
extensionId,
|
|
950
|
+
body,
|
|
951
|
+
},
|
|
952
|
+
{ abortEarly: false, allowUnknown: false }
|
|
953
|
+
);
|
|
954
|
+
if (warrning) {
|
|
955
|
+
Logger({
|
|
956
|
+
level: "WARN",
|
|
957
|
+
message: `Parameter Validation warrnings for partner > Webhook > validateFilterConfiguration \n ${warrning}`,
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
const query_params = {};
|
|
962
|
+
|
|
963
|
+
const response = await PartnerAPIClient.execute(
|
|
964
|
+
this.config,
|
|
965
|
+
"post",
|
|
966
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/validate/filter`,
|
|
967
|
+
query_params,
|
|
968
|
+
body,
|
|
969
|
+
requestHeaders,
|
|
970
|
+
{ responseHeaders }
|
|
971
|
+
);
|
|
972
|
+
|
|
973
|
+
let responseData = response;
|
|
974
|
+
if (responseHeaders) {
|
|
975
|
+
responseData = response[0];
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
const {
|
|
979
|
+
error: res_error,
|
|
980
|
+
} = WebhookPartnerModel.FilterValidationResult().validate(responseData, {
|
|
981
|
+
abortEarly: false,
|
|
982
|
+
allowUnknown: true,
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
if (res_error) {
|
|
986
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
987
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
988
|
+
} else {
|
|
989
|
+
Logger({
|
|
990
|
+
level: "WARN",
|
|
991
|
+
message: `Response Validation Warnings for partner > Webhook > validateFilterConfiguration \n ${res_error}`,
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
return response;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* @param {WebhookPartnerValidator.ValidateReducerConfigurationParam} arg -
|
|
1001
|
+
* Arg object.
|
|
1002
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1003
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
1004
|
+
* @returns {Promise<WebhookPartnerModel.ReducerValidationResult>} - Success response
|
|
1005
|
+
* @name validateReducerConfiguration
|
|
1006
|
+
* @summary: Validate reducer configuration.
|
|
1007
|
+
* @description: Validate a reducer configuration against sample payload data.
|
|
1008
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/validateReducerConfiguration/).
|
|
1009
|
+
*/
|
|
1010
|
+
async validateReducerConfiguration(
|
|
1011
|
+
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
1012
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1013
|
+
) {
|
|
1014
|
+
const {
|
|
1015
|
+
error,
|
|
1016
|
+
} = WebhookPartnerValidator.validateReducerConfiguration().validate(
|
|
1017
|
+
{
|
|
1018
|
+
extensionId,
|
|
1019
|
+
body,
|
|
1020
|
+
},
|
|
1021
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1022
|
+
);
|
|
1023
|
+
if (error) {
|
|
1024
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1028
|
+
const {
|
|
1029
|
+
error: warrning,
|
|
1030
|
+
} = WebhookPartnerValidator.validateReducerConfiguration().validate(
|
|
1031
|
+
{
|
|
1032
|
+
extensionId,
|
|
1033
|
+
body,
|
|
1034
|
+
},
|
|
1035
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1036
|
+
);
|
|
1037
|
+
if (warrning) {
|
|
1038
|
+
Logger({
|
|
1039
|
+
level: "WARN",
|
|
1040
|
+
message: `Parameter Validation warrnings for partner > Webhook > validateReducerConfiguration \n ${warrning}`,
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
const query_params = {};
|
|
1045
|
+
|
|
1046
|
+
const response = await PartnerAPIClient.execute(
|
|
1047
|
+
this.config,
|
|
1048
|
+
"post",
|
|
1049
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/validate/reducer`,
|
|
1050
|
+
query_params,
|
|
1051
|
+
body,
|
|
1052
|
+
requestHeaders,
|
|
1053
|
+
{ responseHeaders }
|
|
1054
|
+
);
|
|
1055
|
+
|
|
1056
|
+
let responseData = response;
|
|
1057
|
+
if (responseHeaders) {
|
|
1058
|
+
responseData = response[0];
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
const {
|
|
1062
|
+
error: res_error,
|
|
1063
|
+
} = WebhookPartnerModel.ReducerValidationResult().validate(responseData, {
|
|
1064
|
+
abortEarly: false,
|
|
1065
|
+
allowUnknown: true,
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
if (res_error) {
|
|
1069
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1070
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1071
|
+
} else {
|
|
1072
|
+
Logger({
|
|
1073
|
+
level: "WARN",
|
|
1074
|
+
message: `Response Validation Warnings for partner > Webhook > validateReducerConfiguration \n ${res_error}`,
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
return response;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* @param {WebhookPartnerValidator.SaveFilterReducerConfigurationParam} arg
|
|
1084
|
+
* - Arg object.
|
|
1085
|
+
*
|
|
1086
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1087
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
1088
|
+
* @returns {Promise<WebhookPartnerModel.FilterReducerSaveResult>} - Success response
|
|
1089
|
+
* @name saveFilterReducerConfiguration
|
|
1090
|
+
* @summary: Save filter or reducer configuration.
|
|
1091
|
+
* @description: Save filter and/or reducer configuration for a subscriber event mapping.
|
|
1092
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/saveFilterReducerConfiguration/).
|
|
1093
|
+
*/
|
|
1094
|
+
async saveFilterReducerConfiguration(
|
|
1095
|
+
{ extensionId, companyId, subscriberId, body, requestHeaders } = {
|
|
1096
|
+
requestHeaders: {},
|
|
1097
|
+
},
|
|
1098
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1099
|
+
) {
|
|
1100
|
+
const {
|
|
1101
|
+
error,
|
|
1102
|
+
} = WebhookPartnerValidator.saveFilterReducerConfiguration().validate(
|
|
1103
|
+
{
|
|
1104
|
+
extensionId,
|
|
1105
|
+
companyId,
|
|
1106
|
+
subscriberId,
|
|
1107
|
+
body,
|
|
1108
|
+
},
|
|
1109
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1110
|
+
);
|
|
1111
|
+
if (error) {
|
|
1112
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1116
|
+
const {
|
|
1117
|
+
error: warrning,
|
|
1118
|
+
} = WebhookPartnerValidator.saveFilterReducerConfiguration().validate(
|
|
1119
|
+
{
|
|
1120
|
+
extensionId,
|
|
1121
|
+
companyId,
|
|
1122
|
+
subscriberId,
|
|
1123
|
+
body,
|
|
1124
|
+
},
|
|
1125
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1126
|
+
);
|
|
1127
|
+
if (warrning) {
|
|
1128
|
+
Logger({
|
|
1129
|
+
level: "WARN",
|
|
1130
|
+
message: `Parameter Validation warrnings for partner > Webhook > saveFilterReducerConfiguration \n ${warrning}`,
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
const query_params = {};
|
|
1135
|
+
|
|
1136
|
+
const response = await PartnerAPIClient.execute(
|
|
1137
|
+
this.config,
|
|
1138
|
+
"put",
|
|
1139
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/company/${companyId}/subscriber/${subscriberId}/filter_reducer`,
|
|
1140
|
+
query_params,
|
|
1141
|
+
body,
|
|
1142
|
+
requestHeaders,
|
|
1143
|
+
{ responseHeaders }
|
|
1144
|
+
);
|
|
1145
|
+
|
|
1146
|
+
let responseData = response;
|
|
1147
|
+
if (responseHeaders) {
|
|
1148
|
+
responseData = response[0];
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
const {
|
|
1152
|
+
error: res_error,
|
|
1153
|
+
} = WebhookPartnerModel.FilterReducerSaveResult().validate(responseData, {
|
|
1154
|
+
abortEarly: false,
|
|
1155
|
+
allowUnknown: true,
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
if (res_error) {
|
|
1159
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1160
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1161
|
+
} else {
|
|
1162
|
+
Logger({
|
|
1163
|
+
level: "WARN",
|
|
1164
|
+
message: `Response Validation Warnings for partner > Webhook > saveFilterReducerConfiguration \n ${res_error}`,
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
return response;
|
|
1170
|
+
}
|
|
837
1171
|
}
|
|
838
1172
|
module.exports = Webhook;
|
|
@@ -1,4 +1,72 @@
|
|
|
1
1
|
export = WebhookPartnerModel;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef ReportDownloadPayload
|
|
4
|
+
* @property {string} end_date - The end date and time for the report, in ISO 8601 format.
|
|
5
|
+
* @property {string} start_date - The start date and time for the report, in
|
|
6
|
+
* ISO 8601 format.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef DownloadReportResult
|
|
10
|
+
* @property {string} [file_name] - The generated report file name.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef FilterValidationPayload
|
|
14
|
+
* @property {Object} sample_data - Sample payload used to validate the filter logic.
|
|
15
|
+
* @property {FilterValidationSchema} filters
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @typedef ReducerValidationPayload
|
|
19
|
+
* @property {Object} sample_data - Sample payload used to validate the reducer mapping.
|
|
20
|
+
* @property {Object} reducer - The reducer property allows users to customize
|
|
21
|
+
* the JSON structure of the webhook payload using JSONPath queries.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef FilterReducerSave
|
|
25
|
+
* @property {FilterSaveSchema} [filter_configuration]
|
|
26
|
+
* @property {Object} [reducer_configuration] - The reducer property allows
|
|
27
|
+
* users to customize the JSON structure of the webhook payload using JSONPath queries.
|
|
28
|
+
* @property {string} event_slug - Event slug for which filter/reducer is being
|
|
29
|
+
* configured.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @typedef FilterValidationSchema
|
|
33
|
+
* @property {string} [query] - JSONPath expression to extract a value from
|
|
34
|
+
* sample payload.
|
|
35
|
+
* @property {string} [condition] - JavaScript condition function evaluated for
|
|
36
|
+
* the extracted value.
|
|
37
|
+
* @property {string} [logic] - Logical operator for combining nested filter conditions.
|
|
38
|
+
* @property {Object[]} [conditions] - Nested filter conditions evaluated with
|
|
39
|
+
* the selected logical operator.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* @typedef FilterSaveSchema
|
|
43
|
+
* @property {string} [query] - JSONPath expression to extract a value from event payload.
|
|
44
|
+
* @property {string} [condition] - JavaScript condition function evaluated for
|
|
45
|
+
* the extracted value.
|
|
46
|
+
* @property {string} [logic] - Logical operator for combining nested filter conditions.
|
|
47
|
+
* @property {Object[]} [conditions] - Nested filter conditions evaluated with
|
|
48
|
+
* the selected logical operator.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @typedef FilterValidationResult
|
|
52
|
+
* @property {boolean} [success] - Indicates if the filter validation succeeded.
|
|
53
|
+
* @property {string} [message] - Additional details about filter validation result.
|
|
54
|
+
* @property {boolean} [filter_result] - Evaluated result of the filter condition.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* @typedef ReducerValidationResult
|
|
58
|
+
* @property {boolean} [success] - Indicates if the reducer validation succeeded.
|
|
59
|
+
* @property {string} [message] - Additional details about reducer validation result.
|
|
60
|
+
* @property {Object} [reducer_result] - Result produced by applying reducer
|
|
61
|
+
* mapping on sample data.
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* @typedef FilterReducerSaveResult
|
|
65
|
+
* @property {boolean} [success] - Indicates if filter/reducer configuration was
|
|
66
|
+
* saved successfully.
|
|
67
|
+
* @property {string} [message] - Additional details about save operation result.
|
|
68
|
+
* @property {Object} [data] - Additional response payload returned by the save operation.
|
|
69
|
+
*/
|
|
2
70
|
/**
|
|
3
71
|
* @typedef SubscriberUpdate
|
|
4
72
|
* @property {string} [status] - Represents the status of the subscriber update operation.
|
|
@@ -323,8 +391,161 @@ export = WebhookPartnerModel;
|
|
|
323
391
|
declare class WebhookPartnerModel {
|
|
324
392
|
}
|
|
325
393
|
declare namespace WebhookPartnerModel {
|
|
326
|
-
export { SubscriberUpdate, SubscriberUpdateResult, Association, AuthMeta, BroadcasterConfig, SubscriberEventMapping, FilterSchema, EventConfigDetails, SubscriberConfigDetails, InvalidEventsPayload, InvalidEventsResult, HistoryFilters, Url, CdnObject, UploadServiceObject, HistoryAssociation, HistoryItems, HistoryResult, HistoryPayload, CancelDownloadResult, FilterReportResult, DeliveryTsResult, DeliveryTsSchema, DeliveryDetailsPayload, EventDeliveryDetailSchema, DeliveryDetailsResult, EventProcessReportObject, Page, DeliveryEventLevelSchema, ResponseTimeTs, AvgResponseTime, DeliverySummaryResult, DeliverySummarySchema, ItemSchema };
|
|
394
|
+
export { ReportDownloadPayload, DownloadReportResult, FilterValidationPayload, ReducerValidationPayload, FilterReducerSave, FilterValidationSchema, FilterSaveSchema, FilterValidationResult, ReducerValidationResult, FilterReducerSaveResult, SubscriberUpdate, SubscriberUpdateResult, Association, AuthMeta, BroadcasterConfig, SubscriberEventMapping, FilterSchema, EventConfigDetails, SubscriberConfigDetails, InvalidEventsPayload, InvalidEventsResult, HistoryFilters, Url, CdnObject, UploadServiceObject, HistoryAssociation, HistoryItems, HistoryResult, HistoryPayload, CancelDownloadResult, FilterReportResult, DeliveryTsResult, DeliveryTsSchema, DeliveryDetailsPayload, EventDeliveryDetailSchema, DeliveryDetailsResult, EventProcessReportObject, Page, DeliveryEventLevelSchema, ResponseTimeTs, AvgResponseTime, DeliverySummaryResult, DeliverySummarySchema, ItemSchema };
|
|
327
395
|
}
|
|
396
|
+
/** @returns {ReportDownloadPayload} */
|
|
397
|
+
declare function ReportDownloadPayload(): ReportDownloadPayload;
|
|
398
|
+
type ReportDownloadPayload = {
|
|
399
|
+
/**
|
|
400
|
+
* - The end date and time for the report, in ISO 8601 format.
|
|
401
|
+
*/
|
|
402
|
+
end_date: string;
|
|
403
|
+
/**
|
|
404
|
+
* - The start date and time for the report, in
|
|
405
|
+
* ISO 8601 format.
|
|
406
|
+
*/
|
|
407
|
+
start_date: string;
|
|
408
|
+
};
|
|
409
|
+
/** @returns {DownloadReportResult} */
|
|
410
|
+
declare function DownloadReportResult(): DownloadReportResult;
|
|
411
|
+
type DownloadReportResult = {
|
|
412
|
+
/**
|
|
413
|
+
* - The generated report file name.
|
|
414
|
+
*/
|
|
415
|
+
file_name?: string;
|
|
416
|
+
};
|
|
417
|
+
/** @returns {FilterValidationPayload} */
|
|
418
|
+
declare function FilterValidationPayload(): FilterValidationPayload;
|
|
419
|
+
type FilterValidationPayload = {
|
|
420
|
+
/**
|
|
421
|
+
* - Sample payload used to validate the filter logic.
|
|
422
|
+
*/
|
|
423
|
+
sample_data: any;
|
|
424
|
+
filters: FilterValidationSchema;
|
|
425
|
+
};
|
|
426
|
+
/** @returns {ReducerValidationPayload} */
|
|
427
|
+
declare function ReducerValidationPayload(): ReducerValidationPayload;
|
|
428
|
+
type ReducerValidationPayload = {
|
|
429
|
+
/**
|
|
430
|
+
* - Sample payload used to validate the reducer mapping.
|
|
431
|
+
*/
|
|
432
|
+
sample_data: any;
|
|
433
|
+
/**
|
|
434
|
+
* - The reducer property allows users to customize
|
|
435
|
+
* the JSON structure of the webhook payload using JSONPath queries.
|
|
436
|
+
*/
|
|
437
|
+
reducer: any;
|
|
438
|
+
};
|
|
439
|
+
/** @returns {FilterReducerSave} */
|
|
440
|
+
declare function FilterReducerSave(): FilterReducerSave;
|
|
441
|
+
type FilterReducerSave = {
|
|
442
|
+
filter_configuration?: FilterSaveSchema;
|
|
443
|
+
/**
|
|
444
|
+
* - The reducer property allows
|
|
445
|
+
* users to customize the JSON structure of the webhook payload using JSONPath queries.
|
|
446
|
+
*/
|
|
447
|
+
reducer_configuration?: any;
|
|
448
|
+
/**
|
|
449
|
+
* - Event slug for which filter/reducer is being
|
|
450
|
+
* configured.
|
|
451
|
+
*/
|
|
452
|
+
event_slug: string;
|
|
453
|
+
};
|
|
454
|
+
/** @returns {FilterValidationSchema} */
|
|
455
|
+
declare function FilterValidationSchema(): FilterValidationSchema;
|
|
456
|
+
type FilterValidationSchema = {
|
|
457
|
+
/**
|
|
458
|
+
* - JSONPath expression to extract a value from
|
|
459
|
+
* sample payload.
|
|
460
|
+
*/
|
|
461
|
+
query?: string;
|
|
462
|
+
/**
|
|
463
|
+
* - JavaScript condition function evaluated for
|
|
464
|
+
* the extracted value.
|
|
465
|
+
*/
|
|
466
|
+
condition?: string;
|
|
467
|
+
/**
|
|
468
|
+
* - Logical operator for combining nested filter conditions.
|
|
469
|
+
*/
|
|
470
|
+
logic?: string;
|
|
471
|
+
/**
|
|
472
|
+
* - Nested filter conditions evaluated with
|
|
473
|
+
* the selected logical operator.
|
|
474
|
+
*/
|
|
475
|
+
conditions?: any[];
|
|
476
|
+
};
|
|
477
|
+
/** @returns {FilterSaveSchema} */
|
|
478
|
+
declare function FilterSaveSchema(): FilterSaveSchema;
|
|
479
|
+
type FilterSaveSchema = {
|
|
480
|
+
/**
|
|
481
|
+
* - JSONPath expression to extract a value from event payload.
|
|
482
|
+
*/
|
|
483
|
+
query?: string;
|
|
484
|
+
/**
|
|
485
|
+
* - JavaScript condition function evaluated for
|
|
486
|
+
* the extracted value.
|
|
487
|
+
*/
|
|
488
|
+
condition?: string;
|
|
489
|
+
/**
|
|
490
|
+
* - Logical operator for combining nested filter conditions.
|
|
491
|
+
*/
|
|
492
|
+
logic?: string;
|
|
493
|
+
/**
|
|
494
|
+
* - Nested filter conditions evaluated with
|
|
495
|
+
* the selected logical operator.
|
|
496
|
+
*/
|
|
497
|
+
conditions?: any[];
|
|
498
|
+
};
|
|
499
|
+
/** @returns {FilterValidationResult} */
|
|
500
|
+
declare function FilterValidationResult(): FilterValidationResult;
|
|
501
|
+
type FilterValidationResult = {
|
|
502
|
+
/**
|
|
503
|
+
* - Indicates if the filter validation succeeded.
|
|
504
|
+
*/
|
|
505
|
+
success?: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* - Additional details about filter validation result.
|
|
508
|
+
*/
|
|
509
|
+
message?: string;
|
|
510
|
+
/**
|
|
511
|
+
* - Evaluated result of the filter condition.
|
|
512
|
+
*/
|
|
513
|
+
filter_result?: boolean;
|
|
514
|
+
};
|
|
515
|
+
/** @returns {ReducerValidationResult} */
|
|
516
|
+
declare function ReducerValidationResult(): ReducerValidationResult;
|
|
517
|
+
type ReducerValidationResult = {
|
|
518
|
+
/**
|
|
519
|
+
* - Indicates if the reducer validation succeeded.
|
|
520
|
+
*/
|
|
521
|
+
success?: boolean;
|
|
522
|
+
/**
|
|
523
|
+
* - Additional details about reducer validation result.
|
|
524
|
+
*/
|
|
525
|
+
message?: string;
|
|
526
|
+
/**
|
|
527
|
+
* - Result produced by applying reducer
|
|
528
|
+
* mapping on sample data.
|
|
529
|
+
*/
|
|
530
|
+
reducer_result?: any;
|
|
531
|
+
};
|
|
532
|
+
/** @returns {FilterReducerSaveResult} */
|
|
533
|
+
declare function FilterReducerSaveResult(): FilterReducerSaveResult;
|
|
534
|
+
type FilterReducerSaveResult = {
|
|
535
|
+
/**
|
|
536
|
+
* - Indicates if filter/reducer configuration was
|
|
537
|
+
* saved successfully.
|
|
538
|
+
*/
|
|
539
|
+
success?: boolean;
|
|
540
|
+
/**
|
|
541
|
+
* - Additional details about save operation result.
|
|
542
|
+
*/
|
|
543
|
+
message?: string;
|
|
544
|
+
/**
|
|
545
|
+
* - Additional response payload returned by the save operation.
|
|
546
|
+
*/
|
|
547
|
+
data?: any;
|
|
548
|
+
};
|
|
328
549
|
/** @returns {SubscriberUpdate} */
|
|
329
550
|
declare function SubscriberUpdate(): SubscriberUpdate;
|
|
330
551
|
type SubscriberUpdate = {
|
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
const Joi = require("joi");
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @typedef ReportDownloadPayload
|
|
5
|
+
* @property {string} end_date - The end date and time for the report, in ISO 8601 format.
|
|
6
|
+
* @property {string} start_date - The start date and time for the report, in
|
|
7
|
+
* ISO 8601 format.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef DownloadReportResult
|
|
12
|
+
* @property {string} [file_name] - The generated report file name.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef FilterValidationPayload
|
|
17
|
+
* @property {Object} sample_data - Sample payload used to validate the filter logic.
|
|
18
|
+
* @property {FilterValidationSchema} filters
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef ReducerValidationPayload
|
|
23
|
+
* @property {Object} sample_data - Sample payload used to validate the reducer mapping.
|
|
24
|
+
* @property {Object} reducer - The reducer property allows users to customize
|
|
25
|
+
* the JSON structure of the webhook payload using JSONPath queries.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @typedef FilterReducerSave
|
|
30
|
+
* @property {FilterSaveSchema} [filter_configuration]
|
|
31
|
+
* @property {Object} [reducer_configuration] - The reducer property allows
|
|
32
|
+
* users to customize the JSON structure of the webhook payload using JSONPath queries.
|
|
33
|
+
* @property {string} event_slug - Event slug for which filter/reducer is being
|
|
34
|
+
* configured.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @typedef FilterValidationSchema
|
|
39
|
+
* @property {string} [query] - JSONPath expression to extract a value from
|
|
40
|
+
* sample payload.
|
|
41
|
+
* @property {string} [condition] - JavaScript condition function evaluated for
|
|
42
|
+
* the extracted value.
|
|
43
|
+
* @property {string} [logic] - Logical operator for combining nested filter conditions.
|
|
44
|
+
* @property {Object[]} [conditions] - Nested filter conditions evaluated with
|
|
45
|
+
* the selected logical operator.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @typedef FilterSaveSchema
|
|
50
|
+
* @property {string} [query] - JSONPath expression to extract a value from event payload.
|
|
51
|
+
* @property {string} [condition] - JavaScript condition function evaluated for
|
|
52
|
+
* the extracted value.
|
|
53
|
+
* @property {string} [logic] - Logical operator for combining nested filter conditions.
|
|
54
|
+
* @property {Object[]} [conditions] - Nested filter conditions evaluated with
|
|
55
|
+
* the selected logical operator.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @typedef FilterValidationResult
|
|
60
|
+
* @property {boolean} [success] - Indicates if the filter validation succeeded.
|
|
61
|
+
* @property {string} [message] - Additional details about filter validation result.
|
|
62
|
+
* @property {boolean} [filter_result] - Evaluated result of the filter condition.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @typedef ReducerValidationResult
|
|
67
|
+
* @property {boolean} [success] - Indicates if the reducer validation succeeded.
|
|
68
|
+
* @property {string} [message] - Additional details about reducer validation result.
|
|
69
|
+
* @property {Object} [reducer_result] - Result produced by applying reducer
|
|
70
|
+
* mapping on sample data.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @typedef FilterReducerSaveResult
|
|
75
|
+
* @property {boolean} [success] - Indicates if filter/reducer configuration was
|
|
76
|
+
* saved successfully.
|
|
77
|
+
* @property {string} [message] - Additional details about save operation result.
|
|
78
|
+
* @property {Object} [data] - Additional response payload returned by the save operation.
|
|
79
|
+
*/
|
|
80
|
+
|
|
3
81
|
/**
|
|
4
82
|
* @typedef SubscriberUpdate
|
|
5
83
|
* @property {string} [status] - Represents the status of the subscriber update operation.
|
|
@@ -356,6 +434,93 @@ const Joi = require("joi");
|
|
|
356
434
|
*/
|
|
357
435
|
|
|
358
436
|
class WebhookPartnerModel {
|
|
437
|
+
/** @returns {ReportDownloadPayload} */
|
|
438
|
+
static ReportDownloadPayload() {
|
|
439
|
+
return Joi.object({
|
|
440
|
+
end_date: Joi.string().allow("").required(),
|
|
441
|
+
start_date: Joi.string().allow("").required(),
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** @returns {DownloadReportResult} */
|
|
446
|
+
static DownloadReportResult() {
|
|
447
|
+
return Joi.object({
|
|
448
|
+
file_name: Joi.string().allow(""),
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** @returns {FilterValidationPayload} */
|
|
453
|
+
static FilterValidationPayload() {
|
|
454
|
+
return Joi.object({
|
|
455
|
+
sample_data: Joi.object().pattern(/\S/, Joi.any()).required(),
|
|
456
|
+
filters: WebhookPartnerModel.FilterValidationSchema().required(),
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** @returns {ReducerValidationPayload} */
|
|
461
|
+
static ReducerValidationPayload() {
|
|
462
|
+
return Joi.object({
|
|
463
|
+
sample_data: Joi.object().pattern(/\S/, Joi.any()).required(),
|
|
464
|
+
reducer: Joi.object().pattern(/\S/, Joi.any()).required(),
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** @returns {FilterReducerSave} */
|
|
469
|
+
static FilterReducerSave() {
|
|
470
|
+
return Joi.object({
|
|
471
|
+
filter_configuration: WebhookPartnerModel.FilterSaveSchema(),
|
|
472
|
+
reducer_configuration: Joi.object().pattern(/\S/, Joi.any()),
|
|
473
|
+
event_slug: Joi.string().allow("").required(),
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/** @returns {FilterValidationSchema} */
|
|
478
|
+
static FilterValidationSchema() {
|
|
479
|
+
return Joi.object({
|
|
480
|
+
query: Joi.string().allow(""),
|
|
481
|
+
condition: Joi.string().allow(""),
|
|
482
|
+
logic: Joi.string().allow(""),
|
|
483
|
+
conditions: Joi.array().items(Joi.object().pattern(/\S/, Joi.any())),
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** @returns {FilterSaveSchema} */
|
|
488
|
+
static FilterSaveSchema() {
|
|
489
|
+
return Joi.object({
|
|
490
|
+
query: Joi.string().allow(""),
|
|
491
|
+
condition: Joi.string().allow(""),
|
|
492
|
+
logic: Joi.string().allow(""),
|
|
493
|
+
conditions: Joi.array().items(Joi.object().pattern(/\S/, Joi.any())),
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** @returns {FilterValidationResult} */
|
|
498
|
+
static FilterValidationResult() {
|
|
499
|
+
return Joi.object({
|
|
500
|
+
success: Joi.boolean(),
|
|
501
|
+
message: Joi.string().allow(""),
|
|
502
|
+
filter_result: Joi.boolean(),
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/** @returns {ReducerValidationResult} */
|
|
507
|
+
static ReducerValidationResult() {
|
|
508
|
+
return Joi.object({
|
|
509
|
+
success: Joi.boolean(),
|
|
510
|
+
message: Joi.string().allow(""),
|
|
511
|
+
reducer_result: Joi.object().pattern(/\S/, Joi.any()),
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** @returns {FilterReducerSaveResult} */
|
|
516
|
+
static FilterReducerSaveResult() {
|
|
517
|
+
return Joi.object({
|
|
518
|
+
success: Joi.boolean(),
|
|
519
|
+
message: Joi.string().allow(""),
|
|
520
|
+
data: Joi.object().pattern(/\S/, Joi.any()),
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
|
|
359
524
|
/** @returns {SubscriberUpdate} */
|
|
360
525
|
static SubscriberUpdate() {
|
|
361
526
|
return Joi.object({
|
|
@@ -5,9 +5,13 @@ declare class WebhookValidator {
|
|
|
5
5
|
static getDeliveryDetailInsights(): any;
|
|
6
6
|
static fetchDeliveryTs(): any;
|
|
7
7
|
static fetchReportFilters(): any;
|
|
8
|
+
static downloadDeliveryReport(): any;
|
|
8
9
|
static cancelReportDownload(): any;
|
|
9
10
|
static getHistoricalReports(): any;
|
|
10
11
|
static getInvalidEventList(): any;
|
|
11
12
|
static fetchSubscribers(): any;
|
|
12
13
|
static updateSubscriber(): any;
|
|
14
|
+
static validateFilterConfiguration(): any;
|
|
15
|
+
static validateReducerConfiguration(): any;
|
|
16
|
+
static saveFilterReducerConfiguration(): any;
|
|
13
17
|
}
|
|
@@ -43,6 +43,13 @@ class WebhookValidator {
|
|
|
43
43
|
}).required();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
static downloadDeliveryReport() {
|
|
47
|
+
return Joi.object({
|
|
48
|
+
extensionId: Joi.string().allow("").required(),
|
|
49
|
+
body: WebhookModel.ReportDownloadPayload().required(),
|
|
50
|
+
}).required();
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
static cancelReportDownload() {
|
|
47
54
|
return Joi.object({
|
|
48
55
|
extensionId: Joi.string().allow("").required(),
|
|
@@ -77,6 +84,29 @@ class WebhookValidator {
|
|
|
77
84
|
body: WebhookModel.SubscriberUpdate().required(),
|
|
78
85
|
}).required();
|
|
79
86
|
}
|
|
87
|
+
|
|
88
|
+
static validateFilterConfiguration() {
|
|
89
|
+
return Joi.object({
|
|
90
|
+
extensionId: Joi.string().allow("").required(),
|
|
91
|
+
body: WebhookModel.FilterValidationPayload().required(),
|
|
92
|
+
}).required();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static validateReducerConfiguration() {
|
|
96
|
+
return Joi.object({
|
|
97
|
+
extensionId: Joi.string().allow("").required(),
|
|
98
|
+
body: WebhookModel.ReducerValidationPayload().required(),
|
|
99
|
+
}).required();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static saveFilterReducerConfiguration() {
|
|
103
|
+
return Joi.object({
|
|
104
|
+
extensionId: Joi.string().allow("").required(),
|
|
105
|
+
companyId: Joi.number().required(),
|
|
106
|
+
subscriberId: Joi.number().required(),
|
|
107
|
+
body: WebhookModel.FilterReducerSave().required(),
|
|
108
|
+
}).required();
|
|
109
|
+
}
|
|
80
110
|
}
|
|
81
111
|
|
|
82
112
|
module.exports = WebhookValidator;
|
|
@@ -2365,14 +2365,14 @@ export = OrderPlatformModel;
|
|
|
2365
2365
|
* @typedef PostHook
|
|
2366
2366
|
* @property {string} task - Name of the hook that has to be added
|
|
2367
2367
|
* @property {Object} [kwargs] - Additional parameters for the hook
|
|
2368
|
-
* @property {Filter} [
|
|
2368
|
+
* @property {Filter} [filter] - Criteria to filter which hooks are applied
|
|
2369
2369
|
* based on certain conditions.
|
|
2370
2370
|
*/
|
|
2371
2371
|
/**
|
|
2372
2372
|
* @typedef PreHook
|
|
2373
2373
|
* @property {string} task - Name of the hook that has to be added
|
|
2374
2374
|
* @property {Object} [kwargs] - Additional parameters for the hook
|
|
2375
|
-
* @property {Filter} [
|
|
2375
|
+
* @property {Filter} [filter] - Criteria to filter which hooks are applied
|
|
2376
2376
|
* based on certain conditions.
|
|
2377
2377
|
*/
|
|
2378
2378
|
/**
|
|
@@ -10323,7 +10323,7 @@ type PostHook = {
|
|
|
10323
10323
|
* - Criteria to filter which hooks are applied
|
|
10324
10324
|
* based on certain conditions.
|
|
10325
10325
|
*/
|
|
10326
|
-
|
|
10326
|
+
filter?: Filter;
|
|
10327
10327
|
};
|
|
10328
10328
|
/** @returns {PreHook} */
|
|
10329
10329
|
declare function PreHook(): PreHook;
|
|
@@ -10340,7 +10340,7 @@ type PreHook = {
|
|
|
10340
10340
|
* - Criteria to filter which hooks are applied
|
|
10341
10341
|
* based on certain conditions.
|
|
10342
10342
|
*/
|
|
10343
|
-
|
|
10343
|
+
filter?: Filter;
|
|
10344
10344
|
};
|
|
10345
10345
|
/** @returns {Config} */
|
|
10346
10346
|
declare function Config(): Config;
|
|
@@ -2576,7 +2576,7 @@ const Joi = require("joi");
|
|
|
2576
2576
|
* @typedef PostHook
|
|
2577
2577
|
* @property {string} task - Name of the hook that has to be added
|
|
2578
2578
|
* @property {Object} [kwargs] - Additional parameters for the hook
|
|
2579
|
-
* @property {Filter} [
|
|
2579
|
+
* @property {Filter} [filter] - Criteria to filter which hooks are applied
|
|
2580
2580
|
* based on certain conditions.
|
|
2581
2581
|
*/
|
|
2582
2582
|
|
|
@@ -2584,7 +2584,7 @@ const Joi = require("joi");
|
|
|
2584
2584
|
* @typedef PreHook
|
|
2585
2585
|
* @property {string} task - Name of the hook that has to be added
|
|
2586
2586
|
* @property {Object} [kwargs] - Additional parameters for the hook
|
|
2587
|
-
* @property {Filter} [
|
|
2587
|
+
* @property {Filter} [filter] - Criteria to filter which hooks are applied
|
|
2588
2588
|
* based on certain conditions.
|
|
2589
2589
|
*/
|
|
2590
2590
|
|
|
@@ -8399,7 +8399,7 @@ class OrderPlatformModel {
|
|
|
8399
8399
|
return Joi.object({
|
|
8400
8400
|
task: Joi.string().allow("").required(),
|
|
8401
8401
|
kwargs: Joi.object().pattern(/\S/, Joi.any()),
|
|
8402
|
-
|
|
8402
|
+
filter: OrderPlatformModel.Filter(),
|
|
8403
8403
|
});
|
|
8404
8404
|
}
|
|
8405
8405
|
|
|
@@ -8408,7 +8408,7 @@ class OrderPlatformModel {
|
|
|
8408
8408
|
return Joi.object({
|
|
8409
8409
|
task: Joi.string().allow("").required(),
|
|
8410
8410
|
kwargs: Joi.object().pattern(/\S/, Joi.any()),
|
|
8411
|
-
|
|
8411
|
+
filter: OrderPlatformModel.Filter(),
|
|
8412
8412
|
});
|
|
8413
8413
|
}
|
|
8414
8414
|
|
|
@@ -421,6 +421,8 @@ export = UserPlatformModel;
|
|
|
421
421
|
* @property {Object} [meta]
|
|
422
422
|
* @property {string} [external_id]
|
|
423
423
|
* @property {string} [rr_id]
|
|
424
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
425
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
424
426
|
*/
|
|
425
427
|
/**
|
|
426
428
|
* @typedef CreateUserResponseSchema
|
|
@@ -608,6 +610,8 @@ export = UserPlatformModel;
|
|
|
608
610
|
* @typedef UpdateUserRequestSchema
|
|
609
611
|
* @property {string} [first_name]
|
|
610
612
|
* @property {string} [last_name]
|
|
613
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
614
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
611
615
|
* @property {string} [gender]
|
|
612
616
|
* @property {string} [external_id]
|
|
613
617
|
* @property {string} [rr_id]
|
|
@@ -640,7 +644,8 @@ export = UserPlatformModel;
|
|
|
640
644
|
* @property {PhoneNumber[]} [phone_numbers]
|
|
641
645
|
* @property {Email[]} [emails]
|
|
642
646
|
* @property {string} [gender]
|
|
643
|
-
* @property {string} [dob]
|
|
647
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
648
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
644
649
|
* @property {boolean} [active]
|
|
645
650
|
* @property {string} [profile_pic_url]
|
|
646
651
|
* @property {string} [username]
|
|
@@ -662,7 +667,8 @@ export = UserPlatformModel;
|
|
|
662
667
|
* @property {PhoneNumber[]} [phone_numbers]
|
|
663
668
|
* @property {Email[]} [emails]
|
|
664
669
|
* @property {string} [gender]
|
|
665
|
-
* @property {string} [dob]
|
|
670
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
671
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
666
672
|
* @property {boolean} [active]
|
|
667
673
|
* @property {string} [profile_pic_url]
|
|
668
674
|
* @property {string} [username]
|
|
@@ -1550,6 +1556,11 @@ type CreateUserRequestSchema = {
|
|
|
1550
1556
|
meta?: any;
|
|
1551
1557
|
external_id?: string;
|
|
1552
1558
|
rr_id?: string;
|
|
1559
|
+
/**
|
|
1560
|
+
* - User's date of birth in ISO date
|
|
1561
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
1562
|
+
*/
|
|
1563
|
+
dob?: string;
|
|
1553
1564
|
};
|
|
1554
1565
|
/** @returns {CreateUserResponseSchema} */
|
|
1555
1566
|
declare function CreateUserResponseSchema(): CreateUserResponseSchema;
|
|
@@ -1804,6 +1815,11 @@ declare function UpdateUserRequestSchema(): UpdateUserRequestSchema;
|
|
|
1804
1815
|
type UpdateUserRequestSchema = {
|
|
1805
1816
|
first_name?: string;
|
|
1806
1817
|
last_name?: string;
|
|
1818
|
+
/**
|
|
1819
|
+
* - User's date of birth in ISO date
|
|
1820
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
1821
|
+
*/
|
|
1822
|
+
dob?: string;
|
|
1807
1823
|
gender?: string;
|
|
1808
1824
|
external_id?: string;
|
|
1809
1825
|
rr_id?: string;
|
|
@@ -1839,6 +1855,10 @@ type UserSchema = {
|
|
|
1839
1855
|
phone_numbers?: PhoneNumber[];
|
|
1840
1856
|
emails?: Email[];
|
|
1841
1857
|
gender?: string;
|
|
1858
|
+
/**
|
|
1859
|
+
* - User's date of birth in ISO date
|
|
1860
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
1861
|
+
*/
|
|
1842
1862
|
dob?: string;
|
|
1843
1863
|
active?: boolean;
|
|
1844
1864
|
profile_pic_url?: string;
|
|
@@ -1862,6 +1882,10 @@ type UserSearchSchema = {
|
|
|
1862
1882
|
phone_numbers?: PhoneNumber[];
|
|
1863
1883
|
emails?: Email[];
|
|
1864
1884
|
gender?: string;
|
|
1885
|
+
/**
|
|
1886
|
+
* - User's date of birth in ISO date
|
|
1887
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
1888
|
+
*/
|
|
1865
1889
|
dob?: string;
|
|
1866
1890
|
active?: boolean;
|
|
1867
1891
|
profile_pic_url?: string;
|
|
@@ -469,6 +469,8 @@ const Joi = require("joi");
|
|
|
469
469
|
* @property {Object} [meta]
|
|
470
470
|
* @property {string} [external_id]
|
|
471
471
|
* @property {string} [rr_id]
|
|
472
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
473
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
472
474
|
*/
|
|
473
475
|
|
|
474
476
|
/**
|
|
@@ -684,6 +686,8 @@ const Joi = require("joi");
|
|
|
684
686
|
* @typedef UpdateUserRequestSchema
|
|
685
687
|
* @property {string} [first_name]
|
|
686
688
|
* @property {string} [last_name]
|
|
689
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
690
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
687
691
|
* @property {string} [gender]
|
|
688
692
|
* @property {string} [external_id]
|
|
689
693
|
* @property {string} [rr_id]
|
|
@@ -719,7 +723,8 @@ const Joi = require("joi");
|
|
|
719
723
|
* @property {PhoneNumber[]} [phone_numbers]
|
|
720
724
|
* @property {Email[]} [emails]
|
|
721
725
|
* @property {string} [gender]
|
|
722
|
-
* @property {string} [dob]
|
|
726
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
727
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
723
728
|
* @property {boolean} [active]
|
|
724
729
|
* @property {string} [profile_pic_url]
|
|
725
730
|
* @property {string} [username]
|
|
@@ -742,7 +747,8 @@ const Joi = require("joi");
|
|
|
742
747
|
* @property {PhoneNumber[]} [phone_numbers]
|
|
743
748
|
* @property {Email[]} [emails]
|
|
744
749
|
* @property {string} [gender]
|
|
745
|
-
* @property {string} [dob]
|
|
750
|
+
* @property {string} [dob] - User's date of birth in ISO date
|
|
751
|
+
* format("1990-01-01T00:00:00.000Z").
|
|
746
752
|
* @property {boolean} [active]
|
|
747
753
|
* @property {string} [profile_pic_url]
|
|
748
754
|
* @property {string} [username]
|
|
@@ -1307,6 +1313,7 @@ class UserPlatformModel {
|
|
|
1307
1313
|
meta: Joi.object().pattern(/\S/, Joi.any()),
|
|
1308
1314
|
external_id: Joi.string().allow(""),
|
|
1309
1315
|
rr_id: Joi.string().allow(""),
|
|
1316
|
+
dob: Joi.string().allow(""),
|
|
1310
1317
|
});
|
|
1311
1318
|
}
|
|
1312
1319
|
|
|
@@ -1574,6 +1581,7 @@ class UserPlatformModel {
|
|
|
1574
1581
|
return Joi.object({
|
|
1575
1582
|
first_name: Joi.string().allow(""),
|
|
1576
1583
|
last_name: Joi.string().allow(""),
|
|
1584
|
+
dob: Joi.string().allow(""),
|
|
1577
1585
|
gender: Joi.string().allow(""),
|
|
1578
1586
|
external_id: Joi.string().allow(""),
|
|
1579
1587
|
rr_id: Joi.string().allow(""),
|