@creator.co/wapi 1.2.2 → 1.2.3

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 (55) hide show
  1. package/.eslintrc.cjs +29 -22
  2. package/.github/workflows/npmpublish.yml +1 -1
  3. package/.github/workflows/prs.yml +1 -1
  4. package/index.ts +12 -10
  5. package/jest.config.ts +19 -19
  6. package/package.json +1 -1
  7. package/src/API/Request.ts +17 -35
  8. package/src/API/Response.ts +24 -42
  9. package/src/API/Utils.ts +5 -7
  10. package/src/BaseEvent/EventProcessor.ts +16 -24
  11. package/src/BaseEvent/Process.ts +7 -12
  12. package/src/BaseEvent/Transaction.ts +25 -43
  13. package/src/Config/Configuration.ts +8 -14
  14. package/src/Config/EnvironmentVar.ts +10 -20
  15. package/src/Crypto/Crypto.ts +10 -10
  16. package/src/Crypto/JWT.ts +4 -10
  17. package/src/Globals.ts +19 -25
  18. package/src/Logger/Logger.ts +36 -51
  19. package/src/Mailer/Mailer.ts +19 -31
  20. package/src/Publisher/Publisher.ts +7 -12
  21. package/src/Server/RouteResolver.ts +5 -6
  22. package/src/Server/Router.ts +7 -12
  23. package/src/Server/lib/ContainerServer.ts +5 -5
  24. package/src/Server/lib/Server.ts +26 -38
  25. package/src/Server/lib/container/GenericHandler.ts +8 -13
  26. package/src/Server/lib/container/GenericHandlerEvent.ts +21 -35
  27. package/src/Server/lib/container/HealthHandler.ts +2 -2
  28. package/src/Server/lib/container/Proxy.ts +26 -38
  29. package/src/Server/lib/container/Utils.ts +2 -2
  30. package/src/Validation/Validator.ts +6 -6
  31. package/tests/API/Request.test.ts +107 -111
  32. package/tests/API/Response.test.ts +86 -91
  33. package/tests/API/Utils.test.ts +64 -64
  34. package/tests/BaseEvent/EventProcessor.test.ts +68 -84
  35. package/tests/BaseEvent/Process.test.ts +11 -11
  36. package/tests/BaseEvent/Transaction.test.ts +44 -53
  37. package/tests/Config/Config.test.ts +50 -50
  38. package/tests/Config/EnvironmentVar.test.ts +50 -59
  39. package/tests/Crypto/Crypto.test.ts +20 -22
  40. package/tests/Crypto/JWT.test.ts +40 -40
  41. package/tests/Logger/Logger.test.ts +24 -36
  42. package/tests/Mailer/Mailer.test.ts +21 -29
  43. package/tests/Publisher/Publisher.test.ts +18 -18
  44. package/tests/Server/RouteResolver.test.ts +56 -59
  45. package/tests/Server/Router.test.ts +16 -16
  46. package/tests/Server/lib/ContainerServer.test.ts +83 -85
  47. package/tests/Server/lib/Server.test.ts +4 -4
  48. package/tests/Server/lib/container/GenericHandler.test.ts +31 -41
  49. package/tests/Server/lib/container/GenericHandlerEvent.test.ts +35 -36
  50. package/tests/Server/lib/container/HealthHandler.test.ts +7 -7
  51. package/tests/Server/lib/container/Proxy.test.ts +66 -79
  52. package/tests/Server/lib/container/Utils.test.ts +16 -17
  53. package/tests/Test.utils.ts +9 -9
  54. package/tests/Validation/Validator.test.ts +28 -40
  55. package/tests/main.test.ts +2 -2
@@ -1,36 +1,34 @@
1
- import { expect as j_expect } from "@jest/globals"
2
- import { expect } from "chai"
1
+ import { expect as j_expect } from '@jest/globals'
2
+ import { expect } from 'chai'
3
3
 
4
- import Response from "../../src/API/Response"
5
- import EventProcessor from "../../src/BaseEvent/EventProcessor"
6
- import Globals from "../../src/Globals"
7
- import { emptyQueueEvent, observableContext } from "../Test.utils"
4
+ import Response from '../../src/API/Response'
5
+ import EventProcessor from '../../src/BaseEvent/EventProcessor'
6
+ import Globals from '../../src/Globals'
7
+ import { emptyQueueEvent, observableContext } from '../Test.utils'
8
8
 
