serverless-spy 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +236 -9
- package/API.md +161 -0
- package/dist/releasetag.txt +1 -1
- package/extension/interceptor.ts +19 -16
- package/functions/sqsSubscriptionAndDropAllMessages.ts +3 -0
- package/lib/extension/dist/layer/nodejs/node_modules/interceptor.js +10463 -23565
- package/lib/extension/dist/layer/nodejs/node_modules/interceptor.js.map +4 -4
- package/lib/listener/ServerlessSpyListenerParams.d.ts +1 -0
- package/lib/listener/ServerlessSpyListenerParams.js +1 -1
- package/lib/listener/ServerlessSpyListenerParams.mjs +1 -1
- package/lib/listener/WsListener.d.ts +4 -21
- package/lib/listener/WsListener.js +11 -3
- package/lib/listener/WsListener.mjs +11 -3
- package/lib/src/ServerlessSpy.d.ts +44 -14
- package/lib/src/ServerlessSpy.js +229 -86
- package/lib/src/ServerlessSpy.mjs +228 -85
- package/lib/src/common/envVariableNames.d.ts +6 -2
- package/lib/src/common/envVariableNames.js +6 -2
- package/lib/src/common/envVariableNames.mjs +6 -2
- package/listener/ServerlessSpyListenerParams.ts +1 -0
- package/listener/WsListener.ts +18 -6
- package/package.json +1 -1
package/.jsii
CHANGED
|
@@ -3149,7 +3149,7 @@
|
|
|
3149
3149
|
},
|
|
3150
3150
|
"locationInModule": {
|
|
3151
3151
|
"filename": "src/ServerlessSpy.ts",
|
|
3152
|
-
"line":
|
|
3152
|
+
"line": 53
|
|
3153
3153
|
},
|
|
3154
3154
|
"parameters": [
|
|
3155
3155
|
{
|
|
@@ -3176,7 +3176,7 @@
|
|
|
3176
3176
|
"kind": "class",
|
|
3177
3177
|
"locationInModule": {
|
|
3178
3178
|
"filename": "src/ServerlessSpy.ts",
|
|
3179
|
-
"line":
|
|
3179
|
+
"line": 40
|
|
3180
3180
|
},
|
|
3181
3181
|
"methods": [
|
|
3182
3182
|
{
|
|
@@ -3185,7 +3185,7 @@
|
|
|
3185
3185
|
},
|
|
3186
3186
|
"locationInModule": {
|
|
3187
3187
|
"filename": "src/ServerlessSpy.ts",
|
|
3188
|
-
"line":
|
|
3188
|
+
"line": 697
|
|
3189
3189
|
},
|
|
3190
3190
|
"name": "getConstructName",
|
|
3191
3191
|
"parameters": [
|
|
@@ -3201,6 +3201,56 @@
|
|
|
3201
3201
|
"primitive": "string"
|
|
3202
3202
|
}
|
|
3203
3203
|
}
|
|
3204
|
+
},
|
|
3205
|
+
{
|
|
3206
|
+
"docs": {
|
|
3207
|
+
"stability": "stable",
|
|
3208
|
+
"summary": "Initalize spying on resources."
|
|
3209
|
+
},
|
|
3210
|
+
"locationInModule": {
|
|
3211
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3212
|
+
"line": 181
|
|
3213
|
+
},
|
|
3214
|
+
"name": "spy",
|
|
3215
|
+
"parameters": [
|
|
3216
|
+
{
|
|
3217
|
+
"docs": {
|
|
3218
|
+
"summary": "Limit which resources to spy on."
|
|
3219
|
+
},
|
|
3220
|
+
"name": "filter",
|
|
3221
|
+
"optional": true,
|
|
3222
|
+
"type": {
|
|
3223
|
+
"fqn": "serverless-spy.SpyFilter"
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
]
|
|
3227
|
+
},
|
|
3228
|
+
{
|
|
3229
|
+
"docs": {
|
|
3230
|
+
"stability": "stable",
|
|
3231
|
+
"summary": "Initalize spying on resources given as parameter."
|
|
3232
|
+
},
|
|
3233
|
+
"locationInModule": {
|
|
3234
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3235
|
+
"line": 168
|
|
3236
|
+
},
|
|
3237
|
+
"name": "spyNodes",
|
|
3238
|
+
"parameters": [
|
|
3239
|
+
{
|
|
3240
|
+
"docs": {
|
|
3241
|
+
"summary": "Which reources and their children to spy on."
|
|
3242
|
+
},
|
|
3243
|
+
"name": "nodes",
|
|
3244
|
+
"type": {
|
|
3245
|
+
"collection": {
|
|
3246
|
+
"elementtype": {
|
|
3247
|
+
"fqn": "constructs.IConstruct"
|
|
3248
|
+
},
|
|
3249
|
+
"kind": "array"
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
]
|
|
3204
3254
|
}
|
|
3205
3255
|
],
|
|
3206
3256
|
"name": "ServerlessSpy",
|
|
@@ -3211,7 +3261,7 @@
|
|
|
3211
3261
|
},
|
|
3212
3262
|
"locationInModule": {
|
|
3213
3263
|
"filename": "src/ServerlessSpy.ts",
|
|
3214
|
-
"line":
|
|
3264
|
+
"line": 49
|
|
3215
3265
|
},
|
|
3216
3266
|
"name": "serviceKeys",
|
|
3217
3267
|
"type": {
|
|
@@ -3229,7 +3279,7 @@
|
|
|
3229
3279
|
},
|
|
3230
3280
|
"locationInModule": {
|
|
3231
3281
|
"filename": "src/ServerlessSpy.ts",
|
|
3232
|
-
"line":
|
|
3282
|
+
"line": 51
|
|
3233
3283
|
},
|
|
3234
3284
|
"name": "wsUrl",
|
|
3235
3285
|
"type": {
|
|
@@ -3249,7 +3299,7 @@
|
|
|
3249
3299
|
"kind": "interface",
|
|
3250
3300
|
"locationInModule": {
|
|
3251
3301
|
"filename": "src/ServerlessSpy.ts",
|
|
3252
|
-
"line":
|
|
3302
|
+
"line": 23
|
|
3253
3303
|
},
|
|
3254
3304
|
"name": "ServerlessSpyProps",
|
|
3255
3305
|
"properties": [
|
|
@@ -3261,18 +3311,195 @@
|
|
|
3261
3311
|
"immutable": true,
|
|
3262
3312
|
"locationInModule": {
|
|
3263
3313
|
"filename": "src/ServerlessSpy.ts",
|
|
3264
|
-
"line":
|
|
3314
|
+
"line": 26
|
|
3315
|
+
},
|
|
3316
|
+
"name": "debugMode",
|
|
3317
|
+
"optional": true,
|
|
3318
|
+
"type": {
|
|
3319
|
+
"primitive": "boolean"
|
|
3320
|
+
}
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
"abstract": true,
|
|
3324
|
+
"docs": {
|
|
3325
|
+
"stability": "stable"
|
|
3326
|
+
},
|
|
3327
|
+
"immutable": true,
|
|
3328
|
+
"locationInModule": {
|
|
3329
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3330
|
+
"line": 24
|
|
3265
3331
|
},
|
|
3266
3332
|
"name": "generateSpyEventsFileLocation",
|
|
3267
3333
|
"optional": true,
|
|
3268
3334
|
"type": {
|
|
3269
3335
|
"primitive": "string"
|
|
3270
3336
|
}
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
"abstract": true,
|
|
3340
|
+
"docs": {
|
|
3341
|
+
"stability": "stable"
|
|
3342
|
+
},
|
|
3343
|
+
"immutable": true,
|
|
3344
|
+
"locationInModule": {
|
|
3345
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3346
|
+
"line": 25
|
|
3347
|
+
},
|
|
3348
|
+
"name": "spySqsWithNoSubscriptionAndDropAllMessages",
|
|
3349
|
+
"optional": true,
|
|
3350
|
+
"type": {
|
|
3351
|
+
"primitive": "boolean"
|
|
3352
|
+
}
|
|
3271
3353
|
}
|
|
3272
3354
|
],
|
|
3273
3355
|
"symbolId": "src/ServerlessSpy:ServerlessSpyProps"
|
|
3356
|
+
},
|
|
3357
|
+
"serverless-spy.SpyFilter": {
|
|
3358
|
+
"assembly": "serverless-spy",
|
|
3359
|
+
"datatype": true,
|
|
3360
|
+
"docs": {
|
|
3361
|
+
"stability": "stable"
|
|
3362
|
+
},
|
|
3363
|
+
"fqn": "serverless-spy.SpyFilter",
|
|
3364
|
+
"kind": "interface",
|
|
3365
|
+
"locationInModule": {
|
|
3366
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3367
|
+
"line": 29
|
|
3368
|
+
},
|
|
3369
|
+
"name": "SpyFilter",
|
|
3370
|
+
"properties": [
|
|
3371
|
+
{
|
|
3372
|
+
"abstract": true,
|
|
3373
|
+
"docs": {
|
|
3374
|
+
"stability": "stable"
|
|
3375
|
+
},
|
|
3376
|
+
"immutable": true,
|
|
3377
|
+
"locationInModule": {
|
|
3378
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3379
|
+
"line": 37
|
|
3380
|
+
},
|
|
3381
|
+
"name": "spyDynamoDB",
|
|
3382
|
+
"optional": true,
|
|
3383
|
+
"type": {
|
|
3384
|
+
"primitive": "boolean"
|
|
3385
|
+
}
|
|
3386
|
+
},
|
|
3387
|
+
{
|
|
3388
|
+
"abstract": true,
|
|
3389
|
+
"docs": {
|
|
3390
|
+
"stability": "stable"
|
|
3391
|
+
},
|
|
3392
|
+
"immutable": true,
|
|
3393
|
+
"locationInModule": {
|
|
3394
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3395
|
+
"line": 34
|
|
3396
|
+
},
|
|
3397
|
+
"name": "spyEventBridge",
|
|
3398
|
+
"optional": true,
|
|
3399
|
+
"type": {
|
|
3400
|
+
"primitive": "boolean"
|
|
3401
|
+
}
|
|
3402
|
+
},
|
|
3403
|
+
{
|
|
3404
|
+
"abstract": true,
|
|
3405
|
+
"docs": {
|
|
3406
|
+
"stability": "stable"
|
|
3407
|
+
},
|
|
3408
|
+
"immutable": true,
|
|
3409
|
+
"locationInModule": {
|
|
3410
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3411
|
+
"line": 35
|
|
3412
|
+
},
|
|
3413
|
+
"name": "spyEventBridgeRule",
|
|
3414
|
+
"optional": true,
|
|
3415
|
+
"type": {
|
|
3416
|
+
"primitive": "boolean"
|
|
3417
|
+
}
|
|
3418
|
+
},
|
|
3419
|
+
{
|
|
3420
|
+
"abstract": true,
|
|
3421
|
+
"docs": {
|
|
3422
|
+
"stability": "stable"
|
|
3423
|
+
},
|
|
3424
|
+
"immutable": true,
|
|
3425
|
+
"locationInModule": {
|
|
3426
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3427
|
+
"line": 30
|
|
3428
|
+
},
|
|
3429
|
+
"name": "spyLambda",
|
|
3430
|
+
"optional": true,
|
|
3431
|
+
"type": {
|
|
3432
|
+
"primitive": "boolean"
|
|
3433
|
+
}
|
|
3434
|
+
},
|
|
3435
|
+
{
|
|
3436
|
+
"abstract": true,
|
|
3437
|
+
"docs": {
|
|
3438
|
+
"stability": "stable"
|
|
3439
|
+
},
|
|
3440
|
+
"immutable": true,
|
|
3441
|
+
"locationInModule": {
|
|
3442
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3443
|
+
"line": 36
|
|
3444
|
+
},
|
|
3445
|
+
"name": "spyS3",
|
|
3446
|
+
"optional": true,
|
|
3447
|
+
"type": {
|
|
3448
|
+
"primitive": "boolean"
|
|
3449
|
+
}
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
"abstract": true,
|
|
3453
|
+
"docs": {
|
|
3454
|
+
"stability": "stable"
|
|
3455
|
+
},
|
|
3456
|
+
"immutable": true,
|
|
3457
|
+
"locationInModule": {
|
|
3458
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3459
|
+
"line": 33
|
|
3460
|
+
},
|
|
3461
|
+
"name": "spySnsSubsription",
|
|
3462
|
+
"optional": true,
|
|
3463
|
+
"type": {
|
|
3464
|
+
"primitive": "boolean"
|
|
3465
|
+
}
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
"abstract": true,
|
|
3469
|
+
"docs": {
|
|
3470
|
+
"stability": "stable"
|
|
3471
|
+
},
|
|
3472
|
+
"immutable": true,
|
|
3473
|
+
"locationInModule": {
|
|
3474
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3475
|
+
"line": 32
|
|
3476
|
+
},
|
|
3477
|
+
"name": "spySnsTopic",
|
|
3478
|
+
"optional": true,
|
|
3479
|
+
"type": {
|
|
3480
|
+
"primitive": "boolean"
|
|
3481
|
+
}
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
"abstract": true,
|
|
3485
|
+
"docs": {
|
|
3486
|
+
"stability": "stable"
|
|
3487
|
+
},
|
|
3488
|
+
"immutable": true,
|
|
3489
|
+
"locationInModule": {
|
|
3490
|
+
"filename": "src/ServerlessSpy.ts",
|
|
3491
|
+
"line": 31
|
|
3492
|
+
},
|
|
3493
|
+
"name": "spySqs",
|
|
3494
|
+
"optional": true,
|
|
3495
|
+
"type": {
|
|
3496
|
+
"primitive": "boolean"
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
],
|
|
3500
|
+
"symbolId": "src/ServerlessSpy:SpyFilter"
|
|
3274
3501
|
}
|
|
3275
3502
|
},
|
|
3276
|
-
"version": "0.0.
|
|
3277
|
-
"fingerprint": "
|
|
3503
|
+
"version": "0.0.36",
|
|
3504
|
+
"fingerprint": "Ar9LJKLO1bTD6oiUzz0OAkPg9EPRzEfMSQhNhT1BRjs="
|
|
3278
3505
|
}
|
package/API.md
CHANGED
|
@@ -44,6 +44,8 @@ new ServerlessSpy(scope: Construct, id: string, props?: ServerlessSpyProps)
|
|
|
44
44
|
| --- | --- |
|
|
45
45
|
| <code><a href="#serverless-spy.ServerlessSpy.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
46
46
|
| <code><a href="#serverless-spy.ServerlessSpy.getConstructName">getConstructName</a></code> | *No description.* |
|
|
47
|
+
| <code><a href="#serverless-spy.ServerlessSpy.spy">spy</a></code> | Initalize spying on resources. |
|
|
48
|
+
| <code><a href="#serverless-spy.ServerlessSpy.spyNodes">spyNodes</a></code> | Initalize spying on resources given as parameter. |
|
|
47
49
|
|
|
48
50
|
---
|
|
49
51
|
|
|
@@ -67,6 +69,38 @@ public getConstructName(construct: IConstruct): string
|
|
|
67
69
|
|
|
68
70
|
---
|
|
69
71
|
|
|
72
|
+
##### `spy` <a name="spy" id="serverless-spy.ServerlessSpy.spy"></a>
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
public spy(filter?: SpyFilter): void
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Initalize spying on resources.
|
|
79
|
+
|
|
80
|
+
###### `filter`<sup>Optional</sup> <a name="filter" id="serverless-spy.ServerlessSpy.spy.parameter.filter"></a>
|
|
81
|
+
|
|
82
|
+
- *Type:* <a href="#serverless-spy.SpyFilter">SpyFilter</a>
|
|
83
|
+
|
|
84
|
+
Limit which resources to spy on.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
##### `spyNodes` <a name="spyNodes" id="serverless-spy.ServerlessSpy.spyNodes"></a>
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
public spyNodes(nodes: IConstruct[]): void
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Initalize spying on resources given as parameter.
|
|
95
|
+
|
|
96
|
+
###### `nodes`<sup>Required</sup> <a name="nodes" id="serverless-spy.ServerlessSpy.spyNodes.parameter.nodes"></a>
|
|
97
|
+
|
|
98
|
+
- *Type:* constructs.IConstruct[]
|
|
99
|
+
|
|
100
|
+
Which reources and their children to spy on.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
70
104
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
71
105
|
|
|
72
106
|
| **Name** | **Description** |
|
|
@@ -152,7 +186,19 @@ const serverlessSpyProps: ServerlessSpyProps = { ... }
|
|
|
152
186
|
|
|
153
187
|
| **Name** | **Type** | **Description** |
|
|
154
188
|
| --- | --- | --- |
|
|
189
|
+
| <code><a href="#serverless-spy.ServerlessSpyProps.property.debugMode">debugMode</a></code> | <code>boolean</code> | *No description.* |
|
|
155
190
|
| <code><a href="#serverless-spy.ServerlessSpyProps.property.generateSpyEventsFileLocation">generateSpyEventsFileLocation</a></code> | <code>string</code> | *No description.* |
|
|
191
|
+
| <code><a href="#serverless-spy.ServerlessSpyProps.property.spySqsWithNoSubscriptionAndDropAllMessages">spySqsWithNoSubscriptionAndDropAllMessages</a></code> | <code>boolean</code> | *No description.* |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
##### `debugMode`<sup>Optional</sup> <a name="debugMode" id="serverless-spy.ServerlessSpyProps.property.debugMode"></a>
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
public readonly debugMode: boolean;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
- *Type:* boolean
|
|
156
202
|
|
|
157
203
|
---
|
|
158
204
|
|
|
@@ -166,5 +212,120 @@ public readonly generateSpyEventsFileLocation: string;
|
|
|
166
212
|
|
|
167
213
|
---
|
|
168
214
|
|
|
215
|
+
##### `spySqsWithNoSubscriptionAndDropAllMessages`<sup>Optional</sup> <a name="spySqsWithNoSubscriptionAndDropAllMessages" id="serverless-spy.ServerlessSpyProps.property.spySqsWithNoSubscriptionAndDropAllMessages"></a>
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
public readonly spySqsWithNoSubscriptionAndDropAllMessages: boolean;
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- *Type:* boolean
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### SpyFilter <a name="SpyFilter" id="serverless-spy.SpyFilter"></a>
|
|
226
|
+
|
|
227
|
+
#### Initializer <a name="Initializer" id="serverless-spy.SpyFilter.Initializer"></a>
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import { SpyFilter } from 'serverless-spy'
|
|
231
|
+
|
|
232
|
+
const spyFilter: SpyFilter = { ... }
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
236
|
+
|
|
237
|
+
| **Name** | **Type** | **Description** |
|
|
238
|
+
| --- | --- | --- |
|
|
239
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spyDynamoDB">spyDynamoDB</a></code> | <code>boolean</code> | *No description.* |
|
|
240
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spyEventBridge">spyEventBridge</a></code> | <code>boolean</code> | *No description.* |
|
|
241
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spyEventBridgeRule">spyEventBridgeRule</a></code> | <code>boolean</code> | *No description.* |
|
|
242
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spyLambda">spyLambda</a></code> | <code>boolean</code> | *No description.* |
|
|
243
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spyS3">spyS3</a></code> | <code>boolean</code> | *No description.* |
|
|
244
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spySnsSubsription">spySnsSubsription</a></code> | <code>boolean</code> | *No description.* |
|
|
245
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spySnsTopic">spySnsTopic</a></code> | <code>boolean</code> | *No description.* |
|
|
246
|
+
| <code><a href="#serverless-spy.SpyFilter.property.spySqs">spySqs</a></code> | <code>boolean</code> | *No description.* |
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
##### `spyDynamoDB`<sup>Optional</sup> <a name="spyDynamoDB" id="serverless-spy.SpyFilter.property.spyDynamoDB"></a>
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
public readonly spyDynamoDB: boolean;
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
- *Type:* boolean
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
##### `spyEventBridge`<sup>Optional</sup> <a name="spyEventBridge" id="serverless-spy.SpyFilter.property.spyEventBridge"></a>
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
public readonly spyEventBridge: boolean;
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
- *Type:* boolean
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
##### `spyEventBridgeRule`<sup>Optional</sup> <a name="spyEventBridgeRule" id="serverless-spy.SpyFilter.property.spyEventBridgeRule"></a>
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
public readonly spyEventBridgeRule: boolean;
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
- *Type:* boolean
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
##### `spyLambda`<sup>Optional</sup> <a name="spyLambda" id="serverless-spy.SpyFilter.property.spyLambda"></a>
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
public readonly spyLambda: boolean;
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
- *Type:* boolean
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
##### `spyS3`<sup>Optional</sup> <a name="spyS3" id="serverless-spy.SpyFilter.property.spyS3"></a>
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
public readonly spyS3: boolean;
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
- *Type:* boolean
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
##### `spySnsSubsription`<sup>Optional</sup> <a name="spySnsSubsription" id="serverless-spy.SpyFilter.property.spySnsSubsription"></a>
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
public readonly spySnsSubsription: boolean;
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
- *Type:* boolean
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
##### `spySnsTopic`<sup>Optional</sup> <a name="spySnsTopic" id="serverless-spy.SpyFilter.property.spySnsTopic"></a>
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
public readonly spySnsTopic: boolean;
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
- *Type:* boolean
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
##### `spySqs`<sup>Optional</sup> <a name="spySqs" id="serverless-spy.SpyFilter.property.spySqs"></a>
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
public readonly spySqs: boolean;
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
- *Type:* boolean
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
169
330
|
|
|
170
331
|
|
package/dist/releasetag.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v0.0.
|
|
1
|
+
v0.0.36
|
package/extension/interceptor.ts
CHANGED
|
@@ -13,7 +13,7 @@ const ORIGINAL_HANDLER_KEY = 'ORIGINAL_HANDLER';
|
|
|
13
13
|
const subscribedToSQS =
|
|
14
14
|
process.env[envVariableNames.SSPY_SUBSCRIBED_TO_SQS] === 'true';
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const debugMode = process.env[envVariableNames.SSPY_DEBUG] === 'true';
|
|
17
17
|
|
|
18
18
|
// Wrap original handler.
|
|
19
19
|
// Handler can be async or non-async:
|
|
@@ -23,11 +23,13 @@ export const handler = (
|
|
|
23
23
|
context: Context,
|
|
24
24
|
callback: Callback
|
|
25
25
|
): Promise<any> | undefined => {
|
|
26
|
+
log('Request', JSON.stringify(event));
|
|
27
|
+
|
|
26
28
|
const promises: Promise<any>[] = [];
|
|
27
29
|
|
|
28
30
|
if (subscribedToSQS) {
|
|
29
31
|
// send raw message
|
|
30
|
-
|
|
32
|
+
log('Send raw message for SQS');
|
|
31
33
|
const p = sendRawSpyEvent(event);
|
|
32
34
|
promises.push(p);
|
|
33
35
|
}
|
|
@@ -39,7 +41,6 @@ export const handler = (
|
|
|
39
41
|
clientContext: context.clientContext,
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
console.log('EXTENSION REQUEST:', JSON.stringify(event));
|
|
43
44
|
const key = `Function#${
|
|
44
45
|
process.env[envVariableNames.SSPY_FUNCTION_NAME]
|
|
45
46
|
}#Request`;
|
|
@@ -52,7 +53,7 @@ export const handler = (
|
|
|
52
53
|
const originalHandler = getOriginalHandler();
|
|
53
54
|
|
|
54
55
|
const fail = (error: any) => {
|
|
55
|
-
|
|
56
|
+
logError(error);
|
|
56
57
|
const key = `Function#${
|
|
57
58
|
process.env[envVariableNames.SSPY_FUNCTION_NAME]
|
|
58
59
|
}#Error`;
|
|
@@ -66,7 +67,7 @@ export const handler = (
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
const succeed = (response: any) => {
|
|
69
|
-
|
|
70
|
+
log('Response', JSON.stringify(response));
|
|
70
71
|
const key = `Function#${
|
|
71
72
|
process.env[envVariableNames[envVariableNames.SSPY_FUNCTION_NAME]]
|
|
72
73
|
}#Response`;
|
|
@@ -136,20 +137,10 @@ async function sendLambdaSpyEvent(
|
|
|
136
137
|
|
|
137
138
|
async function sendRawSpyEvent(data: any) {
|
|
138
139
|
await publishSpyEvent(data);
|
|
139
|
-
|
|
140
|
-
// console.log('EXTENSION SPY EVENT:', JSON.stringify(data));
|
|
141
|
-
|
|
142
|
-
// const command = new InvokeCommand({
|
|
143
|
-
// FunctionName: fluentTestSendFunctionName,
|
|
144
|
-
// InvocationType: 'RequestResponse',
|
|
145
|
-
// LogType: 'Tail',
|
|
146
|
-
// Payload: JSON.stringify(data) as any,
|
|
147
|
-
// });
|
|
148
|
-
// await lambdaClient.send(command);
|
|
149
140
|
}
|
|
150
141
|
|
|
151
142
|
function getOriginalHandler(): Handler {
|
|
152
|
-
|
|
143
|
+
log('Original handler', process.env[ORIGINAL_HANDLER_KEY]);
|
|
153
144
|
|
|
154
145
|
if (process.env[ORIGINAL_HANDLER_KEY] === undefined)
|
|
155
146
|
throw Error('Missing original handler');
|
|
@@ -158,3 +149,15 @@ function getOriginalHandler(): Handler {
|
|
|
158
149
|
process.env[ORIGINAL_HANDLER_KEY]
|
|
159
150
|
) as Handler;
|
|
160
151
|
}
|
|
152
|
+
|
|
153
|
+
function log(message: string, ...optionalParams: any[]) {
|
|
154
|
+
if (debugMode) {
|
|
155
|
+
console.debug('SSPY EXTENSION', message, ...optionalParams);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function logError(message: string, ...optionalParams: any[]) {
|
|
160
|
+
if (debugMode) {
|
|
161
|
+
console.error('SSPY EXTENSION', message, ...optionalParams);
|
|
162
|
+
}
|
|
163
|
+
}
|