nestjs-temporal-core 2.0.1 → 2.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 +159 -27
- package/dist/client/temporal-client.module.js +39 -13
- package/dist/client/temporal-client.module.js.map +1 -1
- package/dist/client/temporal-client.service.d.ts +4 -7
- package/dist/client/temporal-client.service.js +12 -4
- package/dist/client/temporal-client.service.js.map +1 -1
- package/dist/constants.d.ts +42 -6
- package/dist/constants.js +43 -7
- package/dist/constants.js.map +1 -1
- package/dist/decorators/activity-method.decorator.d.ts +5 -1
- package/dist/decorators/activity-method.decorator.js +27 -6
- package/dist/decorators/activity-method.decorator.js.map +1 -1
- package/dist/decorators/activity.decorator.d.ts +2 -1
- package/dist/decorators/activity.decorator.js +6 -7
- package/dist/decorators/activity.decorator.js.map +1 -1
- package/dist/decorators/index.d.ts +0 -1
- package/dist/decorators/index.js +0 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/workflow.decorator.d.ts +16 -2
- package/dist/decorators/workflow.decorator.js +10 -2
- package/dist/decorators/workflow.decorator.js.map +1 -1
- package/dist/interfaces/base.interface.d.ts +4 -0
- package/dist/interfaces/client.interface.d.ts +27 -1
- package/dist/interfaces/worker.interface.d.ts +17 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/worker/temporal-metadata.accessor.d.ts +14 -3
- package/dist/worker/temporal-metadata.accessor.js +76 -0
- package/dist/worker/temporal-metadata.accessor.js.map +1 -1
- package/dist/worker/temporal-worker.module.d.ts +2 -1
- package/dist/worker/temporal-worker.module.js +35 -35
- package/dist/worker/temporal-worker.module.js.map +1 -1
- package/dist/worker/worker-manager.service.d.ts +17 -24
- package/dist/worker/worker-manager.service.js +124 -140
- package/dist/worker/worker-manager.service.js.map +1 -1
- package/package.json +1 -1
- package/dist/decorators/inject-temporal-client.decorator.d.ts +0 -1
- package/dist/decorators/inject-temporal-client.decorator.js +0 -8
- package/dist/decorators/inject-temporal-client.decorator.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
# NestJS Temporal Core
|
|
2
2
|
|
|
3
|
-
A NestJS integration for [Temporal.io](https://temporal.io/) that provides seamless worker and client support for building reliable distributed applications.
|
|
3
|
+
A robust NestJS integration for [Temporal.io](https://temporal.io/) that provides seamless worker and client support for building reliable distributed applications.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- 🚀 Easy integration with NestJS modules
|
|
8
8
|
- 🔄 Automatic worker initialization and shutdown
|
|
9
|
-
- 🎯 Declarative activity decorators
|
|
9
|
+
- 🎯 Declarative activity and workflow decorators
|
|
10
10
|
- 🔌 Built-in connection management
|
|
11
11
|
- 🛡️ Type-safe workflow execution
|
|
12
12
|
- 📡 Simplified client operations
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
- 🔒 TLS support for secure connections
|
|
14
|
+
- 🎛️ Configurable runtime options
|
|
15
|
+
- 🔄 Enhanced worker options customization
|
|
16
|
+
- 📊 Worker status monitoring
|
|
17
|
+
- 📅 Cron workflow scheduling
|
|
18
|
+
- 🔍 Query handling support
|
|
19
|
+
- 📣 Signal handling
|
|
20
|
+
- 🚦 Workflow retry policies
|
|
17
21
|
|
|
18
22
|
## Installation
|
|
19
23
|
|
|
@@ -25,15 +29,12 @@ npm install nestjs-temporal-core @temporalio/client @temporalio/worker @temporal
|
|
|
25
29
|
|
|
26
30
|
### 1. Enable Shutdown Hooks
|
|
27
31
|
|
|
28
|
-
First, make sure to enable shutdown hooks in your `main.ts` file
|
|
32
|
+
First, make sure to enable shutdown hooks in your `main.ts` file:
|
|
29
33
|
|
|
30
34
|
```typescript
|
|
31
35
|
async function bootstrap() {
|
|
32
36
|
const app = await NestFactory.create(AppModule);
|
|
33
|
-
|
|
34
|
-
// Enable shutdown hooks - IMPORTANT: Add this line to handle graceful shutdowns
|
|
35
37
|
app.enableShutdownHooks();
|
|
36
|
-
|
|
37
38
|
await app.listen(3000);
|
|
38
39
|
}
|
|
39
40
|
bootstrap();
|
|
@@ -55,6 +56,23 @@ import { TemporalWorkerModule, TemporalClientModule } from 'nestjs-temporal-core
|
|
|
55
56
|
taskQueue: 'my-task-queue',
|
|
56
57
|
workflowsPath: require.resolve('./workflows'),
|
|
57
58
|
activityClasses: [MyActivity],
|
|
59
|
+
// Optional runtime configuration
|
|
60
|
+
runtimeOptions: {
|
|
61
|
+
// Add your runtime options here
|
|
62
|
+
},
|
|
63
|
+
// Optional worker configuration
|
|
64
|
+
workerOptions: {
|
|
65
|
+
// Add your worker options here
|
|
66
|
+
},
|
|
67
|
+
// Auto-start configuration
|
|
68
|
+
autoStart: {
|
|
69
|
+
enabled: true,
|
|
70
|
+
delayMs: 1000, // Start worker after 1 second
|
|
71
|
+
},
|
|
72
|
+
// Optional monitoring configuration
|
|
73
|
+
monitoring: {
|
|
74
|
+
statsIntervalMs: 60000, // Log stats every minute
|
|
75
|
+
},
|
|
58
76
|
}),
|
|
59
77
|
TemporalClientModule.register({
|
|
60
78
|
connection: {
|
|
@@ -72,13 +90,27 @@ export class AppModule {}
|
|
|
72
90
|
```typescript
|
|
73
91
|
import { Activity, ActivityMethod } from 'nestjs-temporal-core';
|
|
74
92
|
|
|
75
|
-
@Activity(
|
|
93
|
+
@Activity({
|
|
94
|
+
name: 'PaymentActivities', // Optional custom name
|
|
95
|
+
description: 'Activities for payment processing',
|
|
96
|
+
})
|
|
76
97
|
export class PaymentActivity {
|
|
77
|
-
@ActivityMethod(
|
|
98
|
+
@ActivityMethod({
|
|
99
|
+
name: 'processPayment', // Optional custom name
|
|
100
|
+
timeout: {
|
|
101
|
+
startToClose: '30s',
|
|
102
|
+
},
|
|
103
|
+
})
|
|
78
104
|
async processPayment(amount: number): Promise<string> {
|
|
79
105
|
// Implementation
|
|
80
106
|
return 'payment-id';
|
|
81
107
|
}
|
|
108
|
+
|
|
109
|
+
@ActivityMethod()
|
|
110
|
+
async refundPayment(paymentId: string): Promise<boolean> {
|
|
111
|
+
// Implementation
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
82
114
|
}
|
|
83
115
|
```
|
|
84
116
|
|
|
@@ -88,13 +120,17 @@ export class PaymentActivity {
|
|
|
88
120
|
import { proxyActivities } from '@temporalio/workflow';
|
|
89
121
|
import type { PaymentActivity } from './payment.activity';
|
|
90
122
|
|
|
91
|
-
const { processPayment } = proxyActivities<PaymentActivity>({
|
|
123
|
+
const { processPayment, refundPayment } = proxyActivities<PaymentActivity>({
|
|
92
124
|
startToCloseTimeout: '30 seconds',
|
|
93
125
|
});
|
|
94
126
|
|
|
95
127
|
export async function paymentWorkflow(amount: number): Promise<string> {
|
|
96
128
|
return await processPayment(amount);
|
|
97
129
|
}
|
|
130
|
+
|
|
131
|
+
export async function refundWorkflow(paymentId: string): Promise<boolean> {
|
|
132
|
+
return await refundPayment(paymentId);
|
|
133
|
+
}
|
|
98
134
|
```
|
|
99
135
|
|
|
100
136
|
### 5. Use the Client Service
|
|
@@ -108,14 +144,33 @@ export class PaymentService {
|
|
|
108
144
|
constructor(private readonly temporalClient: TemporalClientService) {}
|
|
109
145
|
|
|
110
146
|
async initiatePayment(amount: number) {
|
|
111
|
-
const { result } = await this.temporalClient.startWorkflow<string, [number]>(
|
|
147
|
+
const { result, workflowId } = await this.temporalClient.startWorkflow<string, [number]>(
|
|
112
148
|
'paymentWorkflow',
|
|
113
149
|
[amount],
|
|
114
150
|
{
|
|
115
151
|
taskQueue: 'my-task-queue',
|
|
152
|
+
workflowExecutionTimeout: '1h',
|
|
153
|
+
workflowTaskTimeout: '10s',
|
|
154
|
+
retry: {
|
|
155
|
+
maximumAttempts: 3,
|
|
156
|
+
},
|
|
116
157
|
},
|
|
117
158
|
);
|
|
118
|
-
|
|
159
|
+
|
|
160
|
+
// Wait for the workflow to complete
|
|
161
|
+
const paymentId = await result;
|
|
162
|
+
|
|
163
|
+
return { paymentId, workflowId };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async checkPaymentStatus(workflowId: string) {
|
|
167
|
+
// Query a running workflow
|
|
168
|
+
return await this.temporalClient.queryWorkflow<string>(workflowId, 'getPaymentStatus');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async cancelPayment(workflowId: string, reason: string) {
|
|
172
|
+
// Signal a running workflow
|
|
173
|
+
await this.temporalClient.signalWorkflow(workflowId, 'cancelPayment', [reason]);
|
|
119
174
|
}
|
|
120
175
|
}
|
|
121
176
|
```
|
|
@@ -130,11 +185,17 @@ TemporalWorkerModule.registerAsync({
|
|
|
130
185
|
useFactory: async (configService: ConfigService) => ({
|
|
131
186
|
connection: {
|
|
132
187
|
address: configService.get('TEMPORAL_ADDRESS'),
|
|
188
|
+
connectionTimeout: configService.get('TEMPORAL_CONNECTION_TIMEOUT', 5000),
|
|
133
189
|
},
|
|
134
190
|
namespace: configService.get('TEMPORAL_NAMESPACE'),
|
|
135
191
|
taskQueue: configService.get('TEMPORAL_TASK_QUEUE'),
|
|
136
192
|
workflowsPath: require.resolve('./workflows'),
|
|
137
193
|
activityClasses: [MyActivity],
|
|
194
|
+
autoStart: {
|
|
195
|
+
enabled: configService.get('TEMPORAL_WORKER_AUTOSTART', true),
|
|
196
|
+
delayMs: configService.get('TEMPORAL_WORKER_START_DELAY', 0),
|
|
197
|
+
},
|
|
198
|
+
allowWorkerFailure: configService.get('TEMPORAL_ALLOW_WORKER_FAILURE', true),
|
|
138
199
|
}),
|
|
139
200
|
inject: [ConfigService],
|
|
140
201
|
});
|
|
@@ -150,10 +211,15 @@ TemporalClientModule.register({
|
|
|
150
211
|
clientCertPair: {
|
|
151
212
|
crt: Buffer.from('...'),
|
|
152
213
|
key: Buffer.from('...'),
|
|
214
|
+
ca: Buffer.from('...'), // Optional CA certificate
|
|
153
215
|
},
|
|
216
|
+
serverName: 'temporal.example.com', // Optional for SNI
|
|
217
|
+
verifyServer: true, // Optional, defaults to true
|
|
154
218
|
},
|
|
219
|
+
connectionTimeout: 10000, // 10 seconds
|
|
155
220
|
},
|
|
156
221
|
namespace: 'production',
|
|
222
|
+
allowConnectionFailure: true, // Allow application to start if Temporal connection fails
|
|
157
223
|
});
|
|
158
224
|
```
|
|
159
225
|
|
|
@@ -161,10 +227,9 @@ TemporalClientModule.register({
|
|
|
161
227
|
|
|
162
228
|
### Decorators
|
|
163
229
|
|
|
164
|
-
- `@Activity()`: Marks a class as a Temporal activity
|
|
165
|
-
- `@ActivityMethod()`: Marks a method as a Temporal activity implementation
|
|
166
|
-
- `@Workflow()`: Marks a class as a Temporal workflow
|
|
167
|
-
- `@InjectTemporalClient()`: Injects the Temporal client instance
|
|
230
|
+
- `@Activity(options?)`: Marks a class as a Temporal activity with optional configuration
|
|
231
|
+
- `@ActivityMethod(options?)`: Marks a method as a Temporal activity implementation with optional configuration
|
|
232
|
+
- `@Workflow(options)`: Marks a class as a Temporal workflow with configuration
|
|
168
233
|
|
|
169
234
|
### Services
|
|
170
235
|
|
|
@@ -172,8 +237,17 @@ TemporalClientModule.register({
|
|
|
172
237
|
|
|
173
238
|
- `startWorkflow<T, A>()`: Start a new workflow execution
|
|
174
239
|
- `signalWorkflow()`: Send a signal to a running workflow
|
|
240
|
+
- `queryWorkflow<T>()`: Query a running workflow
|
|
175
241
|
- `terminateWorkflow()`: Terminate a running workflow
|
|
242
|
+
- `cancelWorkflow()`: Request cancellation of a workflow
|
|
176
243
|
- `getWorkflowHandle()`: Get a handle to manage a workflow
|
|
244
|
+
- `getWorkflowClient()`: Get the underlying workflow client instance
|
|
245
|
+
|
|
246
|
+
#### WorkerManager
|
|
247
|
+
|
|
248
|
+
- `startWorker()`: Manually start the worker if it's not running
|
|
249
|
+
- `shutdown()`: Gracefully shutdown the worker
|
|
250
|
+
- `getWorker()`: Get the underlying worker instance
|
|
177
251
|
|
|
178
252
|
### Module Options
|
|
179
253
|
|
|
@@ -187,6 +261,22 @@ interface TemporalWorkerOptions {
|
|
|
187
261
|
workflowsPath: string;
|
|
188
262
|
activityClasses?: Array<new (...args: any[]) => any>;
|
|
189
263
|
runtimeOptions?: RuntimeOptions;
|
|
264
|
+
workerOptions?: WorkerOptions;
|
|
265
|
+
autoStart?: {
|
|
266
|
+
enabled?: boolean;
|
|
267
|
+
delayMs?: number;
|
|
268
|
+
};
|
|
269
|
+
allowWorkerFailure?: boolean;
|
|
270
|
+
monitoring?: {
|
|
271
|
+
statsIntervalMs?: number;
|
|
272
|
+
metrics?: {
|
|
273
|
+
enabled?: boolean;
|
|
274
|
+
prometheus?: {
|
|
275
|
+
enabled?: boolean;
|
|
276
|
+
port?: number;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
};
|
|
190
280
|
}
|
|
191
281
|
```
|
|
192
282
|
|
|
@@ -196,22 +286,59 @@ interface TemporalWorkerOptions {
|
|
|
196
286
|
interface TemporalClientOptions {
|
|
197
287
|
connection: ConnectionOptions;
|
|
198
288
|
namespace?: string;
|
|
289
|
+
allowConnectionFailure?: boolean;
|
|
290
|
+
reconnect?: {
|
|
291
|
+
enabled?: boolean;
|
|
292
|
+
maxAttempts?: number;
|
|
293
|
+
initialDelayMs?: number;
|
|
294
|
+
maxDelayMs?: number;
|
|
295
|
+
backoffCoefficient?: number;
|
|
296
|
+
};
|
|
199
297
|
}
|
|
200
298
|
```
|
|
201
299
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
The module provides built-in error handling and logging. Worker and client errors are logged using NestJS's built-in logger.
|
|
300
|
+
### Activity Method Options
|
|
205
301
|
|
|
206
|
-
|
|
302
|
+
```typescript
|
|
303
|
+
interface ActivityMethodOptions {
|
|
304
|
+
name?: string;
|
|
305
|
+
description?: string;
|
|
306
|
+
timeout?: {
|
|
307
|
+
startToClose?: string | number;
|
|
308
|
+
scheduleToStart?: string | number;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
```
|
|
207
312
|
|
|
208
|
-
|
|
313
|
+
### Workflow Options
|
|
209
314
|
|
|
210
315
|
```typescript
|
|
211
|
-
|
|
212
|
-
|
|
316
|
+
interface TemporalWorkflowDecoratorOptions {
|
|
317
|
+
name?: string;
|
|
318
|
+
description?: string;
|
|
319
|
+
taskQueue: string;
|
|
320
|
+
workflowIdPrefix?: string;
|
|
321
|
+
executionTimeout?: string;
|
|
322
|
+
workflowTaskTimeout?: string;
|
|
323
|
+
retry?: {
|
|
324
|
+
maximumAttempts?: number;
|
|
325
|
+
initialInterval?: number;
|
|
326
|
+
maximumInterval?: number;
|
|
327
|
+
backoffCoefficient?: number;
|
|
328
|
+
};
|
|
329
|
+
}
|
|
213
330
|
```
|
|
214
331
|
|
|
332
|
+
## Error Handling
|
|
333
|
+
|
|
334
|
+
The module includes comprehensive error handling:
|
|
335
|
+
|
|
336
|
+
- Worker initialization errors are logged and can prevent application startup if critical
|
|
337
|
+
- Client operations include detailed error messages and proper error propagation
|
|
338
|
+
- Activity and workflow errors are properly captured and logged
|
|
339
|
+
- Connection errors are handled gracefully with automatic cleanup
|
|
340
|
+
- Configurable failure modes for both client and worker connections
|
|
341
|
+
|
|
215
342
|
## Best Practices
|
|
216
343
|
|
|
217
344
|
1. Always define activity interfaces for type safety
|
|
@@ -219,6 +346,11 @@ const status = await workerManager.getStatus();
|
|
|
219
346
|
3. Implement proper error handling in activities
|
|
220
347
|
4. Set appropriate timeouts for activities and workflows
|
|
221
348
|
5. Use signals for long-running workflow coordination
|
|
349
|
+
6. Monitor worker status using the WorkerManager service
|
|
350
|
+
7. Configure appropriate runtime and worker options for production deployments
|
|
351
|
+
8. Implement proper TLS security for production environments
|
|
352
|
+
9. Use workflow queries for reading workflow state without side effects
|
|
353
|
+
10. Configure graceful shutdown for workers to prevent activity interruptions
|
|
222
354
|
|
|
223
355
|
## Contributing
|
|
224
356
|
|
|
@@ -230,4 +362,4 @@ MIT
|
|
|
230
362
|
|
|
231
363
|
## Author
|
|
232
364
|
|
|
233
|
-
Harsh M
|
|
365
|
+
Harsh M
|
|
@@ -16,21 +16,30 @@ let TemporalClientModule = TemporalClientModule_1 = class TemporalClientModule {
|
|
|
16
16
|
static async createClient(options) {
|
|
17
17
|
let connection = null;
|
|
18
18
|
try {
|
|
19
|
+
this.logger.log(`Connecting to Temporal server at ${options.connection.address}`);
|
|
19
20
|
connection = await client_1.Connection.connect({
|
|
20
21
|
address: options.connection.address,
|
|
21
22
|
tls: options.connection.tls,
|
|
23
|
+
...(options.connection.connectionTimeout && {
|
|
24
|
+
connectionTimeout: options.connection.connectionTimeout,
|
|
25
|
+
}),
|
|
22
26
|
});
|
|
27
|
+
const namespace = options.namespace || constants_1.DEFAULT_NAMESPACE;
|
|
28
|
+
this.logger.log(`Connected to Temporal server, using namespace "${namespace}"`);
|
|
23
29
|
return new client_1.Client({
|
|
24
30
|
connection,
|
|
25
|
-
namespace
|
|
31
|
+
namespace,
|
|
26
32
|
});
|
|
27
33
|
}
|
|
28
34
|
catch (error) {
|
|
29
35
|
if (connection) {
|
|
30
|
-
await connection.close().catch(() => {
|
|
36
|
+
await connection.close().catch((closeError) => {
|
|
37
|
+
this.logger.error('Failed to close Temporal connection during error handling', closeError);
|
|
31
38
|
});
|
|
32
39
|
}
|
|
33
|
-
|
|
40
|
+
const errorMsg = `${constants_1.ERRORS.CLIENT_INITIALIZATION}: ${error.message}`;
|
|
41
|
+
this.logger.error(errorMsg, error.stack);
|
|
42
|
+
throw new Error(errorMsg);
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
static register(options) {
|
|
@@ -42,8 +51,12 @@ let TemporalClientModule = TemporalClientModule_1 = class TemporalClientModule {
|
|
|
42
51
|
return this.addShutdownHook(client);
|
|
43
52
|
}
|
|
44
53
|
catch (error) {
|
|
45
|
-
this.logger.error('Failed to initialize Temporal client',
|
|
46
|
-
|
|
54
|
+
this.logger.error('Failed to initialize Temporal client', error);
|
|
55
|
+
if (options.allowConnectionFailure !== false) {
|
|
56
|
+
this.logger.warn('Continuing application startup without Temporal client');
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
47
60
|
}
|
|
48
61
|
},
|
|
49
62
|
};
|
|
@@ -69,8 +82,12 @@ let TemporalClientModule = TemporalClientModule_1 = class TemporalClientModule {
|
|
|
69
82
|
return this.addShutdownHook(client);
|
|
70
83
|
}
|
|
71
84
|
catch (error) {
|
|
72
|
-
this.logger.error('Failed to initialize Temporal client',
|
|
73
|
-
|
|
85
|
+
this.logger.error('Failed to initialize Temporal client', error);
|
|
86
|
+
if (clientOptions.allowConnectionFailure !== false) {
|
|
87
|
+
this.logger.warn('Continuing application startup without Temporal client');
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
74
91
|
}
|
|
75
92
|
},
|
|
76
93
|
inject: [constants_1.TEMPORAL_MODULE_OPTIONS],
|
|
@@ -78,7 +95,11 @@ let TemporalClientModule = TemporalClientModule_1 = class TemporalClientModule {
|
|
|
78
95
|
return {
|
|
79
96
|
module: TemporalClientModule_1,
|
|
80
97
|
imports: options.imports || [],
|
|
81
|
-
providers: [
|
|
98
|
+
providers: [
|
|
99
|
+
...this.createAsyncProviders(options),
|
|
100
|
+
clientProvider,
|
|
101
|
+
temporal_client_service_1.TemporalClientService,
|
|
102
|
+
],
|
|
82
103
|
exports: [temporal_client_service_1.TemporalClientService],
|
|
83
104
|
};
|
|
84
105
|
}
|
|
@@ -114,15 +135,20 @@ let TemporalClientModule = TemporalClientModule_1 = class TemporalClientModule {
|
|
|
114
135
|
},
|
|
115
136
|
];
|
|
116
137
|
}
|
|
117
|
-
throw new Error(
|
|
138
|
+
throw new Error(constants_1.ERRORS.INVALID_OPTIONS);
|
|
118
139
|
}
|
|
119
140
|
static addShutdownHook(client) {
|
|
120
141
|
const enhancedClient = client;
|
|
121
|
-
enhancedClient.onApplicationShutdown = async () => {
|
|
142
|
+
enhancedClient.onApplicationShutdown = async (signal) => {
|
|
143
|
+
this.logger.log(`Closing Temporal client connection (signal: ${signal || 'unknown'})`);
|
|
122
144
|
if (client?.connection) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
145
|
+
try {
|
|
146
|
+
await client.connection.close();
|
|
147
|
+
this.logger.log('Temporal connection closed successfully');
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.logger.error('Failed to close Temporal connection', error);
|
|
151
|
+
}
|
|
126
152
|
}
|
|
127
153
|
};
|
|
128
154
|
return enhancedClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporal-client.module.js","sourceRoot":"","sources":["../../src/client/temporal-client.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAOwB;AACxB,+CAAwD;AAMxD,
|
|
1
|
+
{"version":3,"file":"temporal-client.module.js","sourceRoot":"","sources":["../../src/client/temporal-client.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAOwB;AACxB,+CAAwD;AAMxD,4CAAmG;AACnG,uEAAkE;AAQ3D,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAQrB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAA8B;QAC5D,IAAI,UAAU,GAAsB,IAAI,CAAC;QACzC,IAAI,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YAElF,UAAU,GAAG,MAAM,mBAAU,CAAC,OAAO,CAAC;gBAClC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;gBACnC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG;gBAC3B,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,IAAI;oBACxC,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,iBAAiB;iBAC1D,CAAC;aACL,CAAC,CAAC;YAEH,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,6BAAiB,CAAC;YACzD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kDAAkD,SAAS,GAAG,CAAC,CAAC;YAEhF,OAAO,IAA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AC,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;gBACpE,CAAC;YACL,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,cAAc,CAAC;IAC1B,CAAC;;AA9LQ,oDAAoB;AACL,2BAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,AAAxC,CAAyC;+BAD9D,oBAAoB;IAFhC,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,oBAAoB,CA+LhC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OnModuleInit } from '@nestjs/common';
|
|
2
2
|
import { Client, WorkflowClient, WorkflowHandle } from '@temporalio/client';
|
|
3
|
+
import { StartWorkflowOptions } from 'src/interfaces';
|
|
3
4
|
export declare class TemporalClientService implements OnModuleInit {
|
|
4
5
|
private readonly client;
|
|
5
6
|
private readonly logger;
|
|
@@ -8,17 +9,13 @@ export declare class TemporalClientService implements OnModuleInit {
|
|
|
8
9
|
onModuleInit(): Promise<void>;
|
|
9
10
|
getWorkflowClient(): WorkflowClient | null;
|
|
10
11
|
private ensureClientInitialized;
|
|
11
|
-
startWorkflow<T, A extends any[]>(workflowType: string, args: A, options: {
|
|
12
|
-
taskQueue: string;
|
|
13
|
-
workflowId?: string;
|
|
14
|
-
signal?: string;
|
|
15
|
-
}): Promise<{
|
|
12
|
+
startWorkflow<T, A extends any[]>(workflowType: string, args: A, options: StartWorkflowOptions): Promise<{
|
|
16
13
|
result: Promise<T>;
|
|
17
14
|
workflowId: string;
|
|
18
15
|
firstExecutionRunId: string;
|
|
19
16
|
handle: WorkflowHandle;
|
|
20
17
|
}>;
|
|
21
|
-
signalWorkflow(workflowId: string, signalName: string, args
|
|
18
|
+
signalWorkflow(workflowId: string, signalName: string, args?: any[]): Promise<void>;
|
|
22
19
|
terminateWorkflow(workflowId: string, reason?: string): Promise<void>;
|
|
23
|
-
getWorkflowHandle(workflowId: string): Promise<WorkflowHandle>;
|
|
20
|
+
getWorkflowHandle(workflowId: string, runId?: string): Promise<WorkflowHandle>;
|
|
24
21
|
}
|
|
@@ -29,6 +29,9 @@ let TemporalClientService = TemporalClientService_1 = class TemporalClientServic
|
|
|
29
29
|
if (!this.client) {
|
|
30
30
|
this.logger.warn('Temporal client not initialized - some features may be unavailable');
|
|
31
31
|
}
|
|
32
|
+
else {
|
|
33
|
+
this.logger.log('Temporal client initialized successfully');
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
getWorkflowClient() {
|
|
34
37
|
return this.workflowClient;
|
|
@@ -40,12 +43,13 @@ let TemporalClientService = TemporalClientService_1 = class TemporalClientServic
|
|
|
40
43
|
}
|
|
41
44
|
async startWorkflow(workflowType, args, options) {
|
|
42
45
|
this.ensureClientInitialized();
|
|
43
|
-
const { taskQueue, workflowId = `${workflowType}-${Date.now()}-${Math.random().toString(36).slice(2)}`, } = options;
|
|
46
|
+
const { taskQueue, workflowId = `${workflowType}-${Date.now()}-${Math.random().toString(36).slice(2)}`, ...restOptions } = options;
|
|
44
47
|
try {
|
|
45
48
|
const handle = await this.workflowClient.start(workflowType, {
|
|
46
49
|
args,
|
|
47
50
|
taskQueue,
|
|
48
51
|
workflowId,
|
|
52
|
+
...restOptions,
|
|
49
53
|
});
|
|
50
54
|
return {
|
|
51
55
|
result: handle.result(),
|
|
@@ -55,16 +59,18 @@ let TemporalClientService = TemporalClientService_1 = class TemporalClientServic
|
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
61
|
catch (error) {
|
|
62
|
+
this.logger.error(`Failed to start workflow '${workflowType}': ${error.message}`);
|
|
58
63
|
throw new Error(`Failed to start workflow '${workflowType}': ${error.message}`);
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
|
-
async signalWorkflow(workflowId, signalName, args) {
|
|
66
|
+
async signalWorkflow(workflowId, signalName, args = []) {
|
|
62
67
|
this.ensureClientInitialized();
|
|
63
68
|
try {
|
|
64
69
|
const handle = await this.workflowClient.getHandle(workflowId);
|
|
65
70
|
await handle.signal(signalName, ...args);
|
|
66
71
|
}
|
|
67
72
|
catch (error) {
|
|
73
|
+
this.logger.error(`Failed to send signal '${signalName}' to workflow ${workflowId}: ${error.message}`);
|
|
68
74
|
throw new Error(`Failed to send signal '${signalName}' to workflow ${workflowId}: ${error.message}`);
|
|
69
75
|
}
|
|
70
76
|
}
|
|
@@ -75,15 +81,17 @@ let TemporalClientService = TemporalClientService_1 = class TemporalClientServic
|
|
|
75
81
|
await handle.terminate(reason);
|
|
76
82
|
}
|
|
77
83
|
catch (error) {
|
|
84
|
+
this.logger.error(`Failed to terminate workflow ${workflowId}: ${error.message}`);
|
|
78
85
|
throw new Error(`Failed to terminate workflow ${workflowId}: ${error.message}`);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
|
-
async getWorkflowHandle(workflowId) {
|
|
88
|
+
async getWorkflowHandle(workflowId, runId) {
|
|
82
89
|
this.ensureClientInitialized();
|
|
83
90
|
try {
|
|
84
|
-
return await this.workflowClient.getHandle(workflowId);
|
|
91
|
+
return await this.workflowClient.getHandle(workflowId, runId);
|
|
85
92
|
}
|
|
86
93
|
catch (error) {
|
|
94
|
+
this.logger.error(`Failed to get workflow handle for ${workflowId}: ${error.message}`);
|
|
87
95
|
throw new Error(`Failed to get workflow handle for ${workflowId}: ${error.message}`);
|
|
88
96
|
}
|
|
89
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporal-client.service.js","sourceRoot":"","sources":["../../src/client/temporal-client.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAE1E,4CAA+C;
|
|
1
|
+
{"version":3,"file":"temporal-client.service.js","sourceRoot":"","sources":["../../src/client/temporal-client.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAE1E,4CAA+C;AAIxC,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAI9B,YAEI,MAAsC;QAArB,WAAM,GAAN,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AK,CAAC,gCAAgC,UAAU,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAClF,MAAM,IAAI,KAAK,CAAC,gCAAgC,UAAU,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACpF,CAAC;IACL,CAAC;IAQD,KAAK,CAAC,iBAAiB,CAAC,UAAkB,EAAE,KAAc;QACtD,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/B,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,cAAe,CAAC,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,UAAU,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACvF,MAAM,IAAI,KAAK,CAAC,qCAAqC,UAAU,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACzF,CAAC;IACL,CAAC;CACJ,CAAA;AArIY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAMJ,WAAA,IAAA,eAAM,EAAC,2BAAe,CAAC,CAAA;;GALnB,qBAAqB,CAqIjC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const TEMPORAL_CLIENT
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
1
|
+
export declare const TEMPORAL_MODULE_OPTIONS = "TEMPORAL_MODULE_OPTIONS";
|
|
2
|
+
export declare const TEMPORAL_CLIENT_MODULE_OPTIONS = "TEMPORAL_CLIENT_MODULE_OPTIONS";
|
|
3
|
+
export declare const TEMPORAL_WORKER_MODULE_OPTIONS = "TEMPORAL_WORKER_MODULE_OPTIONS";
|
|
4
|
+
export declare const TEMPORAL_CLIENT = "TEMPORAL_CLIENT";
|
|
5
|
+
export declare const TEMPORAL_CONNECTION = "TEMPORAL_CONNECTION";
|
|
6
|
+
export declare const TEMPORAL_ACTIVITY = "TEMPORAL_ACTIVITY";
|
|
7
|
+
export declare const TEMPORAL_ACTIVITY_METHOD = "TEMPORAL_ACTIVITY_METHOD";
|
|
8
|
+
export declare const TEMPORAL_ACTIVITY_METHOD_NAME = "TEMPORAL_ACTIVITY_METHOD_NAME";
|
|
9
|
+
export declare const TEMPORAL_ACTIVITY_METHOD_OPTIONS = "TEMPORAL_ACTIVITY_METHOD_OPTIONS";
|
|
10
|
+
export declare const TEMPORAL_ACTIVITY_OPTIONS = "TEMPORAL_ACTIVITY_OPTIONS";
|
|
11
|
+
export declare const TEMPORAL_WORKFLOW = "TEMPORAL_WORKFLOW";
|
|
12
|
+
export declare const TEMPORAL_WORKFLOW_METHOD = "TEMPORAL_WORKFLOW_METHOD";
|
|
13
|
+
export declare const TEMPORAL_WORKFLOW_METHOD_NAME = "TEMPORAL_WORKFLOW_METHOD_NAME";
|
|
14
|
+
export declare const TEMPORAL_WORKFLOW_OPTIONS = "TEMPORAL_WORKFLOW_OPTIONS";
|
|
15
|
+
export declare const TEMPORAL_SIGNAL_METHOD = "TEMPORAL_SIGNAL_METHOD";
|
|
16
|
+
export declare const TEMPORAL_SIGNAL_NAME = "TEMPORAL_SIGNAL_NAME";
|
|
17
|
+
export declare const TEMPORAL_QUERY_METHOD = "TEMPORAL_QUERY_METHOD";
|
|
18
|
+
export declare const TEMPORAL_QUERY_NAME = "TEMPORAL_QUERY_NAME";
|
|
19
|
+
export declare const DEFAULT_NAMESPACE = "default";
|
|
20
|
+
export declare const DEFAULT_TASK_QUEUE = "default-task-queue";
|
|
21
|
+
export declare const DEFAULT_ACTIVITY_RETRY_ATTEMPTS = 3;
|
|
22
|
+
export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 5000;
|
|
23
|
+
export declare const DEFAULT_WORKFLOW_ID_REUSE_POLICY = "WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE";
|
|
24
|
+
export declare const DEFAULT_WORKFLOW_ID_CONFLICT_POLICY = "WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE";
|
|
25
|
+
export declare const DEFAULT_WORKER_SHUTDOWN_GRACE_PERIOD_MS = 5000;
|
|
26
|
+
export declare const DEFAULT_MAX_CONCURRENT_ACTIVITIES = 100;
|
|
27
|
+
export declare const DEFAULT_MAX_CONCURRENT_WORKFLOW_TASKS = 100;
|
|
28
|
+
export declare const DEFAULT_WORKER_MONITORING_INTERVAL_MS = 60000;
|
|
29
|
+
export declare const ERRORS: {
|
|
30
|
+
CLIENT_INITIALIZATION: string;
|
|
31
|
+
WORKER_INITIALIZATION: string;
|
|
32
|
+
CLIENT_NOT_INITIALIZED: string;
|
|
33
|
+
WORKER_NOT_INITIALIZED: string;
|
|
34
|
+
INVALID_OPTIONS: string;
|
|
35
|
+
MISSING_TASK_QUEUE: string;
|
|
36
|
+
MISSING_WORKFLOW_TYPE: string;
|
|
37
|
+
MISSING_ACTIVITY_TYPE: string;
|
|
38
|
+
ACTIVITY_NOT_FOUND: string;
|
|
39
|
+
WORKFLOW_NOT_FOUND: string;
|
|
40
|
+
INVALID_DECORATOR_USAGE: string;
|
|
41
|
+
SCHEDULE_CLIENT_NOT_INITIALIZED: string;
|
|
42
|
+
};
|