@segment/action-destinations 3.181.0 → 3.183.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 (155) hide show
  1. package/dist/destinations/app-fit/config.d.ts +3 -0
  2. package/dist/destinations/app-fit/config.js +7 -0
  3. package/dist/destinations/app-fit/config.js.map +1 -0
  4. package/dist/destinations/app-fit/generated-types.d.ts +3 -0
  5. package/dist/destinations/app-fit/generated-types.js +3 -0
  6. package/dist/destinations/app-fit/generated-types.js.map +1 -0
  7. package/dist/destinations/app-fit/index.d.ts +4 -0
  8. package/dist/destinations/app-fit/index.js +39 -0
  9. package/dist/destinations/app-fit/index.js.map +1 -0
  10. package/dist/destinations/app-fit/track/generated-types.d.ts +13 -0
  11. package/dist/destinations/app-fit/track/generated-types.js +3 -0
  12. package/dist/destinations/app-fit/track/generated-types.js.map +1 -0
  13. package/dist/destinations/app-fit/track/index.d.ts +5 -0
  14. package/dist/destinations/app-fit/track/index.js +109 -0
  15. package/dist/destinations/app-fit/track/index.js.map +1 -0
  16. package/dist/destinations/engage-messaging-sendgrid/index.js +3 -1
  17. package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
  18. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.d.ts +15 -0
  19. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.js +3 -0
  20. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.js.map +1 -0
  21. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.d.ts +5 -0
  22. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js +28 -0
  23. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js.map +1 -0
  24. package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.d.ts +12 -0
  25. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +38 -12
  26. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
  27. package/dist/destinations/engage-messaging-sendgrid/utils/api-lookups.d.ts +20 -0
  28. package/dist/destinations/engage-messaging-sendgrid/utils/api-lookups.js +108 -0
  29. package/dist/destinations/engage-messaging-sendgrid/utils/api-lookups.js.map +1 -0
  30. package/dist/destinations/engage-messaging-sendgrid/utils/types.d.ts +6 -0
  31. package/dist/destinations/engage-messaging-sendgrid/utils/types.js +3 -0
  32. package/dist/destinations/engage-messaging-sendgrid/utils/types.js.map +1 -0
  33. package/dist/destinations/engage-messaging-twilio/operationTracking/GenericMethodDecorator.d.ts +1 -0
  34. package/dist/destinations/engage-messaging-twilio/operationTracking/GenericMethodDecorator.js +3 -0
  35. package/dist/destinations/engage-messaging-twilio/operationTracking/GenericMethodDecorator.js.map +1 -0
  36. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDecorator.d.ts +46 -0
  37. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDecorator.js +46 -0
  38. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDecorator.js.map +1 -0
  39. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDuration.d.ts +12 -0
  40. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDuration.js +23 -0
  41. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDuration.js.map +1 -0
  42. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationErrorHandler.d.ts +12 -0
  43. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationErrorHandler.js +35 -0
  44. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationErrorHandler.js.map +1 -0
  45. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationFinallyHooks.d.ts +10 -0
  46. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationFinallyHooks.js +29 -0
  47. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationFinallyHooks.js.map +1 -0
  48. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationLogger.d.ts +30 -0
  49. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationLogger.js +107 -0
  50. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationLogger.js.map +1 -0
  51. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationStats.d.ts +39 -0
  52. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationStats.js +130 -0
  53. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationStats.js.map +1 -0
  54. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.d.ts +1 -0
  55. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.js +377 -0
  56. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.js.map +1 -0
  57. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTree.d.ts +23 -0
  58. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTree.js +49 -0
  59. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTree.js.map +1 -0
  60. package/dist/destinations/engage-messaging-twilio/operationTracking/TrackedError.d.ts +6 -0
  61. package/dist/destinations/engage-messaging-twilio/operationTracking/TrackedError.js +3 -0
  62. package/dist/destinations/engage-messaging-twilio/operationTracking/TrackedError.js.map +1 -0
  63. package/dist/destinations/engage-messaging-twilio/operationTracking/index.d.ts +10 -0
  64. package/dist/destinations/engage-messaging-twilio/operationTracking/index.js +23 -0
  65. package/dist/destinations/engage-messaging-twilio/operationTracking/index.js.map +1 -0
  66. package/dist/destinations/engage-messaging-twilio/operationTracking/wrapTryCatchFinallyPromisable.d.ts +21 -0
  67. package/dist/destinations/engage-messaging-twilio/operationTracking/wrapTryCatchFinallyPromisable.js +99 -0
  68. package/dist/destinations/engage-messaging-twilio/operationTracking/wrapTryCatchFinallyPromisable.js.map +1 -0
  69. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.d.ts +1 -1
  70. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js +7 -25
  71. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +1 -1
  72. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.d.ts +1 -1
  73. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +31 -25
  74. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +1 -1
  75. package/dist/destinations/engage-messaging-twilio/sendSms/index.js +1 -1
  76. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
  77. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +1 -1
  78. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +20 -10
  79. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +1 -1
  80. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js +1 -1
  81. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +1 -1
  82. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +1 -1
  83. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +42 -36
  84. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +1 -1
  85. package/dist/destinations/engage-messaging-twilio/utils/IntegrationErrorWrapper.d.ts +12 -0
  86. package/dist/destinations/engage-messaging-twilio/utils/IntegrationErrorWrapper.js +31 -0
  87. package/dist/destinations/engage-messaging-twilio/utils/IntegrationErrorWrapper.js.map +1 -0
  88. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.d.ts +15 -0
  89. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js +36 -0
  90. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js.map +1 -0
  91. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.d.ts +14 -0
  92. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.js +78 -0
  93. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.js.map +1 -0
  94. package/dist/destinations/engage-messaging-twilio/utils/index.d.ts +6 -0
  95. package/dist/destinations/engage-messaging-twilio/utils/index.js +19 -0
  96. package/dist/destinations/engage-messaging-twilio/utils/index.js.map +1 -0
  97. package/dist/destinations/engage-messaging-twilio/utils/isDestinationActionService.d.ts +1 -0
  98. package/dist/destinations/engage-messaging-twilio/utils/isDestinationActionService.js +8 -0
  99. package/dist/destinations/engage-messaging-twilio/utils/isDestinationActionService.js.map +1 -0
  100. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +21 -54
  101. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +112 -225
  102. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +1 -1
  103. package/dist/destinations/engage-messaging-twilio/utils/phone-message.d.ts +7 -0
  104. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +30 -33
  105. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +1 -1
  106. package/dist/destinations/engage-messaging-twilio/utils/track.d.ts +45 -0
  107. package/dist/destinations/engage-messaging-twilio/utils/track.js +9 -0
  108. package/dist/destinations/engage-messaging-twilio/utils/track.js.map +1 -0
  109. package/dist/destinations/hubspot/generated-types.d.ts +1 -0
  110. package/dist/destinations/hubspot/index.js +7 -1
  111. package/dist/destinations/hubspot/index.js.map +1 -1
  112. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +9 -1
  113. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
  114. package/dist/destinations/index.js +3 -0
  115. package/dist/destinations/index.js.map +1 -1
  116. package/dist/destinations/insider/trackEvent/index.js +1 -1
  117. package/dist/destinations/insider/trackEvent/index.js.map +1 -1
  118. package/dist/destinations/listrak/generated-types.d.ts +4 -0
  119. package/dist/destinations/listrak/generated-types.js +3 -0
  120. package/dist/destinations/listrak/generated-types.js.map +1 -0
  121. package/dist/destinations/listrak/index.d.ts +4 -0
  122. package/dist/destinations/listrak/index.js +55 -0
  123. package/dist/destinations/listrak/index.js.map +1 -0
  124. package/dist/destinations/listrak/updateEmailContactProfileFields/generated-types.d.ts +8 -0
  125. package/dist/destinations/listrak/updateEmailContactProfileFields/generated-types.js +3 -0
  126. package/dist/destinations/listrak/updateEmailContactProfileFields/generated-types.js.map +1 -0
  127. package/dist/destinations/listrak/updateEmailContactProfileFields/index.d.ts +13 -0
  128. package/dist/destinations/listrak/updateEmailContactProfileFields/index.js +77 -0
  129. package/dist/destinations/listrak/updateEmailContactProfileFields/index.js.map +1 -0
  130. package/dist/destinations/liveramp-audiences/audienceEntered/index.js +1 -1
  131. package/dist/destinations/liveramp-audiences/audienceEntered/index.js.map +1 -1
  132. package/dist/destinations/liveramp-audiences/audienceEntered/sftp.d.ts +2 -2
  133. package/dist/destinations/liveramp-audiences/audienceEntered/sftp.js +6 -2
  134. package/dist/destinations/liveramp-audiences/audienceEntered/sftp.js.map +1 -1
  135. package/dist/destinations/liveramp-audiences/index.js +1 -1
  136. package/dist/destinations/liveramp-audiences/index.js.map +1 -1
  137. package/dist/destinations/m3ter/auth.d.ts +7 -0
  138. package/dist/destinations/m3ter/auth.js +16 -0
  139. package/dist/destinations/m3ter/auth.js.map +1 -0
  140. package/dist/destinations/m3ter/constants.d.ts +4 -0
  141. package/dist/destinations/m3ter/constants.js +8 -0
  142. package/dist/destinations/m3ter/constants.js.map +1 -0
  143. package/dist/destinations/m3ter/generated-types.d.ts +5 -0
  144. package/dist/destinations/m3ter/generated-types.js +3 -0
  145. package/dist/destinations/m3ter/generated-types.js.map +1 -0
  146. package/dist/destinations/m3ter/index.d.ts +4 -0
  147. package/dist/destinations/m3ter/index.js +68 -0
  148. package/dist/destinations/m3ter/index.js.map +1 -0
  149. package/dist/destinations/m3ter/submitMeasurements/generated-types.d.ts +32 -0
  150. package/dist/destinations/m3ter/submitMeasurements/generated-types.js +3 -0
  151. package/dist/destinations/m3ter/submitMeasurements/generated-types.js.map +1 -0
  152. package/dist/destinations/m3ter/submitMeasurements/index.d.ts +5 -0
  153. package/dist/destinations/m3ter/submitMeasurements/index.js +116 -0
  154. package/dist/destinations/m3ter/submitMeasurements/index.js.map +1 -0
  155. package/package.json +4 -4
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperationStats = void 0;
4
+ const OperationDuration_1 = require("./OperationDuration");
5
+ const OperationDecorator_1 = require("./OperationDecorator");
6
+ class OperationStats {
7
+ static getTryCatchFinallyHook(_ctx) {
8
+ throw new Error('OperationStats.getTryCatchFinallyHook is abstract and must be implemented by derived class');
9
+ }
10
+ getMetricName(ctx) {
11
+ const opName = OperationDecorator_1.OperationDecorator.getOperationName(ctx);
12
+ if (!opName)
13
+ return undefined;
14
+ switch (ctx.stage) {
15
+ case 'try':
16
+ return `${opName}.try`;
17
+ case 'catch':
18
+ return `${opName}.catch`;
19
+ case 'finally':
20
+ default:
21
+ return `${opName}`;
22
+ }
23
+ }
24
+ onTry(ctx) {
25
+ ctx.tags = [];
26
+ if (!ctx.sharedContext.tags)
27
+ ctx.sharedContext.tags = [];
28
+ return () => {
29
+ const metricName = this.getMetricName(ctx);
30
+ if (metricName)
31
+ this.statsOperationEvent({
32
+ context: ctx,
33
+ event: 'try',
34
+ shouldStats: false,
35
+ stats: {
36
+ metric: metricName,
37
+ method: 'incr',
38
+ value: 1,
39
+ tags: this.mergeTags(ctx.sharedContext.tags, ctx.tags)
40
+ }
41
+ });
42
+ };
43
+ }
44
+ mergeTags(...tagSets) {
45
+ const res = [];
46
+ for (const tags of tagSets) {
47
+ if (tags)
48
+ res.push(...tags);
49
+ }
50
+ return res.filter((t) => t);
51
+ }
52
+ statsOperationEvent(args) {
53
+ if (args.context.decoratorArgs?.shouldStats) {
54
+ const shouldStats = args.context.decoratorArgs.shouldStats(args);
55
+ if (shouldStats !== undefined)
56
+ args.shouldStats = shouldStats;
57
+ }
58
+ if (args.shouldStats && args.stats) {
59
+ this.stats(args.stats);
60
+ }
61
+ }
62
+ onCatch(ctx) {
63
+ const metricName = this.getMetricName(ctx);
64
+ if (metricName)
65
+ this.statsOperationEvent({
66
+ context: ctx,
67
+ event: ctx.stage,
68
+ shouldStats: false,
69
+ stats: {
70
+ metric: metricName,
71
+ method: 'incr',
72
+ value: 1,
73
+ tags: this.mergeTags(ctx.sharedContext.tags, ctx.tags)
74
+ }
75
+ });
76
+ }
77
+ onFinally(ctx) {
78
+ const finallyTags = [];
79
+ if (ctx.stage == 'finally')
80
+ finallyTags.push(`error:${ctx.error ? 'true' : 'false'}`);
81
+ if (ctx.error) {
82
+ const error = ctx.error;
83
+ finallyTags.push(...(this.extractTagsFromError(error, ctx) || []));
84
+ }
85
+ ctx.tags.push(...finallyTags);
86
+ return () => {
87
+ const finallyTags = this.mergeTags(ctx.sharedContext.tags, ctx.tags);
88
+ const metricName = this.getMetricName(ctx);
89
+ if (metricName)
90
+ this.statsOperationEvent({
91
+ context: ctx,
92
+ event: 'finally',
93
+ shouldStats: true,
94
+ stats: { metric: metricName, method: 'incr', value: 1, tags: [...finallyTags] }
95
+ });
96
+ const duration = OperationDuration_1.OperationDuration.getDuration(ctx);
97
+ const histogramMetric = this.getHistogramMetric(ctx);
98
+ if (duration !== undefined && histogramMetric)
99
+ this.statsOperationEvent({
100
+ context: ctx,
101
+ event: 'duration',
102
+ shouldStats: true,
103
+ stats: { metric: histogramMetric, method: 'histogram', value: duration, tags: [...finallyTags] }
104
+ });
105
+ };
106
+ }
107
+ getHistogramMetric(ctx) {
108
+ const opName = OperationDecorator_1.OperationDecorator.getOperationName(ctx);
109
+ if (!opName)
110
+ return undefined;
111
+ return `${opName}.duration`;
112
+ }
113
+ extractTagsFromError(error, ctx) {
114
+ const res = [];
115
+ const errorOperation = this.getErrorOperationNameTag(error, ctx);
116
+ if (errorOperation)
117
+ res.push(`error_operation:${errorOperation}`);
118
+ res.push(`error_class:${error?.constructor?.name || typeof error}`);
119
+ return res;
120
+ }
121
+ getErrorOperationNameTag(error, ctx) {
122
+ const errorContext = error.trackedContext;
123
+ return errorContext ? this.getOperationNameTag(errorContext) : this.getOperationNameTag(ctx);
124
+ }
125
+ getOperationNameTag(ctx) {
126
+ return OperationDecorator_1.OperationDecorator.getOperationName(ctx);
127
+ }
128
+ }
129
+ exports.OperationStats = OperationStats;
130
+ //# sourceMappingURL=OperationStats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationStats.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/operationTracking/OperationStats.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAEvD,6DAAyD;AA0BzD,MAAsB,cAAc;IAGlC,MAAM,CAAC,sBAAsB,CAAC,IAA2B;QACvD,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAA;IAC/G,CAAC;IAGD,aAAa,CAAC,GAA0B;QACtC,MAAM,MAAM,GAAG,uCAAkB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM;YAAE,OAAO,SAAS,CAAA;QAE7B,QAAQ,GAAG,CAAC,KAAK,EAAE;YACjB,KAAK,KAAK;gBACR,OAAO,GAAG,MAAM,MAAM,CAAA;YACxB,KAAK,OAAO;gBACV,OAAO,GAAG,MAAM,QAAQ,CAAA;YAC1B,KAAK,SAAS,CAAC;YACf;gBACE,OAAO,GAAG,MAAM,EAAE,CAAA;SACrB;IACH,CAAC;IAED,KAAK,CAAC,GAA0B;QAC9B,GAAG,CAAC,IAAI,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI;YAAE,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,EAAE,CAAA;QACxD,OAAO,GAAG,EAAE;YACV,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;YAC1C,IAAI,UAAU;gBACZ,IAAI,CAAC,mBAAmB,CAAC;oBACvB,OAAO,EAAE,GAAG;oBACZ,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,KAAK;oBAClB,KAAK,EAAE;wBACL,MAAM,EAAE,UAAU;wBAClB,MAAM,EAAE,MAAM;wBACd,KAAK,EAAE,CAAC;wBACR,IAAI,EAAE,IAAI,CA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377 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const OperationLogger_1 = require("./OperationLogger");
10
+ const OperationStats_1 = require("./OperationStats");
11
+ const OperationDecorator_1 = require("./OperationDecorator");
12
+ class TestLogger extends OperationLogger_1.OperationLogger {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.logInfo = jest.fn();
16
+ this.logError = jest.fn();
17
+ }
18
+ static getTryCatchFinallyHook(ctx) {
19
+ return ctx.funcThis.logger;
20
+ }
21
+ }
22
+ class TestStats extends OperationStats_1.OperationStats {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.stats = jest.fn();
26
+ }
27
+ static getTryCatchFinallyHook(ctx) {
28
+ return ctx.funcThis.stats;
29
+ }
30
+ }
31
+ const testTrack = OperationDecorator_1.OperationDecorator.createDecoratorFactoryWithDefault(TestLogger, TestStats);
32
+ function createTestClass(decoratorArgs, testMethodImpl, asyncMethods) {
33
+ class MyTestTargetBase {
34
+ constructor() {
35
+ this.logger = new TestLogger();
36
+ this.stats = new TestStats();
37
+ this.testMethodImpl = jest.fn(testMethodImpl);
38
+ }
39
+ testMethod(...args) {
40
+ const instance = this;
41
+ if (asyncMethods)
42
+ return (async () => {
43
+ await new Promise((res) => setTimeout(res, 100));
44
+ return await testMethodImpl.apply(instance, args);
45
+ })();
46
+ return testMethodImpl.apply(instance, args);
47
+ }
48
+ }
49
+ __decorate([
50
+ testTrack(decoratorArgs)
51
+ ], MyTestTargetBase.prototype, "testMethod", null);
52
+ if (asyncMethods) {
53
+ class MyTestTargetAsync extends MyTestTargetBase {
54
+ async parentMethod(...args) {
55
+ return {
56
+ iAm: 'parent',
57
+ child: await this.childMethod(...args)
58
+ };
59
+ }
60
+ async childMethod(...args) {
61
+ return {
62
+ iAm: 'child',
63
+ testMethod: await this.testMethod(...args)
64
+ };
65
+ }
66
+ }
67
+ __decorate([
68
+ testTrack(decoratorArgs)
69
+ ], MyTestTargetAsync.prototype, "parentMethod", null);
70
+ __decorate([
71
+ testTrack(decoratorArgs)
72
+ ], MyTestTargetAsync.prototype, "childMethod", null);
73
+ return MyTestTargetAsync;
74
+ }
75
+ else {
76
+ class MyTestTargetSync extends MyTestTargetBase {
77
+ parentMethod(...args) {
78
+ return {
79
+ iAm: 'parent',
80
+ child: this.childMethod(...args)
81
+ };
82
+ }
83
+ childMethod(...args) {
84
+ return {
85
+ iAm: 'child',
86
+ testMethod: this.testMethod(...args)
87
+ };
88
+ }
89
+ }
90
+ __decorate([
91
+ testTrack(decoratorArgs)
92
+ ], MyTestTargetSync.prototype, "parentMethod", null);
93
+ __decorate([
94
+ testTrack(decoratorArgs)
95
+ ], MyTestTargetSync.prototype, "childMethod", null);
96
+ return MyTestTargetSync;
97
+ }
98
+ }
99
+ class MyCustomError extends Error {
100
+ constructor(msg) {
101
+ super(msg);
102
+ }
103
+ }
104
+ beforeEach(() => {
105
+ jest.clearAllMocks();
106
+ });
107
+ describe('pass through', () => {
108
+ describe.each([
109
+ ['async target method', true],
110
+ ['sync target method', false]
111
+ ])('%s', (_name, isAsync) => {
112
+ describe.each([
113
+ ['target method thows error', true],
114
+ ['target completes successfully', false]
115
+ ])('%s', (_name, throwError) => {
116
+ test.each([
117
+ undefined,
118
+ {},
119
+ { operation: 'test_method' },
120
+ {
121
+ onError(_e) { }
122
+ },
123
+ {
124
+ shouldLog: () => true,
125
+ shouldStats: () => true
126
+ },
127
+ {
128
+ shouldLog: () => false,
129
+ shouldStats: () => false
130
+ }
131
+ ])(`${throwError ? 'error' : 'result'} passed through. decoratorArgs: %s`, async (decoratorArgs) => {
132
+ const testMethod = function () {
133
+ if (throwError)
134
+ throw new MyCustomError('my custom error');
135
+ expect(this).toEqual(instance);
136
+ return {
137
+ instance: this,
138
+ result: 'success'
139
+ };
140
+ };
141
+ const TestClass = createTestClass(decoratorArgs, testMethod, isAsync);
142
+ const instance = new TestClass();
143
+ if (throwError) {
144
+ await expect(async () => await instance.testMethod()).rejects.toThrow('my custom error');
145
+ await expect(async () => await instance.parentMethod()).rejects.toThrow('my custom error');
146
+ }
147
+ else {
148
+ const resTestMethod = await instance.testMethod();
149
+ expect(resTestMethod.instance).toBe(instance);
150
+ expect(resTestMethod.result).toBe('success');
151
+ const resParentMethod = await instance.parentMethod();
152
+ expect(resParentMethod).toMatchObject({
153
+ iAm: 'parent',
154
+ child: { iAm: 'child', testMethod: { instance, result: 'success' } }
155
+ });
156
+ }
157
+ });
158
+ });
159
+ });
160
+ });
161
+ describe('log', () => {
162
+ describe.each([
163
+ ['async target method', true],
164
+ ['sync target method', false]
165
+ ])('%s', (_name, isAsync) => {
166
+ async function runTestMethod(args) {
167
+ const MyTestClass = createTestClass(args.decoratorArgs, args.testMethodImpl, isAsync);
168
+ const classInstance = new MyTestClass();
169
+ const testMethodMock = classInstance.testMethodImpl;
170
+ try {
171
+ const methodToRun = classInstance[args.methodToRun || 'testMethod'].bind(classInstance);
172
+ const testMethodResult = await methodToRun(...(args.methodArgs || []));
173
+ return { classInstance, testMethodResult, testMethodMock };
174
+ }
175
+ catch (e) {
176
+ return { classInstance, testMethodError: e, testMethodMock };
177
+ }
178
+ }
179
+ test('when method succeeds', async () => {
180
+ const testResult = await runTestMethod({ testMethodImpl: () => 'success' });
181
+ expect(testResult.testMethodResult).toBe('success');
182
+ expectLogInfo(testResult.classInstance.logger.logInfo, ['testMethod starting...'], ['testMethod succeeded after']);
183
+ expect(testResult.classInstance.logger.logError).toHaveBeenCalledTimes(0);
184
+ });
185
+ test('on method failing', async () => {
186
+ const testResult = await runTestMethod({
187
+ testMethodImpl: () => {
188
+ throw new MyCustomError('My custom error');
189
+ }
190
+ });
191
+ expect(testResult.testMethodError instanceof MyCustomError).toBe(true);
192
+ expectLogInfo(testResult.classInstance.logger.logInfo, ['testMethod starting...']);
193
+ expectLogError(testResult.classInstance.logger.logError, [
194
+ 'testMethod failed after',
195
+ 'MyCustomError',
196
+ testResult.testMethodError.message
197
+ ]);
198
+ });
199
+ test('shouldLog false', async () => {
200
+ const testResult = await runTestMethod({
201
+ decoratorArgs: { shouldLog: () => false },
202
+ testMethodImpl: () => 'success'
203
+ });
204
+ expect(testResult.testMethodResult).toBe('success');
205
+ expect(testResult.classInstance.logger.logInfo).toHaveBeenCalledTimes(0);
206
+ expect(testResult.classInstance.logger.logError).toHaveBeenCalledTimes(0);
207
+ });
208
+ test('shouldLog finally only', async () => {
209
+ const testResult = await runTestMethod({
210
+ decoratorArgs: { shouldLog: (t) => t.stage == 'finally' },
211
+ testMethodImpl: () => 'success'
212
+ });
213
+ expect(testResult.testMethodResult).toBe('success');
214
+ expectLogInfo(testResult.classInstance.logger.logInfo, ['testMethod succeeded after']);
215
+ });
216
+ test('onFinally hook to add extra data on error', async () => {
217
+ const myCustomError = new MyCustomError('My custom error');
218
+ const someExtraErrorMessage = 'some extra info about error';
219
+ const methodImpl = function (throwError) {
220
+ const op = testTrack.getCurrentOperation(this);
221
+ op?.onFinally.push(() => {
222
+ expect(!!op.error).toBe(throwError);
223
+ op.logs.push(someExtraErrorMessage);
224
+ });
225
+ if (throwError)
226
+ throw myCustomError;
227
+ else
228
+ return 'success';
229
+ };
230
+ const testResultSuccess = await runTestMethod({ testMethodImpl: methodImpl, methodArgs: [false] });
231
+ expect(testResultSuccess.testMethodResult).toBe('success');
232
+ expectLogInfo(testResultSuccess.classInstance.logger.logInfo, ['testMethod starting...'], ['testMethod succeeded after', someExtraErrorMessage]);
233
+ const testResultFailure = await runTestMethod({ testMethodImpl: methodImpl, methodArgs: [true] });
234
+ expect(testResultFailure.testMethodError).toBe(myCustomError);
235
+ expectLogInfo(testResultFailure.classInstance.logger.logInfo, ['testMethod starting...']);
236
+ expectLogError(testResultFailure.classInstance.logger.logError, [
237
+ 'testMethod failed after',
238
+ 'MyCustomError',
239
+ testResultFailure.testMethodError.message,
240
+ someExtraErrorMessage
241
+ ]);
242
+ });
243
+ test('onError for error wrapping', async () => {
244
+ const testResult = await runTestMethod({
245
+ decoratorArgs: {
246
+ onError: (ctx) => {
247
+ ctx.error = new MyCustomError('Wrapper error');
248
+ }
249
+ },
250
+ testMethodImpl: () => {
251
+ throw new MyCustomError('Child error');
252
+ }
253
+ });
254
+ expectLogError(testResult.classInstance.logger.logError, ['Wrapper error', 'Child error']);
255
+ expect(testResult.testMethodError.message).toBe('Wrapper error');
256
+ expect(testResult.testMethodError.underlyingError?.message).toBe('Child error');
257
+ });
258
+ test('child operations success: parentMethod > childMethod > testMethod', async () => {
259
+ const testRes = await runTestMethod({
260
+ testMethodImpl: () => 'test method',
261
+ methodToRun: 'parentMethod'
262
+ });
263
+ expect(testRes.testMethodResult).toMatchObject({
264
+ iAm: 'parent',
265
+ child: { iAm: 'child', testMethod: 'test method' }
266
+ });
267
+ const { logInfo } = testRes.classInstance.logger;
268
+ expectLogInfo(logInfo, ['parentMethod starting'], ['parentMethod > childMethod starting'], ['parentMethod > childMethod > testMethod starting'], ['parentMethod > childMethod > testMethod succeeded'], ['parentMethod > childMethod succeeded'], ['parentMethod succeeded']);
269
+ });
270
+ test('child operations failed: parentMethod > childMethod > testMethod', async () => {
271
+ const myCustomError = new MyCustomError('My custom error');
272
+ const testRes = await runTestMethod({
273
+ testMethodImpl: () => {
274
+ throw myCustomError;
275
+ },
276
+ methodToRun: 'parentMethod'
277
+ });
278
+ expect(testRes.testMethodError).toBe(myCustomError);
279
+ expectLogInfo(testRes.classInstance.logger.logInfo, ['parentMethod starting'], ['parentMethod > childMethod starting'], ['parentMethod > childMethod > testMethod starting']);
280
+ expectLogError(testRes.classInstance.logger.logError, ['parentMethod > childMethod > testMethod failed', myCustomError.message], ['parentMethod > childMethod failed'], ['parentMethod failed']);
281
+ });
282
+ });
283
+ });
284
+ describe('stats', () => {
285
+ describe.each([
286
+ ['async target method', true],
287
+ ['sync target method', false]
288
+ ])('%s', (_testName, isAsync) => {
289
+ describe.each([
290
+ ['target method thows error', true],
291
+ ['target completes successfully', false]
292
+ ])('%s', (_testName, _throwError) => {
293
+ const testMethod = jest.fn(function () {
294
+ if (_throwError)
295
+ throw new MyCustomError('My custom error');
296
+ return 'success';
297
+ });
298
+ test('try and finally. decoratorArgs undefined', async () => {
299
+ const TestClass = createTestClass(undefined, testMethod, isAsync);
300
+ const testInstance = new TestClass();
301
+ try {
302
+ await testInstance.testMethod();
303
+ }
304
+ catch (e) {
305
+ }
306
+ expect(testInstance.stats.stats).toHaveBeenCalledTimes(2);
307
+ const tags = [
308
+ _throwError ? 'error:true' : 'error:false',
309
+ ...(_throwError ? ['error_operation:testMethod', 'error_class:MyCustomError'] : [])
310
+ ];
311
+ expect(testInstance.stats.stats).toHaveBeenCalledWith({
312
+ metric: 'testMethod',
313
+ method: 'incr',
314
+ value: 1,
315
+ tags
316
+ });
317
+ expect(testInstance.stats.stats).toHaveBeenCalledWith({
318
+ metric: 'testMethod.duration',
319
+ method: 'histogram',
320
+ value: expect.any(Number),
321
+ tags
322
+ });
323
+ });
324
+ test('try and finally. shouldStats:only on try', async () => {
325
+ const TestClass = createTestClass({ shouldStats: (st) => st.event == 'try' }, testMethod, isAsync);
326
+ const testInstance = new TestClass();
327
+ try {
328
+ await testInstance.testMethod();
329
+ }
330
+ catch (e) {
331
+ }
332
+ expect(testInstance.stats.stats).toHaveBeenCalledTimes(1);
333
+ expect(testInstance.stats.stats).toHaveBeenCalledWith({
334
+ metric: 'testMethod.try',
335
+ method: 'incr',
336
+ value: 1,
337
+ tags: []
338
+ });
339
+ });
340
+ });
341
+ });
342
+ });
343
+ function expectLogInfo(logInfo, ...messagesContains) {
344
+ expect(logInfo).toHaveBeenCalledTimes(messagesContains.length);
345
+ if (!jest.isMockFunction(logInfo))
346
+ fail('logInfo is not a mock function');
347
+ else
348
+ for (const messageParts of messagesContains) {
349
+ const hasSomeMatches = logInfo.mock.calls.some((args) => {
350
+ const [message, _meta] = args;
351
+ return messageParts.every((part) => message.includes(part));
352
+ });
353
+ if (!hasSomeMatches) {
354
+ throw new Error(`expectLogInfo failed to match\nExpected: ${messageParts.join('*')}\nActual calls:\n${logInfo.mock.calls
355
+ .map((args) => args.join(', '))
356
+ .join('\n')}`);
357
+ }
358
+ }
359
+ }
360
+ function expectLogError(logError, ...messagesContains) {
361
+ expect(logError).toHaveBeenCalledTimes(messagesContains.length);
362
+ if (!jest.isMockFunction(logError))
363
+ fail('logInfo is not a mock function');
364
+ else
365
+ for (const messageParts of messagesContains) {
366
+ const hasSomeMatches = logError.mock.calls.some((args) => {
367
+ const [message, _meta] = args;
368
+ return messageParts.every((part) => message.includes(part));
369
+ });
370
+ if (!hasSomeMatches) {
371
+ throw new Error(`expectLogError failed to match\nExpected: ${messageParts.join('*')}\nActual calls:\n${logError.mock.calls
372
+ .map((args) => args.join(', '))
373
+ .join('\n')}`);
374
+ }
375
+ }
376
+ }
377
+ //# sourceMappingURL=OperationTracker.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationTracker.test.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.ts"],"names":[],"mappings":";;;;;;;;AAEA,uDAA2E;AAC3E,qDAAwE;AACxE,6DAA+E;AAI/E,MAAM,UAAW,SAAQ,iCAAe;IAAxC;;QACE,YAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QACnB,aAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAItB,CAAC;IAHC,MAAM,CAAC,sBAAsB,CAAC,GAA2B;QACvD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAA;IAC5B,CAAC;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CAAC,IAAI,CAAC,CAAC;qBACrC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAA;aACF;SACF;AACL,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { ContextFromHookProviders, FuncFromHookProviders, OperationHookProvider } from './OperationDecorator';
2
+ import { TryCatchFinallyHook, TryCatchFinallyContext } from './wrapTryCatchFinallyPromisable';
3
+ declare type OperationTreeContext<TParentContext extends TryCatchFinallyContext = TryCatchFinallyContext> = TParentContext & {
4
+ parent?: OperationTreeContext<TParentContext>;
5
+ sharedContext: {};
6
+ };
7
+ export declare class OperationTree {
8
+ static getTryCatchFinallyHook(_ctx: OperationTreeContext): TryCatchFinallyHook<OperationTreeContext>;
9
+ static getPriority(): number;
10
+ static onTry(ctx: OperationTreeContext): void;
11
+ static onFinally(ctx: OperationTreeContext): () => void;
12
+ static getCurrentOperationFromTrackedClassInstance<TClassInstance>(classInstance: TClassInstance): OperationTreeContext<TryCatchFinallyContext<(this: any, ...args: any[]) => any>>;
13
+ static getCurrentOperationFromContext(ctx: OperationTreeContext): OperationTreeContext<TryCatchFinallyContext<(this: any, ...args: any[]) => any>>;
14
+ protected static setCurrentOperationToContext(ctx: OperationTreeContext, newCurrentOperation: OperationTreeContext | undefined): void;
15
+ static getOperationsStack<TContext extends OperationTreeContext>(ctx: TContext): TContext[];
16
+ static getDecoratorUtils(): {
17
+ getCurrentOperation(classInstance: any): OperationTreeContext | undefined;
18
+ };
19
+ }
20
+ export declare type CanGetCurrentOperation<TOperationHookProviders extends OperationHookProvider[]> = {
21
+ getCurrentOperation(classInstance: ThisParameterType<FuncFromHookProviders<TOperationHookProviders>>): ContextFromHookProviders<TOperationHookProviders> | undefined;
22
+ };
23
+ export {};
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperationTree = void 0;
4
+ class OperationTree {
5
+ static getTryCatchFinallyHook(_ctx) {
6
+ return this;
7
+ }
8
+ static getPriority() {
9
+ return -1;
10
+ }
11
+ static onTry(ctx) {
12
+ const parent = this.getCurrentOperationFromContext(ctx);
13
+ ctx.sharedContext = parent?.sharedContext || {};
14
+ ctx.parent = parent;
15
+ this.setCurrentOperationToContext(ctx, ctx);
16
+ }
17
+ static onFinally(ctx) {
18
+ return () => {
19
+ this.setCurrentOperationToContext(ctx, ctx.parent);
20
+ };
21
+ }
22
+ static getCurrentOperationFromTrackedClassInstance(classInstance) {
23
+ return classInstance?.currentOperation;
24
+ }
25
+ static getCurrentOperationFromContext(ctx) {
26
+ return ctx.funcThis.currentOperation;
27
+ }
28
+ static setCurrentOperationToContext(ctx, newCurrentOperation) {
29
+ ctx.funcThis.currentOperation = newCurrentOperation;
30
+ }
31
+ static getOperationsStack(ctx) {
32
+ const stack = [];
33
+ let current = ctx;
34
+ while (current) {
35
+ stack.unshift(current);
36
+ current = current.parent;
37
+ }
38
+ return stack;
39
+ }
40
+ static getDecoratorUtils() {
41
+ return {
42
+ getCurrentOperation(classInstance) {
43
+ return classInstance?.currentOperation;
44
+ }
45
+ };
46
+ }
47
+ }
48
+ exports.OperationTree = OperationTree;
49
+ //# sourceMappingURL=OperationTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationTree.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/operationTracking/OperationTree.ts"],"names":[],"mappings":";;;AAWA,MAAa,aAAa;IACxB,MAAM,CAAC,sBAAsB,CAAC,IAA0B;QAEtD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,CAAC,WAAW;QAChB,OAAO,CAAC,CAAC,CAAA;IACX,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,GAAyB;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,CAAA;QACvD,GAAG,CAAC,aAAa,GAAG,MAAM,EAAE,aAAa,IAAI,EAAE,CAAA;QAC/C,GAAG,CAAC,MAAM,GAAG,MAAM,CAAA;QACnB,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC7C,CAAC;IACD,MAAM,CAAC,SAAS,CAAC,GAAyB;QACxC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QACpD,CAAC,CAAA;IACH,CAAC;IACD,MAAM,CAAC,2CAA2C,CAAiB,aAA6B;QAE9F,OAAQ,aAAqB,EAAE,gBAAwC,CAAA;IACzE,CAAC;IACD,MAAM,CAAC,8BAA8B,CAAC,GAAyB;QAC7D,OAAO,GAAG,CAAC,QAAQ,CAAC,gBAAwC,CAAA;IAC9D,CAAC;IACS,MAAM,CAAC,4BAA4B,CAC3C,GAAyB,EACzB,mBAAqD;QAErD,GAAG,CAAC,QAAQ,CAAC,gBAAgB,GAAG,mBAAmB,CAAA;IACrD,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAwC,GAAa;QAC5E,MAAM,KAAK,GAAe,EAAE,CAAA;QAC5B,IAAI,OAAO,GAAG,GAAG,CAAA;QACjB,OAAO,OAAO,EAAE;YACd,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAEtB,OAAO,GAAG,OAAO,CAAC,MAAkB,CAAA;SACrC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,CAAC,iBAAiB;QACtB,OAAO;YAEL,mBAAmB,CAAC,aAAkB;gBACpC,OAAO,aAAa,EAAE,gBAAgB,CAAA;YACxC,CAAC;SACF,CAAA;IACH,CAAC;CACF;AApDD,sCAoDC"}
@@ -0,0 +1,6 @@
1
+ import { TryCatchFinallyContext } from './wrapTryCatchFinallyPromisable';
2
+ export interface TrackedError<TContext extends TryCatchFinallyContext = TryCatchFinallyContext> extends Error {
3
+ underlyingError?: unknown;
4
+ trackedContext?: TContext;
5
+ [key: string]: any;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TrackedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrackedError.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/operationTracking/TrackedError.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export * from './wrapTryCatchFinallyPromisable';
2
+ export * from './OperationDecorator';
3
+ export * from './GenericMethodDecorator';
4
+ export * from './OperationTree';
5
+ export * from './OperationFinallyHooks';
6
+ export * from './OperationLogger';
7
+ export * from './OperationDuration';
8
+ export * from './OperationStats';
9
+ export * from './OperationErrorHandler';
10
+ export * from './TrackedError';