@transai/connector-runner-dummy-node 0.1.2 → 0.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/index.cjs +1 -1
  3. package/index.cjs.map +1 -1
  4. package/index.js +1 -1
  5. package/libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.d.ts +18 -0
  6. package/libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.d.ts +38 -0
  7. package/libs/connector-runtime-sdk/src/lib/sdk/index.d.ts +3 -0
  8. package/libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.d.ts +1 -0
  9. package/libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.d.ts +1 -0
  10. package/libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.d.ts +15 -0
  11. package/libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.d.ts +15 -0
  12. package/libs/types/src/lib/http-status-codes.enum.d.ts +2 -1
  13. package/libs/types/src/lib/management-api/event-origin.interface.d.ts +2 -0
  14. package/libs/types/src/lib/management-api/index.d.ts +1 -1
  15. package/libs/types/src/lib/management-api/semantic-trigger/custom-cron-trigger-record.interface.d.ts +6 -0
  16. package/libs/types/src/lib/management-api/semantic-trigger/index.d.ts +1 -0
  17. package/libs/types/src/lib/management-api/semantic-trigger/semantic-trigger.interface.d.ts +1 -0
  18. package/libs/types/src/lib/management-api/web/generic-filter.dto.d.ts +37 -0
  19. package/libs/types/src/lib/management-api/{pagination → web}/index.d.ts +1 -0
  20. package/libs/types/src/lib/management-api/workflow/offset.interface.d.ts +1 -3
  21. package/libs/types/src/lib/management-api/workflow/trigger-types.interface.d.ts +10 -1
  22. package/libs/types/src/lib/management-api/workflow/workflow-definition.interface.d.ts +9 -1
  23. package/libs/types/src/lib/management-api/workflow/workflow-run.d.ts +7 -2
  24. package/libs/types/src/lib/management-api/workflow/workflow.drawing.d.ts +2 -1
  25. package/libs/types/src/lib/types.d.ts +4 -1
  26. package/package.json +10 -1
  27. /package/libs/types/src/lib/management-api/{pagination → web}/paginated-response.interface.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 0.2.0 (2025-11-19)
