serverless-spy 0.0.34 → 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 CHANGED
@@ -3149,7 +3149,7 @@
3149
3149
  },
3150
3150
  "locationInModule": {
3151
3151
  "filename": "src/ServerlessSpy.ts",
3152
- "line": 37
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": 25
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": 493
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": 34
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": 35
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": 21
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": 22
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.34",
3277
- "fingerprint": "VlGyOqTBqt3S7lh687Y1De02BbMROvvJmMqb0uEIX00="
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
 
@@ -33,7 +33,7 @@ const ddb = new DynamoDBClient({
33
33
 
34
34
  const apigwManagementApi = new ApiGatewayManagementApi({
35
35
  apiVersion: '2018-11-29',
36
- endpoint: process.env[envVariableNames.WS_ENDPOINT]!,
36
+ endpoint: process.env[envVariableNames.SSPY_WS_ENDPOINT]!,
37
37
  });
38
38
 
39
39
  let connections: Record<string, AttributeValue>[] | undefined;
@@ -41,13 +41,13 @@ let connections: Record<string, AttributeValue>[] | undefined;
41
41
  export async function publishSpyEvent(event: any) {
42
42
  console.log('EVENT', JSON.stringify(event));
43
43
 
44
- const mapping = JSON.parse(process.env[envVariableNames.INFRA_MAPPING]!);
44
+ const mapping = JSON.parse(process.env[envVariableNames.SSPY_INFRA_MAPPING]!);
45
45
  console.log('mapping', JSON.stringify(mapping));
46
46
 
47
47
  let connectionData;
48
48
 
49
49
  const scanParams = new ScanCommand({
50
- TableName: process.env[envVariableNames.TABLE_NAME] as string,
50
+ TableName: process.env[envVariableNames.SSPY_WS_TABLE_NAME] as string,
51
51
  ProjectionExpression: 'connectionId',
52
52
  });
53
53
 
@@ -245,7 +245,7 @@ export async function postData(spyMessage: Omit<SpyMessage, 'timestamp'>) {
245
245
  console.log(`Found stale connection, deleting ${connectionId}`);
246
246
 
247
247
  const deleteParams = new DeleteItemCommand({
248
- TableName: process.env[envVariableNames.TABLE_NAME],
248
+ TableName: process.env[envVariableNames.SSPY_WS_TABLE_NAME],
249
249
  Key: { connectionId },
250
250
  });
251
251
 
@@ -1 +1 @@
1
- v0.0.34
1
+ v0.0.36
@@ -9,12 +9,11 @@ import { envVariableNames } from '../src/common/envVariableNames';
9
9
  import { load } from './aws/UserFunction';
10
10
 
11
11
  const ORIGINAL_HANDLER_KEY = 'ORIGINAL_HANDLER';
12
- const fluentTestSendFunctionName =
13
- process.env[envVariableNames.FLUENT_TEST_SEND_FUNCTION_NAME];
12
+
14
13
  const subscribedToSQS =
15
- process.env[envVariableNames.FLUENT_TEST_SUBSCRIBED_TO_SQS] === 'true';
14
+ process.env[envVariableNames.SSPY_SUBSCRIBED_TO_SQS] === 'true';
16
15
 
17
- const lambdaClient = new LambdaClient({});
16
+ const debugMode = process.env[envVariableNames.SSPY_DEBUG] === 'true';
18
17
 
19
18
  // Wrap original handler.
20
19
  // Handler can be async or non-async:
@@ -24,11 +23,13 @@ export const handler = (
24
23
  context: Context,
25
24
  callback: Callback
26
25
  ): Promise<any> | undefined => {
26
+ log('Request', JSON.stringify(event));
27
+
27
28
  const promises: Promise<any>[] = [];
28
29
 
29
30
  if (subscribedToSQS) {
30
31
  // send raw message
31
- console.log('EXTENSION: Send raw message for SQS');
32
+ log('Send raw message for SQS');
32
33
  const p = sendRawSpyEvent(event);
33
34
  promises.push(p);
34
35
  }
@@ -40,8 +41,9 @@ export const handler = (
40
41
  clientContext: context.clientContext,
41
42
  };
42
43
 
43
- console.log('EXTENSION REQUEST:', JSON.stringify(event));
44
- const key = `Function#${process.env[envVariableNames.FUNCTION_NAME]}#Request`;
44
+ const key = `Function#${
45
+ process.env[envVariableNames.SSPY_FUNCTION_NAME]
46
+ }#Request`;
45
47
  const p = sendLambdaSpyEvent(key, <FunctionRequestSpyEvent>{
46
48
  request: event,
47
49
  context: contextSpy,
@@ -51,8 +53,10 @@ export const handler = (
51
53
  const originalHandler = getOriginalHandler();
52
54
 
53
55
  const fail = (error: any) => {
54
- console.error('FAIL', error);
55
- const key = `Function#${process.env[envVariableNames.FUNCTION_NAME]}#Error`;
56
+ logError(error);
57
+ const key = `Function#${
58
+ process.env[envVariableNames.SSPY_FUNCTION_NAME]
59
+ }#Error`;
56
60
  const p = sendLambdaSpyEvent(key, <FunctionErrorSpyEvent>{
57
61
  request: event,
58
62
  error,
@@ -63,9 +67,9 @@ export const handler = (
63
67
  };
64
68
 
65
69
  const succeed = (response: any) => {
66
- console.log('EXTENSION RESPONSE:', JSON.stringify(response));
70
+ log('Response', JSON.stringify(response));
67
71
  const key = `Function#${
68
- process.env[envVariableNames[envVariableNames.FUNCTION_NAME]]
72
+ process.env[envVariableNames[envVariableNames.SSPY_FUNCTION_NAME]]
69
73
  }#Response`;
70
74
  const p = sendLambdaSpyEvent(key, <FunctionResponseSpyEvent>{
71
75
  request: event,
@@ -133,20 +137,10 @@ async function sendLambdaSpyEvent(
133
137
 
134
138
  async function sendRawSpyEvent(data: any) {
135
139
  await publishSpyEvent(data);
136
-
137
- // console.log('EXTENSION SPY EVENT:', JSON.stringify(data));
138
-
139
- // const command = new InvokeCommand({
140
- // FunctionName: fluentTestSendFunctionName,
141
- // InvocationType: 'RequestResponse',
142
- // LogType: 'Tail',
143
- // Payload: JSON.stringify(data) as any,
144
- // });
145
- // await lambdaClient.send(command);
146
140
  }
147
141
 
148
142
  function getOriginalHandler(): Handler {
149
- console.log('ORIGINAL_HANDLER_KEY', process.env[ORIGINAL_HANDLER_KEY]);
143
+ log('Original handler', process.env[ORIGINAL_HANDLER_KEY]);
150
144
 
151
145
  if (process.env[ORIGINAL_HANDLER_KEY] === undefined)
152
146
  throw Error('Missing original handler');
@@ -155,3 +149,15 @@ function getOriginalHandler(): Handler {
155
149
  process.env[ORIGINAL_HANDLER_KEY]
156
150
  ) as Handler;
157
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
+ }
@@ -10,7 +10,7 @@ exports.handler = async (event: APIGatewayEvent) => {
10
10
  console.log('EVENT', JSON.stringify(event));
11
11
 
12
12
  const putParams = new PutItemCommand({
13
- TableName: process.env[envVariableNames.TABLE_NAME] as string,
13
+ TableName: process.env[envVariableNames.SSPY_WS_TABLE_NAME] as string,
14
14
  Item: {
15
15
  connectionId: { S: event.requestContext.connectionId! },
16
16
  },
@@ -9,7 +9,7 @@ export const handler = async (event: APIGatewayEvent) => {
9
9
  console.log('EVENT', JSON.stringify(event));
10
10
 
11
11
  const deleteParams = new DeleteItemCommand({
12
- TableName: process.env[envVariableNames.TABLE_NAME],
12
+ TableName: process.env[envVariableNames.SSPY_WS_TABLE_NAME],
13
13
  Key: {
14
14
  connectionId: { S: event.requestContext.connectionId! },
15
15
  },
@@ -0,0 +1,3 @@
1
+ export const handler = async (event: any) => {
2
+ return event;
3
+ };