@transai/connector-runtime-sdk 0.9.1 → 0.9.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/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var d=Object.create;var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var v=(r,o)=>{for(var e in o)s(r,e,{get:o[e],enumerable:!0})},p=(r,o,e,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of C(o))!I.call(r,n)&&n!==e&&s(r,n,{get:()=>o[n],enumerable:!(t=g(o,n))||t.enumerable});return r};var x=(r,o,e)=>(e=r!=null?d(b(r)):{},p(o||!r||!r.__esModule?s(e,"default",{value:r,enumerable:!0}):e,r)),u=r=>p(s({},"__esModule",{value:!0}),r);var h={};v(h,{ConnectorRuntimeSDK:()=>a,NullLogger:()=>c});module.exports=u(h);var i=x(require("node:process")),a=class{constructor(o,e){this.#o="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.#o&&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."),o.actions?.forEach(t=>{if(t.config.templates===void 0)return;let n={};Object.entries(t.config.templates).forEach(([f,m])=>{try{n[f]=e.templating.compile(m)}catch(l){e.logger.error(`Error compiling template ${f} for action ${t.identifier}`,l)}}),t.config.parsedTemplates=n})}#o;#e;set callbackFunction(o){this.connectorSDK.receiver.registerCallback(this.#r(o))}get connectorSDK(){return this.#e}#r(o){return async e=>{let t=await this.#e.receiver.getActionConfig(e);return t?o(e,t):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var c=class{info(){}debug(){}error(){}warn(){}verbose(){}};0&&(module.exports={ConnectorRuntimeSDK,NullLogger});
1
+ var l=Object.create;var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var C=(t,r)=>{for(var e in r)i(t,e,{get:r[e],enumerable:!0})},f=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of I(r))!x.call(t,o)&&o!==e&&i(t,o,{get:()=>r[o],enumerable:!(n=d(r,o))||n.enumerable});return t};var y=(t,r,e)=>(e=t!=null?l(b(t)):{},f(r||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),P=t=>f(i({},"__esModule",{value:!0}),t);var k={};C(k,{ConnectorOrigin:()=>m,ConnectorRuntimeSDK:()=>c,NullLogger:()=>s});module.exports=P(k);var m=(e=>(e.from_template="from_template",e.manual="manual",e))(m||{});var a=y(require("node:process")),c=class{constructor(r,e){this.#r="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=e,a.default.on?a.default.on("message",n=>{n.cmd===this.#r&&e.logger.verbose(`${a.default.pid} Received message from parent process:`,n)}):e.logger.warn("IPC channel is not available. process.on is undefined."),a.default.send||e.logger.warn("IPC channel is not available. process.send is undefined."),r.actions?.forEach(n=>{if(n.config.templates===void 0)return;let o={};Object.entries(n.config.templates).forEach(([p,u])=>{try{o[p]=e.templating.compile(u)}catch(g){e.logger.error(`Error compiling template ${p} for action ${n.identifier}`,g)}}),n.config.parsedTemplates=o})}#r;#e;set callbackFunction(r){this.connectorSDK.receiver.registerCallback(this.#t(r))}get connectorSDK(){return this.#e}#t(r){return async e=>{let n=await this.#e.receiver.getActionConfig(e);return n?r(e,n):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var s=class{info(){}debug(){}error(){}warn(){}verbose(){}};0&&(module.exports={ConnectorOrigin,ConnectorRuntimeSDK,NullLogger});
2
2
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../libs/connector-runtime-sdk/src/index.ts", "../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts", "../../../libs/connector-runtime-sdk/src/lib/support/null-logger.ts"],
4
- "sourcesContent": ["export * from './lib/connector-runtime';\nexport * from './lib/connector-runtime.interface';\nexport * from './lib/sdk';\nexport * from './lib/support';\n", "import process from 'node:process';\n\nimport {\n KafkaCallbackResponse,\n BaseConnectorConfig,\n ActionInterface,\n ConnectorInterface,\n XodJobType,\n} from '@xip-online-data/types';\n\nimport { ConnectorRuntimeInterface } from './connector-runtime.interface';\nimport { CompileDelegate, ConnectorSDKInterface } from './sdk';\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 { LoggerSDKInterface } from '../sdk';\n\nexport class NullLogger implements LoggerSDKInterface {\n info(): void {\n // Do nothing\n }\n\n debug(): void {\n // Do nothing\n }\n\n error(): void {\n // Do nothing\n }\n\n warn(): void {\n // Do nothing\n }\n\n verbose(): void {\n // Do nothing\n }\n}\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,eAAAC,IAAA,eAAAC,EAAAJ,GCAA,IAAAK,EAAoB,2BAkBEC,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,EAEjB,EAAAG,QAAQ,GACV,EAAAA,QAAQ,GAAG,UAAYC,GAAwB,CACzCA,EAAQ,MAAQ,KAAKH,IACvBD,EAAa,OAAO,QAClB,GAAG,EAAAG,QAAQ,GAAG,yCACdC,CACF,CAEJ,CAAC,EAEDJ,EAAa,OAAO,KAClB,wDACF,EAGG,EAAAG,QAAQ,MAEXH,EAAa,OAAO,KAClB,0DACF,EAIFD,EAAU,SAAS,QAASM,GAA4B,CACtD,GAAIA,EAAO,OAAO,YAAiB,OACjC,OAGF,IAAMC,EAEF,CAAC,EAEL,OAAO,QAAQD,EAAO,OAAO,SAAY,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CACnE,GAAI,CAEFF,EAAWC,CAAG,EAAIP,EAAa,WAAW,QAAQQ,CAAK,CACzD,OAASC,EAAgB,CACvBT,EAAa,OAAO,MAClB,4BAA4BO,CAAG,eAAeF,EAAO,UAAU,GAC/DI,CACF,CACF,CACF,CAAC,EAGDJ,EAAO,OAAO,gBAAqBC,CACrC,CAAC,CACH,CAzDSL,GAEAC,GA+DT,IAAI,iBACFQ,EAIA,CACA,KAAK,aAAa,SAAS,iBACzB,KAAKC,GAAwBD,CAAQ,CACvC,CACF,CAEA,IAAc,cAAyC,CACrD,OAAO,KAAKR,EACd,CAEAS,GACEC,EAIyD,CACzD,MAAO,OAAOR,GAAwB,CACpC,IAAMC,EAAS,MAAM,KAAKH,GAAc,SAAS,gBAAgBE,CAAO,EACxE,OAAKC,EAKEO,EAAiBR,EAASC,CAAM,EAJ9B,KAAKH,GAAc,SAAS,UAAU,WAC3C,kBACF,EAAEE,CAAO,CAGb,CACF,CACF,ECnHO,IAAMS,EAAN,KAA+C,CACpD,MAAa,CAEb,CAEA,OAAc,CAEd,CAEA,OAAc,CAEd,CAEA,MAAa,CAEb,CAEA,SAAgB,CAEhB,CACF",
6
- "names": ["index_exports", "__export", "ConnectorRuntimeSDK", "NullLogger", "__toCommonJS", "import_node_process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "process", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "NullLogger"]
3
+ "sources": ["../../../libs/connector-runtime-sdk/src/index.ts", "../../../libs/connector-runtime-sdk/src/lib/types/action.ts", "../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts", "../../../libs/connector-runtime-sdk/src/lib/support/null-logger.ts"],
4
+ "sourcesContent": ["export * from './lib/types';\nexport * from './lib/connector-runtime';\nexport * from './lib/connector-runtime.interface';\nexport * from './lib/sdk';\nexport * from './lib/support';\n", "export enum ConnectorOrigin {\n from_template = 'from_template',\n manual = 'manual',\n}\n\nexport interface LegacyOutputParameterInterface {\n [key: string]: string;\n}\n\nexport type SupportedOutputTypes =\n | 'string'\n | 'number'\n | 'boolean'\n | 'array'\n | 'null';\n\nexport interface OutputItemParameterInterface {\n type: SupportedOutputTypes | Array<SupportedOutputTypes>;\n description?: string;\n required?: boolean;\n}\n\nexport interface ArrayOutputParameterInterface extends OutputItemParameterInterface {\n type: 'array';\n items: OutputParameterInterface;\n}\n\nexport interface NumberOutputParameterInterface extends OutputItemParameterInterface {\n type: 'number' | Array<'number' | 'null'>;\n minimum?: number;\n maximum?: number;\n}\n\nexport interface OutputParameterInterface {\n [key: string]:\n | OutputItemParameterInterface\n | ArrayOutputParameterInterface\n | NumberOutputParameterInterface;\n}\n\nexport interface InputParameterInterface {\n name: string;\n description?: string;\n type: 'string' | 'number' | 'boolean' | 'array';\n required?: boolean;\n items?: Array<InputParameterInterface>;\n}\n\nexport interface ActionInterface {\n identifier: string;\n version: string;\n tenantIdentifier: string;\n name: string;\n description?: string;\n connectorIdentifier: string;\n config: {\n [key: string]: { [key: string]: string | object } | string | object;\n };\n inputParameters: Array<InputParameterInterface>;\n outputParameters: LegacyOutputParameterInterface | OutputParameterInterface;\n mode?: ConnectorOrigin;\n createdAt: Date;\n}\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 { LoggerSDKInterface } from '../sdk';\n\nexport class NullLogger implements LoggerSDKInterface {\n info(): void {\n // Do nothing\n }\n\n debug(): void {\n // Do nothing\n }\n\n error(): void {\n // Do nothing\n }\n\n warn(): void {\n // Do nothing\n }\n\n verbose(): void {\n // Do nothing\n }\n}\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,wBAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GCAO,IAAKM,OACVA,EAAA,cAAgB,gBAChBA,EAAA,OAAS,SAFCA,OAAA,ICAZ,IAAAC,EAAoB,2BAiBEC,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,EAEjB,EAAAG,QAAQ,GACV,EAAAA,QAAQ,GAAG,UAAYC,GAAwB,CACzCA,EAAQ,MAAQ,KAAKH,IACvBD,EAAa,OAAO,QAClB,GAAG,EAAAG,QAAQ,GAAG,yCACdC,CACF,CAEJ,CAAC,EAEDJ,EAAa,OAAO,KAClB,wDACF,EAGG,EAAAG,QAAQ,MAEXH,EAAa,OAAO,KAClB,0DACF,EAIFD,EAAU,SAAS,QAASM,GAA4B,CACtD,GAAIA,EAAO,OAAO,YAAiB,OACjC,OAGF,IAAMC,EAEF,CAAC,EAEL,OAAO,QAAQD,EAAO,OAAO,SAAY,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CACnE,GAAI,CAEFF,EAAWC,CAAG,EAAIP,EAAa,WAAW,QAAQQ,CAAK,CACzD,OAASC,EAAgB,CACvBT,EAAa,OAAO,MAClB,4BAA4BO,CAAG,eAAeF,EAAO,UAAU,GAC/DI,CACF,CACF,CACF,CAAC,EAGDJ,EAAO,OAAO,gBAAqBC,CACrC,CAAC,CACH,CAzDSL,GAEAC,GA+DT,IAAI,iBACFQ,EAIA,CACA,KAAK,aAAa,SAAS,iBACzB,KAAKC,GAAwBD,CAAQ,CACvC,CACF,CAEA,IAAc,cAAyC,CACrD,OAAO,KAAKR,EACd,CAEAS,GACEC,EAIyD,CACzD,MAAO,OAAOR,GAAwB,CACpC,IAAMC,EAAS,MAAM,KAAKH,GAAc,SAAS,gBAAgBE,CAAO,EACxE,OAAKC,EAKEO,EAAiBR,EAASC,CAAM,EAJ9B,KAAKH,GAAc,SAAS,UAAU,WAC3C,kBACF,EAAEE,CAAO,CAGb,CACF,CACF,EClHO,IAAMS,EAAN,KAA+C,CACpD,MAAa,CAEb,CAEA,OAAc,CAEd,CAEA,OAAc,CAEd,CAEA,MAAa,CAEb,CAEA,SAAgB,CAEhB,CACF",
6
+ "names": ["index_exports", "__export", "ConnectorOrigin", "ConnectorRuntimeSDK", "NullLogger", "__toCommonJS", "ConnectorOrigin", "import_node_process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "process", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "NullLogger"]
7
7
  }
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import t from"node:process";var s=class{constructor(r,e){this.#o="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=e,t.on?t.on("message",o=>{o.cmd===this.#o&&e.logger.verbose(`${t.pid} Received message from parent process:`,o)}):e.logger.warn("IPC channel is not available. process.on is undefined."),t.send||e.logger.warn("IPC channel is not available. process.send is undefined."),r.actions?.forEach(o=>{if(o.config.templates===void 0)return;let n={};Object.entries(o.config.templates).forEach(([i,f])=>{try{n[i]=e.templating.compile(f)}catch(p){e.logger.error(`Error compiling template ${i} for action ${o.identifier}`,p)}}),o.config.parsedTemplates=n})}#o;#e;set callbackFunction(r){this.connectorSDK.receiver.registerCallback(this.#r(r))}get connectorSDK(){return this.#e}#r(r){return async e=>{let o=await this.#e.receiver.getActionConfig(e);return o?r(e,o):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var a=class{info(){}debug(){}error(){}warn(){}verbose(){}};export{s as ConnectorRuntimeSDK,a as NullLogger};
1
+ var m=(e=>(e.from_template="from_template",e.manual="manual",e))(m||{});import n from"node:process";var i=class{constructor(t,e){this.#r="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=e,n.on?n.on("message",r=>{r.cmd===this.#r&&e.logger.verbose(`${n.pid} Received message from parent process:`,r)}):e.logger.warn("IPC channel is not available. process.on is undefined."),n.send||e.logger.warn("IPC channel is not available. process.send is undefined."),t.actions?.forEach(r=>{if(r.config.templates===void 0)return;let o={};Object.entries(r.config.templates).forEach(([a,p])=>{try{o[a]=e.templating.compile(p)}catch(f){e.logger.error(`Error compiling template ${a} for action ${r.identifier}`,f)}}),r.config.parsedTemplates=o})}#r;#e;set callbackFunction(t){this.connectorSDK.receiver.registerCallback(this.#t(t))}get connectorSDK(){return this.#e}#t(t){return async e=>{let r=await this.#e.receiver.getActionConfig(e);return r?t(e,r):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var c=class{info(){}debug(){}error(){}warn(){}verbose(){}};export{m as ConnectorOrigin,i as ConnectorRuntimeSDK,c as NullLogger};
2
2
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts", "../../../libs/connector-runtime-sdk/src/lib/support/null-logger.ts"],
4
- "sourcesContent": ["import process from 'node:process';\n\nimport {\n KafkaCallbackResponse,\n BaseConnectorConfig,\n ActionInterface,\n ConnectorInterface,\n XodJobType,\n} from '@xip-online-data/types';\n\nimport { ConnectorRuntimeInterface } from './connector-runtime.interface';\nimport { CompileDelegate, ConnectorSDKInterface } from './sdk';\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 { LoggerSDKInterface } from '../sdk';\n\nexport class NullLogger implements LoggerSDKInterface {\n info(): void {\n // Do nothing\n }\n\n debug(): void {\n // Do nothing\n }\n\n error(): void {\n // Do nothing\n }\n\n warn(): void {\n // Do nothing\n }\n\n verbose(): void {\n // Do nothing\n }\n}\n"],
5
- "mappings": "AAAA,OAAOA,MAAa,eAkBb,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,MAAQ,KAAKF,IACvBD,EAAa,OAAO,QAClB,GAAGH,EAAQ,GAAG,yCACdM,CACF,CAEJ,CAAC,EAEDH,EAAa,OAAO,KAClB,wDACF,EAGGH,EAAQ,MAEXG,EAAa,OAAO,KAClB,0DACF,EAIFD,EAAU,SAAS,QAASK,GAA4B,CACtD,GAAIA,EAAO,OAAO,YAAiB,OACjC,OAGF,IAAMC,EAEF,CAAC,EAEL,OAAO,QAAQD,EAAO,OAAO,SAAY,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CACnE,GAAI,CAEFF,EAAWC,CAAG,EAAIN,EAAa,WAAW,QAAQO,CAAK,CACzD,OAASC,EAAgB,CACvBR,EAAa,OAAO,MAClB,4BAA4BM,CAAG,eAAeF,EAAO,UAAU,GAC/DI,CACF,CACF,CACF,CAAC,EAGDJ,EAAO,OAAO,gBAAqBC,CACrC,CAAC,CACH,CAzDSJ,GAEAC,GA+DT,IAAI,iBACFO,EAIA,CACA,KAAK,aAAa,SAAS,iBACzB,KAAKC,GAAwBD,CAAQ,CACvC,CACF,CAEA,IAAc,cAAyC,CACrD,OAAO,KAAKP,EACd,CAEAQ,GACEC,EAIyD,CACzD,MAAO,OAAOR,GAAwB,CACpC,IAAMC,EAAS,MAAM,KAAKF,GAAc,SAAS,gBAAgBC,CAAO,EACxE,OAAKC,EAKEO,EAAiBR,EAASC,CAAM,EAJ9B,KAAKF,GAAc,SAAS,UAAU,WAC3C,kBACF,EAAEC,CAAO,CAGb,CACF,CACF,ECnHO,IAAMS,EAAN,KAA+C,CACpD,MAAa,CAEb,CAEA,OAAc,CAEd,CAEA,OAAc,CAEd,CAEA,MAAa,CAEb,CAEA,SAAgB,CAEhB,CACF",
6
- "names": ["process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "NullLogger"]
3
+ "sources": ["../../../libs/connector-runtime-sdk/src/lib/types/action.ts", "../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts", "../../../libs/connector-runtime-sdk/src/lib/support/null-logger.ts"],
4
+ "sourcesContent": ["export enum ConnectorOrigin {\n from_template = 'from_template',\n manual = 'manual',\n}\n\nexport interface LegacyOutputParameterInterface {\n [key: string]: string;\n}\n\nexport type SupportedOutputTypes =\n | 'string'\n | 'number'\n | 'boolean'\n | 'array'\n | 'null';\n\nexport interface OutputItemParameterInterface {\n type: SupportedOutputTypes | Array<SupportedOutputTypes>;\n description?: string;\n required?: boolean;\n}\n\nexport interface ArrayOutputParameterInterface extends OutputItemParameterInterface {\n type: 'array';\n items: OutputParameterInterface;\n}\n\nexport interface NumberOutputParameterInterface extends OutputItemParameterInterface {\n type: 'number' | Array<'number' | 'null'>;\n minimum?: number;\n maximum?: number;\n}\n\nexport interface OutputParameterInterface {\n [key: string]:\n | OutputItemParameterInterface\n | ArrayOutputParameterInterface\n | NumberOutputParameterInterface;\n}\n\nexport interface InputParameterInterface {\n name: string;\n description?: string;\n type: 'string' | 'number' | 'boolean' | 'array';\n required?: boolean;\n items?: Array<InputParameterInterface>;\n}\n\nexport interface ActionInterface {\n identifier: string;\n version: string;\n tenantIdentifier: string;\n name: string;\n description?: string;\n connectorIdentifier: string;\n config: {\n [key: string]: { [key: string]: string | object } | string | object;\n };\n inputParameters: Array<InputParameterInterface>;\n outputParameters: LegacyOutputParameterInterface | OutputParameterInterface;\n mode?: ConnectorOrigin;\n createdAt: Date;\n}\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 { LoggerSDKInterface } from '../sdk';\n\nexport class NullLogger implements LoggerSDKInterface {\n info(): void {\n // Do nothing\n }\n\n debug(): void {\n // Do nothing\n }\n\n error(): void {\n // Do nothing\n }\n\n warn(): void {\n // Do nothing\n }\n\n verbose(): void {\n // Do nothing\n }\n}\n"],
5
+ "mappings": "AAAO,IAAKA,OACVA,EAAA,cAAgB,gBAChBA,EAAA,OAAS,SAFCA,OAAA,ICAZ,OAAOC,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,MAAQ,KAAKF,IACvBD,EAAa,OAAO,QAClB,GAAGH,EAAQ,GAAG,yCACdM,CACF,CAEJ,CAAC,EAEDH,EAAa,OAAO,KAClB,wDACF,EAGGH,EAAQ,MAEXG,EAAa,OAAO,KAClB,0DACF,EAIFD,EAAU,SAAS,QAASK,GAA4B,CACtD,GAAIA,EAAO,OAAO,YAAiB,OACjC,OAGF,IAAMC,EAEF,CAAC,EAEL,OAAO,QAAQD,EAAO,OAAO,SAAY,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CACnE,GAAI,CAEFF,EAAWC,CAAG,EAAIN,EAAa,WAAW,QAAQO,CAAK,CACzD,OAASC,EAAgB,CACvBR,EAAa,OAAO,MAClB,4BAA4BM,CAAG,eAAeF,EAAO,UAAU,GAC/DI,CACF,CACF,CACF,CAAC,EAGDJ,EAAO,OAAO,gBAAqBC,CACrC,CAAC,CACH,CAzDSJ,GAEAC,GA+DT,IAAI,iBACFO,EAIA,CACA,KAAK,aAAa,SAAS,iBACzB,KAAKC,GAAwBD,CAAQ,CACvC,CACF,CAEA,IAAc,cAAyC,CACrD,OAAO,KAAKP,EACd,CAEAQ,GACEC,EAIyD,CACzD,MAAO,OAAOR,GAAwB,CACpC,IAAMC,EAAS,MAAM,KAAKF,GAAc,SAAS,gBAAgBC,CAAO,EACxE,OAAKC,EAKEO,EAAiBR,EAASC,CAAM,EAJ9B,KAAKF,GAAc,SAAS,UAAU,WAC3C,kBACF,EAAEC,CAAO,CAGb,CACF,CACF,EClHO,IAAMS,EAAN,KAA+C,CACpD,MAAa,CAEb,CAEA,OAAc,CAEd,CAEA,OAAc,CAEd,CAEA,MAAa,CAEb,CAEA,SAAgB,CAEhB,CACF",
6
+ "names": ["ConnectorOrigin", "process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "NullLogger"]
7
7
  }
package/meta.cjs.json CHANGED
@@ -1,15 +1,46 @@
1
1
  {
2
2
  "inputs": {
3
- "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
4
- "bytes": 3301,
3
+ "libs/connector-runtime-sdk/src/lib/types/action.ts": {
4
+ "bytes": 1556,
5
+ "imports": [],
6
+ "format": "esm"
7
+ },
8
+ "libs/connector-runtime-sdk/src/lib/types/kafka.ts": {
9
+ "bytes": 1115,
10
+ "imports": [],
11
+ "format": "esm"
12
+ },
13
+ "libs/connector-runtime-sdk/src/lib/types.ts": {
14
+ "bytes": 709,
5
15
  "imports": [
6
16
  {
7
- "path": "node:process",
17
+ "path": "./types/action",
8
18
  "kind": "import-statement",
9
19
  "external": true
10
20
  },
11
21
  {
12
- "path": "@xip-online-data/types",
22
+ "path": "./types/kafka",
23
+ "kind": "import-statement",
24
+ "external": true
25
+ },
26
+ {
27
+ "path": "libs/connector-runtime-sdk/src/lib/types/action.ts",
28
+ "kind": "import-statement",
29
+ "original": "./types/action"
30
+ },
31
+ {
32
+ "path": "libs/connector-runtime-sdk/src/lib/types/kafka.ts",
33
+ "kind": "import-statement",
34
+ "original": "./types/kafka"
35
+ }
36
+ ],
37
+ "format": "esm"
38
+ },
39
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
40
+ "bytes": 3285,
41
+ "imports": [
42
+ {
43
+ "path": "node:process",
13
44
  "kind": "import-statement",
14
45
  "external": true
15
46
  },
@@ -22,6 +53,11 @@
22
53
  "path": "./sdk",
23
54
  "kind": "import-statement",
24
55
  "external": true
56
+ },
57
+ {
58
+ "path": "./types",
59
+ "kind": "import-statement",
60
+ "external": true
25
61
  }
26
62
  ],
27
63
  "format": "esm"
@@ -32,10 +68,10 @@
32
68
  "format": "esm"
33
69
  },
34
70
  "libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.ts": {
35
- "bytes": 1511,
71
+ "bytes": 1497,
36
72
  "imports": [
37
73
  {
38
- "path": "@xip-online-data/types",
74
+ "path": "../types",
39
75
  "kind": "import-statement",
40
76
  "external": true
41
77
  },
@@ -108,10 +144,10 @@
108
144
  "format": "esm"
109
145
  },
110
146
  "libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.ts": {
111
- "bytes": 954,
147
+ "bytes": 940,
112
148
  "imports": [
113
149
  {
114
- "path": "@xip-online-data/types",
150
+ "path": "../types",
115
151
  "kind": "import-statement",
116
152
  "external": true
117
153
  }
@@ -217,8 +253,13 @@
217
253
  "format": "esm"
218
254
  },
219
255
  "libs/connector-runtime-sdk/src/index.ts": {
220
- "bytes": 150,
256
+ "bytes": 179,
221
257
  "imports": [
258
+ {
259
+ "path": "libs/connector-runtime-sdk/src/lib/types.ts",
260
+ "kind": "import-statement",
261
+ "original": "./lib/types"
262
+ },
222
263
  {
223
264
  "path": "libs/connector-runtime-sdk/src/lib/connector-runtime.ts",
224
265
  "kind": "import-statement",
@@ -248,7 +289,7 @@
248
289
  "imports": [],
249
290
  "exports": [],
250
291
  "inputs": {},
251
- "bytes": 5772
292
+ "bytes": 7578
252
293
  },
253
294
  "dist/libs/connector-runtime-sdk/index.cjs": {
254
295
  "imports": [
@@ -262,7 +303,13 @@
262
303
  "entryPoint": "libs/connector-runtime-sdk/src/index.ts",
263
304
  "inputs": {
264
305
  "libs/connector-runtime-sdk/src/index.ts": {
265
- "bytesInOutput": 79
306
+ "bytesInOutput": 101
307
+ },
308
+ "libs/connector-runtime-sdk/src/lib/types/action.ts": {
309
+ "bytesInOutput": 72
310
+ },
311
+ "libs/connector-runtime-sdk/src/lib/types.ts": {
312
+ "bytesInOutput": 0
266
313
  },
267
314
  "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
268
315
  "bytesInOutput": 1036
@@ -277,7 +324,7 @@
277
324
  "bytesInOutput": 0
278
325
  }
279
326
  },
280
- "bytes": 1820
327
+ "bytes": 1930
281
328
  }
282
329
  }
283
330
  }
package/meta.esm.json CHANGED
@@ -1,15 +1,46 @@
1
1
  {
2
2
  "inputs": {
3
- "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
4
- "bytes": 3301,
3
+ "libs/connector-runtime-sdk/src/lib/types/action.ts": {
4
+ "bytes": 1556,
5
+ "imports": [],
6
+ "format": "esm"
7
+ },
8
+ "libs/connector-runtime-sdk/src/lib/types/kafka.ts": {
9
+ "bytes": 1115,
10
+ "imports": [],
11
+ "format": "esm"
12
+ },
13
+ "libs/connector-runtime-sdk/src/lib/types.ts": {
14
+ "bytes": 709,
5
15
  "imports": [
6
16
  {
7
- "path": "node:process",
17
+ "path": "./types/action",
8
18
  "kind": "import-statement",
9
19
  "external": true
10
20
  },
11
21
  {
12
- "path": "@xip-online-data/types",
22
+ "path": "./types/kafka",
23
+ "kind": "import-statement",
24
+ "external": true
25
+ },
26
+ {
27
+ "path": "libs/connector-runtime-sdk/src/lib/types/action.ts",
28
+ "kind": "import-statement",
29
+ "original": "./types/action"
30
+ },
31
+ {
32
+ "path": "libs/connector-runtime-sdk/src/lib/types/kafka.ts",
33
+ "kind": "import-statement",
34
+ "original": "./types/kafka"
35
+ }
36
+ ],
37
+ "format": "esm"
38
+ },
39
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
40
+ "bytes": 3285,
41
+ "imports": [
42
+ {
43
+ "path": "node:process",
13
44
  "kind": "import-statement",
14
45
  "external": true
15
46
  },
@@ -22,6 +53,11 @@
22
53
  "path": "./sdk",
23
54
  "kind": "import-statement",
24
55
  "external": true
56
+ },
57
+ {
58
+ "path": "./types",
59
+ "kind": "import-statement",
60
+ "external": true
25
61
  }
26
62
  ],
27
63
  "format": "esm"
@@ -32,10 +68,10 @@
32
68
  "format": "esm"
33
69
  },
34
70
  "libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.ts": {
35
- "bytes": 1511,
71
+ "bytes": 1497,
36
72
  "imports": [
37
73
  {
38
- "path": "@xip-online-data/types",
74
+ "path": "../types",
39
75
  "kind": "import-statement",
40
76
  "external": true
41
77
  },
@@ -108,10 +144,10 @@
108
144
  "format": "esm"
109
145
  },
110
146
  "libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.ts": {
111
- "bytes": 954,
147
+ "bytes": 940,
112
148
  "imports": [
113
149
  {
114
- "path": "@xip-online-data/types",
150
+ "path": "../types",
115
151
  "kind": "import-statement",
116
152
  "external": true
117
153
  }
@@ -217,8 +253,13 @@
217
253
  "format": "esm"
218
254
  },
219
255
  "libs/connector-runtime-sdk/src/index.ts": {
220
- "bytes": 150,
256
+ "bytes": 179,
221
257
  "imports": [
258
+ {
259
+ "path": "libs/connector-runtime-sdk/src/lib/types.ts",
260
+ "kind": "import-statement",
261
+ "original": "./lib/types"
262
+ },
222
263
  {
223
264
  "path": "libs/connector-runtime-sdk/src/lib/connector-runtime.ts",
224
265
  "kind": "import-statement",
@@ -248,7 +289,7 @@
248
289
  "imports": [],
249
290
  "exports": [],
250
291
  "inputs": {},
251
- "bytes": 5370
292
+ "bytes": 7115
252
293
  },
253
294
  "dist/libs/connector-runtime-sdk/index.js": {
254
295
  "imports": [
@@ -259,17 +300,24 @@
259
300
  }
260
301
  ],
261
302
  "exports": [
303
+ "ConnectorOrigin",
262
304
  "ConnectorRuntimeSDK",
263
305
  "NullLogger"
264
306
  ],
265
307
  "entryPoint": "libs/connector-runtime-sdk/src/index.ts",
266
308
  "inputs": {
267
- "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
268
- "bytesInOutput": 1003
309
+ "libs/connector-runtime-sdk/src/lib/types/action.ts": {
310
+ "bytesInOutput": 72
311
+ },
312
+ "libs/connector-runtime-sdk/src/lib/types.ts": {
313
+ "bytesInOutput": 0
269
314
  },
270
315
  "libs/connector-runtime-sdk/src/index.ts": {
271
316
  "bytesInOutput": 0
272
317
  },
318
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
319
+ "bytesInOutput": 1003
320
+ },
273
321
  "libs/connector-runtime-sdk/src/lib/sdk/index.ts": {
274
322
  "bytesInOutput": 0
275
323
  },
@@ -280,7 +328,7 @@
280
328
  "bytesInOutput": 0
281
329
  }
282
330
  },
283
- "bytes": 1146
331
+ "bytes": 1239
284
332
  }
285
333
  }
286
334
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transai/connector-runtime-sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,5 +12,5 @@
12
12
  },
13
13
  "type": "commonjs",
14
14
  "main": "./index.cjs",
15
- "typings": "./index.d.ts"
15
+ "typings": "./src/index.d.ts"
16
16
  }
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './lib/types';
1
2
  export * from './lib/connector-runtime';
2
3
  export * from './lib/connector-runtime.interface';
3
4
  export * from './lib/sdk';
@@ -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 '@xip-online-data/types';
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 '@xip-online-data/types';
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
+ }