@siglo/fastify 0.0.0-stage → 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Jerico de guzman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,187 @@
1
- # Temporary Holding Version
1
+ # @siglo/fastify Adapter Guide
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@siglo/fastify` provides an idiomatic Fastify route handler adapter for executing `Siglo` workflows. It is optimized for high-throughput, low-overhead microservices, taking advantage of Fastify's asynchronous request lifecycle, schema validation, and raw Node.js HTTP stream signals for cooperative cancellation.
4
+
5
+ ---
6
+
7
+ ## 1. Overview & Architecture
8
+
9
+ Fastify is designed for minimal overhead. The `@siglo/fastify` handler adapter integrates as a standard Fastify route handler:
10
+
11
+ ```mermaid
12
+ flowchart TD
13
+ Req["Fastify HTTP Request"] --> Handler["sigloFastifyHandler<br/>• Extract request.body / query<br/>• Extract request.raw.signal (Native AbortSignal)<br/>• Mirror X-Correlation-Id<br/>• Resolve Tenant Namespace"]
14
+ Handler --> WF["Siglo Workflow<br/>• Typed Input Parameters<br/>• Timeout Deadlines<br/>• Subgraph Step Execution"]
15
+ WF -->|Success| Success["Set Stack ID<br/>Return JSON"]
16
+ WF -->|Error| Error["getErrorStatusCode(err)<br/>reply.status(code).send()"]
17
+ ```
18
+
19
+ ---
20
+
21
+ ## 2. Installation & Requirements
22
+
23
+ Install `@siglo/fastify` alongside Fastify:
24
+
25
+ ```bash
26
+ npm install @siglo/core @siglo/fastify fastify
27
+ ```
28
+
29
+ Peer dependency matrix:
30
+ - `Siglo`: `*` (v1.0.0+)
31
+ - `fastify`: `^4.0.0 || ^5.0.0`
32
+
33
+ ---
34
+
35
+ ## 3. API Reference
36
+
37
+ ### `sigloFastifyHandler(workflow, options)`
38
+
39
+ Creates a Fastify route handler `(request, reply) => Promise<any>`:
40
+
41
+ ```typescript
42
+ function sigloFastifyHandler<TInput = any, TOutput = any, TReq = any>(
43
+ workflow: Flow<TInput, TOutput>,
44
+ options?: SigloFastifyOptions<TReq, TInput, TOutput>
45
+ ): (request: any, reply: any) => Promise<any>;
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 4. Configuration Options (`SigloFastifyOptions`)
51
+
52
+ | Option | Type | Default | Description |
53
+ | :--- | :--- | :--- | :--- |
54
+ | `input` | `(req: TReq) => Promise<TInput> \| TInput` | `request.body \|\| request.query` | Function transforming incoming Fastify request into workflow parameters. |
55
+ | `output` | `(result: TOutput, reply: FastifyReply) => Promise<any> \| any` | `result` | Function formatting the final response. If omitted, Fastify serializes the clean result. |
56
+ | `timeout` | `number` | `undefined` | Execution timeout in milliseconds. |
57
+ | `namespace` | `string \| ((req: TReq) => string \| undefined)` | `undefined` | Namespace identifier or extractor function for tenant partitioning. |
58
+ | `allowHeaderNamespace` | `boolean` | `false` | When true, permits extracting tenant namespace from incoming `x-namespace` headers. Keep disabled when client requests are untrusted. |
59
+ | `exposeErrorDetails` | `boolean` | `process.env.NODE_ENV !== 'production'` | Controls whether 500 error messages expose internal details. In production, a generic `'Internal workflow execution error'` is returned. |
60
+ | `onError` | `(err: any, reply: FastifyReply) => Promise<any> \| any` | Default JSON error handler | Custom error responder. If omitted, maps status codes and returns sanitized `{ error: message }`. |
61
+ | `correlationIdHeader` | `string` | `'x-correlation-id'` | Header name for correlation propagation. |
62
+
63
+ ---
64
+
65
+ ## 5. Status Code Resolution & Error Semantics
66
+
67
+ If a workflow throws an unhandled error and no `onError` hook is specified, the adapter automatically categorizes the error and formats the response:
68
+
69
+ | Error Name / Hierarchy | Status Code | HTTP Status |
70
+ | :--- | :--- | :--- |
71
+ | `StepTimeoutException` / `FlowTimeoutException` | `504` | Gateway Timeout |
72
+ | `ValidationException` / `SpecFailedException` | `400` | Bad Request |
73
+ | `IdempotencyConflictException` | `409` | Conflict |
74
+ | `CancellationException` / `AbortError` | `499` | Client Closed Request |
75
+ | Other `Error` instances | `500` | Internal Server Error (sanitized in production) |
76
+
77
+ *Default Error JSON Payload:*
78
+ ```json
79
+ {
80
+ "error": "Timeout occurred while executing step 'chargeCustomer'"
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 6. Native Request Abort & Cooperative Cancellation
87
+
88
+ Fastify exposes Node.js's native `request.raw.signal`. When an HTTP client aborts (e.g. closes connection or timeout occurs on the client proxy), Fastify emits an abort event on `request.raw.signal`.
89
+
90
+ The adapter extracts `request.raw.signal` and attaches it to the workflow's `ExecutionOptions`. Any workflow step calling external APIs can link their child operations:
91
+
92
+ ```typescript
93
+ const queryExternalAPI = Step.create(async (param) => {
94
+ const signal = param.$signal?.();
95
+ const res = await fetch('https://api.upstream.io/data', { signal });
96
+ return await res.json();
97
+ });
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 7. Complete Production Example
103
+
104
+ ```typescript
105
+ import Fastify from 'fastify';
106
+ import { Step, flow } from '@siglo/core';
107
+ import { sigloFastifyHandler } from '@siglo/fastify';
108
+
109
+ const fastify = Fastify({
110
+ logger: true,
111
+ });
112
+
113
+ // 1. Workflow Definition
114
+ interface KYCInput {
115
+ customerId: string;
116
+ ssn: string;
117
+ country: string;
118
+ }
119
+
120
+ const verifyIdentity = Step.create('verifyIdentity', async (input: KYCInput) => {
121
+ if (!input.customerId || !input.ssn) {
122
+ const err = new Error('customerId and ssn are required');
123
+ err.name = 'ValidationException';
124
+ throw err;
125
+ }
126
+ return { verified: true, riskScore: 12 };
127
+ });
128
+
129
+ const runSanctionCheck = Step.create('runSanctionCheck', async (param: any) => {
130
+ // Upstream sanctions database check
131
+ return { sanctioned: false, clearanceId: `clear_${Date.now()}` };
132
+ });
133
+
134
+ const kycPipeline = flow(verifyIdentity, runSanctionCheck);
135
+
136
+ // 2. Fastify Route Schema + Handler Adapter
137
+ fastify.post(
138
+ '/api/v1/kyc/verify',
139
+ {
140
+ schema: {
141
+ body: {
142
+ type: 'object',
143
+ required: ['customerId', 'ssn'],
144
+ properties: {
145
+ customerId: { type: 'string' },
146
+ ssn: { type: 'string' },
147
+ country: { type: 'string', default: 'US' },
148
+ },
149
+ },
150
+ },
151
+ },
152
+ sigloFastifyHandler(kycPipeline, {
153
+ timeout: 8000, // 8-second timeout SLA
154
+ correlationIdHeader: 'x-request-id',
155
+ namespace: (req) => req.headers['x-tenant-id'] as string,
156
+ output: (result, reply) => {
157
+ reply.status(200).send({
158
+ success: true,
159
+ clearanceId: result.clearanceId,
160
+ verified: result.verified,
161
+ riskScore: result.riskScore,
162
+ });
163
+ },
164
+ onError: (err, reply) => {
165
+ if (err.name === 'ValidationException') {
166
+ return reply.status(400).send({ error: err.message, type: 'BAD_REQUEST' });
167
+ }
168
+ if (err.name === 'StepTimeoutException') {
169
+ return reply.status(504).send({ error: 'KYC check timed out', type: 'TIMEOUT' });
170
+ }
171
+ reply.status(500).send({ error: 'KYC verification failed', detail: err.message });
172
+ },
173
+ })
174
+ );
175
+
176
+ // Start server
177
+ const start = async () => {
178
+ try {
179
+ await fastify.listen({ port: 3000, host: '0.0.0.0' });
180
+ } catch (err) {
181
+ fastify.log.error(err);
182
+ process.exit(1);
183
+ }
184
+ };
185
+
186
+ start();
187
+ ```
@@ -0,0 +1,19 @@
1
+ import { Flow } from '@siglo/core';
2
+ export interface SigloFastifyOptions<TReq = any, TInput = any, TOutput = any> {
3
+ input?: (req: TReq) => Promise<TInput> | TInput;
4
+ output?: (result: TOutput, reply: any) => Promise<any> | any;
5
+ timeout?: number;
6
+ namespace?: string | ((req: TReq) => string | undefined);
7
+ onError?: (err: any, reply: any) => Promise<any> | any;
8
+ correlationIdHeader?: string;
9
+ allowHeaderNamespace?: boolean;
10
+ exposeErrorDetails?: boolean;
11
+ }
12
+ export declare function getErrorStatusCode(err: any): number;
13
+ /**
14
+ * Creates a Fastify route handler for executing a rivulet workflow.
15
+ */
16
+ export declare function sigloFastifyHandler<TInput = any, TOutput = any, TReq = any>(workflow: Flow<TInput, TOutput>, options?: SigloFastifyOptions<TReq, TInput, TOutput>): (request: any, reply: any) => Promise<any>;
17
+ export type RivuletFastifyOptions<TReq = any, TInput = any, TOutput = any> = SigloFastifyOptions<TReq, TInput, TOutput>;
18
+ export declare const rivuletFastifyHandler: typeof sigloFastifyHandler;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG;IACxE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAChD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACvD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAoBnD;AAiBD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,IAAI,GAAG,GAAG,EACvE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAM,aAEjC,GAAG,SAAS,GAAG,KAAG,OAAO,CAAC,GAAG,CAAC,CAgExD;AAGD,MAAM,MAAM,qBAAqB,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACxH,eAAO,MAAM,qBAAqB,4BAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rivuletFastifyHandler = void 0;
4
+ exports.getErrorStatusCode = getErrorStatusCode;
5
+ exports.sigloFastifyHandler = sigloFastifyHandler;
6
+ function getErrorStatusCode(err) {
7
+ if (!err) {
8
+ return 500;
9
+ }
10
+ const name = err.name || '';
11
+ const causeName = err.cause?.name || (err.error?.name) || '';
12
+ if (err.isTimeout || name.includes('Timeout') || causeName.includes('Timeout')) {
13
+ return 504;
14
+ }
15
+ if (name.includes('SpecFailed') || name.includes('Validation') || causeName.includes('SpecFailed') || causeName.includes('Validation')) {
16
+ return 400;
17
+ }
18
+ if (name.includes('Idempotency') || name.includes('Conflict') || causeName.includes('Idempotency') || causeName.includes('Conflict')) {
19
+ return 409;
20
+ }
21
+ if (err.isCancellation || name.includes('Cancellation') || name.includes('Abort') || causeName.includes('Cancellation') || causeName.includes('Abort') || err.message?.includes('aborted')) {
22
+ return 499;
23
+ }
24
+ return typeof err.status === 'number' ? err.status : 500;
25
+ }
26
+ function unwrapContext(obj) {
27
+ if (!obj || typeof obj !== 'object') {
28
+ return obj;
29
+ }
30
+ const clean = {};
31
+ for (const key of Object.keys(obj)) {
32
+ if (key.startsWith('$')) {
33
+ continue;
34
+ }
35
+ const val = typeof obj[key] === 'function' ? (obj[key].val !== undefined ? obj[key].val : (obj[key].length === 0 ? obj[key]() : obj[key])) : obj[key];
36
+ clean[key] = val;
37
+ }
38
+ return clean;
39
+ }
40
+ /**
41
+ * Creates a Fastify route handler for executing a rivulet workflow.
42
+ */
43
+ function sigloFastifyHandler(workflow, options = {}) {
44
+ return async (request, reply) => {
45
+ try {
46
+ // Correlation ID handling
47
+ const corrHeader = (options.correlationIdHeader || 'x-correlation-id').toLowerCase();
48
+ const correlationId = request.headers?.[corrHeader] || request.headers?.['x-request-id'];
49
+ if (correlationId && reply.header) {
50
+ reply.header('X-Correlation-Id', correlationId);
51
+ }
52
+ let inputData = {};
53
+ if (options.input) {
54
+ inputData = await options.input(request);
55
+ }
56
+ else if (request.body) {
57
+ inputData = request.body;
58
+ }
59
+ else if (request.query) {
60
+ inputData = request.query;
61
+ }
62
+ let namespace;
63
+ if (typeof options.namespace === 'function') {
64
+ namespace = options.namespace(request);
65
+ }
66
+ else if (options.namespace) {
67
+ namespace = options.namespace;
68
+ }
69
+ else if (options.allowHeaderNamespace && request.headers?.['x-namespace']) {
70
+ namespace = request.headers['x-namespace'];
71
+ }
72
+ const abortSignal = request.raw?.signal;
73
+ const execOptions = {
74
+ signal: abortSignal,
75
+ timeout: options.timeout,
76
+ namespace,
77
+ };
78
+ const rawResult = await workflow.run(inputData, execOptions);
79
+ const stackId = typeof rawResult?.$stackId === 'function'
80
+ ? rawResult.$stackId()
81
+ : (rawResult?.stackId || rawResult?.$stackId);
82
+ if (stackId && reply.header) {
83
+ reply.header('X-Workflow-Stack-Id', stackId);
84
+ }
85
+ const cleanResult = unwrapContext(rawResult);
86
+ if (options.output) {
87
+ return await options.output(cleanResult, reply);
88
+ }
89
+ return cleanResult;
90
+ }
91
+ catch (err) {
92
+ if (options.onError) {
93
+ return await options.onError(err, reply);
94
+ }
95
+ const status = getErrorStatusCode(err);
96
+ const exposeDetails = options.exposeErrorDetails ?? (process.env.NODE_ENV !== 'production');
97
+ let errorMessage = err.message || 'Workflow execution error';
98
+ if (status === 500 && !exposeDetails) {
99
+ errorMessage = 'Internal workflow execution error';
100
+ }
101
+ return reply.status(status).send({ error: errorMessage });
102
+ }
103
+ };
104
+ }
105
+ exports.rivuletFastifyHandler = sigloFastifyHandler;
106
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAaA,gDAoBC;AAoBD,kDAoEC;AA5GD,SAAgB,kBAAkB,CAAC,GAAQ;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,GAAG,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;IAC5B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,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AAE,CAAC;gBAC1B,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,WAAW,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;YAE7C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACjB,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YACpD,CAAC;YAED,OAAO,WAAW,CAAC;QACvB,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC7C,CAAC;YACD,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;YACvC,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC;YAC5F,IAAI,YAAY,GAAG,GAAG,CAAC,OAAO,IAAI,0BAA0B,CAAC;YAC7D,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnC,YAAY,GAAG,mCAAmC,CAAC;YACvD,CAAC;YACD,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QAC9D,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAIY,QAAA,qBAAqB,GAAG,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@siglo/fastify",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Fastify route handler adapter for executing Siglo workflows",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "registry": "https://registry.npmjs.org/"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc -p tsconfig.json",
27
+ "prepublishOnly": "npm run build",
28
+ "test": "npm run build && mocha -r tsx 'src/**/*.test.ts'"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/jsoftgem/siglo.git",
33
+ "directory": "packages/fastify"
34
+ },
35
+ "author": "Jerico de Guzman",
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/jsoftgem/siglo/issues"
39
+ },
40
+ "homepage": "https://github.com/jsoftgem/siglo#readme",
41
+ "dependencies": {
42
+ "@siglo/core": "^1.0.0"
43
+ },
44
+ "peerDependencies": {
45
+ "fastify": "^4.0.0 || ^5.0.0"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "fastify": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "devDependencies": {
53
+ "@types/chai": "^5.2.3",
54
+ "@types/mocha": "^10.0.10",
55
+ "@types/node": "^26.6.5",
56
+ "chai": "^3.5.0",
57
+ "mocha": "^12.0.3",
58
+ "tsx": "^4.23.15",
59
+ "typescript": "~5.7.0"
60
+ }
61
+ }