nodestack-client 2.2.0 → 2.3.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/dist/Client.d.ts +4 -0
- package/dist/Client.d.ts.map +1 -1
- package/dist/index.cjs +139 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +139 -0
- package/dist/index.mjs.map +3 -3
- package/dist/services/FlowService.d.ts +97 -0
- package/dist/services/FlowService.d.ts.map +1 -0
- package/dist/services/FunctionService.d.ts +51 -0
- package/dist/services/FunctionService.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { BaseService } from './BaseService';
|
|
2
|
+
import type { SendOptions } from '../types';
|
|
3
|
+
export interface FlowConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
triggerType: string;
|
|
9
|
+
eventTrigger?: string | null;
|
|
10
|
+
definition: any;
|
|
11
|
+
created: string;
|
|
12
|
+
updated: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FlowExecution {
|
|
15
|
+
id: string;
|
|
16
|
+
flowId: string;
|
|
17
|
+
flowName: string;
|
|
18
|
+
status: 'running' | 'succeeded' | 'failed' | 'timeout' | 'cancelled' | 'aborted';
|
|
19
|
+
input: any;
|
|
20
|
+
output?: any;
|
|
21
|
+
error?: string;
|
|
22
|
+
durationMs: number;
|
|
23
|
+
stepLogs: Array<{
|
|
24
|
+
step: string;
|
|
25
|
+
type: string;
|
|
26
|
+
input: any;
|
|
27
|
+
output?: any;
|
|
28
|
+
status: string;
|
|
29
|
+
durationMs: number;
|
|
30
|
+
error?: string;
|
|
31
|
+
timestamp: string;
|
|
32
|
+
}>;
|
|
33
|
+
actorId?: string | null;
|
|
34
|
+
startedAt: string;
|
|
35
|
+
finishedAt?: string;
|
|
36
|
+
checkpoint?: {
|
|
37
|
+
currentStateName?: string | null;
|
|
38
|
+
currentPayload?: any;
|
|
39
|
+
stepCount?: number;
|
|
40
|
+
loopCounters?: Record<string, number>;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
} | null;
|
|
43
|
+
}
|
|
44
|
+
export interface FlowAsyncDispatchResponse {
|
|
45
|
+
executionId: string;
|
|
46
|
+
flowId: string;
|
|
47
|
+
flowName: string;
|
|
48
|
+
status: 'running';
|
|
49
|
+
pollUrl: string;
|
|
50
|
+
}
|
|
51
|
+
export declare class FlowService extends BaseService {
|
|
52
|
+
/**
|
|
53
|
+
* Triggers or executes a Flow state machine by ID or name.
|
|
54
|
+
* If wait is true (default), returns the finished FlowExecution object.
|
|
55
|
+
*/
|
|
56
|
+
execute<TResponse = any, TInput = any>(flowIdOrName: string, input?: TInput, options?: {
|
|
57
|
+
wait?: boolean;
|
|
58
|
+
} & Omit<SendOptions, 'body'>): Promise<TResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Fetch all flows configured in the active application scope (requires admin auth).
|
|
61
|
+
*/
|
|
62
|
+
getList(options?: {
|
|
63
|
+
search?: string;
|
|
64
|
+
enabled?: boolean;
|
|
65
|
+
}): Promise<FlowConfig[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Fetch a single flow by ID or name (requires admin auth).
|
|
68
|
+
*/
|
|
69
|
+
getOne(idOrName: string): Promise<FlowConfig>;
|
|
70
|
+
/**
|
|
71
|
+
* Fetch executions history for a specific flow or across all flows (requires admin auth).
|
|
72
|
+
*/
|
|
73
|
+
getExecutions(options?: {
|
|
74
|
+
flowId?: string;
|
|
75
|
+
status?: string;
|
|
76
|
+
page?: number;
|
|
77
|
+
perPage?: number;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
items: FlowExecution[];
|
|
80
|
+
totalItems: number;
|
|
81
|
+
page: number;
|
|
82
|
+
perPage: number;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Fetch a single execution record by ID (requires admin auth).
|
|
86
|
+
*/
|
|
87
|
+
getExecution(executionId: string): Promise<FlowExecution>;
|
|
88
|
+
/**
|
|
89
|
+
* Resumes an orphaned or interrupted running flow from its last completed checkpoint.
|
|
90
|
+
*/
|
|
91
|
+
resumeExecution(executionId: string): Promise<FlowExecution>;
|
|
92
|
+
/**
|
|
93
|
+
* Aborts an orphaned running flow gracefully with status: 'aborted'.
|
|
94
|
+
*/
|
|
95
|
+
abortExecution(executionId: string, reason?: string): Promise<FlowExecution>;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=FlowService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowService.d.ts","sourceRoot":"","sources":["../../src/services/FlowService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,GAAG,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IACjF,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,C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E,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAM5F;IAED;;OAEG;IACU,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAKzD;IAED;;OAEG;IACU,aAAa,CAAC,OAAO,CAAC,EAAE;QACnC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAUzF;IAED;;OAEG;IACU,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAMrE;IAED;;OAEG;IACU,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAMxE;IAED;;OAEG;IACU,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CASxF;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseService } from './BaseService';
|
|
2
|
+
import type { SendOptions } from '../types';
|
|
3
|
+
export interface FunctionConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
authPolicy: string;
|
|
9
|
+
methods: string[];
|
|
10
|
+
eventTrigger?: string | null;
|
|
11
|
+
timeoutMs: number;
|
|
12
|
+
memoryLimitMb: number;
|
|
13
|
+
allowedDomains: string[];
|
|
14
|
+
elevated: boolean;
|
|
15
|
+
env: Record<string, string>;
|
|
16
|
+
created: string;
|
|
17
|
+
updated: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FunctionExecutionResult<T = any> {
|
|
20
|
+
status: 'success' | 'error' | 'timeout';
|
|
21
|
+
statusCode: number;
|
|
22
|
+
body?: T;
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
memoryUsedMb?: number;
|
|
26
|
+
logs: string[];
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class FunctionService extends BaseService {
|
|
30
|
+
/**
|
|
31
|
+
* Invokes a serverless function by name or ID.
|
|
32
|
+
* Scoped to the client's configured application if specified.
|
|
33
|
+
*/
|
|
34
|
+
invoke<TResponse = any, TBody = any>(name: string, body?: TBody, options?: Omit<SendOptions, 'body'>): Promise<TResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch all functions configured in the active application scope (requires admin auth).
|
|
37
|
+
*/
|
|
38
|
+
getList(options?: {
|
|
39
|
+
search?: string;
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
}): Promise<FunctionConfig[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Fetch a single function by ID or name (requires admin auth).
|
|
44
|
+
*/
|
|
45
|
+
getOne(idOrName: string): Promise<FunctionConfig>;
|
|
46
|
+
/**
|
|
47
|
+
* Test execute a function in sandboxed runner (requires admin auth).
|
|
48
|
+
*/
|
|
49
|
+
test(id: string, testPayload?: any): Promise<FunctionExecutionResult>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=FunctionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FunctionService.d.ts","sourceRoot":"","sources":["../../src/services/FunctionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IA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