@aikirun/client 0.8.0 → 0.9.0
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 +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ console.log("Current status:", state.status);
|
|
|
62
62
|
- **Workflow Management** - Start workflows with type-safe inputs
|
|
63
63
|
- **State Polling** - Wait for workflow completion with configurable polling
|
|
64
64
|
- **Logger** - Built-in logging for debugging
|
|
65
|
-
- **Context
|
|
65
|
+
- **Create Context** - Pass application context through workflow execution
|
|
66
66
|
- **Redis Integration** - Connect to Redis for distributed state management
|
|
67
67
|
|
|
68
68
|
## Configuration
|
|
@@ -81,18 +81,18 @@ interface ClientParams<AppContext> {
|
|
|
81
81
|
retryDelayOnFailoverMs?: number;
|
|
82
82
|
connectTimeoutMs?: number;
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
createContext?: (run: WorkflowRun) => AppContext | Promise<AppContext>;
|
|
85
85
|
logger?: Logger;
|
|
86
86
|
}
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
### Context
|
|
89
|
+
### Create Context Example
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
const aikiClient = await client({
|
|
93
93
|
url: "http://localhost:9876",
|
|
94
94
|
redis: { host: "localhost", port: 6379 },
|
|
95
|
-
|
|
95
|
+
createContext: (run) => ({
|
|
96
96
|
traceId: generateTraceId(),
|
|
97
97
|
workflowRunId: run.id,
|
|
98
98
|
userId: extractUserIdFromRun(run),
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { AdaptivePollingSubscriberStrategy, ApiClient, Client, ClientParams, Log
|
|
|
14
14
|
* @param params.redis.host - Redis server hostname
|
|
15
15
|
* @param params.redis.port - Redis server port
|
|
16
16
|
* @param params.redis.password - Optional Redis password
|
|
17
|
-
* @param params.
|
|
17
|
+
* @param params.createContext - Optional function to create context for each workflow run
|
|
18
18
|
* @param params.logger - Optional custom logger (defaults to ConsoleLogger)
|
|
19
19
|
* @returns Promise resolving to a configured Client instance
|
|
20
20
|
*
|
|
@@ -23,7 +23,7 @@ export { AdaptivePollingSubscriberStrategy, ApiClient, Client, ClientParams, Log
|
|
|
23
23
|
* const aikiClient = await client({
|
|
24
24
|
* url: "http://localhost:9876",
|
|
25
25
|
* redis: { host: "localhost", port: 6379 },
|
|
26
|
-
*
|
|
26
|
+
* createContext: (run) => ({
|
|
27
27
|
* traceId: generateTraceId(),
|
|
28
28
|
* userId: extractUserId(run),
|
|
29
29
|
* }),
|
package/dist/index.js
CHANGED
|
@@ -501,7 +501,7 @@ function resolveSubscriberStrategy(client2, strategy, workflows, workerShards) {
|
|
|
501
501
|
// return createPollingStrategy(client, strategy);
|
|
502
502
|
// case "adaptive_polling":
|
|
503
503
|
// return createAdaptivePollingStrategy(client, strategy);
|
|
504
|
-
case "
|
|
504
|
+
case "redis":
|
|
505
505
|
return createRedisStreamsStrategy(client2, strategy, workflows, workerShards);
|
|
506
506
|
default:
|
|
507
507
|
return strategy.type;
|
|
@@ -529,7 +529,7 @@ var ClientImpl = class {
|
|
|
529
529
|
getConnection: () => this.getRedisConnection(),
|
|
530
530
|
closeConnection: () => this.closeRedisConnection()
|
|
531
531
|
},
|
|
532
|
-
|
|
532
|
+
createContext: this.params.createContext
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
535
|
api;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aikirun/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Client SDK for Aiki - connect to the server, start workflows, and manage execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "tsup"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@aikirun/types": "0.
|
|
21
|
+
"@aikirun/types": "0.9.0",
|
|
22
22
|
"@orpc/client": "^1.9.3",
|
|
23
23
|
"ioredis": "^5.4.1",
|
|
24
24
|
"zod": "^4.1.12"
|