@allma/cdk-integration-utils 1.0.1 → 1.0.3
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 +65 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,25 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @allma/cdk-integration-utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@allma/cdk-integration-utils)
|
|
4
|
+
[](https://github.com/ALLMA-dev/allma-core/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
8
|
+
## What is Allma?
|
|
8
9
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.3",
|
|
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.
|
|
39
|
+
"@allma/core-types": "1.0.3",
|
|
40
40
|
"aws-cdk-lib": "^2.200.1",
|
|
41
41
|
"constructs": "^10.0.0"
|
|
42
42
|
},
|