@transai/connector-runner-dummy-node 0.14.0 → 0.15.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.
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.create;var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var y=(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 g(r))!b.call(t,o)&&o!==e&&i(t,o,{get:()=>r[o],enumerable:!(n=d(r,o))||n.enumerable});return t};var P=(t,r,e)=>(e=t!=null?l(I(t)):{},m(r||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),x=t=>m(i({},"__esModule",{value:!0}),t);var C={};y(C,{ConnectorRunnerDummyNode:()=>p});module.exports=x(C);var a=P(require("node:process")),s=class{#r="connector-runtime";#e;constructor(r,e){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,f])=>{try{o[c]=e.templating.compile(f)}catch(u){e.logger.error(`Error compiling template ${c} for action ${n.identifier}`,u)}}),n.config.parsedTemplates=o})}init=()=>Promise.resolve();start=()=>Promise.resolve();stop=()=>Promise.resolve();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 p=class extends s{CONNECTOR_INSTANCE="XOD_CONNECTOR_DUMMY_NODE_CONFIG";init=async()=>{let{config:r}=this.connectorSDK,e=r.failProbability||0;e>0&&this.connectorSDK.logger.debug("Fail probability set to",e);let n=()=>Math.random()<e;this.callbackFunction=async(o,c)=>(this.connectorSDK.logger.info("Received message: ",o.testRun?"(test run)":"",o.eventId,o.payload),n()?(this.connectorSDK.logger.error("Dummy process failed"),this.connectorSDK.receiver.responses.internalServerError("Dummy process failed")(o)):this.connectorSDK.receiver.responses.ok()(o))}};0&&(module.exports={ConnectorRunnerDummyNode});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -23,13 +23,26 @@ export interface NumberOutputParameterInterface extends OutputItemParameterInter
|
|
|
23
23
|
export interface OutputParameterInterface {
|
|
24
24
|
[key: string]: OutputItemParameterInterface | ArrayOutputParameterInterface | NumberOutputParameterInterface;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
interface BaseInputParameter {
|
|
27
27
|
name: string;
|
|
28
28
|
description?: string;
|
|
29
|
-
type: 'string' | 'number' | 'boolean' | 'array';
|
|
30
29
|
required?: boolean;
|
|
31
|
-
items?: Array<InputParameterInterface>;
|
|
32
30
|
}
|
|
31
|
+
export interface ValueInputParameter extends BaseInputParameter {
|
|
32
|
+
type: 'string' | 'number' | 'boolean';
|
|
33
|
+
}
|
|
34
|
+
export interface SimpleArrayInputParameter extends BaseInputParameter {
|
|
35
|
+
type: 'simple-array';
|
|
36
|
+
itemType: 'string' | 'number' | 'boolean';
|
|
37
|
+
}
|
|
38
|
+
export interface ArrayInputParameter extends BaseInputParameter {
|
|
39
|
+
type: 'array';
|
|
40
|
+
items: Array<InputParameterInterface>;
|
|
41
|
+
}
|
|
42
|
+
export interface UnknownInputParameter extends BaseInputParameter {
|
|
43
|
+
type: 'unknown';
|
|
44
|
+
}
|
|
45
|
+
export type InputParameterInterface = ValueInputParameter | SimpleArrayInputParameter | ArrayInputParameter | UnknownInputParameter;
|
|
33
46
|
export interface ActionInterface {
|
|
34
47
|
identifier: string;
|
|
35
48
|
version: string;
|
|
@@ -47,3 +60,4 @@ export interface ActionInterface {
|
|
|
47
60
|
mode?: ConnectorOrigin;
|
|
48
61
|
createdAt: Date;
|
|
49
62
|
}
|
|
63
|
+
export {};
|