@transai/connector-runtime-sdk 0.1.0 → 0.2.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 (42) hide show
  1. package/index.cjs +2 -0
  2. package/index.cjs.map +7 -0
  3. package/index.js +2 -0
  4. package/index.js.map +7 -0
  5. package/meta.cjs.json +250 -0
  6. package/meta.esm.json +252 -0
  7. package/package.json +1 -1
  8. package/src/lib/connector-runtime.d.ts +16 -0
  9. package/src/lib/connector-runtime.interface.d.ts +5 -0
  10. package/src/lib/sdk/files.sdk.interface.d.ts +18 -0
  11. package/src/lib/sdk/http-client.interface.d.ts +38 -0
  12. package/src/lib/sdk/logger.sdk.interface.d.ts +7 -0
  13. package/src/lib/sdk/offset-store.sdk.interface.d.ts +12 -0
  14. package/src/lib/sdk/processing.sdk.interface.d.ts +13 -0
  15. package/src/lib/sdk/receiver.sdk.interface.d.ts +14 -0
  16. package/src/lib/sdk/sdk.interface.d.ts +31 -0
  17. package/src/lib/sdk/sender.sdk.interface.d.ts +22 -0
  18. package/src/lib/sdk/telemetry.sdk.interface.d.ts +15 -0
  19. package/src/lib/sdk/templating.sdk.interface.d.ts +12 -0
  20. package/.eslintrc.json +0 -30
  21. package/CHANGELOG.md +0 -25
  22. package/README.md +0 -11
  23. package/jest.config.ts +0 -10
  24. package/project.json +0 -37
  25. package/src/lib/connector-runtime.interface.ts +0 -7
  26. package/src/lib/connector-runtime.spec.ts +0 -115
  27. package/src/lib/connector-runtime.ts +0 -119
  28. package/src/lib/sdk/files.sdk.interface.ts +0 -29
  29. package/src/lib/sdk/http-client.interface.ts +0 -110
  30. package/src/lib/sdk/logger.sdk.interface.ts +0 -11
  31. package/src/lib/sdk/offset-store.sdk.interface.ts +0 -14
  32. package/src/lib/sdk/processing.sdk.interface.ts +0 -20
  33. package/src/lib/sdk/receiver.sdk.interface.ts +0 -29
  34. package/src/lib/sdk/sdk.interface.ts +0 -42
  35. package/src/lib/sdk/sender.sdk.interface.ts +0 -34
  36. package/src/lib/sdk/telemetry.sdk.interface.ts +0 -12
  37. package/src/lib/sdk/templating.sdk.interface.ts +0 -16
  38. package/tsconfig.json +0 -16
  39. package/tsconfig.lib.json +0 -11
  40. package/tsconfig.spec.json +0 -14
  41. /package/src/{index.ts → index.d.ts} +0 -0
  42. /package/src/lib/sdk/{index.ts → index.d.ts} +0 -0
