serverless-spy 2.3.10 → 2.3.11
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 +2 -2
- package/dist/releasetag.txt +1 -1
- package/lib/_virtual/rolldown_runtime.js +25 -0
- package/lib/_virtual/rolldown_runtime.mjs +11 -0
- package/lib/cli/cli.d.mts +1 -0
- package/lib/cli/cli.d.ts +1 -2
- package/lib/cli/cli.js +151 -208
- package/lib/cli/cli.js.map +1 -0
- package/lib/cli/cli.mjs +144 -205
- package/lib/cli/cli.mjs.map +1 -0
- package/lib/cli/sampleData.d.mts +896 -0
- package/lib/cli/sampleData.d.ts +860 -856
- package/lib/cli/sampleData.js +496 -480
- package/lib/cli/sampleData.js.map +1 -0
- package/lib/cli/sampleData.mjs +495 -477
- package/lib/cli/sampleData.mjs.map +1 -0
- package/lib/common/SpyEventSender.d.mts +26 -0
- package/lib/common/SpyEventSender.d.ts +23 -18
- package/lib/common/SpyEventSender.js +180 -230
- package/lib/common/SpyEventSender.js.map +1 -0
- package/lib/common/SpyEventSender.mjs +180 -227
- package/lib/common/SpyEventSender.mjs.map +1 -0
- package/lib/common/getWebSocketUrl.d.mts +7 -0
- package/lib/common/getWebSocketUrl.d.ts +7 -2
- package/lib/common/getWebSocketUrl.js +51 -62
- package/lib/common/getWebSocketUrl.js.map +1 -0
- package/lib/common/getWebSocketUrl.mjs +49 -60
- package/lib/common/getWebSocketUrl.mjs.map +1 -0
- package/lib/common/spyEvents/DynamoDBSpyEvent.d.mts +15 -0
- package/lib/common/spyEvents/DynamoDBSpyEvent.d.ts +14 -9
- package/lib/common/spyEvents/DynamoDBSpyEvent.js +0 -3
- package/lib/common/spyEvents/DynamoDBSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/EventBridgeBaseSpyEvent.d.mts +14 -0
- package/lib/common/spyEvents/EventBridgeBaseSpyEvent.d.ts +13 -8
- package/lib/common/spyEvents/EventBridgeBaseSpyEvent.js +0 -3
- package/lib/common/spyEvents/EventBridgeBaseSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/EventBridgeRuleSpyEvent.d.mts +9 -0
- package/lib/common/spyEvents/EventBridgeRuleSpyEvent.d.ts +8 -3
- package/lib/common/spyEvents/EventBridgeRuleSpyEvent.js +0 -3
- package/lib/common/spyEvents/EventBridgeRuleSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/EventBridgeSpyEvent.d.mts +9 -0
- package/lib/common/spyEvents/EventBridgeSpyEvent.d.ts +8 -3
- package/lib/common/spyEvents/EventBridgeSpyEvent.js +0 -3
- package/lib/common/spyEvents/EventBridgeSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/FunctionBaseSpyEvent.d.mts +11 -0
- package/lib/common/spyEvents/FunctionBaseSpyEvent.d.ts +10 -5
- package/lib/common/spyEvents/FunctionBaseSpyEvent.js +0 -3
- package/lib/common/spyEvents/FunctionBaseSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/FunctionConsole.d.mts +10 -0
- package/lib/common/spyEvents/FunctionConsole.d.ts +9 -5
- package/lib/common/spyEvents/FunctionConsole.js +0 -3
- package/lib/common/spyEvents/FunctionConsole.mjs +1 -2
- package/lib/common/spyEvents/FunctionConsoleSpyEvent.d.mts +11 -0
- package/lib/common/spyEvents/FunctionConsoleSpyEvent.d.ts +10 -5
- package/lib/common/spyEvents/FunctionConsoleSpyEvent.js +0 -3
- package/lib/common/spyEvents/FunctionConsoleSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/FunctionContext.d.mts +12 -0
- package/lib/common/spyEvents/FunctionContext.d.ts +11 -6
- package/lib/common/spyEvents/FunctionContext.js +0 -3
- package/lib/common/spyEvents/FunctionContext.mjs +1 -2
- package/lib/common/spyEvents/FunctionErrorSpyEvent.d.mts +13 -0
- package/lib/common/spyEvents/FunctionErrorSpyEvent.d.ts +12 -7
- package/lib/common/spyEvents/FunctionErrorSpyEvent.js +0 -3
- package/lib/common/spyEvents/FunctionErrorSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/FunctionRequestSpyEvent.d.mts +12 -0
- package/lib/common/spyEvents/FunctionRequestSpyEvent.d.ts +11 -6
- package/lib/common/spyEvents/FunctionRequestSpyEvent.js +0 -3
- package/lib/common/spyEvents/FunctionRequestSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/FunctionResponseSpyEvent.d.mts +10 -0
- package/lib/common/spyEvents/FunctionResponseSpyEvent.d.ts +9 -4
- package/lib/common/spyEvents/FunctionResponseSpyEvent.js +0 -3
- package/lib/common/spyEvents/FunctionResponseSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/S3SpyEvent.d.mts +13 -0
- package/lib/common/spyEvents/S3SpyEvent.d.ts +12 -7
- package/lib/common/spyEvents/S3SpyEvent.js +0 -3
- package/lib/common/spyEvents/S3SpyEvent.mjs +1 -2
- package/lib/common/spyEvents/SnsSpyEventBase.d.mts +15 -0
- package/lib/common/spyEvents/SnsSpyEventBase.d.ts +14 -9
- package/lib/common/spyEvents/SnsSpyEventBase.js +0 -3
- package/lib/common/spyEvents/SnsSpyEventBase.mjs +1 -2
- package/lib/common/spyEvents/SnsSubscriptionSpyEvent.d.mts +9 -0
- package/lib/common/spyEvents/SnsSubscriptionSpyEvent.d.ts +8 -3
- package/lib/common/spyEvents/SnsSubscriptionSpyEvent.js +0 -3
- package/lib/common/spyEvents/SnsSubscriptionSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/SnsTopicSpyEvent.d.mts +9 -0
- package/lib/common/spyEvents/SnsTopicSpyEvent.d.ts +8 -3
- package/lib/common/spyEvents/SnsTopicSpyEvent.js +0 -3
- package/lib/common/spyEvents/SnsTopicSpyEvent.mjs +1 -2
- package/lib/common/spyEvents/SpyEvent.d.mts +7 -0
- package/lib/common/spyEvents/SpyEvent.d.ts +6 -2
- package/lib/common/spyEvents/SpyEvent.js +0 -3
- package/lib/common/spyEvents/SpyEvent.mjs +1 -2
- package/lib/common/spyEvents/SpyMessage.d.mts +11 -0
- package/lib/common/spyEvents/SpyMessage.d.ts +10 -5
- package/lib/common/spyEvents/SpyMessage.js +0 -3
- package/lib/common/spyEvents/SpyMessage.mjs +1 -2
- package/lib/common/spyEvents/SqsSpyEvent.d.mts +12 -0
- package/lib/common/spyEvents/SqsSpyEvent.d.ts +11 -6
- package/lib/common/spyEvents/SqsSpyEvent.js +0 -3
- package/lib/common/spyEvents/SqsSpyEvent.mjs +1 -2
- package/lib/extension/dist/layer/nodejs/node_modules/interceptor.js +2 -2
- package/lib/extension/dist/layer/nodejs/node_modules/interceptor.js.map +2 -2
- package/lib/functions/onConnect.d.mts +1 -0
- package/lib/functions/onConnect.d.ts +1 -1
- package/lib/functions/onConnect.js +28 -26
- package/lib/functions/onConnect.js.map +1 -0
- package/lib/functions/onConnect.mjs +35 -26
- package/lib/functions/onConnect.mjs.map +1 -0
- package/lib/functions/onDisconnect.d.mts +10 -0
- package/lib/functions/onDisconnect.d.ts +9 -4
- package/lib/functions/onDisconnect.js +28 -27
- package/lib/functions/onDisconnect.js.map +1 -0
- package/lib/functions/onDisconnect.mjs +29 -25
- package/lib/functions/onDisconnect.mjs.map +1 -0
- package/lib/functions/sendMessage.d.mts +8 -0
- package/lib/functions/sendMessage.d.ts +7 -3
- package/lib/functions/sendMessage.js +26 -21
- package/lib/functions/sendMessage.js.map +1 -0
- package/lib/functions/sendMessage.mjs +28 -19
- package/lib/functions/sendMessage.mjs.map +1 -0
- package/lib/functions/sqsSubscriptionAndDropAllMessages.d.mts +5 -0
- package/lib/functions/sqsSubscriptionAndDropAllMessages.d.ts +5 -1
- package/lib/functions/sqsSubscriptionAndDropAllMessages.js +6 -5
- package/lib/functions/sqsSubscriptionAndDropAllMessages.js.map +1 -0
- package/lib/functions/sqsSubscriptionAndDropAllMessages.mjs +7 -3
- package/lib/functions/sqsSubscriptionAndDropAllMessages.mjs.map +1 -0
- package/lib/index.d.mts +4 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.js +6 -19
- package/lib/index.mjs +5 -3
- package/lib/listener/PrettifyForDisplay.d.mts +5 -0
- package/lib/listener/PrettifyForDisplay.d.ts +5 -3
- package/lib/listener/PrettifyForDisplay.js +0 -3
- package/lib/listener/PrettifyForDisplay.mjs +1 -2
- package/lib/listener/RecursivePartial.d.mts +7 -0
- package/lib/listener/RecursivePartial.d.ts +7 -4
- package/lib/listener/RecursivePartial.js +0 -3
- package/lib/listener/RecursivePartial.mjs +1 -2
- package/lib/listener/ServerlessSpyListener.d.mts +23 -0
- package/lib/listener/ServerlessSpyListener.d.ts +22 -42
- package/lib/listener/ServerlessSpyListener.js +0 -3
- package/lib/listener/ServerlessSpyListener.mjs +1 -2
- package/lib/listener/ServerlessSpyListenerParams.d.mts +14 -0
- package/lib/listener/ServerlessSpyListenerParams.d.ts +13 -8
- package/lib/listener/ServerlessSpyListenerParams.js +0 -3
- package/lib/listener/ServerlessSpyListenerParams.mjs +1 -2
- package/lib/listener/SpyHandlers.ts.d.mts +158 -0
- package/lib/listener/SpyHandlers.ts.d.ts +144 -144
- package/lib/listener/SpyHandlers.ts.js +0 -3
- package/lib/listener/SpyHandlers.ts.mjs +1 -2
- package/lib/listener/WaitForParams.d.mts +10 -0
- package/lib/listener/WaitForParams.d.ts +9 -4
- package/lib/listener/WaitForParams.js +0 -3
- package/lib/listener/WaitForParams.mjs +1 -2
- package/lib/listener/WsListener.d.mts +27 -0
- package/lib/listener/WsListener.d.ts +26 -21
- package/lib/listener/WsListener.js +173 -231
- package/lib/listener/WsListener.js.map +1 -0
- package/lib/listener/WsListener.mjs +174 -228
- package/lib/listener/WsListener.mjs.map +1 -0
- package/lib/listener/createServerlessSpyListener.d.mts +8 -0
- package/lib/listener/createServerlessSpyListener.d.ts +8 -2
- package/lib/listener/createServerlessSpyListener.js +25 -25
- package/lib/listener/createServerlessSpyListener.js.map +1 -0
- package/lib/listener/createServerlessSpyListener.mjs +26 -23
- package/lib/listener/createServerlessSpyListener.mjs.map +1 -0
- package/lib/listener/index.d.mts +3 -0
- package/lib/listener/index.d.ts +3 -2
- package/lib/listener/index.js +3 -19
- package/lib/listener/index.mjs +3 -3
- package/lib/listener/iot-connection.d.mts +13 -0
- package/lib/listener/iot-connection.d.ts +12 -7
- package/lib/listener/iot-connection.js +48 -46
- package/lib/listener/iot-connection.js.map +1 -0
- package/lib/listener/iot-connection.mjs +46 -44
- package/lib/listener/iot-connection.mjs.map +1 -0
- package/lib/listener/matchers.d.mts +1 -0
- package/lib/listener/matchers.d.ts +1 -0
- package/lib/listener/matchers.js +0 -55
- package/lib/listener/matchers.mjs +1 -55
- package/lib/listener/setup.d.mts +1 -0
- package/lib/listener/setup.d.ts +1 -0
- package/lib/listener/setup.js +0 -21
- package/lib/listener/setup.mjs +1 -21
- package/lib/listener/topic.d.mts +6 -0
- package/lib/listener/topic.d.ts +6 -2
- package/lib/listener/topic.js +9 -7
- package/lib/listener/topic.js.map +1 -0
- package/lib/listener/topic.mjs +8 -4
- package/lib/listener/topic.mjs.map +1 -0
- package/lib/node_modules/tsdown/esm-shims.mjs +11 -0
- package/lib/node_modules/tsdown/esm-shims.mjs.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/native.js +10 -0
- package/lib/node_modules/uuid/dist/esm-node/native.js.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/native.mjs +8 -0
- package/lib/node_modules/uuid/dist/esm-node/native.mjs.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/rng.js +18 -0
- package/lib/node_modules/uuid/dist/esm-node/rng.js.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/rng.mjs +16 -0
- package/lib/node_modules/uuid/dist/esm-node/rng.mjs.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/stringify.js +15 -0
- package/lib/node_modules/uuid/dist/esm-node/stringify.js.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/stringify.mjs +14 -0
- package/lib/node_modules/uuid/dist/esm-node/stringify.mjs.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/v4.js +23 -0
- package/lib/node_modules/uuid/dist/esm-node/v4.js.map +1 -0
- package/lib/node_modules/uuid/dist/esm-node/v4.mjs +23 -0
- package/lib/node_modules/uuid/dist/esm-node/v4.mjs.map +1 -0
- package/lib/src/ServerlessSpy.d.mts +77 -0
- package/lib/src/ServerlessSpy.js +1 -1
- package/lib/src/ServerlessSpy.js.map +1 -0
- package/lib/src/ServerlessSpy.mjs +441 -618
- package/lib/src/ServerlessSpy.mjs.map +1 -0
- package/lib/src/common/envVariableNames.d.mts +35 -0
- package/lib/src/common/envVariableNames.js.map +1 -0
- package/lib/src/common/envVariableNames.mjs +43 -35
- package/lib/src/common/envVariableNames.mjs.map +1 -0
- package/lib/src/index.d.mts +2 -0
- package/lib/src/index.mjs +3 -2
- package/node_modules/debug/package.json +2 -3
- package/node_modules/debug/src/browser.js +1 -1
- package/node_modules/debug/src/common.js +1 -1
- package/package.json +2 -1
- package/tsdown.config.ts +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerlessSpy.mjs","names":["props?: ServerlessSpyProps","filterWithDefaults: Required<SpyFilter>","nodes: IConstruct[]","functionSubscription: LambdaSubscription | undefined","fs","fs: LambdaSpied"],"sources":["../../src/ServerlessSpy.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { PythonLayerVersion } from '@aws-cdk/aws-lambda-python-alpha';\nimport {\n aws_iam,\n BundlingFileAccess,\n CfnOutput,\n custom_resources,\n Duration,\n NestedStack,\n Stack,\n} from 'aws-cdk-lib';\nimport * as dynamoDb from 'aws-cdk-lib/aws-dynamodb';\nimport * as events from 'aws-cdk-lib/aws-events';\nimport * as targets from 'aws-cdk-lib/aws-events-targets';\nimport { Effect } from 'aws-cdk-lib/aws-iam';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport {\n Architecture,\n ILayerVersion,\n SingletonFunction,\n} from 'aws-cdk-lib/aws-lambda';\nimport * as dynamoDbStream from 'aws-cdk-lib/aws-lambda-event-sources';\nimport { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';\nimport * as lambdaNode from 'aws-cdk-lib/aws-lambda-nodejs';\nimport { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as s3 from 'aws-cdk-lib/aws-s3';\nimport * as s3notif from 'aws-cdk-lib/aws-s3-notifications';\nimport * as sns from 'aws-cdk-lib/aws-sns';\nimport * as snsSubs from 'aws-cdk-lib/aws-sns-subscriptions';\nimport * as sqs from 'aws-cdk-lib/aws-sqs';\nimport { Construct, IConstruct } from 'constructs';\nimport { envVariableNames } from './common/envVariableNames';\n\nexport interface ServerlessSpyProps {\n readonly generateSpyEventsFileLocation?: string;\n readonly spySqsWithNoSubscriptionAndDropAllMessages?: boolean;\n readonly debugMode?: boolean;\n}\n\nexport interface SpyFilter {\n readonly spyLambda?: boolean;\n readonly spySqs?: boolean;\n readonly spySnsTopic?: boolean;\n readonly spySnsSubsription?: boolean;\n readonly spyEventBridge?: boolean;\n readonly spyEventBridgeRule?: boolean;\n readonly spyS3?: boolean;\n readonly spyDynamoDB?: boolean;\n}\n\nconst isLambdaFunction = (node: IConstruct): node is lambda.Function =>\n 'functionName' in node && 'functionArn' in node && 'runtime' in node;\n\nconst serverlessSpyIotEndpointCrNamePrefix = 'ServerlessSpyIotEndpoint';\n\nexport class ServerlessSpy extends Construct {\n private createdResourcesBySSpy: IConstruct[] = [];\n private lambdaSubscriptionPool: LambdaSubscription[] = [];\n private lambdaSubscriptionMain: LambdaSubscription;\n private lambdasSpied: LambdaSpied[] = [];\n public serviceKeys: string[] = [];\n private spiedNodes: IConstruct[] = [];\n private layerMap: Partial<Record<string, ILayerVersion>> = {};\n private readonly iotEndpoint: string;\n\n constructor(\n scope: Construct,\n id: string,\n private props?: ServerlessSpyProps\n ) {\n super(scope, id);\n\n const rootStack = this.cleanName(\n this.findRootStack(Stack.of(this)).node.id\n );\n\n const getIoTEndpoint = new custom_resources.AwsCustomResource(\n this,\n serverlessSpyIotEndpointCrNamePrefix,\n {\n onCreate: {\n service: 'Iot',\n action: 'describeEndpoint',\n physicalResourceId:\n custom_resources.PhysicalResourceId.fromResponse('endpointAddress'),\n parameters: {\n endpointType: 'iot:Data-ATS',\n },\n },\n onUpdate: {\n service: 'Iot',\n action: 'describeEndpoint',\n physicalResourceId:\n custom_resources.PhysicalResourceId.fromResponse('endpointAddress'),\n parameters: {\n endpointType: 'iot:Data-ATS',\n },\n },\n installLatestAwsSdk: false,\n policy: custom_resources.AwsCustomResourcePolicy.fromSdkCalls({\n resources: custom_resources.AwsCustomResourcePolicy.ANY_RESOURCE,\n }),\n functionName: serverlessSpyIotEndpointCrNamePrefix + rootStack,\n }\n );\n this.iotEndpoint = getIoTEndpoint.getResponseField('endpointAddress');\n\n this.createdResourcesBySSpy.push(getIoTEndpoint);\n\n new CfnOutput(this, 'ServerlessSpyIoTEndpoint', {\n key: 'ServerlessSpyWsUrl',\n value: `${this.iotEndpoint}/${rootStack}`,\n });\n\n this.lambdaSubscriptionMain = this.provideFunctionForSubscription();\n }\n\n private getDefaultLambdaEnvironmentVariables(): { [key: string]: string } {\n return {\n NODE_OPTIONS: '--enable-source-maps',\n };\n }\n\n /**\n * Initalize spying on resources given as parameter.\n * @param nodes Which reources and their children to spy on.\n */\n public spyNodes(nodes: IConstruct[]) {\n for (const node of nodes) {\n let ns = this.getAllNodes(node);\n this.internalSpyNodes(ns);\n }\n\n this.finalizeSpy();\n }\n\n /**\n * Initalize spying on resources.\n * @param filter Limit which resources to spy on.\n */\n public spy(filter?: SpyFilter) {\n let nodes = this.getAllNodes(Stack.of(this));\n\n const filterWithDefaults: Required<SpyFilter> = {\n spyLambda: true,\n spySqs: true,\n spySnsTopic: true,\n spySnsSubsription: true,\n spyEventBridge: true,\n spyEventBridgeRule: true,\n spyS3: true,\n spyDynamoDB: true,\n ...filter,\n };\n\n const CRID =\n 'AWS' +\n custom_resources.AwsCustomResource.PROVIDER_FUNCTION_UUID.replace(\n /-/gi,\n ''\n ).substring(0, 16);\n\n nodes = nodes.filter((node) => {\n if (\n // Ignore the custom resource and the Provider (as well as any other Providers using the same provider function), otherwise we cause\n // circular dependencies\n node.node.id.startsWith(CRID) ||\n node.node.id === 'Provider' ||\n // Ignore singleton functions as they can cause very odd behavior and crashes\n node instanceof SingletonFunction\n ) {\n if (this.props?.debugMode) {\n console.info(`Skipping ${node.node.id}`);\n }\n return false;\n } else if (\n filterWithDefaults.spyLambda &&\n (node instanceof lambda.Function ||\n node instanceof NodejsFunction ||\n isLambdaFunction(node))\n ) {\n return true;\n } else if (filterWithDefaults.spySnsTopic && node instanceof sns.Topic) {\n return true;\n } else if (\n filterWithDefaults.spySnsSubsription &&\n node instanceof sns.Subscription\n ) {\n return true;\n } else if (filterWithDefaults.spyS3 && node instanceof s3.Bucket) {\n return true;\n } else if (\n filterWithDefaults.spyDynamoDB &&\n node instanceof dynamoDb.Table\n ) {\n return true;\n } else if (\n filterWithDefaults.spyDynamoDB &&\n node instanceof dynamoDb.TableV2\n ) {\n return true;\n } else if (\n filterWithDefaults.spyEventBridge &&\n node instanceof events.EventBus\n ) {\n return true;\n } else if (\n filterWithDefaults.spyEventBridgeRule &&\n node instanceof events.Rule\n ) {\n return true;\n } else if (\n filterWithDefaults.spySqs &&\n node instanceof lambda.CfnEventSourceMapping\n ) {\n return true;\n } else if (\n filterWithDefaults.spySqs &&\n this.props?.spySqsWithNoSubscriptionAndDropAllMessages &&\n node instanceof sqs.Queue\n ) {\n return true;\n }\n\n return false;\n });\n\n this.internalSpyNodes(nodes);\n this.finalizeSpy();\n }\n\n private internalSpyNodes(nodes: IConstruct[]) {\n for (const node of nodes) {\n this.internalSpyNode(node);\n }\n }\n\n private finalizeSpy() {\n //set mapping property for all functions we created\n for (const func of this.lambdaSubscriptionPool) {\n func.function.addEnvironment(\n envVariableNames.SSPY_INFRA_MAPPING,\n JSON.stringify(func.mapping)\n );\n }\n\n //set mapping property for all functions we spy on\n for (const func of this.lambdasSpied) {\n func.function.addEnvironment(\n envVariableNames.SSPY_INFRA_MAPPING,\n JSON.stringify(func.mapping)\n );\n }\n\n if (this.props?.generateSpyEventsFileLocation) {\n this.writeSpyEventsClass(this.props?.generateSpyEventsFileLocation);\n }\n }\n\n private getExtensionAssetLocation() {\n let extensionAssetLocation = path.join(\n __dirname,\n '../extension/dist/layer'\n );\n\n const extensionAssetLocationAlt = path.join(\n __dirname,\n '../lib/extension/dist/layer'\n );\n\n if (!fs.existsSync(extensionAssetLocation)) {\n if (!fs.existsSync(extensionAssetLocationAlt)) {\n throw new Error(\n `Folder with assets for extension does not exists at ${extensionAssetLocation} or at ${extensionAssetLocationAlt} `\n );\n } else {\n extensionAssetLocation = extensionAssetLocationAlt;\n }\n }\n\n const extensionAssetLocationWrapper = path.join(\n extensionAssetLocation,\n 'spy-wrapper'\n );\n if (!fs.existsSync(extensionAssetLocationWrapper)) {\n throw new Error(\n `Wrapper script for extension does not exists ${extensionAssetLocation}`\n );\n }\n\n const extensionAssetLocationCode = path.join(\n extensionAssetLocation,\n `nodejs/node_modules/interceptor.js`\n );\n if (!fs.existsSync(extensionAssetLocationCode)) {\n throw new Error(\n `Code for extension does not exists ${extensionAssetLocationCode}`\n );\n }\n return extensionAssetLocation;\n }\n\n private getLanguageExtensionAssetLocation(language: string) {\n const rootDir = path.join(__dirname, '..');\n\n let extensionAssetLocation = path.join(rootDir, `extensions/${language}`);\n\n const extensionAssetLocationAlt = path.join(\n rootDir,\n `lib/extensions/${language}`\n );\n\n if (!fs.existsSync(extensionAssetLocation)) {\n if (!fs.existsSync(extensionAssetLocationAlt)) {\n throw new Error(\n `Folder with assets for extension for ${language} does not exists at ${extensionAssetLocation} or at ${extensionAssetLocationAlt} `\n );\n } else {\n extensionAssetLocation = extensionAssetLocationAlt;\n }\n }\n\n const extensionAssetLocationWrapper = path.join(\n // extensionAssetLocation.substring(\n // 0,\n // extensionAssetLocation.lastIndexOf(path.sep)\n // ),\n extensionAssetLocation,\n 'spy-wrapper'\n );\n if (!fs.existsSync(extensionAssetLocationWrapper)) {\n throw new Error(\n `Wrapper script for extension does not exists at ${extensionAssetLocationWrapper}`\n );\n }\n\n return extensionAssetLocation;\n }\n\n /**\n * Write SpyEvents class, which helps with writing the code for tests.\n * @param fileLocation\n */\n private writeSpyEventsClass(fileLocation: string) {\n fs.mkdirSync(path.dirname(fileLocation), { recursive: true });\n\n const properties = this.serviceKeys\n .map((sk) => ` ${sk.replace(/#/g, '')}: '${sk}' = '${sk}';\\n`)\n .join('');\n\n const code = `/* eslint-disable */\\nexport class ServerlessSpyEvents {\\n${properties}}\\n`;\n\n fs.writeFileSync(fileLocation, code);\n }\n\n private getAllNodes(parent: IConstruct) {\n const nodes: IConstruct[] = [];\n nodes.push(parent);\n this.getAllNodesRecursive(parent, nodes);\n return nodes;\n }\n\n private getAllNodesRecursive(parent: IConstruct, nodes: IConstruct[]) {\n for (const node of parent.node.children) {\n nodes.push(node);\n this.getAllNodesRecursive(node, nodes);\n }\n }\n\n private internalSpyNode(node: IConstruct) {\n if (this.spiedNodes.includes(node)) {\n return;\n }\n\n this.spiedNodes.push(node);\n\n if (this.createdResourcesBySSpy.includes(node)) {\n return;\n }\n\n if (this.lambdaSubscriptionPool.find((s) => s.function === node)) {\n return;\n }\n\n if (this.props?.debugMode) {\n console.info('Spy on node', this.getConstructName(node));\n }\n\n if (\n node instanceof lambda.Function ||\n node instanceof NodejsFunction ||\n isLambdaFunction(node)\n ) {\n this.internalSpyLambda(node);\n } else if (node instanceof sns.Topic) {\n this.internalSpySnsTopic(node);\n } else if (node instanceof sns.Subscription) {\n this.internalSpySnsSubscription(node);\n } else if (node instanceof s3.Bucket) {\n this.internalSpyS3(node);\n } else if (node instanceof dynamoDb.Table) {\n this.internalSpyDynamodb(node);\n } else if (node instanceof dynamoDb.TableV2) {\n this.internalSpyDynamodb(node);\n } else if (node instanceof events.EventBus) {\n this.internalSpyEventBus(node);\n } else if (node instanceof events.Rule) {\n this.internalSpyEventBusRule(node);\n } else if (node instanceof lambda.CfnEventSourceMapping) {\n this.internalSpySqs(node);\n } else if (node instanceof sqs.Queue) {\n if (this.props?.spySqsWithNoSubscriptionAndDropAllMessages) {\n this.internalSpySpySqsWithNoSubscription(node);\n }\n }\n }\n\n private getExtensionForRuntime(\n runtime: lambda.Runtime,\n architecture: lambda.Architecture\n ): { layer: lambda.ILayerVersion; spyWrapperPath: string } | undefined {\n const layerKey =\n `sspy_extension_${runtime.toString()}_${architecture.name.toString()}`.replace(\n /\\./g,\n '_'\n );\n\n let layer = this.layerMap[layerKey];\n let spyWrapperPath = '/opt/spy-wrapper';\n\n switch (runtime.name) {\n case lambda.Runtime.PYTHON_3_8.name:\n case lambda.Runtime.PYTHON_3_9.name:\n case lambda.Runtime.PYTHON_3_10.name:\n case lambda.Runtime.PYTHON_3_11.name:\n case lambda.Runtime.PYTHON_3_12.name:\n spyWrapperPath = '/opt/python/spy-wrapper';\n layer =\n layer ||\n new PythonLayerVersion(this, layerKey, {\n compatibleRuntimes: [runtime],\n compatibleArchitectures: [architecture],\n entry: this.getLanguageExtensionAssetLocation('python'),\n bundling: {\n bundlingFileAccess: BundlingFileAccess.VOLUME_COPY,\n },\n });\n break;\n case lambda.Runtime.NODEJS_12_X.name:\n case lambda.Runtime.NODEJS_14_X.name:\n case lambda.Runtime.NODEJS_16_X.name:\n case lambda.Runtime.NODEJS_18_X.name:\n case lambda.Runtime.NODEJS_20_X.name:\n case lambda.Runtime.NODEJS_22_X.name:\n layer =\n layer ||\n new lambda.LayerVersion(this, layerKey, {\n compatibleRuntimes: [runtime],\n compatibleArchitectures: [architecture],\n code: lambda.Code.fromAsset(this.getExtensionAssetLocation()),\n });\n break;\n default:\n console.log(`No extensions available for ${runtime.toString()}`);\n return undefined;\n }\n\n this.layerMap[layerKey] = layer;\n this.createdResourcesBySSpy.push(layer);\n return { layer, spyWrapperPath };\n }\n\n private internalSpySpySqsWithNoSubscription(queue: sqs.Queue) {\n const subscription = this.findElement<lambda.CfnEventSourceMapping>(\n (n: IConstruct) =>\n n instanceof lambda.CfnEventSourceMapping &&\n (n as lambda.CfnEventSourceMapping).eventSourceArn === queue.queueArn\n );\n\n if (subscription) {\n return; //already have subscription\n }\n\n const queueName = this.getConstructName(queue);\n const func = new NodejsFunction(\n this,\n `${queueName}SqsSubscriptionAndDropAllMessages`,\n {\n memorySize: 512,\n timeout: Duration.seconds(5),\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: 'handler',\n entry: this.getAssetLocation(\n 'functions/sqsSubscriptionAndDropAllMessages.js'\n ),\n environment: this.getDefaultLambdaEnvironmentVariables(),\n }\n );\n func.addEventSource(new SqsEventSource(queue));\n this.setupForIoT(func);\n const { layer, spyWrapperPath } = this.getExtensionForRuntime(\n func.runtime,\n func.architecture\n )!;\n func.addLayers(layer);\n\n func.addEnvironment('AWS_LAMBDA_EXEC_WRAPPER', spyWrapperPath);\n\n if (this.props?.debugMode) {\n func.addEnvironment(envVariableNames.SSPY_DEBUG, 'true');\n }\n\n this.createdResourcesBySSpy.push(func);\n\n const serviceKey = `Sqs#${queueName}`;\n\n this.addMappingToFunction(func, {\n key: queue.queueArn,\n value: serviceKey,\n });\n\n this.serviceKeys.push(serviceKey);\n func.addEnvironment(envVariableNames.SSPY_SUBSCRIBED_TO_SQS, 'true');\n }\n\n private internalSpySqs(node: lambda.CfnEventSourceMapping) {\n const queue = this.findElement<sqs.Queue>(\n (n: IConstruct) =>\n n instanceof sqs.Queue &&\n (n as sqs.Queue).queueArn === node.eventSourceArn\n );\n\n const func = this.findElement<lambda.Function>(\n (n: IConstruct) =>\n n instanceof lambda.Function &&\n (n as lambda.Function).functionName === node.functionName\n );\n\n if (queue && func) {\n const queueName = this.getConstructName(queue);\n\n const serviceKey = `Sqs#${queueName}`;\n\n this.addMappingToFunction(func, {\n key: queue.queueArn,\n value: serviceKey,\n });\n\n this.serviceKeys.push(serviceKey);\n func.addEnvironment(envVariableNames.SSPY_SUBSCRIBED_TO_SQS, 'true');\n }\n }\n\n private createFunctionForSubscription(index: number) {\n const func = new lambdaNode.NodejsFunction(this, `Subscription${index}`, {\n memorySize: 512,\n timeout: Duration.seconds(5),\n runtime: lambda.Runtime.NODEJS_22_X,\n handler: 'handler',\n entry: this.getAssetLocation('functions/sendMessage.js'),\n environment: {\n NODE_OPTIONS: '--enable-source-maps',\n },\n });\n this.setupForIoT(func);\n return func;\n }\n\n private internalSpyS3(s3Bucket: s3.Bucket) {\n s3Bucket.addEventNotification(\n s3.EventType.OBJECT_CREATED_PUT,\n new s3notif.LambdaDestination(this.lambdaSubscriptionMain.function)\n );\n\n const name = this.getConstructName(s3Bucket);\n\n const serviceKey = `S3#${name}`;\n this.lambdaSubscriptionMain.mapping[s3Bucket.bucketArn] = serviceKey;\n this.serviceKeys.push(serviceKey);\n }\n\n private internalSpyDynamodb(table: dynamoDb.Table | dynamoDb.TableV2) {\n // enable DynamoDB streams with a hack\n (table.node.defaultChild as dynamoDb.CfnTable).streamSpecification = {\n streamViewType: dynamoDb.StreamViewType.NEW_AND_OLD_IMAGES,\n };\n (table as any).tableStreamArn = (\n table.node.defaultChild as dynamoDb.CfnTable\n ).attrStreamArn;\n\n this.lambdaSubscriptionMain.function.addEventSource(\n new dynamoDbStream.DynamoEventSource(table, {\n startingPosition: lambda.StartingPosition.LATEST,\n batchSize: 1,\n retryAttempts: 0,\n })\n );\n\n const name = this.getConstructName(table);\n\n const serviceKey = `DynamoDB#${name}`;\n this.lambdaSubscriptionMain.mapping[table.tableArn] = serviceKey;\n this.serviceKeys.push(serviceKey);\n }\n\n private internalSpyEventBusRule(rule: events.Rule) {\n const { eventBusName } = rule.node.defaultChild as events.CfnRule;\n let bridgeName = 'Default';\n if (!!eventBusName) {\n const eventBridge = this.getEventBridge(eventBusName);\n\n if (!eventBridge) {\n throw new Error(`Can not find EventBridge with name \"${eventBusName}\"`);\n }\n bridgeName = this.getConstructName(eventBridge);\n }\n\n const functionSubscription = this.provideFunctionForSubscription(\n (s) => !s.usedForEventBridge\n );\n functionSubscription.usedForEventBridge = true;\n\n rule.addTarget(new targets.LambdaFunction(functionSubscription.function));\n\n const ruleName = this.getConstructName(rule);\n const serviceKey = `EventBridgeRule#${bridgeName}#${ruleName}`;\n functionSubscription.mapping.eventBridge = serviceKey;\n this.serviceKeys.push(serviceKey);\n }\n\n private internalSpyEventBus(eventBus: events.EventBus) {\n const functionSubscription = this.provideFunctionForSubscription(\n (s) => !s.usedForEventBridge\n );\n functionSubscription.usedForEventBridge = true;\n\n const bridgeName = this.getConstructName(eventBus);\n const rule = new events.Rule(this, `RuleAll${bridgeName}`, {\n eventBus,\n eventPattern: { version: ['0'] },\n targets: [new targets.LambdaFunction(functionSubscription.function)],\n });\n\n this.createdResourcesBySSpy.push(rule);\n const serviceKey = `EventBridge#${bridgeName}`;\n functionSubscription.mapping.eventBridge = serviceKey;\n this.serviceKeys.push(serviceKey);\n }\n\n private internalSpySnsTopic(topic: sns.Topic) {\n const functionSubscription = this.provideFunctionForSubscription(\n (s) => !s.subsribedTopics.includes(topic)\n );\n\n const subscription = topic.addSubscription(\n new snsSubs.LambdaSubscription(functionSubscription.function)\n );\n this.createdResourcesBySSpy.push(subscription);\n const topicName = this.getConstructName(topic);\n const serviceKey = `SnsTopic#${topicName}`;\n functionSubscription.mapping[topic.topicArn] = serviceKey;\n this.serviceKeys.push(serviceKey);\n functionSubscription.subsribedTopics.push(topic);\n }\n\n private internalSpySnsSubscription(subscription: sns.Subscription) {\n if (!subscription.node.scope) {\n return;\n }\n\n const topic = this.getTopic(\n (subscription.node.defaultChild as sns.CfnSubscription).topicArn\n );\n\n if (!topic) {\n throw new Error('Can not find Topic');\n }\n\n const functionSubscription = this.provideFunctionForSubscription(\n (s) => !s.subsribedTopics.includes(topic)\n );\n\n const { filterPolicy } = subscription.node\n .defaultChild as sns.CfnSubscription;\n\n const subscriptionClone = topic.addSubscription(\n new snsSubs.LambdaSubscription(functionSubscription.function)\n );\n (subscriptionClone.node.defaultChild as sns.CfnSubscription).filterPolicy =\n filterPolicy;\n\n this.createdResourcesBySSpy.push(subscriptionClone);\n\n const topicName = this.getConstructName(topic);\n const targetName = this.getConstructName(subscription.node.scope);\n\n functionSubscription.subsribedTopics.push(topic);\n const serviceKey = `SnsSubscription#${topicName}#${targetName}`;\n functionSubscription.mapping[topic.topicArn] = serviceKey;\n this.serviceKeys.push(serviceKey);\n }\n\n private provideFunctionForSubscription(\n filterFunction?: (subscription: LambdaSubscription) => boolean\n ) {\n let functionSubscription: LambdaSubscription | undefined;\n\n if (filterFunction) {\n functionSubscription = this.lambdaSubscriptionPool.find(filterFunction);\n } else if (this.lambdaSubscriptionPool.length > 0) {\n functionSubscription = this.lambdaSubscriptionPool[0];\n }\n\n if (!functionSubscription) {\n functionSubscription = {\n subsribedTopics: [],\n usedForEventBridge: false,\n mapping: {},\n function: this.createFunctionForSubscription(\n this.lambdaSubscriptionPool.length\n ),\n };\n this.lambdaSubscriptionPool.push(functionSubscription);\n }\n return functionSubscription;\n }\n\n private setupForIoT(func: lambda.Function) {\n func.addEnvironment(\n envVariableNames.SSPY_ROOT_STACK,\n this.cleanName(this.findRootStack(Stack.of(this)).node.id)\n );\n func.addEnvironment(envVariableNames.SSPY_IOT_ENDPOINT, this.iotEndpoint);\n\n func.addToRolePolicy(\n new aws_iam.PolicyStatement({\n actions: ['iot:*'],\n effect: Effect.ALLOW,\n resources: ['*'],\n })\n );\n }\n\n private internalSpyLambda(func: lambda.Function) {\n const { layer, spyWrapperPath } = this.getExtensionForRuntime(\n func.runtime,\n func.architecture || Architecture.X86_64\n )!;\n if (!layer) {\n return;\n }\n func.addLayers(layer);\n\n const functionName = this.getConstructName(func);\n\n func.addEnvironment(envVariableNames.SSPY_FUNCTION_NAME, functionName);\n func.addEnvironment('AWS_LAMBDA_EXEC_WRAPPER', spyWrapperPath);\n\n if (this.props?.debugMode) {\n func.addEnvironment(envVariableNames.SSPY_DEBUG, 'true');\n }\n\n this.setupForIoT(func);\n\n this.serviceKeys.push(`Function#${functionName}#Request`);\n this.serviceKeys.push(`Function#${functionName}#Error`);\n this.serviceKeys.push(`Function#${functionName}#Console`);\n this.serviceKeys.push(`Function#${functionName}#Response`);\n\n this.addMappingToFunction(func);\n }\n\n public getConstructName(construct: IConstruct) {\n let constructName = construct.node.path;\n const { node } = Stack.of(this);\n\n if (constructName.startsWith(node.id)) {\n constructName = constructName.substring(node.id.length + 1);\n }\n\n return this.cleanName(constructName);\n }\n\n private cleanName(name: string) {\n //snake case to camel case including dash and first letter to upper case\n return name\n .replace(/[-_]+/g, ' ')\n .replace(/[^\\w\\s]/g, '')\n .replace(/\\s(.)/g, ($1) => $1.toUpperCase())\n .replace(/\\s/g, '')\n .replace(/^(.)/, ($1) => $1.toUpperCase());\n }\n\n private getTopic(topicArn: string): sns.Topic | undefined {\n const topic = this.findElement<sns.Topic>(\n (node: IConstruct) =>\n node instanceof sns.Topic && (node as sns.Topic).topicArn === topicArn\n );\n\n return topic;\n }\n\n private getEventBridge(eventBusName: string): events.IEventBus | undefined {\n const eventBridge = this.findElement<events.IEventBus>(\n (node: IConstruct) =>\n (node instanceof events.EventBus ||\n node.constructor.name === 'ImportedEventBus') &&\n (node as events.IEventBus).eventBusName === eventBusName\n );\n\n return eventBridge;\n }\n\n private findRootStack(stack: Stack): Stack {\n if (stack.nested) {\n const parentStack = (stack as NestedStack).nestedStackParent;\n if (parentStack) return this.findRootStack(parentStack);\n return stack;\n } else {\n return stack;\n }\n }\n\n private findElement<T extends IConstruct = IConstruct>(\n filterFunc: (node: IConstruct) => boolean,\n parent?: IConstruct\n ): T | undefined {\n if (!parent) {\n parent = this.findRootStack(Stack.of(this));\n }\n\n for (const node of parent.node.children) {\n if (filterFunc(node)) {\n return node as T;\n }\n const elementFoundInChild = this.findElement<T>(filterFunc, node);\n if (elementFoundInChild) {\n return elementFoundInChild;\n }\n }\n\n return undefined;\n }\n\n private addMappingToFunction(\n func: lambda.Function,\n keyValue?: { key: string; value: string }\n ) {\n for (const fs of this.lambdasSpied) {\n if (fs.function === func) {\n if (keyValue) {\n fs.mapping[keyValue.key] = keyValue.value;\n }\n return;\n }\n }\n\n const fs: LambdaSpied = {\n function: func,\n mapping: {},\n };\n\n if (keyValue) {\n fs.mapping[keyValue.key] = keyValue.value;\n }\n\n this.lambdasSpied.push(fs);\n }\n\n private getAssetLocation(location: string) {\n const loc = path.join(__dirname, '../lib/' + location);\n\n if (fs.existsSync(loc)) {\n return loc;\n }\n\n const loc2 = path.join(__dirname, '../../lib/' + location);\n\n if (fs.existsSync(loc2)) {\n return loc2;\n }\n\n throw new Error(`Location ${loc} and ${loc2} does not exists.`);\n }\n}\n\ntype LambdaSubscription = {\n subsribedTopics: sns.Topic[];\n usedForEventBridge: boolean;\n function: lambdaNode.NodejsFunction;\n mapping: Record<string, string>;\n};\n\ntype LambdaSpied = {\n function: lambda.Function;\n mapping: Record<string, string>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;uBAgC6D;AAmB7D,MAAM,oBAAoB,SACxB,kBAAkB,QAAQ,iBAAiB,QAAQ,aAAa;AAElE,MAAM,uCAAuC;AAE7C,IAAa,gBAAb,cAAmC,UAAU;CAU3C,YACE,OACA,IACA,AAAQA,OACR;AACA,QAAM,OAAO,GAAG;EAFR;gCAZqC,EAAE;gCACM,EAAE;sBAEnB,EAAE;qBACT,EAAE;oBACE,EAAE;kBACsB,EAAE;EAU3D,MAAM,YAAY,KAAK,UACrB,KAAK,cAAc,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,GACzC;EAED,MAAM,iBAAiB,IAAI,iBAAiB,kBAC1C,MACA,sCACA;GACE,UAAU;IACR,SAAS;IACT,QAAQ;IACR,oBACE,iBAAiB,mBAAmB,aAAa,kBAAkB;IACrE,YAAY,EACV,cAAc,gBACf;IACF;GACD,UAAU;IACR,SAAS;IACT,QAAQ;IACR,oBACE,iBAAiB,mBAAmB,aAAa,kBAAkB;IACrE,YAAY,EACV,cAAc,gBACf;IACF;GACD,qBAAqB;GACrB,QAAQ,iBAAiB,wBAAwB,aAAa,EAC5D,WAAW,iBAAiB,wBAAwB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region src/common/envVariableNames.d.ts
|
|
2
|
+
declare enum envVariableNames {
|
|
3
|
+
/**
|
|
4
|
+
* Note that the function is subscribed to SQS, so we need to send spy events as it comes from SQS.
|
|
5
|
+
*/
|
|
6
|
+
SSPY_SUBSCRIBED_TO_SQS = "SSPY_SUBSCRIBED_TO_SQS",
|
|
7
|
+
/**
|
|
8
|
+
* Mapping of resource ARNs to service keys
|
|
9
|
+
*/
|
|
10
|
+
SSPY_INFRA_MAPPING = "SSPY_INFRA_MAPPING",
|
|
11
|
+
/**
|
|
12
|
+
* Web socket endpoint for sending and receiving spy events.
|
|
13
|
+
*/
|
|
14
|
+
SSPY_WS_ENDPOINT = "SSPY_WS_ENDPOINT",
|
|
15
|
+
SSPY_FUNCTION_NAME = "SSPY_FUNCTION_NAME",
|
|
16
|
+
/**
|
|
17
|
+
* DynamoDB table name that stores active websocket connections.
|
|
18
|
+
*/
|
|
19
|
+
SSPY_WS_TABLE_NAME = "SSPY_WS_TABLE_NAME",
|
|
20
|
+
/**
|
|
21
|
+
* Log debugging details.
|
|
22
|
+
*/
|
|
23
|
+
SSPY_DEBUG = "SSPY_DEBUG",
|
|
24
|
+
/**
|
|
25
|
+
* The root stack
|
|
26
|
+
*/
|
|
27
|
+
SSPY_ROOT_STACK = "SSPY_ROOT_STACK",
|
|
28
|
+
/**
|
|
29
|
+
* The endpoint url for AWS IoT for the account
|
|
30
|
+
*/
|
|
31
|
+
SSPY_IOT_ENDPOINT = "SSPY_IOT_ENDPOINT",
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { envVariableNames };
|
|
35
|
+
//# sourceMappingURL=envVariableNames.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envVariableNames.js","names":[],"sources":["../../../src/common/envVariableNames.ts"],"sourcesContent":["//this file is not under root -> common folder because jsii does not allow\n//changing tsconfing.json to remove rootDir property\n\nexport enum envVariableNames {\n /**\n * Note that the function is subscribed to SQS, so we need to send spy events as it comes from SQS.\n */\n SSPY_SUBSCRIBED_TO_SQS = 'SSPY_SUBSCRIBED_TO_SQS',\n\n /**\n * Mapping of resource ARNs to service keys\n */\n SSPY_INFRA_MAPPING = 'SSPY_INFRA_MAPPING',\n\n /**\n * Web socket endpoint for sending and receiving spy events.\n */\n SSPY_WS_ENDPOINT = 'SSPY_WS_ENDPOINT',\n\n SSPY_FUNCTION_NAME = 'SSPY_FUNCTION_NAME',\n\n /**\n * DynamoDB table name that stores active websocket connections.\n */\n SSPY_WS_TABLE_NAME = 'SSPY_WS_TABLE_NAME',\n\n /**\n * Log debugging details.\n */\n SSPY_DEBUG = 'SSPY_DEBUG',\n\n /**\n * The root stack\n */\n SSPY_ROOT_STACK = 'SSPY_ROOT_STACK',\n\n /**\n * The endpoint url for AWS IoT for the account\n */\n SSPY_IOT_ENDPOINT = 'SSPY_IOT_ENDPOINT',\n}\n"],"mappings":";;AAGA,IAAY,gEAAL;;;;AAIL;;;;AAKA;;;;AAKA;AAEA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA"}
|
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
import { __esm } from "../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/common/envVariableNames.ts
|
|
4
|
+
var envVariableNames;
|
|
5
|
+
var init_envVariableNames = __esm({ "src/common/envVariableNames.ts": (() => {
|
|
6
|
+
envVariableNames = /* @__PURE__ */ function(envVariableNames$1) {
|
|
7
|
+
/**
|
|
8
|
+
* Note that the function is subscribed to SQS, so we need to send spy events as it comes from SQS.
|
|
9
|
+
*/
|
|
10
|
+
envVariableNames$1["SSPY_SUBSCRIBED_TO_SQS"] = "SSPY_SUBSCRIBED_TO_SQS";
|
|
11
|
+
/**
|
|
12
|
+
* Mapping of resource ARNs to service keys
|
|
13
|
+
*/
|
|
14
|
+
envVariableNames$1["SSPY_INFRA_MAPPING"] = "SSPY_INFRA_MAPPING";
|
|
15
|
+
/**
|
|
16
|
+
* Web socket endpoint for sending and receiving spy events.
|
|
17
|
+
*/
|
|
18
|
+
envVariableNames$1["SSPY_WS_ENDPOINT"] = "SSPY_WS_ENDPOINT";
|
|
19
|
+
envVariableNames$1["SSPY_FUNCTION_NAME"] = "SSPY_FUNCTION_NAME";
|
|
20
|
+
/**
|
|
21
|
+
* DynamoDB table name that stores active websocket connections.
|
|
22
|
+
*/
|
|
23
|
+
envVariableNames$1["SSPY_WS_TABLE_NAME"] = "SSPY_WS_TABLE_NAME";
|
|
24
|
+
/**
|
|
25
|
+
* Log debugging details.
|
|
26
|
+
*/
|
|
27
|
+
envVariableNames$1["SSPY_DEBUG"] = "SSPY_DEBUG";
|
|
28
|
+
/**
|
|
29
|
+
* The root stack
|
|
30
|
+
*/
|
|
31
|
+
envVariableNames$1["SSPY_ROOT_STACK"] = "SSPY_ROOT_STACK";
|
|
32
|
+
/**
|
|
33
|
+
* The endpoint url for AWS IoT for the account
|
|
34
|
+
*/
|
|
35
|
+
envVariableNames$1["SSPY_IOT_ENDPOINT"] = "SSPY_IOT_ENDPOINT";
|
|
36
|
+
return envVariableNames$1;
|
|
37
|
+
}({});
|
|
38
|
+
}) });
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
init_envVariableNames();
|
|
42
|
+
export { envVariableNames, init_envVariableNames };
|
|
43
|
+
//# sourceMappingURL=envVariableNames.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envVariableNames.mjs","names":[],"sources":["../../../src/common/envVariableNames.ts"],"sourcesContent":["//this file is not under root -> common folder because jsii does not allow\n//changing tsconfing.json to remove rootDir property\n\nexport enum envVariableNames {\n /**\n * Note that the function is subscribed to SQS, so we need to send spy events as it comes from SQS.\n */\n SSPY_SUBSCRIBED_TO_SQS = 'SSPY_SUBSCRIBED_TO_SQS',\n\n /**\n * Mapping of resource ARNs to service keys\n */\n SSPY_INFRA_MAPPING = 'SSPY_INFRA_MAPPING',\n\n /**\n * Web socket endpoint for sending and receiving spy events.\n */\n SSPY_WS_ENDPOINT = 'SSPY_WS_ENDPOINT',\n\n SSPY_FUNCTION_NAME = 'SSPY_FUNCTION_NAME',\n\n /**\n * DynamoDB table name that stores active websocket connections.\n */\n SSPY_WS_TABLE_NAME = 'SSPY_WS_TABLE_NAME',\n\n /**\n * Log debugging details.\n */\n SSPY_DEBUG = 'SSPY_DEBUG',\n\n /**\n * The root stack\n */\n SSPY_ROOT_STACK = 'SSPY_ROOT_STACK',\n\n /**\n * The endpoint url for AWS IoT for the account\n */\n SSPY_IOT_ENDPOINT = 'SSPY_IOT_ENDPOINT',\n}\n"],"mappings":";;;;;CAGY,gEAAL;;;;AAIL;;;;AAKA;;;;AAKA;AAEA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA"}
|
package/lib/src/index.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ServerlessSpy } from "./ServerlessSpy.mjs";
|
|
2
|
+
|
|
3
|
+
export { ServerlessSpy };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "debug",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git://github.com/debug-js/debug.git"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"lint": "xo",
|
|
28
28
|
"test": "npm run test:node && npm run test:browser && npm run lint",
|
|
29
|
-
"test:node": "
|
|
29
|
+
"test:node": "mocha test.js test.node.js",
|
|
30
30
|
"test:browser": "karma start --single-run",
|
|
31
31
|
"test:coverage": "cat ./coverage/lcov.info | coveralls"
|
|
32
32
|
},
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"brfs": "^2.0.1",
|
|
38
38
|
"browserify": "^16.2.3",
|
|
39
39
|
"coveralls": "^3.0.2",
|
|
40
|
-
"istanbul": "^0.4.5",
|
|
41
40
|
"karma": "^3.1.4",
|
|
42
41
|
"karma-browserify": "^6.0.0",
|
|
43
42
|
"karma-chrome-launcher": "^2.2.0",
|
|
@@ -219,7 +219,7 @@ function save(namespaces) {
|
|
|
219
219
|
function load() {
|
|
220
220
|
let r;
|
|
221
221
|
try {
|
|
222
|
-
r = exports.storage.getItem('debug');
|
|
222
|
+
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
|
|
223
223
|
} catch (error) {
|
|
224
224
|
// Swallow
|
|
225
225
|
// XXX (@Qix-) should we be logging these?
|
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"standard-version": "^9",
|
|
77
77
|
"ts-jest": "^29.1.1",
|
|
78
78
|
"ts-node": "^10.9.2",
|
|
79
|
+
"tsdown": "^0.15.11",
|
|
79
80
|
"typescript": "^5.3.3",
|
|
80
81
|
"uuid": "^9.0.1"
|
|
81
82
|
},
|
|
@@ -137,7 +138,7 @@
|
|
|
137
138
|
"require": "./lib/index.js"
|
|
138
139
|
},
|
|
139
140
|
"license": "MPL-2.0",
|
|
140
|
-
"version": "2.3.
|
|
141
|
+
"version": "2.3.11",
|
|
141
142
|
"types": "lib/index.d.ts",
|
|
142
143
|
"stability": "stable",
|
|
143
144
|
"jsii": {
|
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
outDir: './lib',
|
|
5
|
+
entry: [
|
|
6
|
+
'./index.ts',
|
|
7
|
+
'src/**/*.ts',
|
|
8
|
+
'common/**/*.ts',
|
|
9
|
+
'listener/**/*.ts',
|
|
10
|
+
'cli/**/*.ts',
|
|
11
|
+
'!cli/**/webServerlessSpy.ts',
|
|
12
|
+
'functions/**/*.ts',
|
|
13
|
+
],
|
|
14
|
+
unbundle: true,
|
|
15
|
+
shims: true,
|
|
16
|
+
});
|