2
+
3
+ ### 🚀 Features
4
+
5
+ - fix connector packages publish ([517d2fd2](https://github.com/xip-online-applications/xod-core/commit/517d2fd2))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated @transai/connector-runtime-sdk to 0.1.0
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - Youri Lefers @yourilefers
14
+
1
15
  # Changelog
2
16
 
3
17
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
package/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var I=(n,o)=>{for(var e in o)c(n,e,{get:o[e],enumerable:!0})},p=(n,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of C(o))!u.call(n,t)&&t!==e&&c(n,t,{get:()=>o[t],enumerable:!(r=g(o,t))||r.enumerable});return n};var h=(n,o,e)=>(e=n!=null?d(b(n)):{},p(o||!n||!n.__esModule?c(e,"default",{value:n,enumerable:!0}):e,n)),y=n=>p(c({},"__esModule",{value:!0}),n);var v={};I(v,{ConnectorRunnerDummyNode:()=>f});module.exports=y(v);var s=h(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,s.on?s.on("message",r=>{r.cmd===this.#o&&e.logger.verbose(`${s.pid} Received message from parent process:`,r)}):e.logger.warn("IPC channel is not available. process.on is undefined."),s.send||e.logger.warn("IPC channel is not available. process.send is undefined."),o.actions?.forEach(r=>{if(r.config.templates===void 0)return;let t={};Object.entries(r.config.templates).forEach(([i,l])=>{try{t[i]=e.templating.compile(l)}catch(m){e.logger.error(`Error compiling template ${i} for action ${r.identifier}`,m)}}),r.config.parsedTemplates=t})}#o;#e;set callbackFunction(o){this.connectorSDK.receiver.registerCallback(this.#r(o))}get connectorSDK(){return this.#e}#r(o){return async e=>{let r=this.#e.receiver.getActionConfig(e);return r?o(e,r):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var f=class extends a{constructor(){super(...arguments);this.CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";this.init=async()=>{let{config:e}=this.connectorSDK,r=e.failProbability||0;r>0&&this.connectorSDK.logger.debug("Fail probability set to",r);let t=()=>Math.random()<r;this.callbackFunction=async(i,l)=>(this.connectorSDK.logger.info("Received message: ",i.testRun?"(test run)":"",i.eventId,i.payload),t()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(i)):this.connectorSDK.receiver.responses.ok()(i))}}};0&&(module.exports={ConnectorRunnerDummyNode});
1
+ "use strict";var d=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var I=(n,o)=>{for(var e in o)c(n,e,{get:o[e],enumerable:!0})},l=(n,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of C(o))!u.call(n,t)&&t!==e&&c(n,t,{get:()=>o[t],enumerable:!(r=g(o,t))||r.enumerable});return n};var h=(n,o,e)=>(e=n!=null?d(b(n)):{},l(o||!n||!n.__esModule?c(e,"default",{value:n,enumerable:!0}):e,n)),y=n=>l(c({},"__esModule",{value:!0}),n);var v={};I(v,{ConnectorRunnerDummyNode:()=>f});module.exports=y(v);var s=h(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,s.on?s.on("message",r=>{r.cmd===this.#o&&e.logger.verbose(`${s.pid} Received message from parent process:`,r)}):e.logger.warn("IPC channel is not available. process.on is undefined."),s.send||e.logger.warn("IPC channel is not available. process.send is undefined."),o.actions?.forEach(r=>{if(r.config.templates===void 0)return;let t={};Object.entries(r.config.templates).forEach(([i,p])=>{try{t[i]=e.templating.compile(p)}catch(m){e.logger.error(`Error compiling template ${i} for action ${r.identifier}`,m)}}),r.config.parsedTemplates=t})}#o;#e;set callbackFunction(o){this.connectorSDK.receiver.registerCallback(this.#r(o))}get connectorSDK(){return this.#e}#r(o){return async e=>{let r=this.#e.receiver.getActionConfig(e);return r?o(e,r):this.#e.receiver.responses.badRequest("Action not found")(e)}}};var f=class extends a{constructor(){super(...arguments);this.CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";this.init=async()=>{let{config:e}=this.connectorSDK,r=e.failProbability||0;r>0&&this.connectorSDK.logger.debug("Fail probability set to",r);let t=()=>Math.random()<r;this.callbackFunction=async(i,p)=>(this.connectorSDK.logger.info("Received message: ",i.testRun?"(test run)":"",i.eventId,i.payload),t()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(i)):this.connectorSDK.receiver.responses.ok()(i))}}};0&&(module.exports={ConnectorRunnerDummyNode});
2
2
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -3,5 +3,5 @@
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
4
  "sourcesContent": ["export * from './lib/connector-runner-dummy-node';\n", "import * as 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{\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 = 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
5
  "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAyB,2BAkBHC,EAAf,KAGP,CAKE,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,EAET,KACF,KAAG,UAAYG,GAAwB,CACzCA,EAAQ,MAAQ,KAAKF,IACvBD,EAAa,OAAO,QAClB,GAAW,KAAG,yCACdG,CACF,CAEJ,CAAC,EAEDH,EAAa,OAAO,KAClB,wDACF,EAGW,QAEXA,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,KAAKF,GAAc,SAAS,gBAAgBC,CAAO,EAClE,OAAKC,EAKEO,EAAiBR,EAASC,CAAM,EAJ9B,KAAKF,GAAc,SAAS,UAAU,WAC3C,kBACF,EAAEC,CAAO,CAGb,CACF,CACF,EC9GO,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
- "names": ["src_exports", "__export", "ConnectorRunnerDummyNode", "__toCommonJS", "process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "ConnectorRunnerDummyNode", "ConnectorRuntimeSDK", "config", "failProbability", "dummyProcessFailed", "message", "action"]
6
+ "names": ["index_exports", "__export", "ConnectorRunnerDummyNode", "__toCommonJS", "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
  }
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import*as n from"node:process";var s=class{constructor(t,o){this.#o="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=o,n.on?n.on("message",e=>{e.cmd===this.#o&&o.logger.verbose(`${n.pid} Received message from parent process:`,e)}):o.logger.warn("IPC channel is not available. process.on is undefined."),n.send||o.logger.warn("IPC channel is not available. process.send is undefined."),t.actions?.forEach(e=>{if(e.config.templates===void 0)return;let i={};Object.entries(e.config.templates).forEach(([r,c])=>{try{i[r]=o.templating.compile(c)}catch(l){o.logger.error(`Error compiling template ${r} for action ${e.identifier}`,l)}}),e.config.parsedTemplates=i})}#o;#e;set callbackFunction(t){this.connectorSDK.receiver.registerCallback(this.#r(t))}get connectorSDK(){return this.#e}#r(t){return async o=>{let e=this.#e.receiver.getActionConfig(o);return e?t(o,e):this.#e.receiver.responses.badRequest("Action not found")(o)}}};var a=class extends s{constructor(){super(...arguments);this.CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";this.init=async()=>{let{config:o}=this.connectorSDK,e=o.failProbability||0;e>0&&this.connectorSDK.logger.debug("Fail probability set to",e);let i=()=>Math.random()<e;this.callbackFunction=async(r,c)=>(this.connectorSDK.logger.info("Received message: ",r.testRun?"(test run)":"",r.eventId,r.payload),i()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(r)):this.connectorSDK.receiver.responses.ok()(r))}}};export{a as ConnectorRunnerDummyNode};
1
+ import*as n from"node:process";var s=class{constructor(t,o){this.#o="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=o,n.on?n.on("message",e=>{e.cmd===this.#o&&o.logger.verbose(`${n.pid} Received message from parent process:`,e)}):o.logger.warn("IPC channel is not available. process.on is undefined."),n.send||o.logger.warn("IPC channel is not available. process.send is undefined."),t.actions?.forEach(e=>{if(e.config.templates===void 0)return;let i={};Object.entries(e.config.templates).forEach(([r,c])=>{try{i[r]=o.templating.compile(c)}catch(p){o.logger.error(`Error compiling template ${r} for action ${e.identifier}`,p)}}),e.config.parsedTemplates=i})}#o;#e;set callbackFunction(t){this.connectorSDK.receiver.registerCallback(this.#r(t))}get connectorSDK(){return this.#e}#r(t){return async o=>{let e=this.#e.receiver.getActionConfig(o);return e?t(o,e):this.#e.receiver.responses.badRequest("Action not found")(o)}}};var a=class extends s{constructor(){super(...arguments);this.CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";this.init=async()=>{let{config:o}=this.connectorSDK,e=o.failProbability||0;e>0&&this.connectorSDK.logger.debug("Fail probability set to",e);let i=()=>Math.random()<e;this.callbackFunction=async(r,c)=>(this.connectorSDK.logger.info("Received message: ",r.testRun?"(test run)":"",r.eventId,r.payload),i()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(r)):this.connectorSDK.receiver.responses.ok()(r))}}};export{a as ConnectorRunnerDummyNode};
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ export interface FileInfo {
2
+ type: 'DIRECTORY' | 'FILE';
3
+ name: string;
4
+ size: number;
5
+ modifyTime: Date;
6
+ }
7
+ export interface FileHandleInterface {
8
+ get(): Buffer;
9
+ close(): boolean;
10
+ }
11
+ export interface FilesSDKInterface {
12
+ list(path: string): Promise<Array<FileInfo>>;
13
+ read(filePath: string): Promise<FileHandleInterface>;
14
+ write(filePath: string, data: FileHandleInterface | Buffer | string): Promise<boolean>;
15
+ delete(path: string): Promise<boolean>;
16
+ exists(path: string): Promise<boolean>;
17
+ pathAsDsn(path: string): string;
18
+ }
@@ -0,0 +1,38 @@
1
+ export interface HttpConfig {
2
+ baseUrl?: string;
3
+ contentType?: string;
4
+ timeout?: number;
5
+ }
6
+ export type HttpRequestOptions<D = string | object> = {
7
+ headers?: Record<string, string>;
8
+ params?: Record<string, string | number | boolean>;
9
+ data?: D;
10
+ withCredentials?: boolean;
11
+ };
12
+ export type HttpRequestOptionsFormatter<D = string | object> = (requestOptions: HttpRequestOptions<D>, method: HttpMethod, url: string) => Promise<HttpRequestOptions<D>> | HttpRequestOptions<D>;
13
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
14
+ export type HttpResponseHeader = string | Array<string> | number | boolean | null;
15
+ export type HttpResponse<D = unknown> = {
16
+ status: number;
17
+ data: D;
18
+ headers?: Record<string, HttpResponseHeader>;
19
+ };
20
+ export type HttpError = {
21
+ status: number;
22
+ error?: string;
23
+ };
24
+ interface PromiseWithReason<T = unknown, R = unknown> extends Promise<T> {
25
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: R) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
26
+ catch<TResult = never>(onrejected?: ((reason: R) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
27
+ }
28
+ export type HttpClientPromise<T> = PromiseWithReason<HttpResponse<T>, HttpError>;
29
+ export interface HttpClientSDKInterface {
30
+ get<R = unknown>(destination: string, options?: HttpRequestOptions): HttpClientPromise<R>;
31
+ post<R = unknown, D = string | object>(destination: string, data: D, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
32
+ put<R = unknown, D = string | object>(destination: string, data: D, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
33
+ patch<R = unknown, D = string | object>(destination: string, data: D, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
34
+ delete<R = unknown>(destination: string, options?: HttpRequestOptions): HttpClientPromise<R>;
35
+ request<R = unknown, D = string | object>(method: HttpMethod, url: string, options?: HttpRequestOptions<D>): HttpClientPromise<R>;
36
+ setRequestOptionsFormatter<D = string | object>(formatter: HttpRequestOptionsFormatter<D>): HttpClientSDKInterface;
37
+ }
38
+ export {};
@@ -1,7 +1,10 @@
1
1
  export * from './sdk.interface';
2
+ export * from './http-client.interface';
2
3
  export * from './logger.sdk.interface';
3
4
  export * from './offset-store.sdk.interface';
4
5
  export * from './processing.sdk.interface';
5
6
  export * from './receiver.sdk.interface';
6
7
  export * from './sender.sdk.interface';
8
+ export * from './telemetry.sdk.interface';
7
9
  export * from './templating.sdk.interface';
10
+ export * from './files.sdk.interface';
@@ -4,6 +4,7 @@ export interface StoredOffset {
4
4
  isoDate?: string;
5
5
  date?: string;
6
6
  rawTimestamp?: number | string;
7
+ [key: string]: string | number | undefined;
7
8
  }
8
9
  export interface OffsetStoreSDKInterface {
9
10
  getOffset(identifier: string): Promise<StoredOffset>;
@@ -1,5 +1,6 @@
1
1
  export interface IntervalHandler {
2
2
  name?: string;
3
+ onInit?: () => Promise<void> | void;
3
4
  onRun: () => Promise<void> | void;
4
5
  onStop?: () => Promise<void> | void;
5
6
  }
@@ -1,9 +1,12 @@
1
1
  import { BaseConnectorConfig } from '@xip-online-data/types';
2
+ import { FilesSDKInterface } from './files.sdk.interface';
3
+ import { HttpClientSDKInterface, HttpConfig } from './http-client.interface';
2
4
  import { LoggerSDKInterface } from './logger.sdk.interface';
3
5
  import { OffsetStoreSDKInterface } from './offset-store.sdk.interface';
4
6
  import { ProcessingSDKInterface } from './processing.sdk.interface';
5
7
  import { ReceiverSDKInterface } from './receiver.sdk.interface';
6
8
  import { SenderSDKInterface } from './sender.sdk.interface';
9
+ import { TelemetrySDKInterface } from './telemetry.sdk.interface';
7
10
  import { TemplatingSDKInterface } from './templating.sdk.interface';
8
11
  export interface ConnectorSDKInterface<T = BaseConnectorConfig> {
9
12
  get config(): T;
@@ -11,6 +14,18 @@ export interface ConnectorSDKInterface<T = BaseConnectorConfig> {
11
14
  get sender(): SenderSDKInterface;
12
15
  get receiver(): ReceiverSDKInterface;
13
16
  get templating(): TemplatingSDKInterface;
17
+ /**
18
+ * Service to schedule and manage processing tasks that need monitoring and retries.
19
+ */
14
20
  get processing(): ProcessingSDKInterface;
15
21
  get offsetStore(): OffsetStoreSDKInterface;
22
+ /**
23
+ * Ability to send telemetry data such as gauges and increments on how the connector is performing.
24
+ */
25
+ get telemetry(): TelemetrySDKInterface;
26
+ /**
27
+ * Get file service instance to access files using a specified DSN. If no DSN is provided, defaults to local file system tmp dir.
28
+ */
29
+ files(dsn?: string): FilesSDKInterface;
30
+ httpClient(httpConfig?: HttpConfig): HttpClientSDKInterface;
16
31
  }
@@ -0,0 +1,15 @@
1
+ export interface TelemetrySDKInterface {
2
+ /**
3
+ * Increment a telemetry counter by 1.
4
+ */
5
+ increment(key: string): void;
6
+ /**
7
+ * Increment a telemetry counter by a specified value. 0 doesn't send any telemetry.
8
+ * A negative value will decrement the counter.
9
+ */
10
+ increment(key: string, value: number): void;
11
+ /**
12
+ * Send a gauge telemetry metric.
13
+ */
14
+ gauge(key: string, value: number): void;
15
+ }
@@ -59,5 +59,6 @@ export declare enum HttpStatusCode {
59
59
  InsufficientStorage = 507,
60
60
  LoopDetected = 508,
61
61
  NotExtended = 510,
62
- NetworkAuthenticationRequired = 511
62
+ NetworkAuthenticationRequired = 511,
63
+ Aborted = 512
63
64
  }
@@ -7,6 +7,7 @@ export interface CreateEventInterface {
7
7
  origin: EventOriginInterface;
8
8
  payload: object;
9
9
  testRun?: boolean;
10
+ workflowDrawingId?: string;
10
11
  }
11
12
  export interface XodTriggerPayloadType {
12
13
  data?: Record<string, unknown> | Array<unknown>;
@@ -19,4 +20,5 @@ export interface EventInterface {
19
20
  payload: XodTriggerPayloadType;
20
21
  tenantIdentifier: string;
21
22
  testRun?: boolean;
23
+ workflowDrawingId?: string;
22
24
  }
@@ -36,4 +36,4 @@ export { MetaInterface } from './dataset/meta.interface';
36
36
  export { PreAggregationsInterface } from './dataset/pre-aggregations.interface';
37
37
  export { PreAggregateInterface } from './dataset/pre-aggregate.interface';
38
38
  export { TemplateImplementationOverridesInterface } from './template-implementation-overrides.interface';
39
- export * from './pagination';
39
+ export * from './web';
@@ -0,0 +1,6 @@
1
+ import { TriggerType } from '../workflow';
2
+ export interface CustomCronTriggerRecord {
3
+ triggerType: TriggerType;
4
+ workflowIdentifier: string;
5
+ tenantIdentifier: string;
6
+ }
@@ -1,3 +1,4 @@
1
+ export * from './custom-cron-trigger-record.interface';
1
2
  export * from './semantic-trigger-filter.interface';
2
3
  export * from './semantic-trigger-filters.interface';
3
4
  export * from './semantic-trigger-record.interface';
@@ -70,5 +70,6 @@ export interface SemanticTriggerInterface {
70
70
  cron?: string;
71
71
  tz?: string;
72
72
  incrementalField?: string;
73
+ keyField?: string;
73
74
  ungrouped?: boolean;
74
75
  }
@@ -0,0 +1,37 @@
1
+ import { PaginationInterface } from './index';
2
+ export declare const FilterOperator: {
3
+ readonly EQ: "eq";
4
+ readonly NEQ: "neq";
5
+ readonly CONTAINS: "ct";
6
+ readonly NOT_CONTAINS: "nct";
7
+ readonly STARTSWITH: "sw";
8
+ readonly ENDSWITH: "ew";
9
+ readonly NOT_STARTSWITH: "nsw";
10
+ readonly NOT_ENDSWITH: "new";
11
+ readonly BETWEEN: "bt";
12
+ readonly LT: "lt";
13
+ readonly LTE: "lte";
14
+ readonly GT: "gt";
15
+ readonly GTE: "gte";
16
+ readonly IN: "in";
17
+ readonly NOT_IN: "nin";
18
+ readonly LIKE: "like";
19
+ };
20
+ export type FilterOperator = (typeof FilterOperator)[keyof typeof FilterOperator];
21
+ export type FilterValue = {
22
+ [operator in FilterOperator]?: string | number | boolean | string[];
23
+ };
24
+ export declare const SortDirection: {
25
+ readonly ASC: "asc";
26
+ readonly DESC: "desc";
27
+ };
28
+ export type SortDirection = (typeof SortDirection)[keyof typeof SortDirection];
29
+ export type SortOrder<T> = {
30
+ [field in keyof T]?: (typeof SortDirection)[keyof typeof SortDirection];
31
+ };
32
+ export interface GenericFilterDto<T> extends PaginationInterface {
33
+ filter?: {
34
+ [field in keyof T]?: FilterValue;
35
+ };
36
+ sort?: SortOrder<T>;
37
+ }
@@ -1 +1,2 @@
1
+ export * from './generic-filter.dto';
1
2
  export * from './paginated-response.interface';
@@ -1,10 +1,8 @@
1
- export interface OffsetStore {
1
+ export interface ExtendedOffsetStore {
2
2
  timestamp: number;
3
3
  id: number | string;
4
4
  date?: string;
5
5
  rawTimestamp: number | string;
6
- }
7
- export interface ExtendedOffsetStore extends OffsetStore {
8
6
  [key: string]: string | number | undefined;
9
7
  }
10
8
  export interface OffsetInterface {
@@ -1,5 +1,14 @@
1
1
  export declare enum TriggerType {
2
2
  DASHBOARD_VISUALIZATION = "dashboard_visualization",
3
3
  FORM = "form",
4
- SEMANTIC_TRIGGER = "semantic_trigger"
4
+ SEMANTIC_TRIGGER = "semantic_trigger",
5
+ CUSTOM_CRON = "custom_cron",
6
+ /**
7
+ * @deprecated Use SEMANTIC_TRIGGER instead
8
+ */
9
+ SEMANTIC = "SEMANTIC",
10
+ /**
11
+ * @deprecated Use DASHBOARD_VISUALIZATION instead
12
+ */
13
+ DASHBOARD = "DASHBOARD"
5
14
  }
@@ -1,9 +1,10 @@
1
1
  import { TriggerType } from './trigger-types.interface';
2
2
  import { NodeTypes, WorkflowDrawing } from './workflow.drawing';
3
3
  export interface MessageMapper {
4
- [key: string]: string | {
4
+ [key: string]: {
5
5
  selector: string;
6
6
  type?: string;
7
+ required?: boolean;
7
8
  };
8
9
  }
9
10
  export interface ConditionMapper {
@@ -14,6 +15,12 @@ export interface ConditionMapper {
14
15
  };
15
16
  }
16
17
  export type NodeMapper = MessageMapper | ConditionMapper;
18
+ export interface TriggerInterface {
19
+ name: string;
20
+ type: TriggerType;
21
+ identifier: string;
22
+ expression?: string;
23
+ }
17
24
  export interface CreateWorkflowDefinitionStep {
18
25
  name: string;
19
26
  identifier: string;
@@ -39,6 +46,7 @@ export interface CreateWorkflowDefinition {
39
46
  steps: Array<CreateWorkflowDefinitionStep>;
40
47
  enabled: boolean;
41
48
  workflowDrawing?: WorkflowDrawing;
49
+ trigger?: TriggerInterface;
42
50
  }
43
51
  export interface WorkflowDefinition extends CreateWorkflowDefinition {
44
52
  steps: Array<WorkflowDefinitionStep>;
@@ -12,8 +12,9 @@ export declare enum WorkflowJobStatusStatus {
12
12
  RUNNING = "RUNNING",
13
13
  SUCCESS = "SUCCESS",
14
14
  SKIPPED = "SKIPPED",
15
- BAD_REQUEST = "BAD_REQUEST",
16
- INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR"
15
+ BAD_REQUEST = "BAD_REQUEST",// input validation errors
16
+ INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
17
+ ABORTED = "ABORTED"
17
18
  }
18
19
  export interface WorkflowRunInterface {
19
20
  id: string;
@@ -28,6 +29,7 @@ export interface WorkflowRunInterface {
28
29
  createdAt: Date;
29
30
  updatedAt: Date;
30
31
  testRun?: boolean;
32
+ restartOf?: string;
31
33
  }
32
34
  export interface WorkflowJobInterface {
33
35
  id: string;
@@ -63,3 +65,6 @@ export interface ValidationJob extends WorkflowJobInterface {
63
65
  type: NodeTypes.VALIDATION;
64
66
  with: ConditionMapper;
65
67
  }
68
+ export interface PlaceholderJob extends WorkflowJobInterface {
69
+ type: NodeTypes.PLACEHOLDER;
70
+ }
@@ -1,3 +1,4 @@
1
+ import { TriggerType } from './trigger-types.interface';
1
2
  import { ConditionMapper, MessageMapper } from './workflow-definition.interface';
2
3
  export declare enum NodeTypes {
3
4
  TRIGGER = "TRIGGER",
@@ -46,7 +47,7 @@ export interface TriggerNode extends Node {
46
47
  type: NodeTypes.TRIGGER;
47
48
  trigger: {
48
49
  name: string;
49
- type: string;
50
+ type: TriggerType;
50
51
  identifier: string;
51
52
  };
52
53
  }
@@ -2,10 +2,12 @@ export interface MessageMonitorConfig {
2
2
  type: 'in-memory' | 'redis' | 'disabled';
3
3
  }
4
4
  export declare enum ConfiguredConnectorTypes {
5
+ API = "api",
5
6
  API_SINK = "api-sink",
6
7
  API_SOURCE = "api-source",
7
8
  DUMMY_NODE = "dummy-node",
8
9
  FILE_COPY = "file-copy",
10
+ FILE = "file",
9
11
  FILE_SINK = "file-sink",
10
12
  FILE_SOURCE = "file-source",
11
13
  SAMBA_SINK = "samba-sink",
@@ -21,7 +23,8 @@ export declare enum ConfiguredConnectorTypes {
21
23
  OPCUA_SOURCE = "opcua-source",
22
24
  OPCUA_SINK = "opcua-sink",
23
25
  AI_AGENT = "ai-agent",
24
- MICROSOFT_OFFICE365_EMAIL = "microsoft-office365-email"
26
+ MICROSOFT_OFFICE365_EMAIL = "microsoft-office365-email",
27
+ MKG = "mkg"
25
28
  }
26
29
  export interface ConnectorConfig {
27
30
  type: ConfiguredConnectorTypes;
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "@transai/connector-runner-dummy-node",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "license": "LGPL-3.0-or-later",
8
+ "author": {
9
+ "name": "transAI",
10
+ "email": "samen@transai.com",
11
+ "url": "https://transai.com"
12
+ },
4
13
  "dependencies": {
5
14
  "tslib": "^2.3.0"
6
15
  },