package/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ var l=Object.create;var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var u=(r,o)=>{for(var e in o)i(r,e,{get:o[e],enumerable:!0})},f=(r,o,e,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of d(o))!b.call(r,n)&&n!==e&&i(r,n,{get:()=>o[n],enumerable:!(t=g(o,n))||t.enumerable});return r};var I=(r,o,e)=>(e=r!=null?l(C(r)):{},f(o||!r||!r.__esModule?i(e,"default",{value:r,enumerable:!0}):e,r)),x=r=>f(i({},"__esModule",{value:!0}),r);var h={};u(h,{ConnectorRuntimeSDK:()=>c});module.exports=x(h);var s=I(require("node:process")),c=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",t=>{t.cmd===this.#o&&e.logger.verbose(`${s.pid} Received message from parent process:`,t)}):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(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(m){e.logger.error(`Error compiling template ${a} for action ${t.identifier}`,m)}}),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=this.#e.receiver.getActionConfig(e);return t?o(e,t):this.#e.receiver.responses.badRequest("Action not found")(e)}}};0&&(module.exports={ConnectorRuntimeSDK});
2
+ //# sourceMappingURL=index.cjs.map
package/index.cjs.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../libs/connector-runtime-sdk/src/index.ts", "../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts"],
4
+ "sourcesContent": ["export * from './lib/connector-runtime';\nexport * from './lib/connector-runtime.interface';\nexport * from './lib/sdk';\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"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,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",
6
+ "names": ["index_exports", "__export", "ConnectorRuntimeSDK", "__toCommonJS", "process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction"]
7
+ }
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import*as r from"node:process";var i=class{constructor(t,e){this.#o="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=e,r.on?r.on("message",o=>{o.cmd===this.#o&&e.logger.verbose(`${r.pid} Received message from parent process:`,o)}):e.logger.warn("IPC channel is not available. process.on is undefined."),r.send||e.logger.warn("IPC channel is not available. process.send is undefined."),t.actions?.forEach(o=>{if(o.config.templates===void 0)return;let n={};Object.entries(o.config.templates).forEach(([s,c])=>{try{n[s]=e.templating.compile(c)}catch(a){e.logger.error(`Error compiling template ${s} for action ${o.identifier}`,a)}}),o.config.parsedTemplates=n})}#o;#e;set callbackFunction(t){this.connectorSDK.receiver.registerCallback(this.#r(t))}get connectorSDK(){return this.#e}#r(t){return async e=>{let o=this.#e.receiver.getActionConfig(e);return o?t(e,o):this.#e.receiver.responses.badRequest("Action not found")(e)}}};export{i as ConnectorRuntimeSDK};
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../libs/connector-runtime-sdk/src/lib/connector-runtime.ts"],
4
+ "sourcesContent": ["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"],
5
+ "mappings": "AAAA,UAAYA,MAAa,eAkBlB,IAAeC,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",
6
+ "names": ["process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction"]
7
+ }
package/meta.cjs.json ADDED
@@ -0,0 +1,250 @@
1
+ {
2
+ "inputs": {
3
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
4
+ "bytes": 3300,
5
+ "imports": [
6
+ {
7
+ "path": "node:process",
8
+ "kind": "import-statement",
9
+ "external": true
10
+ },
11
+ {
12
+ "path": "@xip-online-data/types",
13
+ "kind": "import-statement",
14
+ "external": true
15
+ },
16
+ {
17
+ "path": "./connector-runtime.interface",
18
+ "kind": "import-statement",
19
+ "external": true
20
+ },
21
+ {
22
+ "path": "./sdk",
23
+ "kind": "import-statement",
24
+ "external": true
25
+ }
26
+ ],
27
+ "format": "esm"
28
+ },
29
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.interface.ts": {
30
+ "bytes": 125,
31
+ "imports": [],
32
+ "format": "esm"
33
+ },
34
+ "libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.ts": {
35
+ "bytes": 1511,
36
+ "imports": [
37
+ {
38
+ "path": "@xip-online-data/types",
39
+ "kind": "import-statement",
40
+ "external": true
41
+ },
42
+ {
43
+ "path": "./files.sdk.interface",
44
+ "kind": "import-statement",
45
+ "external": true
46
+ },
47
+ {
48
+ "path": "./http-client.interface",
49
+ "kind": "import-statement",
50
+ "external": true
51
+ },
52
+ {
53
+ "path": "./logger.sdk.interface",
54
+ "kind": "import-statement",
55
+ "external": true
56
+ },
57
+ {
58
+ "path": "./offset-store.sdk.interface",
59
+ "kind": "import-statement",
60
+ "external": true
61
+ },
62
+ {
63
+ "path": "./processing.sdk.interface",
64
+ "kind": "import-statement",
65
+ "external": true
66
+ },
67
+ {
68
+ "path": "./receiver.sdk.interface",
69
+ "kind": "import-statement",
70
+ "external": true
71
+ },
72
+ {
73
+ "path": "./sender.sdk.interface",
74
+ "kind": "import-statement",
75
+ "external": true
76
+ },
77
+ {
78
+ "path": "./telemetry.sdk.interface",
79
+ "kind": "import-statement",
80
+ "external": true
81
+ },
82
+ {
83
+ "path": "./templating.sdk.interface",
84
+ "kind": "import-statement",
85
+ "external": true
86
+ }
87
+ ],
88
+ "format": "esm"
89
+ },
90
+ "libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.ts": {
91
+ "bytes": 2475,
92
+ "imports": [],
93
+ "format": "esm"
94
+ },
95
+ "libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.ts": {
96
+ "bytes": 244,
97
+ "imports": [],
98
+ "format": "esm"
99
+ },
100
+ "libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.ts": {
101
+ "bytes": 359,
102
+ "imports": [],
103
+ "format": "esm"
104
+ },
105
+ "libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.ts": {
106
+ "bytes": 467,
107
+ "imports": [],
108
+ "format": "esm"
109
+ },
110
+ "libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.ts": {
111
+ "bytes": 945,
112
+ "imports": [
113
+ {
114
+ "path": "@xip-online-data/types",
115
+ "kind": "import-statement",
116
+ "external": true
117
+ }
118
+ ],
119
+ "format": "esm"
120
+ },
121
+ "libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.ts": {
122
+ "bytes": 660,
123
+ "imports": [],
124
+ "format": "esm"
125
+ },
126
+ "libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.ts": {
127
+ "bytes": 417,
128
+ "imports": [],
129
+ "format": "esm"
130
+ },
131
+ "libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.ts": {
132
+ "bytes": 349,
133
+ "imports": [],
134
+ "format": "esm"
135
+ },
136
+ "libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.ts": {
137
+ "bytes": 563,
138
+ "imports": [],
139
+ "format": "esm"
140
+ },
141
+ "libs/connector-runtime-sdk/src/lib/sdk/index.ts": {
142
+ "bytes": 412,
143
+ "imports": [
144
+ {
145
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.ts",
146
+ "kind": "import-statement",
147
+ "original": "./sdk.interface"
148
+ },
149
+ {
150
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.ts",
151
+ "kind": "import-statement",
152
+ "original": "./http-client.interface"
153
+ },
154
+ {
155
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.ts",
156
+ "kind": "import-statement",
157
+ "original": "./logger.sdk.interface"
158
+ },
159
+ {
160
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.ts",
161
+ "kind": "import-statement",
162
+ "original": "./offset-store.sdk.interface"
163
+ },
164
+ {
165
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.ts",
166
+ "kind": "import-statement",
167
+ "original": "./processing.sdk.interface"
168
+ },
169
+ {
170
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.ts",
171
+ "kind": "import-statement",
172
+ "original": "./receiver.sdk.interface"
173
+ },
174
+ {
175
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.ts",
176
+ "kind": "import-statement",
177
+ "original": "./sender.sdk.interface"
178
+ },
179
+ {
180
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.ts",
181
+ "kind": "import-statement",
182
+ "original": "./telemetry.sdk.interface"
183
+ },
184
+ {
185
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.ts",
186
+ "kind": "import-statement",
187
+ "original": "./templating.sdk.interface"
188
+ },
189
+ {
190
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.ts",
191
+ "kind": "import-statement",
192
+ "original": "./files.sdk.interface"
193
+ }
194
+ ],
195
+ "format": "esm"
196
+ },
197
+ "libs/connector-runtime-sdk/src/index.ts": {
198
+ "bytes": 119,
199
+ "imports": [
200
+ {
201
+ "path": "libs/connector-runtime-sdk/src/lib/connector-runtime.ts",
202
+ "kind": "import-statement",
203
+ "original": "./lib/connector-runtime"
204
+ },
205
+ {
206
+ "path": "libs/connector-runtime-sdk/src/lib/connector-runtime.interface.ts",
207
+ "kind": "import-statement",
208
+ "original": "./lib/connector-runtime.interface"
209
+ },
210
+ {
211
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/index.ts",
212
+ "kind": "import-statement",
213
+ "original": "./lib/sdk"
214
+ }
215
+ ],
216
+ "format": "esm"
217
+ }
218
+ },
219
+ "outputs": {
220
+ "dist/libs/connector-runtime-sdk/index.cjs.map": {
221
+ "imports": [],
222
+ "exports": [],
223
+ "inputs": {},
224
+ "bytes": 5115
225
+ },
226
+ "dist/libs/connector-runtime-sdk/index.cjs": {
227
+ "imports": [
228
+ {
229
+ "path": "node:process",
230
+ "kind": "require-call",
231
+ "external": true
232
+ }
233
+ ],
234
+ "exports": [],
235
+ "entryPoint": "libs/connector-runtime-sdk/src/index.ts",
236
+ "inputs": {
237
+ "libs/connector-runtime-sdk/src/index.ts": {
238
+ "bytesInOutput": 62
239
+ },
240
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
241
+ "bytesInOutput": 998
242
+ },
243
+ "libs/connector-runtime-sdk/src/lib/sdk/index.ts": {
244
+ "bytesInOutput": 0
245
+ }
246
+ },
247
+ "bytes": 1695
248
+ }
249
+ }
250
+ }
package/meta.esm.json ADDED
@@ -0,0 +1,252 @@
1
+ {
2
+ "inputs": {
3
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
4
+ "bytes": 3300,
5
+ "imports": [
6
+ {
7
+ "path": "node:process",
8
+ "kind": "import-statement",
9
+ "external": true
10
+ },
11
+ {
12
+ "path": "@xip-online-data/types",
13
+ "kind": "import-statement",
14
+ "external": true
15
+ },
16
+ {
17
+ "path": "./connector-runtime.interface",
18
+ "kind": "import-statement",
19
+ "external": true
20
+ },
21
+ {
22
+ "path": "./sdk",
23
+ "kind": "import-statement",
24
+ "external": true
25
+ }
26
+ ],
27
+ "format": "esm"
28
+ },
29
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.interface.ts": {
30
+ "bytes": 125,
31
+ "imports": [],
32
+ "format": "esm"
33
+ },
34
+ "libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.ts": {
35
+ "bytes": 1511,
36
+ "imports": [
37
+ {
38
+ "path": "@xip-online-data/types",
39
+ "kind": "import-statement",
40
+ "external": true
41
+ },
42
+ {
43
+ "path": "./files.sdk.interface",
44
+ "kind": "import-statement",
45
+ "external": true
46
+ },
47
+ {
48
+ "path": "./http-client.interface",
49
+ "kind": "import-statement",
50
+ "external": true
51
+ },
52
+ {
53
+ "path": "./logger.sdk.interface",
54
+ "kind": "import-statement",
55
+ "external": true
56
+ },
57
+ {
58
+ "path": "./offset-store.sdk.interface",
59
+ "kind": "import-statement",
60
+ "external": true
61
+ },
62
+ {
63
+ "path": "./processing.sdk.interface",
64
+ "kind": "import-statement",
65
+ "external": true
66
+ },
67
+ {
68
+ "path": "./receiver.sdk.interface",
69
+ "kind": "import-statement",
70
+ "external": true
71
+ },
72
+ {
73
+ "path": "./sender.sdk.interface",
74
+ "kind": "import-statement",
75
+ "external": true
76
+ },
77
+ {
78
+ "path": "./telemetry.sdk.interface",
79
+ "kind": "import-statement",
80
+ "external": true
81
+ },
82
+ {
83
+ "path": "./templating.sdk.interface",
84
+ "kind": "import-statement",
85
+ "external": true
86
+ }
87
+ ],
88
+ "format": "esm"
89
+ },
90
+ "libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.ts": {
91
+ "bytes": 2475,
92
+ "imports": [],
93
+ "format": "esm"
94
+ },
95
+ "libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.ts": {
96
+ "bytes": 244,
97
+ "imports": [],
98
+ "format": "esm"
99
+ },
100
+ "libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.ts": {
101
+ "bytes": 359,
102
+ "imports": [],
103
+ "format": "esm"
104
+ },
105
+ "libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.ts": {
106
+ "bytes": 467,
107
+ "imports": [],
108
+ "format": "esm"
109
+ },
110
+ "libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.ts": {
111
+ "bytes": 945,
112
+ "imports": [
113
+ {
114
+ "path": "@xip-online-data/types",
115
+ "kind": "import-statement",
116
+ "external": true
117
+ }
118
+ ],
119
+ "format": "esm"
120
+ },
121
+ "libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.ts": {
122
+ "bytes": 660,
123
+ "imports": [],
124
+ "format": "esm"
125
+ },
126
+ "libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.ts": {
127
+ "bytes": 417,
128
+ "imports": [],
129
+ "format": "esm"
130
+ },
131
+ "libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.ts": {
132
+ "bytes": 349,
133
+ "imports": [],
134
+ "format": "esm"
135
+ },
136
+ "libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.ts": {
137
+ "bytes": 563,
138
+ "imports": [],
139
+ "format": "esm"
140
+ },
141
+ "libs/connector-runtime-sdk/src/lib/sdk/index.ts": {
142
+ "bytes": 412,
143
+ "imports": [
144
+ {
145
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.ts",
146
+ "kind": "import-statement",
147
+ "original": "./sdk.interface"
148
+ },
149
+ {
150
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.ts",
151
+ "kind": "import-statement",
152
+ "original": "./http-client.interface"
153
+ },
154
+ {
155
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.ts",
156
+ "kind": "import-statement",
157
+ "original": "./logger.sdk.interface"
158
+ },
159
+ {
160
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.ts",
161
+ "kind": "import-statement",
162
+ "original": "./offset-store.sdk.interface"
163
+ },
164
+ {
165
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.ts",
166
+ "kind": "import-statement",
167
+ "original": "./processing.sdk.interface"
168
+ },
169
+ {
170
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.ts",
171
+ "kind": "import-statement",
172
+ "original": "./receiver.sdk.interface"
173
+ },
174
+ {
175
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.ts",
176
+ "kind": "import-statement",
177
+ "original": "./sender.sdk.interface"
178
+ },
179
+ {
180
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.ts",
181
+ "kind": "import-statement",
182
+ "original": "./telemetry.sdk.interface"
183
+ },
184
+ {
185
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.ts",
186
+ "kind": "import-statement",
187
+ "original": "./templating.sdk.interface"
188
+ },
189
+ {
190
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.ts",
191
+ "kind": "import-statement",
192
+ "original": "./files.sdk.interface"
193
+ }
194
+ ],
195
+ "format": "esm"
196
+ },
197
+ "libs/connector-runtime-sdk/src/index.ts": {
198
+ "bytes": 119,
199
+ "imports": [
200
+ {
201
+ "path": "libs/connector-runtime-sdk/src/lib/connector-runtime.ts",
202
+ "kind": "import-statement",
203
+ "original": "./lib/connector-runtime"
204
+ },
205
+ {
206
+ "path": "libs/connector-runtime-sdk/src/lib/connector-runtime.interface.ts",
207
+ "kind": "import-statement",
208
+ "original": "./lib/connector-runtime.interface"
209
+ },
210
+ {
211
+ "path": "libs/connector-runtime-sdk/src/lib/sdk/index.ts",
212
+ "kind": "import-statement",
213
+ "original": "./lib/sdk"
214
+ }
215
+ ],
216
+ "format": "esm"
217
+ }
218
+ },
219
+ "outputs": {
220
+ "dist/libs/connector-runtime-sdk/index.js.map": {
221
+ "imports": [],
222
+ "exports": [],
223
+ "inputs": {},
224
+ "bytes": 4814
225
+ },
226
+ "dist/libs/connector-runtime-sdk/index.js": {
227
+ "imports": [
228
+ {
229
+ "path": "node:process",
230
+ "kind": "import-statement",
231
+ "external": true
232
+ }
233
+ ],
234
+ "exports": [
235
+ "ConnectorRuntimeSDK"
236
+ ],
237
+ "entryPoint": "libs/connector-runtime-sdk/src/index.ts",
238
+ "inputs": {
239
+ "libs/connector-runtime-sdk/src/lib/connector-runtime.ts": {
240
+ "bytesInOutput": 1000
241
+ },
242
+ "libs/connector-runtime-sdk/src/index.ts": {
243
+ "bytesInOutput": 0
244
+ },
245
+ "libs/connector-runtime-sdk/src/lib/sdk/index.ts": {
246
+ "bytesInOutput": 0
247
+ }
248
+ },
249
+ "bytes": 1068
250
+ }
251
+ }
252
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transai/connector-runtime-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -0,0 +1,16 @@
1
+ import { KafkaCallbackResponse, BaseConnectorConfig, ActionInterface, ConnectorInterface, XodJobType } from '@xip-online-data/types';
2
+ import { ConnectorRuntimeInterface } from './connector-runtime.interface';
3
+ import { ConnectorSDKInterface } from './sdk';
4
+ export interface IpcMessage {
5
+ cmd: string;
6
+ message: string;
7
+ }
8
+ export declare abstract class ConnectorRuntimeSDK<T extends BaseConnectorConfig = BaseConnectorConfig> implements ConnectorRuntimeInterface {
9
+ #private;
10
+ constructor(connector: ConnectorInterface, connectorSDK: ConnectorSDKInterface);
11
+ init: () => Promise<void>;
12
+ start: () => Promise<void>;
13
+ stop: () => Promise<void>;
14
+ set callbackFunction(callback: (message: XodJobType, action: ActionInterface) => Promise<KafkaCallbackResponse>);
15
+ protected get connectorSDK(): ConnectorSDKInterface<T>;
16
+ }
@@ -0,0 +1,5 @@
1
+ export interface ConnectorRuntimeInterface {
2
+ init(): Promise<void>;
3
+ start(): Promise<void>;
4
+ stop(): Promise<void>;
5
+ }
@@ -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 {};
@@ -0,0 +1,7 @@
1
+ export interface LoggerSDKInterface {
2
+ info(...args: Array<unknown>): void;
3
+ debug(...args: Array<unknown>): void;
4
+ error(...args: Array<unknown>): void;
5
+ warn(...args: Array<unknown>): void;
6
+ verbose(...args: Array<unknown>): void;
7
+ }
@@ -0,0 +1,12 @@
1
+ export interface StoredOffset {
2
+ timestamp: number;
3
+ id: number | string;
4
+ isoDate?: string;
5
+ date?: string;
6
+ rawTimestamp?: number | string;
7
+ [key: string]: string | number | undefined;
8
+ }
9
+ export interface OffsetStoreSDKInterface {
10
+ getOffset(identifier: string): Promise<StoredOffset>;
11
+ setOffset(offset: StoredOffset, identifier: string): void;
12
+ }