@transai/connector-runner-file 0.4.0 → 0.4.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.
- package/CHANGELOG.md +12 -0
- package/index.cjs +37 -37
- package/index.cjs.map +4 -4
- package/index.js +37 -37
- package/index.js.map +4 -4
- package/libs/connector-runner-file/src/lib/actions/action-delete-file.d.ts +12 -0
- package/libs/connector-runner-file/src/lib/actions/action-download-file.d.ts +15 -0
- package/libs/connector-runner-file/src/lib/actions/action-read-file.d.ts +17 -0
- package/libs/connector-runner-file/src/lib/actions/action-upload-file.d.ts +14 -0
- package/libs/connector-runner-file/src/lib/actions/action-write-file.d.ts +14 -0
- package/libs/connector-runner-file/src/lib/{actions-handler.d.ts → actions/actions-handler.d.ts} +3 -2
- package/libs/connector-runner-file/src/lib/types.d.ts +3 -0
- package/libs/connector-runtime-sdk/src/index.d.ts +1 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.d.ts +1 -1
- package/libs/connector-runtime-sdk/src/lib/support/index.d.ts +1 -0
- package/libs/connector-runtime-sdk/src/lib/support/null-logger.d.ts +8 -0
- package/libs/types/src/lib/management-api/workflow/workflow-run.d.ts +1 -5
- package/libs/types/src/lib/management-api/workflow/workflow.drawing.d.ts +1 -9
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FilesSDKInterface, LoggerSDKInterface } from '@transai/connector-runtime-sdk';
|
|
2
|
+
import { FileAction } from '../types';
|
|
3
|
+
type ActionParams = {
|
|
4
|
+
remotePath: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class ActionDeleteFile implements FileAction<ActionParams, void> {
|
|
7
|
+
#private;
|
|
8
|
+
static readonly TYPE = "file.delete";
|
|
9
|
+
constructor(fileHandler: FilesSDKInterface, logger?: LoggerSDKInterface);
|
|
10
|
+
execute(params: ActionParams): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FilesSDKInterface, LoggerSDKInterface } from '@transai/connector-runtime-sdk';
|
|
2
|
+
import { FileAction } from '../types';
|
|
3
|
+
type ActionParams = {
|
|
4
|
+
remotePath: string;
|
|
5
|
+
};
|
|
6
|
+
type ActionResult = {
|
|
7
|
+
pathDsn: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class ActionDownloadFile implements FileAction<ActionParams, ActionResult> {
|
|
10
|
+
#private;
|
|
11
|
+
static readonly TYPE = "file.download";
|
|
12
|
+
constructor(fileHandler: FilesSDKInterface, localFileSDKInterface: FilesSDKInterface, logger?: LoggerSDKInterface);
|
|
13
|
+
execute(params: ActionParams): Promise<ActionResult>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilesSDKInterface, LoggerSDKInterface } from '@transai/connector-runtime-sdk';
|
|
2
|
+
import { FileAction } from '../types';
|
|
3
|
+
type ActionParams = {
|
|
4
|
+
localPath?: string;
|
|
5
|
+
remotePath?: string;
|
|
6
|
+
raw?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type ActionResult = {
|
|
9
|
+
contents: unknown;
|
|
10
|
+
};
|
|
11
|
+
export declare class ActionReadFile implements FileAction<ActionParams, ActionResult> {
|
|
12
|
+
#private;
|
|
13
|
+
static readonly TYPE = "file.read";
|
|
14
|
+
constructor(fileHandler: FilesSDKInterface, localFileSDKInterface: FilesSDKInterface, logger?: LoggerSDKInterface);
|
|
15
|
+
execute(params: ActionParams): Promise<ActionResult>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FilesSDKInterface, LoggerSDKInterface } from '@transai/connector-runtime-sdk';
|
|
2
|
+
import { FileAction } from '../types';
|
|
3
|
+
type ActionParams = {
|
|
4
|
+
localPath: string;
|
|
5
|
+
remotePath: string;
|
|
6
|
+
overwrite?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class ActionUploadFile implements FileAction<ActionParams, void> {
|
|
9
|
+
#private;
|
|
10
|
+
static readonly TYPE = "file.upload";
|
|
11
|
+
constructor(fileHandler: FilesSDKInterface, localFileSDKInterface: FilesSDKInterface, logger?: LoggerSDKInterface);
|
|
12
|
+
execute(params: ActionParams): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FilesSDKInterface, LoggerSDKInterface } from '@transai/connector-runtime-sdk';
|
|
2
|
+
import { FileAction } from '../types';
|
|
3
|
+
type ActionParams = {
|
|
4
|
+
remotePath: string;
|
|
5
|
+
contents: string;
|
|
6
|
+
overwrite?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class ActionWriteFile implements FileAction<ActionParams, void> {
|
|
9
|
+
#private;
|
|
10
|
+
static readonly TYPE = "file.write";
|
|
11
|
+
constructor(fileHandler: FilesSDKInterface, logger?: LoggerSDKInterface);
|
|
12
|
+
execute(params: ActionParams): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/libs/connector-runner-file/src/lib/{actions-handler.d.ts → actions/actions-handler.d.ts}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
1
2
|
import { ConnectorSDKInterface, FilesSDKInterface } from '@transai/connector-runtime-sdk';
|
|
2
3
|
import { ActionInterface, KafkaCallbackResponse, XodJobType } from '@xip-online-data/types';
|
|
3
|
-
export declare class ActionsHandler {
|
|
4
|
+
export declare class ActionsHandler extends EventEmitter {
|
|
4
5
|
#private;
|
|
5
|
-
constructor(
|
|
6
|
+
constructor(sdk: ConnectorSDKInterface, fileHandler: FilesSDKInterface, localFileSDK?: FilesSDKInterface);
|
|
6
7
|
get callbackFunctionChain(): (message: XodJobType, action: ActionInterface) => Promise<KafkaCallbackResponse>;
|
|
7
8
|
}
|
|
@@ -38,3 +38,6 @@ export interface FileConfig extends BaseConnectorConfig {
|
|
|
38
38
|
dsn: string;
|
|
39
39
|
fileSelectors?: Array<FileSelectorConfig>;
|
|
40
40
|
}
|
|
41
|
+
export interface FileAction<T = Record<string, string | number | unknown>, R = Record<string, string | number | unknown> | void> {
|
|
42
|
+
execute(params: T): Promise<R>;
|
|
43
|
+
}
|
|
@@ -9,6 +9,6 @@ export interface ReceiverSDKInterface {
|
|
|
9
9
|
readonly internalServerError: KafkaCallbackResponseType;
|
|
10
10
|
};
|
|
11
11
|
registerCallback<T extends XodJobType = XodJobType>(callbackFunction: (message: T) => Promise<KafkaCallbackResponse>, eventType?: string, identifier?: string): void;
|
|
12
|
-
getActionConfig(message: XodJobType): ActionInterface | null
|
|
12
|
+
getActionConfig(message: XodJobType): Promise<ActionInterface | null>;
|
|
13
13
|
emitEventType<T extends XodJobType = XodJobType>(callbackFunction: (message: T) => Promise<KafkaCallbackResponse>): (message: T) => Promise<KafkaCallbackResponse>;
|
|
14
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './null-logger';
|
|
@@ -25,7 +25,7 @@ export interface WorkflowRunInterface {
|
|
|
25
25
|
workflow: WorkflowDefinition;
|
|
26
26
|
drawing?: WorkflowDrawing;
|
|
27
27
|
trigger: EventInterface;
|
|
28
|
-
jobs: Array<ActionJob | ConditionalJob | ValidationJob
|
|
28
|
+
jobs: Array<ActionJob | ConditionalJob | ValidationJob>;
|
|
29
29
|
createdAt: Date;
|
|
30
30
|
updatedAt: Date;
|
|
31
31
|
testRun?: boolean;
|
|
@@ -53,10 +53,6 @@ export interface ActionJob extends WorkflowJobInterface {
|
|
|
53
53
|
type: NodeTypes.ACTION;
|
|
54
54
|
with: MessageMapper;
|
|
55
55
|
}
|
|
56
|
-
export interface AgentJob extends WorkflowJobInterface {
|
|
57
|
-
type: NodeTypes.AGENT;
|
|
58
|
-
with: MessageMapper;
|
|
59
|
-
}
|
|
60
56
|
export interface ConditionalJob extends WorkflowJobInterface {
|
|
61
57
|
type: NodeTypes.CONDITIONAL;
|
|
62
58
|
with: ConditionMapper;
|
|
@@ -3,7 +3,6 @@ import { ConditionMapper, MessageMapper } from './workflow-definition.interface'
|
|
|
3
3
|
export declare enum NodeTypes {
|
|
4
4
|
TRIGGER = "TRIGGER",
|
|
5
5
|
ACTION = "ACTION",
|
|
6
|
-
AGENT = "AGENT",
|
|
7
6
|
CONDITIONAL = "CONDITIONAL",
|
|
8
7
|
VALIDATION = "VALIDATION",
|
|
9
8
|
ANNOTATION = "ANNOTATION",
|
|
@@ -36,13 +35,6 @@ export interface ActionNode extends Node {
|
|
|
36
35
|
};
|
|
37
36
|
with: MessageMapper;
|
|
38
37
|
}
|
|
39
|
-
export interface AgentNode extends Node {
|
|
40
|
-
type: NodeTypes.AGENT;
|
|
41
|
-
agent: {
|
|
42
|
-
identifier: string;
|
|
43
|
-
};
|
|
44
|
-
with: MessageMapper;
|
|
45
|
-
}
|
|
46
38
|
export interface TriggerNode extends Node {
|
|
47
39
|
type: NodeTypes.TRIGGER;
|
|
48
40
|
trigger: {
|
|
@@ -72,7 +64,7 @@ export interface PlaceholderNode extends Node {
|
|
|
72
64
|
export interface InvisibleNode extends Node {
|
|
73
65
|
type: NodeTypes.INVISIBLE;
|
|
74
66
|
}
|
|
75
|
-
export type WorkflowNode = ActionNode |
|
|
67
|
+
export type WorkflowNode = ActionNode | ConditionalNode | AnnotationNode | PlaceholderNode | ValidationNode | EndNode | InvisibleNode;
|
|
76
68
|
export interface Edge {
|
|
77
69
|
id: string;
|
|
78
70
|
source: {
|