@allma/cdk-integration-utils 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +65 -18
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,25 +1,72 @@
1
- # Allma CDK Integration Utilities
1
+ # @allma/cdk-integration-utils
2
2
 
3
- This package contains shared CDK constructs and utilities intended for consumers of the Allma platform. It provides the necessary building blocks to integrate your own AWS resources, such as custom Lambda functions, with your Allma flows.
3
+ [![npm version](https://img.shields.io/npm/v/%40allma%2Fcdk-integration-utils)](https://www.npmjs.com/package/@allma/cdk-integration-utils)
4
+ [![License](https://img.shields.io/npm/l/%40allma%2Fcdk-integration-utils)](https://github.com/ALLMA-dev/allma-core/blob/main/LICENSE)
4
5
 
5
- ## Purpose
6
+ This package provides helper utilities for developers who are building their own AWS CDK constructs to integrate with an existing Allma deployment. Its primary purpose is to simplify the process of registering custom modules with the Allma platform.
6
7
 
7
- The primary purpose of this package is to facilitate the `CUSTOM_LAMBDA_INVOKE` step type within Allma. It exports the necessary interfaces and utility functions to grant the Allma orchestrator the required IAM permissions to invoke your custom Lambdas.
8
+ ## What is Allma?
8
9
 
9
- ## Usage
10
+ **Allma is a serverless, event-driven platform designed to build, execute, and manage complex, AI-powered automated workflows, known as `Flows`.** It acts as a "digital factory" for orchestrating sophisticated business processes, combining data integration, conditional logic, and advanced AI capabilities in a robust, scalable, and observable environment built on AWS.
10
11
 
11
- To allow Allma to invoke a custom Lambda function, you need to use the `grantInvoke` utility from this package within your CDK stack.
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @allma/cdk-integration-utils
16
+ ```
17
+
18
+ ## Core Usage
19
+
20
+ The most common use case is registering a custom Lambda function as an invokable step (`CUSTOM_LAMBDA_INVOKE`) within the Allma Flow Editor. The `createExternalStepRegistration` utility creates a CDK `AwsCustomResource` that automatically adds an entry to Allma's DynamoDB configuration table during `cdk deploy`.
21
+
22
+ **Example: Registering a custom "Premium Calculator" Lambda.**
12
23
 
13
24
  ```typescript
14
- import { grantInvoke } from '@allma/cdk-integration-utils';
15
- import { MyCustomStack } from './my-custom-stack';
16
-
17
- // In your CDK app file
18
- const app = new cdk.App();
19
- const myStack = new MyCustomStack(app, 'MyCustomStack');
20
-
21
- // Grant the Allma orchestrator permission to invoke your function
22
- grantInvoke(myStack, 'MyCustomFunction', {
23
- allmaStackName: 'MyAllmaStack',
24
- function: myStack.myFunction,
25
- });
25
+ import * as cdk from 'aws-cdk-lib';
26
+ import { Construct } from 'constructs';
27
+ import * as lambda from 'aws-cdk-lib/aws-lambda';
28
+ import { StepType } from '@allma/core-types';
29
+ import { createExternalStepRegistration } from '@allma/cdk-integration-utils';
30
+
31
+ export interface MyCustomModuleStackProps extends cdk.StackProps {
32
+ // Pass in the name of the Allma config table from your Allma deployment
33
+ allmaConfigTableName: string;
34
+ }
35
+
36
+ export class MyCustomModuleStack extends cdk.Stack {
37
+ constructor(scope: Construct, id: string, props: MyCustomModuleStackProps) {
38
+ super(scope, id, props);
39
+
40
+ // 1. Define your custom Lambda function
41
+ const premiumCalculatorLambda = new lambda.Function(this, 'PremiumCalculator', {
42
+ runtime: lambda.Runtime.NODEJS_20_X,
43
+ handler: 'index.handler',
44
+ code: lambda.Code.fromAsset('./lambda'),
45
+ // ... other lambda props
46
+ });
47
+
48
+ // 2. Register it with Allma using the utility
49
+ createExternalStepRegistration(this, 'AllmaPremiumCalculatorRegistration', {
50
+ configTableName: props.allmaConfigTableName,
51
+ moduleIdentifier: 'my-company/premium-calculator',
52
+ displayName: 'Premium Calculator',
53
+ description: 'Calculates an insurance premium based on user data.',
54
+ stepType: StepType.CUSTOM_LAMBDA_INVOKE,
55
+ lambdaArn: premiumCalculatorLambda.functionArn,
56
+ defaultConfig: {
57
+ // This is the default JSON config that appears in the Flow Editor
58
+ // when a user drags this step onto the canvas.
59
+ someDefaultParameter: 'defaultValue',
60
+ },
61
+ });
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Contributing
67
+
68
+ This package is part of the `allma-core` monorepo. We welcome contributions! Please see our main [repository](https://github.com/ALLMA-dev/allma-core) and [contribution guide](https://docs.allma.dev/docs/community/contribution-guide) for more details.
69
+
70
+ ## License
71
+
72
+ This project is licensed under the Apache-2.0 License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allma/cdk-integration-utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Shared CDK constructs and utilities for integrating external modules with the Allma serverless AI orchestration platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@allma/core-types": "1.0.1",
39
+ "@allma/core-types": "1.0.2",
40
40
  "aws-cdk-lib": "^2.200.1",
41
41
  "constructs": "^10.0.0"
42
42
  },