@justworkflowit/cdk-constructs 0.0.1

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/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @justworkflowit/cdk-constructs
2
+
3
+ This package provides an easy-to-use AWS CDK construct for integrating your AWS environment with the [JustWorkflowIt](https://justworkflowit.com) platform.
4
+
5
+ It sets up a secure integration by deploying:
6
+
7
+ - An **integration Lambda** (deployed in your AWS account, maintained by JustWorkflowIt via NPM updates)
8
+ - A **Secrets Manager secret** to store your JustWorkflowIt auth token
9
+ - A **cross-account IAM role** that JustWorkflowIt can assume to perform actions on your behalf
10
+
11
+ ---
12
+
13
+ ## ๐Ÿš€ Quick Start
14
+
15
+ ### 1. Install the package
16
+
17
+ ```bash
18
+ npm install @justworkflowit/cdk-constructs
19
+ ```
20
+
21
+ ### 2. Add the construct to your CDK stack
22
+
23
+ ```ts
24
+ import { JustWorkflowItConstruct } from "@justworkflowit/cdk-constructs";
25
+
26
+ new JustWorkflowItConstruct(this, "JustWorkflowItIntegration");
27
+ ```
28
+
29
+ ---
30
+
31
+ ## ๐Ÿ” What It Deploys
32
+
33
+ | Resource | Purpose |
34
+ | ------------------------ | ------------------------------------------------------------------ |
35
+ | `SecretsManager::Secret` | Created at `/justworkflowit/api/authToken` โ€” paste your token here |
36
+ | `IAM::Role` | Named `JustWorkflowItExecutionRole` โ€” assumed by JustWorkflowIt |
37
+ | `Lambda::Function` | Runs inside your account and can call JustWorkflowIt APIs securely |
38
+
39
+ ---
40
+
41
+ ## ๐Ÿ“ฅ Add Your Auth Token
42
+
43
+ Once deployed, open [Secrets Manager](https://console.aws.amazon.com/secretsmanager/) and edit the secret:
44
+
45
+ ```
46
+ /justworkflowit/api/authToken
47
+ ```
48
+
49
+ Paste in your auth token from the JustWorkflowIt dashboard.
50
+
51
+ ---
52
+
53
+ ## โœ… Default Permissions Granted
54
+
55
+ The IAM role created in your account will allow JustWorkflowIt to:
56
+
57
+ - `lambda:InvokeFunction` โ€“ Call your Lambda functions
58
+ - `sns:Publish` โ€“ Publish messages to SNS topics
59
+ - `sqs:SendMessage` โ€“ Send messages to SQS queues
60
+
61
+ This is designed to support typical event-driven integrations. Additional permissions can be added manually if needed.
62
+
63
+ ---
64
+
65
+ ## ๐Ÿ“„ Outputs
66
+
67
+ You may export the IAM Role ARN from your stack if you want to track or reference it elsewhere:
68
+
69
+ ```ts
70
+ new cdk.CfnOutput(this, "WorkflowItRoleArn", {
71
+ value: myConstruct.crossAccountRole.roleArn,
72
+ });
73
+ ```
74
+
75
+ ---
76
+
77
+ ## ๐Ÿง  Why Use This?
78
+
79
+ - ๐Ÿ” Secure and isolated
80
+ - โš™๏ธ Easy to deploy and revoke
81
+ - โœ… Designed for least privilege and extensibility
82
+ - ๐Ÿ“ฆ Integrates seamlessly with the JustWorkflowIt ecosystem
83
+
84
+ ---
85
+
86
+ ## ๐Ÿงช Coming Soon
87
+
88
+ - Pre-built Lambda integrations (e.g. syncers, processors)
89
+ - Versioned permission sets
90
+ - Auto token provisioning (via CDK parameter store or registration link)
91
+
92
+ ---
93
+
94
+ ## ๐Ÿงฐ Requirements
95
+
96
+ - AWS CDK v2
97
+ - Node.js 16+
98
+ - Deployed into a CDK stack in your AWS account
99
+
100
+ ---
101
+
102
+ ## ๐Ÿง‘โ€๐Ÿ’ป License
103
+
104
+ MIT License โ€” ยฉ 2025 JustWorkflowIt
@@ -0,0 +1,4 @@
1
+ import { Construct } from 'constructs';
2
+ export declare class JustWorkflowItConstruct extends Construct {
3
+ constructor(scope: Construct, id: string);
4
+ }
@@ -0,0 +1,50 @@
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
+ class JustWorkflowItConstruct extends constructs_1.Construct {
10
+ constructor(scope, id) {
11
+ super(scope, id);
12
+ const secret = new aws_secretsmanager_1.Secret(this, 'JustWorkflowItAuthTokenSecret', {
13
+ secretName: '/justworkflowit/api/authToken',
14
+ description: 'Paste your JustWorkflowIt API auth token here to enable secure communication.',
15
+ });
16
+ const integrationLambda = new aws_lambda_1.Function(this, 'IntegrationLambda', {
17
+ runtime: aws_lambda_1.Runtime.NODEJS_18_X,
18
+ handler: 'index.handler',
19
+ code: aws_lambda_1.Code.fromInline(`
20
+ exports.handler = async () => {
21
+ console.log("Integration Lambda triggered.");
22
+ };
23
+ `),
24
+ timeout: aws_cdk_lib_1.Duration.seconds(10),
25
+ environment: {
26
+ AUTH_SECRET_NAME: '/justworkflowit/api/authToken',
27
+ API_BASE_URL: 'https://api.justworkflowit.com',
28
+ },
29
+ });
30
+ secret.grantRead(integrationLambda);
31
+ const executionRole = new aws_iam_1.Role(this, 'JustWorkflowItExecutionRole', {
32
+ roleName: 'JustWorkflowItExecutionRole',
33
+ assumedBy: new aws_iam_1.AccountPrincipal('588738588052'), // <-- Replace this with your actual account ID
34
+ description: 'Role assumed by JustWorkflowIt backend to perform actions inside this account.',
35
+ });
36
+ executionRole.addToPolicy(new aws_iam_1.PolicyStatement({
37
+ actions: ['lambda:InvokeFunction'],
38
+ resources: ['*'],
39
+ }));
40
+ executionRole.addToPolicy(new aws_iam_1.PolicyStatement({
41
+ actions: ['sns:Publish'],
42
+ resources: ['*'],
43
+ }));
44
+ executionRole.addToPolicy(new aws_iam_1.PolicyStatement({
45
+ actions: ['sqs:SendMessage'],
46
+ resources: ['*'],
47
+ }));
48
+ }
49
+ }
50
+ exports.JustWorkflowItConstruct = JustWorkflowItConstruct;
@@ -0,0 +1 @@
1
+ export * from '../lib/justWorkflowItConstruct';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../lib/justWorkflowItConstruct"), exports);
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@justworkflowit/cdk-constructs",
3
+ "description": "",
4
+ "version": "0.0.1",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "prepare": "npm run build",
10
+ "lint": "eslint . --ext .ts"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "README.md"
15
+ ],
16
+ "keywords": [],
17
+ "author": "",
18
+ "license": "ISC",
19
+ "type": "commonjs",
20
+ "dependencies": {
21
+ "aws-cdk-lib": "^2.202.0",
22
+ "constructs": "^10.4.2"
23
+ },
24
+ "devDependencies": {
25
+ "cdk-cli": "^1.1.0",
26
+ "eslint": "^9.29.0",
27
+ "prettier": "^3.6.2",
28
+ "ts-node": "^10.9.2",
29
+ "typescript": "^5.8.3"
30
+ },
31
+ "peerDependencies": {
32
+ "aws-cdk-lib": "^2.0.0",
33
+ "constructs": "^10.0.0"
34
+ }
35
+ }