@justworkflowit/cdk-constructs 0.0.12 → 0.0.14

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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@justworkflowit/cdk-constructs",
3
3
  "description": "",
4
- "version": "0.0.12",
5
- "main": "dist/src/index.js",
6
- "types": "dist/src/index.d.ts",
4
+ "version": "0.0.14",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
10
  "scripts": {
11
- "build": "tsc",
11
+ "build": "tsc && node esbuild-lambdas.js",
12
12
  "lint": "eslint . --ext .ts",
13
13
  "lint:fix": "eslint --fix . --ext .ts"
14
14
  },
@@ -1,8 +0,0 @@
1
- import { Construct } from 'constructs';
2
- export interface JustWorkflowItConstructProps {
3
- disambiguator: string;
4
- }
5
- export declare class JustWorkflowItConstruct extends Construct {
6
- private static readonly CONSTRUCT_ID_PREFIX;
7
- constructor(scope: Construct, props: JustWorkflowItConstructProps);
8
- }
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JustWorkflowItConstruct = void 0;
4
- const aws_cdk_lib_1 = require("aws-cdk-lib");
5
- const constructs_1 = require("constructs");
6
- const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
7
- const aws_iam_1 = require("aws-cdk-lib/aws-iam");
8
- const aws_secretsmanager_1 = require("aws-cdk-lib/aws-secretsmanager");
9
- const custom_resources_1 = require("aws-cdk-lib/custom-resources");
10
- class JustWorkflowItConstruct extends constructs_1.Construct {
11
- constructor(scope, props) {
12
- super(scope, `${JustWorkflowItConstruct.CONSTRUCT_ID_PREFIX}${props.disambiguator}`);
13
- const secretName = '/justworkflowit/api/authToken';
14
- const secret = new aws_secretsmanager_1.Secret(this, 'JustWorkflowItAuthTokenSecret', {
15
- secretName,
16
- secretStringValue: aws_cdk_lib_1.SecretValue.unsafePlainText('REPLACE_ME_WITH_JUST_WORKFLOW_IT_AUTH_TOKEN'),
17
- description: 'Paste your JustWorkflowIt API auth token here to enable secure communication.',
18
- });
19
- const integrationLambda = new aws_lambda_1.Function(this, 'JustWorkflowItAutomationIntegrationLambda', {
20
- functionName: 'JustWorkflowItAutomationIntegrationLambda',
21
- runtime: aws_lambda_1.Runtime.NODEJS_18_X,
22
- handler: 'index.handler',
23
- code: aws_lambda_1.Code.fromInline(`
24
- exports.handler = async (event) => {
25
- console.log("Custom Resource event:", JSON.stringify(event, null, 2));
26
-
27
- const requestType = event.RequestType;
28
- if (requestType === 'Create') {
29
- console.log("Handling CREATE...");
30
- } else if (requestType === 'Update') {
31
- console.log("Handling UPDATE...");
32
- } else if (requestType === 'Delete') {
33
- console.log("Handling DELETE...");
34
- }
35
-
36
- return {
37
- PhysicalResourceId: 'JustWorkflowItIntegrationTrigger',
38
- Data: {
39
- Message: "Integration Lambda ran successfully"
40
- }
41
- };
42
- };
43
- `),
44
- timeout: aws_cdk_lib_1.Duration.seconds(10),
45
- environment: {
46
- AUTH_SECRET_NAME: secretName,
47
- API_BASE_URL: 'https://api.justworkflowit.com',
48
- },
49
- });
50
- secret.grantRead(integrationLambda);
51
- const provider = new custom_resources_1.Provider(this, 'JustWorkflowItAutomationLambdaTriggerProvider', {
52
- onEventHandler: integrationLambda,
53
- });
54
- new aws_cdk_lib_1.CustomResource(this, 'JustWorkflowItAutomationLambdaTrigger', {
55
- serviceToken: provider.serviceToken,
56
- properties: {
57
- timestamp: new Date().toISOString()
58
- }
59
- });
60
- const executionRole = new aws_iam_1.Role(this, 'JustWorkflowItAutomationExecutionRole', {
61
- roleName: 'JustWorkflowItAutomationExecutionRole',
62
- assumedBy: new aws_iam_1.AccountPrincipal('588738588052'),
63
- description: 'Role assumed by JustWorkflowIt backend to perform actions inside this account.',
64
- });
65
- executionRole.addToPolicy(new aws_iam_1.PolicyStatement({
66
- actions: ['lambda:InvokeFunction'],
67
- resources: ['*'],
68
- }));
69
- executionRole.addToPolicy(new aws_iam_1.PolicyStatement({
70
- actions: ['sns:Publish'],
71
- resources: ['*'],
72
- }));
73
- executionRole.addToPolicy(new aws_iam_1.PolicyStatement({
74
- actions: ['sqs:SendMessage'],
75
- resources: ['*'],
76
- }));
77
- }
78
- }
79
- exports.JustWorkflowItConstruct = JustWorkflowItConstruct;
80
- JustWorkflowItConstruct.CONSTRUCT_ID_PREFIX = "JustWorkflowItConstruct";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handler = void 0;
4
- const justWorkflowItApiClient_1 = require("./justWorkflowItApiClient");
5
- const handler = async (event) => {
6
- console.log("Custom Resource Event:", JSON.stringify(event, null, 2));
7
- const { RequestType } = event;
8
- if (RequestType === 'Create') {
9
- (0, justWorkflowItApiClient_1.getApiClient)();
10
- }
11
- return {
12
- PhysicalResourceId: 'JustWorkflowItIntegrationTrigger',
13
- Data: {
14
- Message: `Ran ${RequestType} successfully`,
15
- },
16
- };
17
- };
18
- exports.handler = handler;
@@ -1 +0,0 @@
1
- export * from '../lib/justWorkflowItConstructs';