@allma/core-sdk 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 +63 -0
  2. package/package.json +6 -4
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @allma/core-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/%40allma%2Fcore-sdk)](https://www.npmjs.com/package/@allma/core-sdk)
4
+ [![License](https://img.shields.io/npm/l/%40allma%2Fcore-sdk)](https://github.com/ALLMA-dev/allma-core/blob/main/LICENSE)
5
+
6
+ This package provides a collection of shared utilities for building on the Allma platform. It is primarily designed to be used within AWS Lambda functions, such as custom step handlers (`CUSTOM_LAMBDA_INVOKE`) or Admin API handlers.
7
+
8
+ ## What is Allma?
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.
11
+
12
+ ## Key Features
13
+
14
+ - **Structured JSON Logger:** A simple, level-based logger that outputs structured JSON for easy searching and analysis in Amazon CloudWatch Logs.
15
+ - **S3 Payload Offloading:** Utilities (`offloadIfLarge`, `hydrateInputFromS3Pointers`) to automatically handle large data payloads by storing them in S3, avoiding AWS service limits.
16
+ - **API Response Builders:** Helpers for creating standardized, consistent API Gateway responses.
17
+ - **Auth Middleware:** A higher-order function (`withAdminAuth`) to easily secure Admin API Lambda handlers with Cognito JWT authentication.
18
+ - **JSON Repair Utility:** A robust function (`extractAndParseJson`) to parse JSON from noisy LLM outputs.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @allma/core-sdk
24
+ ```
25
+
26
+ ## Core Usage
27
+
28
+ **Example: Using the structured logger in a custom Lambda handler.**
29
+
30
+ ```typescript
31
+ import { log_info, log_error } from '@allma/core-sdk';
32
+ import { Handler } from 'aws-lambda';
33
+
34
+ export const handler: Handler = async (event, context) => {
35
+ const correlationId = context.awsRequestId; // Use a request ID for tracing
36
+
37
+ log_info('Handler invoked', { input: event }, correlationId);
38
+
39
+ try {
40
+ // ... Your business logic here ...
41
+ const result = { status: 'success' };
42
+ log_info('Processing completed successfully', { result }, correlationId);
43
+ return result;
44
+ } catch (error: any) {
45
+ log_error('An unexpected error occurred during processing', {
46
+ errorName: error.name,
47
+ errorMessage: error.message,
48
+ stack: error.stack
49
+ }, correlationId);
50
+
51
+ // Re-throw the error or handle it as needed
52
+ throw new Error('Processing failed');
53
+ }
54
+ };
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ 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.
60
+
61
+ ## License
62
+
63
+ This project is licensed under the Apache-2.0 License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allma/core-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Core SDK with shared utilities (logging, auth, S3 utils) for building on the Allma serverless AI orchestration platform.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,19 +34,21 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@allma/core-types": "^1.0.1",
37
+ "@allma/core-types": "^1.0.3",
38
38
  "@aws-sdk/client-s3": "^3.500.0",
39
39
  "@aws-sdk/client-secrets-manager": "^3.500.0",
40
40
  "@aws-sdk/client-sns": "^3.500.0",
41
41
  "@aws-sdk/client-sqs": "^3.500.0",
42
42
  "@aws-sdk/client-ssm": "^3.500.0",
43
43
  "@aws-sdk/client-sfn": "^3.500.0",
44
- "@aws-sdk/lib-dynamodb": "^3.500.0",
45
- "zod": "^3.22.4"
44
+ "@aws-sdk/lib-dynamodb": "^3.500.0"
46
45
  },
47
46
  "devDependencies": {
48
47
  "typescript": "^5.9.3",
49
48
  "eslint": "^9.8.0",
50
49
  "typescript-eslint": "^8.0.0"
50
+ },
51
+ "peerDependencies": {
52
+ "zod": "^3.22.4"
51
53
  }
52
54
  }