@transai/connector-runner-dummy-node 0.8.1 → 0.8.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 +6 -0
- package/index.cjs +1 -1
- package/index.cjs.map +2 -2
- package/index.js +1 -1
- package/index.js.map +2 -2
- package/libs/connector-runtime-sdk/src/index.d.ts +1 -0
- package/libs/connector-runtime-sdk/src/lib/connector-runtime.d.ts +1 -1
- package/libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.d.ts +1 -1
- package/libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.d.ts +1 -1
- package/libs/connector-runtime-sdk/src/lib/types/action.d.ts +49 -0
- package/libs/connector-runtime-sdk/src/lib/types/kafka.d.ts +40 -0
- package/libs/connector-runtime-sdk/src/lib/types.d.ts +26 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var C=(o,r)=>{for(var e in r)c(o,e,{get:r[e],enumerable:!0})},m=(o,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of d(r))!b.call(o,n)&&n!==e&&c(o,n,{get:()=>r[n],enumerable:!(t=g(r,n))||t.enumerable});return o};var y=(o,r,e)=>(e=o!=null?l(I(o)):{},m(r||!o||!o.__esModule?c(e,"default",{value:o,enumerable:!0}):e,o)),x=o=>m(c({},"__esModule",{value:!0}),o);var P={};C(P,{ConnectorRunnerDummyNode:()=>f});module.exports=x(P);var i=y(require("node:process")),s=class{constructor(r,e){this.#r="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=e,i.default.on?i.default.on("message",t=>{t.cmd===this.#r&&e.logger.verbose(`${i.default.pid} Received message from parent process:`,t)}):e.logger.warn("IPC channel is not available. process.on is undefined."),i.default.send||e.logger.warn("IPC channel is not available. process.send is undefined."),r.actions?.forEach(t=>{if(t.config.templates===void 0)return;let n={};Object.entries(t.config.templates).forEach(([a,p])=>{try{n[a]=e.templating.compile(p)}catch(u){e.logger.error(`Error compiling template ${a} for action ${t.identifier}`,u)}}),t.config.parsedTemplates=n})}#r;#e;set callbackFunction(r){this.connectorSDK.receiver.registerCallback(this.#t(r))}get connectorSDK(){return this.#e}#t(r){return async e=>{let t=await this.#e.receiver.getActionConfig(e);return t?r(e,t):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var f=class extends s{constructor(){super(...arguments);this.CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";this.init=async()=>{let{config:e}=this.connectorSDK,t=e.failProbability||0;t>0&&this.connectorSDK.logger.debug("Fail probability set to",t);let n=()=>Math.random()<t;this.callbackFunction=async(a,p)=>(this.connectorSDK.logger.info("Received message: ",a.testRun?"(test run)":"",a.eventId,a.payload),n()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(a)):this.connectorSDK.receiver.responses.ok()(a))}}};0&&(module.exports={ConnectorRunnerDummyNode});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../libs/connector-runner-dummy-node/src/index.ts", "../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts", "../../../libs/connector-runner-dummy-node/src/lib/connector-runner-dummy-node.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './lib/connector-runner-dummy-node';\n", "import process from 'node:process';\n\nimport {
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAoB,
|
|
4
|
+
"sourcesContent": ["export * from './lib/connector-runner-dummy-node';\n", "import process from 'node:process';\n\nimport { ConnectorRuntimeInterface } from './connector-runtime.interface';\nimport { CompileDelegate, ConnectorSDKInterface } from './sdk';\nimport {\n ActionInterface,\n BaseConnectorConfig,\n ConnectorInterface,\n KafkaCallbackResponse,\n XodJobType,\n} from './types';\n\nexport interface IpcMessage {\n cmd: string;\n message: string;\n}\n\nexport abstract class ConnectorRuntimeSDK<\n T extends BaseConnectorConfig = BaseConnectorConfig,\n> implements ConnectorRuntimeInterface {\n readonly #IPC_CHANNEL = 'connector-runtime';\n\n readonly #connectorSDK: ConnectorSDKInterface<T>;\n\n constructor(\n connector: ConnectorInterface,\n connectorSDK: ConnectorSDKInterface,\n ) {\n this.#connectorSDK = connectorSDK as ConnectorSDKInterface<T>;\n\n if (process.on) {\n process.on('message', (message: IpcMessage) => {\n if (message.cmd === this.#IPC_CHANNEL) {\n connectorSDK.logger.verbose(\n `${process.pid} Received message from parent process:`,\n message,\n );\n }\n });\n } else {\n connectorSDK.logger.warn(\n 'IPC channel is not available. process.on is undefined.',\n );\n }\n\n if (!process.send) {\n // Check if process.send is available\n connectorSDK.logger.warn(\n 'IPC channel is not available. process.send is undefined.',\n );\n }\n\n // eslint-disable-next-line no-restricted-syntax\n connector.actions?.forEach((action: ActionInterface) => {\n if (action.config['templates'] === undefined) {\n return;\n }\n\n const containers: {\n [key: string]: CompileDelegate;\n } = {};\n\n Object.entries(action.config['templates']).forEach(([key, value]) => {\n try {\n // eslint-disable-next-line security/detect-object-injection\n containers[key] = connectorSDK.templating.compile(value);\n } catch (error: unknown) {\n connectorSDK.logger.error(\n `Error compiling template ${key} for action ${action.identifier}`,\n error,\n );\n }\n });\n\n // eslint-disable-next-line no-param-reassign\n action.config['parsedTemplates'] = containers;\n });\n }\n\n public init: () => Promise<void> = () => Promise.resolve();\n\n public start: () => Promise<void> = () => Promise.resolve();\n\n public stop: () => Promise<void> = () => Promise.resolve();\n\n set callbackFunction(\n callback: (\n message: XodJobType,\n action: ActionInterface,\n ) => Promise<KafkaCallbackResponse>,\n ) {\n this.connectorSDK.receiver.registerCallback(\n this.#enrichWithActionConfig(callback),\n );\n }\n\n protected get connectorSDK(): ConnectorSDKInterface<T> {\n return this.#connectorSDK;\n }\n\n #enrichWithActionConfig(\n callbackFunction: (\n message: XodJobType,\n action: ActionInterface,\n ) => Promise<KafkaCallbackResponse>,\n ): (message: XodJobType) => Promise<KafkaCallbackResponse> {\n return async (message: XodJobType) => {\n const action = await this.#connectorSDK.receiver.getActionConfig(message);\n if (!action) {\n return this.#connectorSDK.receiver.responses.badRequest(\n 'Action not found',\n )(message);\n }\n return callbackFunction(message, action);\n };\n }\n}\n", "import { ConnectorRuntimeSDK } from '@transai/connector-runtime-sdk';\nimport {\n ActionInterface,\n BaseConnectorConfig,\n KafkaCallbackResponse,\n XodJobType,\n} from '@xip-online-data/types';\n\nexport class ConnectorRunnerDummyNode extends ConnectorRuntimeSDK<\n {\n failProbability?: number;\n } & BaseConnectorConfig\n> {\n readonly CONNECTOR_INSTANCE: string = 'XOD_CONNECTOR_DUMMY_NODE_CONFIG';\n\n override init = async (): Promise<void> => {\n const { config } = this.connectorSDK;\n\n const failProbability = config.failProbability || 0.0;\n if (failProbability > 0) {\n this.connectorSDK.logger.debug(\n 'Fail probability set to',\n failProbability,\n );\n }\n\n const dummyProcessFailed = (): boolean => {\n return Math.random() < failProbability;\n };\n\n this.callbackFunction = async (\n message: XodJobType,\n action: ActionInterface,\n ): Promise<KafkaCallbackResponse> => {\n this.connectorSDK.logger.info(\n 'Received message: ',\n message.testRun ? '(test run)' : '',\n message.eventId,\n message.payload,\n );\n\n if (dummyProcessFailed()) {\n this.connectorSDK.logger.error('Dummy process failed');\n return this.connectorSDK.receiver.responses.internalServerError(\n 'Dummy process failed',\n )(message);\n }\n\n return this.connectorSDK.receiver.responses.ok()(message);\n };\n };\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,E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CAAM,EAJ9B,KAAKH,GAAc,SAAS,UAAU,WAC3C,kBACF,EAAEE,CAAO,CAGb,CACF,CACF,EC5GO,IAAMS,EAAN,cAAuCC,CAI5C,CAJK,kCAKL,KAAS,mBAA6B,kCAEtC,KAAS,KAAO,SAA2B,CACzC,GAAM,CAAE,OAAAC,CAAO,EAAI,KAAK,aAElBC,EAAkBD,EAAO,iBAAmB,EAC9CC,EAAkB,GACpB,KAAK,aAAa,OAAO,MACvB,0BACAA,CACF,EAGF,IAAMC,EAAqB,IAClB,KAAK,OAAO,EAAID,EAGzB,KAAK,iBAAmB,MACtBE,EACAC,KAEA,KAAK,aAAa,OAAO,KACvB,qBACAD,EAAQ,QAAU,aAAe,GACjCA,EAAQ,QACRA,EAAQ,OACV,EAEID,EAAmB,GACrB,KAAK,aAAa,OAAO,MAAM,sBAAsB,EAC9C,KAAK,aAAa,SAAS,UAAU,oBAC1C,sBACF,EAAEC,CAAO,GAGJ,KAAK,aAAa,SAAS,UAAU,GAAG,EAAEA,CAAO,EAE5D,EACF",
|
|
6
6
|
"names": ["index_exports", "__export", "ConnectorRunnerDummyNode", "__toCommonJS", "import_node_process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "process", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "ConnectorRunnerDummyNode", "ConnectorRuntimeSDK", "config", "failProbability", "dummyProcessFailed", "message", "action"]
|
|
7
7
|
}
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"node:process";var i=class{constructor(o,r){this.#r="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=r,a.on?a.on("message",e=>{e.cmd===this.#r&&r.logger.verbose(`${a.pid} Received message from parent process:`,e)}):r.logger.warn("IPC channel is not available. process.on is undefined."),a.send||r.logger.warn("IPC channel is not available. process.send is undefined."),o.actions?.forEach(e=>{if(e.config.templates===void 0)return;let n={};Object.entries(e.config.templates).forEach(([t,c])=>{try{n[t]=r.templating.compile(c)}catch(p){r.logger.error(`Error compiling template ${t} for action ${e.identifier}`,p)}}),e.config.parsedTemplates=n})}#r;#e;set callbackFunction(o){this.connectorSDK.receiver.registerCallback(this.#t(o))}get connectorSDK(){return this.#e}#t(o){return async r=>{let e=await this.#e.receiver.getActionConfig(r);return e?o(r,e):this.#e.receiver.responses.badRequest("Action not found")(r)}}};var s=class extends i{constructor(){super(...arguments);this.CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";this.init=async()=>{let{config:r}=this.connectorSDK,e=r.failProbability||0;e>0&&this.connectorSDK.logger.debug("Fail probability set to",e);let n=()=>Math.random()<e;this.callbackFunction=async(t,c)=>(this.connectorSDK.logger.info("Received message: ",t.testRun?"(test run)":"",t.eventId,t.payload),n()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(t)):this.connectorSDK.receiver.responses.ok()(t))}}};export{s as ConnectorRunnerDummyNode};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts", "../../../libs/connector-runner-dummy-node/src/lib/connector-runner-dummy-node.ts"],
|
|
4
|
-
"sourcesContent": ["import process from 'node:process';\n\nimport {
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAa,
|
|
4
|
+
"sourcesContent": ["import process from 'node:process';\n\nimport { ConnectorRuntimeInterface } from './connector-runtime.interface';\nimport { CompileDelegate, ConnectorSDKInterface } from './sdk';\nimport {\n ActionInterface,\n BaseConnectorConfig,\n ConnectorInterface,\n KafkaCallbackResponse,\n XodJobType,\n} from './types';\n\nexport interface IpcMessage {\n cmd: string;\n message: string;\n}\n\nexport abstract class ConnectorRuntimeSDK<\n T extends BaseConnectorConfig = BaseConnectorConfig,\n> implements ConnectorRuntimeInterface {\n readonly #IPC_CHANNEL = 'connector-runtime';\n\n readonly #connectorSDK: ConnectorSDKInterface<T>;\n\n constructor(\n connector: ConnectorInterface,\n connectorSDK: ConnectorSDKInterface,\n ) {\n this.#connectorSDK = connectorSDK as ConnectorSDKInterface<T>;\n\n if (process.on) {\n process.on('message', (message: IpcMessage) => {\n if (message.cmd === this.#IPC_CHANNEL) {\n connectorSDK.logger.verbose(\n `${process.pid} Received message from parent process:`,\n message,\n );\n }\n });\n } else {\n connectorSDK.logger.warn(\n 'IPC channel is not available. process.on is undefined.',\n );\n }\n\n if (!process.send) {\n // Check if process.send is available\n connectorSDK.logger.warn(\n 'IPC channel is not available. process.send is undefined.',\n );\n }\n\n // eslint-disable-next-line no-restricted-syntax\n connector.actions?.forEach((action: ActionInterface) => {\n if (action.config['templates'] === undefined) {\n return;\n }\n\n const containers: {\n [key: string]: CompileDelegate;\n } = {};\n\n Object.entries(action.config['templates']).forEach(([key, value]) => {\n try {\n // eslint-disable-next-line security/detect-object-injection\n containers[key] = connectorSDK.templating.compile(value);\n } catch (error: unknown) {\n connectorSDK.logger.error(\n `Error compiling template ${key} for action ${action.identifier}`,\n error,\n );\n }\n });\n\n // eslint-disable-next-line no-param-reassign\n action.config['parsedTemplates'] = containers;\n });\n }\n\n public init: () => Promise<void> = () => Promise.resolve();\n\n public start: () => Promise<void> = () => Promise.resolve();\n\n public stop: () => Promise<void> = () => Promise.resolve();\n\n set callbackFunction(\n callback: (\n message: XodJobType,\n action: ActionInterface,\n ) => Promise<KafkaCallbackResponse>,\n ) {\n this.connectorSDK.receiver.registerCallback(\n this.#enrichWithActionConfig(callback),\n );\n }\n\n protected get connectorSDK(): ConnectorSDKInterface<T> {\n return this.#connectorSDK;\n }\n\n #enrichWithActionConfig(\n callbackFunction: (\n message: XodJobType,\n action: ActionInterface,\n ) => Promise<KafkaCallbackResponse>,\n ): (message: XodJobType) => Promise<KafkaCallbackResponse> {\n return async (message: XodJobType) => {\n const action = await this.#connectorSDK.receiver.getActionConfig(message);\n if (!action) {\n return this.#connectorSDK.receiver.responses.badRequest(\n 'Action not found',\n )(message);\n }\n return callbackFunction(message, action);\n };\n }\n}\n", "import { ConnectorRuntimeSDK } from '@transai/connector-runtime-sdk';\nimport {\n ActionInterface,\n BaseConnectorConfig,\n KafkaCallbackResponse,\n XodJobType,\n} from '@xip-online-data/types';\n\nexport class ConnectorRunnerDummyNode extends ConnectorRuntimeSDK<\n {\n failProbability?: number;\n } & BaseConnectorConfig\n> {\n readonly CONNECTOR_INSTANCE: string = 'XOD_CONNECTOR_DUMMY_NODE_CONFIG';\n\n override init = async (): Promise<void> => {\n const { config } = this.connectorSDK;\n\n const failProbability = config.failProbability || 0.0;\n if (failProbability > 0) {\n this.connectorSDK.logger.debug(\n 'Fail probability set to',\n failProbability,\n );\n }\n\n const dummyProcessFailed = (): boolean => {\n return Math.random() < failProbability;\n };\n\n this.callbackFunction = async (\n message: XodJobType,\n action: ActionInterface,\n ): Promise<KafkaCallbackResponse> => {\n this.connectorSDK.logger.info(\n 'Received message: ',\n message.testRun ? '(test run)' : '',\n message.eventId,\n message.payload,\n );\n\n if (dummyProcessFailed()) {\n this.connectorSDK.logger.error('Dummy process failed');\n return this.connectorSDK.receiver.responses.internalServerError(\n 'Dummy process failed',\n )(message);\n }\n\n return this.connectorSDK.receiver.responses.ok()(message);\n };\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAa,eAiBb,IAAeC,EAAf,KAEgC,CAKrC,YACEC,EACAC,EACA,CAPF,KAASC,GAAe,oBA2DxB,KAAO,KAA4B,IAAM,QAAQ,QAAQ,EAEzD,KAAO,MAA6B,IAAM,QAAQ,QAAQ,EAE1D,KAAO,KAA4B,IAAM,QAAQ,QAAQ,EAvDvD,KAAKC,GAAgBF,EAEjBH,EAAQ,GACVA,EAAQ,GAAG,UAAYM,GAAwB,CACzCA,EAAQ,MA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AC,KAEA,KAAK,aAAa,OAAO,KACvB,qBACAD,EAAQ,QAAU,aAAe,GACjCA,EAAQ,QACRA,EAAQ,OACV,EAEID,EAAmB,GACrB,KAAK,aAAa,OAAO,MAAM,sBAAsB,EAC9C,KAAK,aAAa,SAAS,UAAU,oBAC1C,sBACF,EAAEC,CAAO,GAGJ,KAAK,aAAa,SAAS,UAAU,GAAG,EAAEA,CAAO,EAE5D,EACF",
|
|
6
6
|
"names": ["process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "ConnectorRunnerDummyNode", "ConnectorRuntimeSDK", "config", "failProbability", "dummyProcessFailed", "message", "action"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KafkaCallbackResponse, BaseConnectorConfig, ActionInterface, ConnectorInterface, XodJobType } from '@xip-online-data/types';
|
|
2
1
|
import { ConnectorRuntimeInterface } from './connector-runtime.interface';
|
|
3
2
|
import { ConnectorSDKInterface } from './sdk';
|
|
3
|
+
import { ActionInterface, BaseConnectorConfig, ConnectorInterface, KafkaCallbackResponse, XodJobType } from './types';
|
|
4
4
|
export interface IpcMessage {
|
|
5
5
|
cmd: string;
|
|
6
6
|
message: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionInterface, KafkaCallbackResponse, KafkaCallbackResponseType, XodJobType } from '
|
|
1
|
+
import { ActionInterface, KafkaCallbackResponse, KafkaCallbackResponseType, XodJobType } from '../types';
|
|
2
2
|
export interface ReceiverSDKInterface {
|
|
3
3
|
readonly responses: {
|
|
4
4
|
readonly ok: KafkaCallbackResponseType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseConnectorConfig } from '
|
|
1
|
+
import { BaseConnectorConfig } from '../types';
|
|
2
2
|
import { FilesSDKInterface } from './files.sdk.interface';
|
|
3
3
|
import { HttpClientSDKInterface, HttpConfig } from './http-client.interface';
|
|
4
4
|
import { LoggerSDKInterface } from './logger.sdk.interface';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare enum ConnectorOrigin {
|
|
2
|
+
from_template = "from_template",
|
|
3
|
+
manual = "manual"
|
|
4
|
+
}
|
|
5
|
+
export interface LegacyOutputParameterInterface {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}
|
|
8
|
+
export type SupportedOutputTypes = 'string' | 'number' | 'boolean' | 'array' | 'null';
|
|
9
|
+
export interface OutputItemParameterInterface {
|
|
10
|
+
type: SupportedOutputTypes | Array<SupportedOutputTypes>;
|
|
11
|
+
description?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ArrayOutputParameterInterface extends OutputItemParameterInterface {
|
|
15
|
+
type: 'array';
|
|
16
|
+
items: OutputParameterInterface;
|
|
17
|
+
}
|
|
18
|
+
export interface NumberOutputParameterInterface extends OutputItemParameterInterface {
|
|
19
|
+
type: 'number' | Array<'number' | 'null'>;
|
|
20
|
+
minimum?: number;
|
|
21
|
+
maximum?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface OutputParameterInterface {
|
|
24
|
+
[key: string]: OutputItemParameterInterface | ArrayOutputParameterInterface | NumberOutputParameterInterface;
|
|
25
|
+
}
|
|
26
|
+
export interface InputParameterInterface {
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
type: 'string' | 'number' | 'boolean' | 'array';
|
|
30
|
+
required?: boolean;
|
|
31
|
+
items?: Array<InputParameterInterface>;
|
|
32
|
+
}
|
|
33
|
+
export interface ActionInterface {
|
|
34
|
+
identifier: string;
|
|
35
|
+
version: string;
|
|
36
|
+
tenantIdentifier: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
connectorIdentifier: string;
|
|
40
|
+
config: {
|
|
41
|
+
[key: string]: {
|
|
42
|
+
[key: string]: string | object;
|
|
43
|
+
} | string | object;
|
|
44
|
+
};
|
|
45
|
+
inputParameters: Array<InputParameterInterface>;
|
|
46
|
+
outputParameters: LegacyOutputParameterInterface | OutputParameterInterface;
|
|
47
|
+
mode?: ConnectorOrigin;
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface KafkaBrokerConfig {
|
|
2
|
+
groupId: string;
|
|
3
|
+
clientId: string;
|
|
4
|
+
brokers: Array<string>;
|
|
5
|
+
sasl?: object;
|
|
6
|
+
intervalCheckForNewTopics?: number;
|
|
7
|
+
disableLogs?: boolean;
|
|
8
|
+
autoCommitThreshold?: number;
|
|
9
|
+
autoCommitInterval?: number;
|
|
10
|
+
partitionsConsumedConcurrently?: number;
|
|
11
|
+
useConfluentLibrary?: boolean;
|
|
12
|
+
newConsumerProtocol?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface KafkaCallbackResponse<T = unknown> {
|
|
15
|
+
success: boolean;
|
|
16
|
+
statusCode: number;
|
|
17
|
+
message: string;
|
|
18
|
+
payload?: T;
|
|
19
|
+
}
|
|
20
|
+
export type KafkaCallbackResponseType<T = string> = (additionalMessage?: T) => (message: XodBaseMessageType) => Promise<KafkaCallbackResponse>;
|
|
21
|
+
export interface XodBaseMessageType {
|
|
22
|
+
type: 'ACTION' | 'EVENT' | 'SOURCE' | 'JOB';
|
|
23
|
+
eventId: string;
|
|
24
|
+
eventType: string;
|
|
25
|
+
eventTopic?: string;
|
|
26
|
+
created: number;
|
|
27
|
+
payload: object;
|
|
28
|
+
ttl: number;
|
|
29
|
+
tenantIdentifier: string;
|
|
30
|
+
testRun?: boolean;
|
|
31
|
+
meta?: {
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface XodJobType extends XodBaseMessageType {
|
|
36
|
+
type: 'JOB';
|
|
37
|
+
actionIdentifier: string;
|
|
38
|
+
actionVersion: string;
|
|
39
|
+
payload: Record<string, unknown>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ActionInterface, ConnectorOrigin } from './types/action';
|
|
2
|
+
import { KafkaBrokerConfig } from './types/kafka';
|
|
3
|
+
export * from './types/action';
|
|
4
|
+
export * from './types/kafka';
|
|
5
|
+
export interface BaseConnectorConfig {
|
|
6
|
+
processIdentifier: string;
|
|
7
|
+
tenantIdentifier: string;
|
|
8
|
+
datasourceIdentifier: string;
|
|
9
|
+
kafka: KafkaBrokerConfig;
|
|
10
|
+
action?: {
|
|
11
|
+
timeSensitive: boolean;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ConnectorInterface<T = Partial<BaseConnectorConfig>> {
|
|
15
|
+
identifier: string;
|
|
16
|
+
connectorType: string;
|
|
17
|
+
tenantIdentifier: string;
|
|
18
|
+
name: string;
|
|
19
|
+
location: string;
|
|
20
|
+
config?: T;
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
actions?: Array<ActionInterface>;
|
|
23
|
+
mode?: ConnectorOrigin;
|
|
24
|
+
createdAt?: Date;
|
|
25
|
+
updatedAt?: Date;
|
|
26
|
+
}
|