@segment/actions-shared 1.92.0-staging-4cdde7a9f → 1.92.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 (82) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -2
  5. package/dist/engage/utils/AggregateError.d.ts +0 -14
  6. package/dist/engage/utils/AggregateError.js +0 -26
  7. package/dist/engage/utils/AggregateError.js.map +0 -1
  8. package/dist/engage/utils/EngageActionPerformer.d.ts +0 -42
  9. package/dist/engage/utils/EngageActionPerformer.js +0 -148
  10. package/dist/engage/utils/EngageActionPerformer.js.map +0 -1
  11. package/dist/engage/utils/EngageLogger.d.ts +0 -18
  12. package/dist/engage/utils/EngageLogger.js +0 -52
  13. package/dist/engage/utils/EngageLogger.js.map +0 -1
  14. package/dist/engage/utils/EngageStats.d.ts +0 -18
  15. package/dist/engage/utils/EngageStats.js +0 -95
  16. package/dist/engage/utils/EngageStats.js.map +0 -1
  17. package/dist/engage/utils/IntegrationErrorWrapper.d.ts +0 -12
  18. package/dist/engage/utils/IntegrationErrorWrapper.js +0 -31
  19. package/dist/engage/utils/IntegrationErrorWrapper.js.map +0 -1
  20. package/dist/engage/utils/MessageSendPerformer.d.ts +0 -65
  21. package/dist/engage/utils/MessageSendPerformer.js +0 -211
  22. package/dist/engage/utils/MessageSendPerformer.js.map +0 -1
  23. package/dist/engage/utils/Profile.d.ts +0 -6
  24. package/dist/engage/utils/Profile.js +0 -3
  25. package/dist/engage/utils/Profile.js.map +0 -1
  26. package/dist/engage/utils/ResponseError.d.ts +0 -25
  27. package/dist/engage/utils/ResponseError.js +0 -22
  28. package/dist/engage/utils/ResponseError.js.map +0 -1
  29. package/dist/engage/utils/getProfileApiEndpoint.d.ts +0 -2
  30. package/dist/engage/utils/getProfileApiEndpoint.js +0 -10
  31. package/dist/engage/utils/getProfileApiEndpoint.js.map +0 -1
  32. package/dist/engage/utils/index.d.ts +0 -14
  33. package/dist/engage/utils/index.js +0 -27
  34. package/dist/engage/utils/index.js.map +0 -1
  35. package/dist/engage/utils/isDestinationActionService.d.ts +0 -1
  36. package/dist/engage/utils/isDestinationActionService.js +0 -8
  37. package/dist/engage/utils/isDestinationActionService.js.map +0 -1
  38. package/dist/engage/utils/isRetryableError.d.ts +0 -2
  39. package/dist/engage/utils/isRetryableError.js +0 -33
  40. package/dist/engage/utils/isRetryableError.js.map +0 -1
  41. package/dist/engage/utils/operationTracking/GenericMethodDecorator.d.ts +0 -1
  42. package/dist/engage/utils/operationTracking/GenericMethodDecorator.js +0 -3
  43. package/dist/engage/utils/operationTracking/GenericMethodDecorator.js.map +0 -1
  44. package/dist/engage/utils/operationTracking/OperationDecorator.d.ts +0 -46
  45. package/dist/engage/utils/operationTracking/OperationDecorator.js +0 -46
  46. package/dist/engage/utils/operationTracking/OperationDecorator.js.map +0 -1
  47. package/dist/engage/utils/operationTracking/OperationDuration.d.ts +0 -12
  48. package/dist/engage/utils/operationTracking/OperationDuration.js +0 -23
  49. package/dist/engage/utils/operationTracking/OperationDuration.js.map +0 -1
  50. package/dist/engage/utils/operationTracking/OperationErrorHandler.d.ts +0 -12
  51. package/dist/engage/utils/operationTracking/OperationErrorHandler.js +0 -35
  52. package/dist/engage/utils/operationTracking/OperationErrorHandler.js.map +0 -1
  53. package/dist/engage/utils/operationTracking/OperationFinallyHooks.d.ts +0 -14
  54. package/dist/engage/utils/operationTracking/OperationFinallyHooks.js +0 -31
  55. package/dist/engage/utils/operationTracking/OperationFinallyHooks.js.map +0 -1
  56. package/dist/engage/utils/operationTracking/OperationLogger.d.ts +0 -31
  57. package/dist/engage/utils/operationTracking/OperationLogger.js +0 -104
  58. package/dist/engage/utils/operationTracking/OperationLogger.js.map +0 -1
  59. package/dist/engage/utils/operationTracking/OperationStats.d.ts +0 -39
  60. package/dist/engage/utils/operationTracking/OperationStats.js +0 -130
  61. package/dist/engage/utils/operationTracking/OperationStats.js.map +0 -1
  62. package/dist/engage/utils/operationTracking/OperationTracker.test.d.ts +0 -1
  63. package/dist/engage/utils/operationTracking/OperationTracker.test.js +0 -377
  64. package/dist/engage/utils/operationTracking/OperationTracker.test.js.map +0 -1
  65. package/dist/engage/utils/operationTracking/OperationTree.d.ts +0 -23
  66. package/dist/engage/utils/operationTracking/OperationTree.js +0 -49
  67. package/dist/engage/utils/operationTracking/OperationTree.js.map +0 -1
  68. package/dist/engage/utils/operationTracking/TrackedError.d.ts +0 -6
  69. package/dist/engage/utils/operationTracking/TrackedError.js +0 -3
  70. package/dist/engage/utils/operationTracking/TrackedError.js.map +0 -1
  71. package/dist/engage/utils/operationTracking/index.d.ts +0 -10
  72. package/dist/engage/utils/operationTracking/index.js +0 -23
  73. package/dist/engage/utils/operationTracking/index.js.map +0 -1
  74. package/dist/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.d.ts +0 -21
  75. package/dist/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js +0 -99
  76. package/dist/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js.map +0 -1
  77. package/dist/engage/utils/testUtils.d.ts +0 -6
  78. package/dist/engage/utils/testUtils.js +0 -27
  79. package/dist/engage/utils/testUtils.js.map +0 -1
  80. package/dist/engage/utils/track.d.ts +0 -52
  81. package/dist/engage/utils/track.js +0 -9
  82. package/dist/engage/utils/track.js.map +0 -1
