@transai/connector-runtime-sdk 0.16.0 → 0.22.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 +1 -1
- package/index.cjs.map +1 -1
- package/index.js.map +1 -1
- package/meta.cjs.json +3 -3
- package/meta.esm.json +3 -3
- package/package.json +2 -2
- package/src/lib/sdk/http-client.interface.d.ts +2 -0
- package/src/lib/types/action.d.ts +2 -2
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var g=Object.create;var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var
|
|
1
|
+
var g=Object.create;var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var b=(t,r)=>{for(var e in r)i(t,e,{get:r[e],enumerable:!0})},m=(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?g(P(t)):{},m(r||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),C=t=>m(i({},"__esModule",{value:!0}),t);var A={};b(A,{ConnectorOrigin:()=>f,ConnectorRuntimeSDK:()=>s,DEFAULT_TIMEOUT_SECONDS:()=>v,NullLogger:()=>p});module.exports=C(A);var f=(e=>(e.from_template="from_template",e.manual="manual",e))(f||{});var a=y(require("node:process")),s=class{constructor(r,e){this.#r="connector-runtime";this.init=()=>Promise.resolve();this.start=()=>Promise.resolve();this.stop=()=>Promise.resolve();this.#e=e,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(([c,u])=>{try{o[c]=e.templating.compile(u)}catch(l){e.logger.error(`Error compiling template ${c} for action ${n.identifier}`,l)}}),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 v=600;var p=class{info(){}debug(){}error(){}warn(){}verbose(){}};0&&(module.exports={ConnectorOrigin,ConnectorRuntimeSDK,DEFAULT_TIMEOUT_SECONDS,NullLogger});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../libs/connector-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/sdk/processing.sdk.interface.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\ninterface BaseInputParameter {\n name: string;\n description?: string;\n required?: boolean;\n}\n\nexport interface ValueInputParameter extends BaseInputParameter {\n type: 'string' | 'number' | 'boolean';\n}\n\nexport interface SimpleArrayInputParameter extends BaseInputParameter {\n type: 'simple-array';\n itemType: 'string' | 'number' | 'boolean';\n}\n\nexport interface ArrayInputParameter extends BaseInputParameter {\n type: 'array';\n items: Array<InputParameterInterface>;\n}\n\nexport interface UnknownInputParameter extends BaseInputParameter {\n type: 'unknown';\n}\n\nexport type InputParameterInterface =\n | ValueInputParameter\n | SimpleArrayInputParameter\n | ArrayInputParameter\n | UnknownInputParameter;\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]
|
|
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\ninterface BaseInputParameter {\n name: string;\n description?: string;\n required?: boolean;\n}\n\nexport interface ValueInputParameter extends BaseInputParameter {\n type: 'string' | 'number' | 'boolean';\n}\n\nexport interface SimpleArrayInputParameter extends BaseInputParameter {\n type: 'simple-array';\n itemType: 'string' | 'number' | 'boolean';\n}\n\nexport interface ArrayInputParameter extends BaseInputParameter {\n type: 'array';\n items: Array<InputParameterInterface>;\n}\n\nexport interface UnknownInputParameter extends BaseInputParameter {\n type: 'unknown';\n}\n\nexport type InputParameterInterface =\n | ValueInputParameter\n | SimpleArrayInputParameter\n | ArrayInputParameter\n | UnknownInputParameter;\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]:\n | { [key: string]: string | number | object }\n | string\n | number\n | 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", "/** The default timeout is 10 minutes */\nexport const DEFAULT_TIMEOUT_SECONDS = 10 * 60;\n\nexport interface IntervalHandler {\n name?: string;\n onInit?: () => Promise<void> | void;\n onRun: () => Promise<void> | void;\n onStop?: () => Promise<void> | void;\n}\n\n/**\n * Options for configuring an interval registered via {@link ProcessingSDKInterface.registerInterval}.\n */\nexport type RegisterIntervalOptions = {\n /**\n * If true, the handler will be invoked immediately once on registration,\n * in addition to subsequent scheduled executions.\n */\n immediate?: boolean;\n\n /**\n * Optional timeout, in seconds, for the interval.\n *\n * This value should be a positive number representing the maximum time,\n * in seconds, that the interval is allowed to run before being considered\n * timed out. Callers should not pass 0 or negative values.\n */\n timeout?: number;\n};\n\nexport interface ProcessingSDKInterface {\n registerInterval(\n intervalSeconds: number,\n handler: IntervalHandler,\n options?: RegisterIntervalOptions,\n ): Promise<string>;\n\n stopInterval(name: string): Promise<void>;\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
5
|
"mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,wBAAAC,EAAA,4BAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAN,GCAO,IAAKO,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,ECnHO,IAAMS,EAA0B,ICChC,IAAMC,EAAN,KAA+C,CACpD,MAAa,CAEb,CAEA,OAAc,CAEd,CAEA,OAAc,CAEd,CAEA,MAAa,CAEb,CAEA,SAAgB,CAEhB,CACF",
|
|
6
6
|
"names": ["index_exports", "__export", "ConnectorOrigin", "ConnectorRuntimeSDK", "DEFAULT_TIMEOUT_SECONDS", "NullLogger", "__toCommonJS", "ConnectorOrigin", "import_node_process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "process", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "DEFAULT_TIMEOUT_SECONDS", "NullLogger"]
|
|
7
7
|
}
|
package/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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/sdk/processing.sdk.interface.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\ninterface BaseInputParameter {\n name: string;\n description?: string;\n required?: boolean;\n}\n\nexport interface ValueInputParameter extends BaseInputParameter {\n type: 'string' | 'number' | 'boolean';\n}\n\nexport interface SimpleArrayInputParameter extends BaseInputParameter {\n type: 'simple-array';\n itemType: 'string' | 'number' | 'boolean';\n}\n\nexport interface ArrayInputParameter extends BaseInputParameter {\n type: 'array';\n items: Array<InputParameterInterface>;\n}\n\nexport interface UnknownInputParameter extends BaseInputParameter {\n type: 'unknown';\n}\n\nexport type InputParameterInterface =\n | ValueInputParameter\n | SimpleArrayInputParameter\n | ArrayInputParameter\n | UnknownInputParameter;\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]
|
|
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\ninterface BaseInputParameter {\n name: string;\n description?: string;\n required?: boolean;\n}\n\nexport interface ValueInputParameter extends BaseInputParameter {\n type: 'string' | 'number' | 'boolean';\n}\n\nexport interface SimpleArrayInputParameter extends BaseInputParameter {\n type: 'simple-array';\n itemType: 'string' | 'number' | 'boolean';\n}\n\nexport interface ArrayInputParameter extends BaseInputParameter {\n type: 'array';\n items: Array<InputParameterInterface>;\n}\n\nexport interface UnknownInputParameter extends BaseInputParameter {\n type: 'unknown';\n}\n\nexport type InputParameterInterface =\n | ValueInputParameter\n | SimpleArrayInputParameter\n | ArrayInputParameter\n | UnknownInputParameter;\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]:\n | { [key: string]: string | number | object }\n | string\n | number\n | 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", "/** The default timeout is 10 minutes */\nexport const DEFAULT_TIMEOUT_SECONDS = 10 * 60;\n\nexport interface IntervalHandler {\n name?: string;\n onInit?: () => Promise<void> | void;\n onRun: () => Promise<void> | void;\n onStop?: () => Promise<void> | void;\n}\n\n/**\n * Options for configuring an interval registered via {@link ProcessingSDKInterface.registerInterval}.\n */\nexport type RegisterIntervalOptions = {\n /**\n * If true, the handler will be invoked immediately once on registration,\n * in addition to subsequent scheduled executions.\n */\n immediate?: boolean;\n\n /**\n * Optional timeout, in seconds, for the interval.\n *\n * This value should be a positive number representing the maximum time,\n * in seconds, that the interval is allowed to run before being considered\n * timed out. Callers should not pass 0 or negative values.\n */\n timeout?: number;\n};\n\nexport interface ProcessingSDKInterface {\n registerInterval(\n intervalSeconds: number,\n handler: IntervalHandler,\n options?: RegisterIntervalOptions,\n ): Promise<string>;\n\n stopInterval(name: string): Promise<void>;\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
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,ECnHO,IAAMS,EAA0B,ICChC,IAAMC,EAAN,KAA+C,CACpD,MAAa,CAEb,CAEA,OAAc,CAEd,CAEA,OAAc,CAEd,CAEA,MAAa,CAEb,CAEA,SAAgB,CAEhB,CACF",
|
|
6
6
|
"names": ["ConnectorOrigin", "process", "ConnectorRuntimeSDK", "connector", "connectorSDK", "#IPC_CHANNEL", "#connectorSDK", "message", "action", "containers", "key", "value", "error", "callback", "#enrichWithActionConfig", "callbackFunction", "DEFAULT_TIMEOUT_SECONDS", "NullLogger"]
|
|
7
7
|
}
|
package/meta.cjs.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"inputs": {
|
|
3
3
|
"libs/connector-runtime-sdk/src/lib/types/action.ts": {
|
|
4
|
-
"bytes":
|
|
4
|
+
"bytes": 2110,
|
|
5
5
|
"imports": [],
|
|
6
6
|
"format": "esm"
|
|
7
7
|
},
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"format": "esm"
|
|
125
125
|
},
|
|
126
126
|
"libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.ts": {
|
|
127
|
-
"bytes":
|
|
127
|
+
"bytes": 3162,
|
|
128
128
|
"imports": [],
|
|
129
129
|
"format": "esm"
|
|
130
130
|
},
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"imports": [],
|
|
290
290
|
"exports": [],
|
|
291
291
|
"inputs": {},
|
|
292
|
-
"bytes":
|
|
292
|
+
"bytes": 9478
|
|
293
293
|
},
|
|
294
294
|
"dist/libs/connector-runtime-sdk/index.cjs": {
|
|
295
295
|
"imports": [
|
package/meta.esm.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"inputs": {
|
|
3
3
|
"libs/connector-runtime-sdk/src/lib/types/action.ts": {
|
|
4
|
-
"bytes":
|
|
4
|
+
"bytes": 2110,
|
|
5
5
|
"imports": [],
|
|
6
6
|
"format": "esm"
|
|
7
7
|
},
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"format": "esm"
|
|
125
125
|
},
|
|
126
126
|
"libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.ts": {
|
|
127
|
-
"bytes":
|
|
127
|
+
"bytes": 3162,
|
|
128
128
|
"imports": [],
|
|
129
129
|
"format": "esm"
|
|
130
130
|
},
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"imports": [],
|
|
290
290
|
"exports": [],
|
|
291
291
|
"inputs": {},
|
|
292
|
-
"bytes":
|
|
292
|
+
"bytes": 8976
|
|
293
293
|
},
|
|
294
294
|
"dist/libs/connector-runtime-sdk/index.js": {
|
|
295
295
|
"imports": [
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ export interface HttpConfig {
|
|
|
2
2
|
baseUrl?: string;
|
|
3
3
|
contentType?: string;
|
|
4
4
|
timeout?: number;
|
|
5
|
+
insecure?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export type HttpRequestOptions<D = string | object> = {
|
|
7
8
|
headers?: Record<string, string>;
|
|
@@ -28,6 +29,7 @@ export type HttpResponse<D = unknown> = {
|
|
|
28
29
|
export type HttpError = {
|
|
29
30
|
status: number;
|
|
30
31
|
error?: string;
|
|
32
|
+
headers?: Record<string, HttpResponseHeader>;
|
|
31
33
|
};
|
|
32
34
|
interface PromiseWithReason<T = unknown, R = unknown> extends Promise<T> {
|
|
33
35
|
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: R) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
@@ -52,8 +52,8 @@ export interface ActionInterface {
|
|
|
52
52
|
connectorIdentifier: string;
|
|
53
53
|
config: {
|
|
54
54
|
[key: string]: {
|
|
55
|
-
[key: string]: string | object;
|
|
56
|
-
} | string | object;
|
|
55
|
+
[key: string]: string | number | object;
|
|
56
|
+
} | string | number | object;
|
|
57
57
|
};
|
|
58
58
|
inputParameters: Array<InputParameterInterface>;
|
|
59
59
|
outputParameters: LegacyOutputParameterInterface | OutputParameterInterface;
|