9
- describe("EventProcessor success invocation path", () => {
10
- test("Simple success", async () => {
11
- const b = { name: "123" }
9
+ describe('EventProcessor success invocation path', () => {
10
+ test('Simple success', async () => {
11
+ const b = { name: '123' }
12
12
  const context = observableContext()
13
13
  const transaction = new EventProcessor(
14
14
  emptyQueueEvent({
15
15
  Records: [{ body: JSON.stringify(b) }, { body: JSON.stringify(b) }],
16
16
  }),
17
17
  context,
18
- {},
18
+ {}
19
19
  )
20
20
  let count = 0
21
- const handlerResp = await transaction.processEvent(
22
- async (transaction, eventRecord) => {
23
- expect(eventRecord).to.be.deep.equal(b)
24
- count++
25
- return Response.SuccessResponse(null)
26
- },
27
- )
21
+ const handlerResp = await transaction.processEvent(async (transaction, eventRecord) => {
22
+ expect(eventRecord).to.be.deep.equal(b)
23
+ count++
24
+ return Response.SuccessResponse(null)
25
+ })
28
26
  // check resp
29
27
  expect(count).to.be.equals(2)
30
28
  expect(handlerResp).to.be.an.instanceof(Response)
31
29
  if (handlerResp instanceof Response) {
32
30
  expect(handlerResp?.getBody()).to.be.deep.equal({
33
- transactionID: "unknown",
31
+ transactionID: 'unknown',
34
32
  })
35
33
  expect(handlerResp.getCode()).to.be.equal(200)
36
34
  }
@@ -40,31 +38,28 @@ describe("EventProcessor success invocation path", () => {
40
38
  j_expect(context.succeed).not.toBeCalled()
41
39
  })
42
40
 
43
- test("Simple success - do not decode", async () => {
44
- const b = { name: "123" }
41
+ test('Simple success - do not decode', async () => {
42
+ const b = { name: '123' }
45
43
  const context = observableContext()
46
44
  const transaction = new EventProcessor(
47
45
  emptyQueueEvent({
48
46
  Records: [{ body: JSON.stringify(b) }, { body: JSON.stringify(b) }],
49
47
  }),
50
48
  context,
51
- {},
49
+ {}
52
50
  )
53
51
  let count = 0
54
- const handlerResp = await transaction.processEvent(
55
- async (transaction, eventRecord) => {
56
- expect(eventRecord).to.be.deep.equal(JSON.stringify(b))
57
- count++
58
- return Response.SuccessResponse(null)
59
- },
60
- true,
61
- )
52
+ const handlerResp = await transaction.processEvent(async (transaction, eventRecord) => {
53
+ expect(eventRecord).to.be.deep.equal(JSON.stringify(b))
54
+ count++
55
+ return Response.SuccessResponse(null)
56
+ }, true)
62
57
  // check resp
63
58
  expect(count).to.be.equals(2)
64
59
  expect(handlerResp).to.be.an.instanceof(Response)
65
60
  if (handlerResp instanceof Response) {
66
61
  expect(handlerResp?.getBody()).to.be.deep.equal({
67
- transactionID: "unknown",
62
+ transactionID: 'unknown',
68
63
  })
69
64
  expect(handlerResp.getCode()).to.be.equal(200)
70
65
  }
@@ -75,34 +70,30 @@ describe("EventProcessor success invocation path", () => {
75
70
  })
76
71
  })
77
72
 
78
- describe("EventProcessor failure invocation path", () => {
79
- test("Simple failure", async () => {
80
- const b = { name: "123" }
73
+ describe('EventProcessor failure invocation path', () => {
74
+ test('Simple failure', async () => {
75
+ const b = { name: '123' }
81
76
  const context = observableContext()
82
77
  const transaction = new EventProcessor(
83
78
  emptyQueueEvent({
84
79
  Records: [
85
80
  { body: JSON.stringify(b) },
86
- { messageId: "123", body: JSON.stringify(b) },
81
+ { messageId: '123', body: JSON.stringify(b) },
87
82
  { body: JSON.stringify(b) },
88
83
  ],
89
84
  }),
90
85
  context,
91
- {},
86
+ {}
92
87
  )
93
88
  let count = 0
94
89
  let handlerResp: any = null,
95
90
  err: any = null
96
91
  try {
97
- handlerResp = await transaction.processEvent(
98
- async (transaction, eventRecord) => {
99
- expect(eventRecord).to.be.deep.equal(b)
100
- count++
101
- return count == 1
102
- ? Response.SuccessResponse(null)
103
- : Response.BadRequestResponse("Failed!")
104
- },
105
- )
92
+ handlerResp = await transaction.processEvent(async (transaction, eventRecord) => {
93
+ expect(eventRecord).to.be.deep.equal(b)
94
+ count++
95
+ return count == 1 ? Response.SuccessResponse(null) : Response.BadRequestResponse('Failed!')
96
+ })
106
97
  } catch (e) {
107
98
  err = e
108
99
  }
@@ -112,10 +103,10 @@ describe("EventProcessor failure invocation path", () => {
112
103
  expect(err).to.be.deep.equal(
113
104
  new Error(
114
105
  JSON.stringify({
115
- err: "Failed!",
116
- transactionID: "unknown",
117
- }),
118
- ),
106
+ err: 'Failed!',
107
+ transactionID: 'unknown',
108
+ })
109
+ )
119
110
  )
120
111
  // ctx
121
112
  j_expect(context.fail).not.toBeCalled()
@@ -123,19 +114,19 @@ describe("EventProcessor failure invocation path", () => {
123
114
  j_expect(context.succeed).not.toBeCalled()
124
115
  })
125
116
 
126
- test("Simple failure w/ null", async () => {
127
- const b = { name: "123" }
117
+ test('Simple failure w/ null', async () => {
118
+ const b = { name: '123' }
128
119
  const context = observableContext()
129
120
  const transaction = new EventProcessor(
130
121
  emptyQueueEvent({
131
122
  Records: [
132
123
  { body: JSON.stringify(b) },
133
- { messageId: "123", body: JSON.stringify(b) },
124
+ { messageId: '123', body: JSON.stringify(b) },
134
125
  { body: JSON.stringify(b) },
135
126
  ],
136
127
  }),
137
128
  context,
138
- {},
129
+ {}
139
130
  )
140
131
  let count = 0
141
132
  let handlerResp: any = null,
@@ -147,7 +138,7 @@ describe("EventProcessor failure invocation path", () => {
147
138
  expect(eventRecord).to.be.deep.equal(b)
148
139
  count++
149
140
  return null
150
- },
141
+ }
151
142
  )
152
143
  } catch (e) {
153
144
  err = e
@@ -161,9 +152,9 @@ describe("EventProcessor failure invocation path", () => {
161
152
  err: Globals.ErrorResponseInvalidServerResponse,
162
153
  rollback: true,
163
154
  errCode: Globals.ErrorCode_APIError,
164
- transactionID: "unknown",
165
- }),
166
- ),
155
+ transactionID: 'unknown',
156
+ })
157
+ )
167
158
  )
168
159
  // ctx
169
160
  j_expect(context.fail).not.toBeCalled()
@@ -171,34 +162,27 @@ describe("EventProcessor failure invocation path", () => {
171
162
  j_expect(context.succeed).not.toBeCalled()
172
163
  })
173
164
 
174
- test("Simple failure - allow failures", async () => {
175
- const b = { name: "123" }
165
+ test('Simple failure - allow failures', async () => {
166
+ const b = { name: '123' }
176
167
  const context = observableContext()
177
168
  const transaction = new EventProcessor(
178
169
  emptyQueueEvent({
179
- Records: [
180
- { body: JSON.stringify(b) },
181
- { messageId: "123", body: JSON.stringify(b) },
182
- ],
170
+ Records: [{ body: JSON.stringify(b) }, { messageId: '123', body: JSON.stringify(b) }],
183
171
  }),
184
172
  context,
185
173
  {},
186
- true,
174
+ true
187
175
  )
188
176
  let count = 0
189
- const handlerResp = await transaction.processEvent(
190
- async (transaction, eventRecord) => {
191
- expect(eventRecord).to.be.deep.equal(b)
192
- count++
193
- return count == 1
194
- ? Response.SuccessResponse(null)
195
- : Response.BadRequestResponse("Failed!")
196
- },
197
- )
177
+ const handlerResp = await transaction.processEvent(async (transaction, eventRecord) => {
178
+ expect(eventRecord).to.be.deep.equal(b)
179
+ count++
180
+ return count == 1 ? Response.SuccessResponse(null) : Response.BadRequestResponse('Failed!')
181
+ })
198
182
  // check resp
199
183
  expect(count).to.be.equals(2)
200
184
  expect(handlerResp).to.be.deep.equal({
201
- batchItemFailures: [{ itemIdentifier: "123" }],
185
+ batchItemFailures: [{ itemIdentifier: '123' }],
202
186
  })
203
187
  // ctx
204
188
  j_expect(context.fail).not.toBeCalled()
@@ -206,19 +190,19 @@ describe("EventProcessor failure invocation path", () => {
206
190
  j_expect(context.succeed).not.toBeCalled()
207
191
  })
208
192
 
209
- test("Simple failure w/ null response - allow failures", async () => {
210
- const b = { name: "123" }
193
+ test('Simple failure w/ null response - allow failures', async () => {
194
+ const b = { name: '123' }
211
195
  const context = observableContext()
212
196
  const transaction = new EventProcessor(
213
197
  emptyQueueEvent({
214
198
  Records: [
215
- { messageId: "456", body: JSON.stringify(b) },
216
- { messageId: "123", body: JSON.stringify(b) },
199
+ { messageId: '456', body: JSON.stringify(b) },
200
+ { messageId: '123', body: JSON.stringify(b) },
217
201
  ],
218
202
  }),
219
203
  context,
220
204
  {},
221
- true,
205
+ true
222
206
  )
223
207
  let count = 0
224
208
  const handlerResp = await transaction.processEvent(
@@ -227,12 +211,12 @@ describe("EventProcessor failure invocation path", () => {
227
211
  expect(eventRecord).to.be.deep.equal(b)
228
212
  count++
229
213
  return null
230
- },
214
+ }
231
215
  )
232
216
  // check resp
233
217
  expect(count).to.be.equals(2)
234
218
  expect(handlerResp).to.be.deep.equal({
235
- batchItemFailures: [{ itemIdentifier: "456" }, { itemIdentifier: "123" }],
219
+ batchItemFailures: [{ itemIdentifier: '456' }, { itemIdentifier: '123' }],
236
220
  })
237
221
  // ctx
238
222
  j_expect(context.fail).not.toBeCalled()
@@ -240,7 +224,7 @@ describe("EventProcessor failure invocation path", () => {
240
224
  j_expect(context.succeed).not.toBeCalled()
241
225
  })
242
226
 
243
- test("Simple failure no records", async () => {
227
+ test('Simple failure no records', async () => {
244
228
  const context = observableContext()
245
229
  const transaction = new EventProcessor(emptyQueueEvent(), context, {})
246
230
  let count = 0
@@ -252,7 +236,7 @@ describe("EventProcessor failure invocation path", () => {
252
236
  async () => {
253
237
  count++
254
238
  return null
255
- },
239
+ }
256
240
  )
257
241
  } catch (e) {
258
242
  err = e
@@ -265,8 +249,8 @@ describe("EventProcessor failure invocation path", () => {
265
249
  JSON.stringify({
266
250
  err: Globals.ErrorResponseNoRecords,
267
251
  errCode: Globals.ErrorCode_NoRecords,
268
- }),
269
- ),
252
+ })
253
+ )
270
254
  )
271
255
  // ctx
272
256
  j_expect(context.fail).not.toBeCalled()
@@ -1,11 +1,11 @@
1
- import { expect } from "chai"
1
+ import { expect } from 'chai'
2
2
 
3
- import Response from "../../src/API/Response"
4
- import Process from "../../src/BaseEvent/Process"
3
+ import Response from '../../src/API/Response'
4
+ import Process from '../../src/BaseEvent/Process'
5
5
 
6
- describe("Process success invocation path", () => {
7
- test("Simple success", async () => {
8
- const b = { name: "123" }
6
+ describe('Process success invocation path', () => {
7
+ test('Simple success', async () => {
8
+ const b = { name: '123' }
9
9
  const proc = new Process({}, 100)
10
10
  let count = 0
11
11
  const handlerResp = await proc.execute(async () => {
@@ -15,7 +15,7 @@ describe("Process success invocation path", () => {
15
15
  // check resp
16
16
  expect(handlerResp).to.be.undefined
17
17
  // check iterations
18
- return new Promise((resolve) => {
18
+ return new Promise(resolve => {
19
19
  setTimeout(() => {
20
20
  expect(count).to.be.equals(2)
21
21
  clearInterval(proc.interval)
@@ -25,18 +25,18 @@ describe("Process success invocation path", () => {
25
25
  })
26
26
  })
27
27
 
28
- describe("Process failure invocation path", () => {
29
- test("Simple failure", async () => {
28
+ describe('Process failure invocation path', () => {
29
+ test('Simple failure', async () => {
30
30
  const proc = new Process({}, 100)
31
31
  let count = 0
32
32
  const handlerResp = await proc.execute(async () => {
33
33
  count++
34
- throw new Error("Failed!")
34
+ throw new Error('Failed!')
35
35
  })
36
36
  // check resp
37
37
  expect(handlerResp).to.be.undefined
38
38
  // check iterations
39
- return new Promise((resolve) => {
39
+ return new Promise(resolve => {
40
40
  setTimeout(() => {
41
41
  expect(count).to.be.equals(2)
42
42
  clearInterval(proc.interval)
@@ -1,14 +1,14 @@
1
- import { expect as j_expect } from "@jest/globals"
2
- import { expect } from "chai"
1
+ import { expect as j_expect } from '@jest/globals'
2
+ import { expect } from 'chai'
3
3
 
4
- import Response from "../../src/API/Response"
5
- import Transaction from "../../src/BaseEvent/Transaction"
6
- import Globals from "../../src/Globals"
7
- import { defaultHeaders, emptyEvent, observableContext } from "../Test.utils"
4
+ import Response from '../../src/API/Response'
5
+ import Transaction from '../../src/BaseEvent/Transaction'
6
+ import Globals from '../../src/Globals'
7
+ import { defaultHeaders, emptyEvent, observableContext } from '../Test.utils'
8
8
 
9
- describe("Transaction success invocation path", () => {
10
- test("Simple success", async () => {
11
- const b = { name: "123" }
9
+ describe('Transaction success invocation path', () => {
10
+ test('Simple success', async () => {
11
+ const b = { name: '123' }
12
12
  const context = observableContext()
13
13
  const transaction = new Transaction<null, typeof b>(emptyEvent(), context)
14
14
  const handlerResp = await transaction.execute(async () => {
@@ -26,8 +26,8 @@ describe("Transaction success invocation path", () => {
26
26
  })
27
27
  })
28
28
 
29
- test("Simple success - sync return", async () => {
30
- const b = { name: "123" }
29
+ test('Simple success - sync return', async () => {
30
+ const b = { name: '123' }
31
31
  const context = observableContext()
32
32
  const transaction = new Transaction<null, typeof b>(emptyEvent(), context, {
33
33
  syncReturn: true,
@@ -46,15 +46,15 @@ describe("Transaction success invocation path", () => {
46
46
  })
47
47
  })
48
48
 
49
- describe("Transaction error invocation path without response", () => {
50
- test("Not valid response returned success", async () => {
49
+ describe('Transaction error invocation path without response', () => {
50
+ test('Not valid response returned success', async () => {
51
51
  const b = {
52
52
  err: Globals.ErrorResponseInvalidServerResponse,
53
53
  rollback: true,
54
54
  errCode: Globals.ErrorCode_APIError,
55
- transactionID: "123",
55
+ transactionID: '123',
56
56
  }
57
- const context = observableContext({ awsRequestId: "123" })
57
+ const context = observableContext({ awsRequestId: '123' })
58
58
  const transaction = new Transaction<null, typeof b>(emptyEvent(), context)
59
59
  const handlerResp = await transaction.execute(async () => {
60
60
  return null
@@ -71,22 +71,22 @@ describe("Transaction error invocation path without response", () => {
71
71
  })
72
72
  })
73
73
 
74
- test("Not valid response returned success - sync return", async () => {
74
+ test('Not valid response returned success - sync return', async () => {
75
75
  const b = {
76
76
  err: Globals.ErrorResponseInvalidServerResponse,
77
77
  rollback: true,
78
78
  errCode: Globals.ErrorCode_APIError,
79
- transactionID: "123",
79
+ transactionID: '123',
80
80
  }
81
81
  const context = observableContext()
82
82
  const transaction = new Transaction<null, typeof b>(
83
83
  emptyEvent({
84
- requestContext: { requestId: "123" },
84
+ requestContext: { requestId: '123' },
85
85
  }),
86
86
  context,
87
87
  {
88
88
  syncReturn: true,
89
- },
89
+ }
90
90
  )
91
91
  const handlerResp = await transaction.execute(async () => {
92
92
  return null
@@ -102,20 +102,17 @@ describe("Transaction error invocation path without response", () => {
102
102
  })
103
103
  })
104
104
 
105
- describe("Transaction error invocation path with non-Response class response", () => {
106
- test("Not a response-class response returned success", async () => {
105
+ describe('Transaction error invocation path with non-Response class response', () => {
106
+ test('Not a response-class response returned success', async () => {
107
107
  const b = {
108
108
  err: Globals.ErrorResponseInvalidServerResponse,
109
109
  rollback: true,
110
110
  errCode: Globals.ErrorCode_APIError,
111
- transactionID: "unknown",
111
+ transactionID: 'unknown',
112
112
  }
113
- const b2 = { name: "abc" }
113
+ const b2 = { name: 'abc' }
114
114
  const context = observableContext()
115
- const transaction = new Transaction<null, null, typeof b2>(
116
- emptyEvent(),
117
- context,
118
- )
115
+ const transaction = new Transaction<null, null, typeof b2>(emptyEvent(), context)
119
116
  const handlerResp = await transaction.execute(async () => {
120
117
  return b2
121
118
  })
@@ -131,14 +128,12 @@ describe("Transaction error invocation path with non-Response class response", (
131
128
  })
132
129
  })
133
130
 
134
- test("Not a response-class response returned success - sync return", async () => {
135
- const b2 = { name: "abc" }
131
+ test('Not a response-class response returned success - sync return', async () => {
132
+ const b2 = { name: 'abc' }
136
133
  const context = observableContext()
137
- const transaction = new Transaction<null, null, typeof b2>(
138
- emptyEvent(),
139
- context,
140
- { syncReturn: true },
141
- )
134
+ const transaction = new Transaction<null, null, typeof b2>(emptyEvent(), context, {
135
+ syncReturn: true,
136
+ })
142
137
  const handlerResp = await transaction.execute(async () => {
143
138
  return b2
144
139
  })
@@ -151,18 +146,18 @@ describe("Transaction error invocation path with non-Response class response", (
151
146
  })
152
147
  })
153
148
 
154
- describe("Transaction error invocation path with exception", () => {
155
- test("Transaction exception", async () => {
149
+ describe('Transaction error invocation path with exception', () => {
150
+ test('Transaction exception', async () => {
156
151
  const b = {
157
152
  err: Globals.ErrorResponseUnhandledError,
158
153
  rollback: true,
159
154
  errCode: Globals.ErrorCode_APIError,
160
- transactionID: "unknown",
155
+ transactionID: 'unknown',
161
156
  }
162
157
  const context = observableContext()
163
158
  const transaction = new Transaction<null, null, null>(emptyEvent(), context)
164
159
  const handlerResp = await transaction.execute(async () => {
165
- throw new Error("Failed!")
160
+ throw new Error('Failed!')
166
161
  })
167
162
  // check resp
168
163
  expect(handlerResp).to.be.null
@@ -176,21 +171,19 @@ describe("Transaction error invocation path with exception", () => {
176
171
  })
177
172
  })
178
173
 
179
- test("Transaction exception - sync return", async () => {
174
+ test('Transaction exception - sync return', async () => {
180
175
  const b = {
181
176
  err: Globals.ErrorResponseUnhandledError,
182
177
  rollback: true,
183
178
  errCode: Globals.ErrorCode_APIError,
184
- transactionID: "unknown",
179
+ transactionID: 'unknown',
185
180
  }
186
181
  const context = observableContext()
187
- const transaction = new Transaction<null, null, null>(
188
- emptyEvent(),
189
- context,
190
- { syncReturn: true },
191
- )
182
+ const transaction = new Transaction<null, null, null>(emptyEvent(), context, {
183
+ syncReturn: true,
184
+ })
192
185
  const handlerResp = await transaction.execute(async () => {
193
- throw new Error("Failed!")
186
+ throw new Error('Failed!')
194
187
  })
195
188
  // check resp
196
189
  expect(handlerResp?.getBody()).to.be.deep.equals(b)
@@ -201,14 +194,12 @@ describe("Transaction error invocation path with exception", () => {
201
194
  j_expect(context.succeed).not.toBeCalled()
202
195
  })
203
196
 
204
- test("Transaction exception - sync return", async () => {
197
+ test('Transaction exception - sync return', async () => {
205
198
  const context = observableContext()
206
- const transaction = new Transaction<null, null, null>(
207
- emptyEvent(),
208
- context,
209
- { throwOnErrors: true },
210
- )
211
- const error = new Error("Failed!")
199
+ const transaction = new Transaction<null, null, null>(emptyEvent(), context, {
200
+ throwOnErrors: true,
201
+ })
202
+ const error = new Error('Failed!')
212
203
  let handlerResp: any = null,
213
204
  err: any = null
214
205
  try {