@@ -1,377 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"OperationTracker.test.js","sourceRoot":"","sources":["../../../../src/engage/utils/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;CACF;AAED,MAAM,SAAU,SAAQ,+BAAc;IAAtC;;QACE,UAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAInB,CAAC;IAHC,MAAM,CAAC,sBAAsB,CAAC,GAA0B;QACtD,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAA;IAC3B,CAAC;CACF;AAED,MAAM,SAAS,GAAG,uCAAkB,CAAC,iCAAiC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;AAK7F,SAAS,eAAe,CACtB,aAA4C,EAC5C,cAAuC,EACvC,YAAqB;IAErB,MAAM,gBAAgB;QAAtB;YACE,WAAM,GAAG,IAAI,UAAU,EAAE,CAAA;YACzB,UAAK,GAAG,IAAI,SAAS,EAAE,CAAA;YAEvB,mBAAc,GAAG,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,CAAA;QAa1C,CAAC;QAVC,UAAU,CAAC,GAAG,IAAW;YAEvB,MAAM,QAAQ,GAAG,IAAI,CAAA;YACrB,IAAI,YAAY;gBACd,OAAO,CAAC,KAAK,IAAI,EAAE;oBACjB,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;oBAChD,OAAO,MAAM,cAAc,CAAC,KAAK,CAAC,QAAQ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9D,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,IAAI,CAAA;gBAC7B,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;YAC7D,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,KAAK,CACb,6CAA6C,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,QAAQ,CAAC,IAAI,CAAC,KAAK;qBACvG,GAAG,CAAC,CAAC,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBACrC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAA;aACF;SACF;AACL,CAAC"}
@@ -1,23 +0,0 @@
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 {};
@@ -1,49 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"OperationTree.js","sourceRoot":"","sources":["../../../../src/engage/utils/operationTracking/OperationTree.ts"],"names":[],"mappings":";;;AAWA,MAAa,aAAa;IACxB,MAAM,CAAC,sBAAsB,CAAC,IAA0B;QAEtD,OAAO,IAAI,C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xC,CAAC;SACF,CAAA;IACH,CAAC;CACF;AApDD,sCAoDC"}
@@ -1,6 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=TrackedError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TrackedError.js","sourceRoot":"","sources":["../../../../src/engage/utils/operationTracking/TrackedError.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
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';
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./wrapTryCatchFinallyPromisable"), exports);
14
- __exportStar(require("./OperationDecorator"), exports);
15
- __exportStar(require("./GenericMethodDecorator"), exports);
16
- __exportStar(require("./OperationTree"), exports);
17
- __exportStar(require("./OperationFinallyHooks"), exports);
18
- __exportStar(require("./OperationLogger"), exports);
19
- __exportStar(require("./OperationDuration"), exports);
20
- __exportStar(require("./OperationStats"), exports);
21
- __exportStar(require("./OperationErrorHandler"), exports);
22
- __exportStar(require("./TrackedError"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engage/utils/operationTracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAA+C;AAC/C,uDAAoC;AACpC,2DAAwC;AACxC,kDAA+B;AAC/B,0DAAuC;AACvC,oDAAiC;AACjC,sDAAmC;AACnC,mDAAgC;AAChC,0DAAuC;AACvC,iDAA8B"}
@@ -1,21 +0,0 @@
1
- export interface TryCatchFinallyContext<TFunc extends (this: any, ...args: any[]) => any = (this: any, ...args: any[]) => any> {
2
- func: TFunc;
3
- funcArgs: Parameters<TFunc>;
4
- funcThis: ThisParameterType<TFunc>;
5
- result?: ReturnType<TFunc> | Awaited<ReturnType<TFunc>>;
6
- error?: unknown;
7
- stage: 'try' | 'success' | 'catch' | 'finally';
8
- }
9
- export interface TryCatchFinallyHook<TContext extends TryCatchFinallyContext<any> = TryCatchFinallyContext<(...args: any[]) => any>> {
10
- onTry?(ctx: TContext): void | (() => void);
11
- onSuccess?(ctx: TContext): void | (() => void);
12
- onCatch?(ctx: TContext): void | (() => void);
13
- onFinally?(ctx: TContext): void | (() => void);
14
- getPriority?(ctx: TContext): number | void;
15
- }
16
- export declare type FuncFromTryCatchFinallyContext<TWrapContext extends TryCatchFinallyContext<any>> = TWrapContext extends TryCatchFinallyContext<infer TFunc> ? TFunc : never;
17
- export declare const DefaultHookPriority = 0;
18
- export declare function wrapTryCatchFinallyPromisable<TFunc extends (...args: any[]) => any, TContext extends TryCatchFinallyContext<TFunc> = TryCatchFinallyContext<TFunc>, THooks extends TryCatchFinallyHook<TContext>[] = TryCatchFinallyHook<TContext>[]>(func: TFunc, getHooks: (ctx: TContext) => THooks, onHookError?: (e: unknown) => unknown | undefined): TFunc;
19
- export declare type Awaited<T> = T extends null | undefined ? T : T extends object & {
20
- then(onfulfilled: infer F, ...args: infer _): any;
21
- } ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapTryCatchFinallyPromisable = exports.DefaultHookPriority = void 0;
4
- exports.DefaultHookPriority = 0;
5
- function wrapTryCatchFinallyPromisable(func, getHooks, onHookError) {
6
- function forEachHook(hooks, inContext, doThis) {
7
- const prioritizedHooks = Object.values(hooks).sort((h1, h2) => {
8
- const p1 = h1.getPriority ? h1.getPriority(inContext) : exports.DefaultHookPriority;
9
- const p2 = h2.getPriority ? h2.getPriority(inContext) : exports.DefaultHookPriority;
10
- return (p1 === undefined ? exports.DefaultHookPriority : p1) - (p2 === undefined ? exports.DefaultHookPriority : p2);
11
- });
12
- const postCallbacks = [];
13
- for (const hook of prioritizedHooks) {
14
- try {
15
- const callback = doThis(hook);
16
- if (callback instanceof Function)
17
- postCallbacks.push(callback);
18
- }
19
- catch (hookError) {
20
- let errorToThrow = hookError;
21
- if (onHookError)
22
- errorToThrow = onHookError(errorToThrow);
23
- if (errorToThrow)
24
- throw errorToThrow;
25
- }
26
- }
27
- for (const callback of postCallbacks.reverse()) {
28
- try {
29
- callback();
30
- }
31
- catch (callbackError) {
32
- let errorToThrow = callbackError;
33
- if (onHookError)
34
- errorToThrow = onHookError(errorToThrow);
35
- if (errorToThrow)
36
- throw errorToThrow;
37
- }
38
- }
39
- }
40
- return function (...funcArgs) {
41
- const ctx = {
42
- funcArgs: funcArgs,
43
- funcThis: this,
44
- func,
45
- stage: 'try'
46
- };
47
- let isPromise = false;
48
- const hooks = getHooks(ctx);
49
- try {
50
- forEachHook(hooks, ctx, (hook) => hook.onTry?.(ctx));
51
- const funcResMayBePromise = func.apply(this, funcArgs);
52
- isPromise = isValuePromise(funcResMayBePromise);
53
- if (isPromise) {
54
- const wrappedPromise = (async () => {
55
- try {
56
- ctx.result = await funcResMayBePromise;
57
- ctx.stage = 'success';
58
- forEachHook(hooks, ctx, (hook) => hook.onSuccess?.(ctx));
59
- }
60
- catch (error) {
61
- ctx.stage = 'catch';
62
- ctx.error = error;
63
- forEachHook(hooks, ctx, (hook) => hook.onCatch?.(ctx));
64
- if (ctx.error)
65
- throw ctx.error;
66
- }
67
- finally {
68
- ctx.stage = 'finally';
69
- forEachHook(hooks, ctx, (hook) => hook.onFinally?.(ctx));
70
- }
71
- return ctx.result;
72
- })();
73
- return wrappedPromise;
74
- }
75
- ctx.result = funcResMayBePromise;
76
- ctx.stage = 'success';
77
- forEachHook(hooks, ctx, (hook) => hook.onSuccess?.(ctx));
78
- }
79
- catch (error) {
80
- ctx.stage = 'catch';
81
- ctx.error = error;
82
- forEachHook(hooks, ctx, (hook) => hook.onCatch?.(ctx));
83
- if (ctx.error)
84
- throw ctx.error;
85
- }
86
- finally {
87
- if (!isPromise) {
88
- ctx.stage = 'finally';
89
- forEachHook(hooks, ctx, (hook) => hook.onFinally?.(ctx));
90
- }
91
- }
92
- return ctx.result;
93
- };
94
- }
95
- exports.wrapTryCatchFinallyPromisable = wrapTryCatchFinallyPromisable;
96
- function isValuePromise(obj) {
97
- return obj instanceof Object && 'then' in obj && typeof obj.then === 'function';
98
- }
99
- //# sourceMappingURL=wrapTryCatchFinallyPromisable.js.map