@transai/connector-runner-ez-mes 0.29.3 → 0.29.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.29.4 (2026-11-27)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated @transai/connector-runtime-sdk to 0.24.4
6
+
7
+ ## 0.29.3 (2026-11-27)
8
+
9
+ ### 🧱 Updated Dependencies
10
+
11
+ - Updated @transai/connector-runtime-sdk to 0.24.3
12
+
1
13
  ## 0.29.2 (2026-11-25)
2
14
 
3
15
  ### 🩹 Fixes
package/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.create;var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var e in t)d(n,e,{get:t[e],enumerable:!0})},h=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S(t))!R.call(n,a)&&a!==e&&d(n,a,{get:()=>t[a],enumerable:!(r=b(t,a))||r.enumerable});return n};var D=(n,t,e)=>(e=n!=null?A(T(n)):{},h(t||!n||!n.__esModule?d(e,"default",{value:n,enumerable:!0}):e,n)),w=n=>h(d({},"__esModule",{value:!0}),n);var K={};k(K,{ConnectorRunnerEzMes:()=>v});module.exports=w(K);var c=D(require("node:process")),u=class{#e="connector-runtime";#t;constructor(t,e){this.#t=e,c.default.on?c.default.on("message",r=>{r.cmd===this.#e&&e.logger.verbose(`${c.default.pid} Received message from parent process:`,r)}):e.logger.warn("IPC channel is not available. process.on is undefined."),c.default.send||e.logger.warn("IPC channel is not available. process.send is undefined."),t.actions?.forEach(r=>{if(r.config.templates===void 0)return;let a={};Object.entries(r.config.templates).forEach(([i,s])=>{try{a[i]=e.templating.compile(s)}catch(C){e.logger.error(`Error compiling template ${i} for action ${r.identifier}`,C)}}),r.config.parsedTemplates=a})}init=()=>Promise.resolve();start=()=>Promise.resolve();stop=()=>Promise.resolve();set callbackFunction(t){this.connectorSDK.receiver.registerCallback(this.#r(t))}get connectorSDK(){return this.#t}#r(t){return async e=>{let r=await this.#t.receiver.getActionConfig(e);return r?t(e,r):this.#t.receiver.responses.badRequest("Action not found")(e)}}};var P=require("node:events");var o=class{constructor(t){this.travelerId=t}travelerId;static NAME="extract.travelers"};var E=require("node:events");var p=class extends E.EventEmitter{static TYPE="traveler.next-step";#e;constructor(t){super(),this.#e=t}async execute(t){let{travelerId:e}=t;if(typeof e!="string")throw new Error("travelerId parameter is required and must be a string");let r=await this.#e.post("/api/V1.2-INTEGRATION/nextStep",{TravelerId:e});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass)throw new Error(`Failed to move traveler to next step: ${JSON.stringify(r.data.arErrors)}`);this.emit(o.NAME,new o(e))}};var x=require("node:events");var m=class extends x.EventEmitter{static TYPE="traveler.start-step";#e;constructor(t){super(),this.#e=t}async execute(t){let{travelerId:e}=t;if(typeof e!="string")throw new Error("travelerId parameter is required and must be a string");let r=await this.#e.post("/api/V1.2-INTEGRATION/startTraveler",{TravelerId:e});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass)throw new Error(`Failed to start traveler: ${JSON.stringify(r.data.arErrors)}`);this.emit(o.NAME,new o(e))}};var y=require("node:events");var l=class extends y.EventEmitter{static TYPE="traveler.stop-step";#e;constructor(t){super(),this.#e=t}async execute(t){let{travelerId:e}=t;if(typeof e!="string")throw new Error("travelerId parameter is required and must be a string");let r=await this.#e.post("/api/V1.2-INTEGRATION/stopTraveler",{TravelerId:e});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass)throw new Error(`Failed to stop traveler: ${JSON.stringify(r.data.arErrors)}`);this.emit(o.NAME,new o(e))}};var I=class extends P.EventEmitter{#e;#t;constructor(t,e){super(),this.#e=t,this.#t={[p.TYPE]:this.#r(new p(e)),[m.TYPE]:this.#r(new m(e)),[l.TYPE]:this.#r(new l(e))}}get callbackFunctionChain(){return this.#n(this.#e.receiver.emitEventType(this.#e.receiver.responses.ok()))}removeAllListeners(t){return Object.values(this.#t).forEach(e=>e.removeAllListeners()),super.removeAllListeners(t)}#r(t){return t.on(o.NAME,e=>this.emit(o.NAME,e))}#n(t){return async(e,r)=>{let a=r.identifier,i=this.#t[a];if(!i)return this.#e.receiver.responses.badRequest(`Action ${a} does not exist.`)(e);try{await i.execute(e.payload),this.#e.logger.info(`Action ${a} executed successfully`)}catch(s){return this.#e.logger.error(`Action ${a} execution failed: ${s}`),this.#e.receiver.responses.internalServerError(`Action ${a} execution failed: ${s?.message??s}`)(e)}return t(e)}}};var f=class{static INTERVAL=300;#e;#t;name="ez-mes-traveler-extraction";constructor(t,e){this.#e=t,this.#t=e}async onRun(t){let e=new URLSearchParams;typeof t=="string"&&e.append("travelerId",t);let r=await this.#t.get("/api/V1.2-INTEGRATION/travelerInformation",{params:Object.fromEntries(e.entries())});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass){this.#e.logger.error(`Failed to fetch traveler information: ${JSON.stringify(r.data?.arErrors)}`);return}let a=r.data.Travelers??r.data.Result?.Travelers,i=typeof t=="string"?{level:"priority"}:void 0;await this.#e.sender.documents(a,{keyField:"TravelerId",collection:"ez-mes-travelers"},i)}};var g=class n{static TOKEN_EXPIRY_BUFFER=600;#e;#t;#r;constructor(t,e){this.#e=t,this.#t=e}async format(t){return{...t,params:{...t.params,User:this.#e.username,PassKey:await this.#n()}}}errorResponseCallback(t,e){return new Promise(async(r,a)=>{if(t.status!==401)throw t;this.#r=void 0;try{await this.#n()}catch(i){a(i);return}e.client.request(e.method,e.url,e.options).then(i=>r(i)).catch(i=>a(i))})}async#n(){let t=this.#r;if(t&&t.expiresAt>Date.now())return t.token;let e=new URLSearchParams;e.set("user",this.#e.username),e.set("password",this.#e.password);let r=await this.#t.get(`/api/V2.0-EZBRM/auth/currentkey?${e.toString()}`).catch(()=>null);if((!r||!r.data)&&(r=await this.#t.get(`/api/V2.0-EZBRM/auth/login?${e.toString()}`)),!r||!r.data)throw new Error("Failed to authenticate and retrieve authentication token");return this.#r={token:r.data,expiresAt:Date.now()+n.TOKEN_EXPIRY_BUFFER*1e3},r.data}};var v=class extends u{#e;#t;#r;constructor(t,e){super(t,e);let{config:r}=this.connectorSDK,a=new g(r,this.connectorSDK.httpClient({baseUrl:r.hostname}));this.#e=this.connectorSDK.httpClient({baseUrl:r.hostname}).setRequestOptionsFormatter(a.format.bind(a)).setErrorResponseHandler(a.errorResponseCallback.bind(a)),this.#t=new f(this.connectorSDK,this.#e),this.#r=new I(this.connectorSDK,this.#e).on(o.NAME,i=>this.#n(i)),this.callbackFunction=this.#r.callbackFunctionChain}init=async()=>{await Promise.all([this.connectorSDK.processing.registerInterval(f.INTERVAL,this.#t,{immediate:!0})])};stop=async()=>{this.#r.removeAllListeners()};#n=async t=>{await this.#t.onRun(t.travelerId)}};0&&(module.exports={ConnectorRunnerEzMes});
1
+ "use strict";var b=Object.create;var d=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var e in t)d(n,e,{get:t[e],enumerable:!0})},h=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S(t))!R.call(n,a)&&a!==e&&d(n,a,{get:()=>t[a],enumerable:!(r=A(t,a))||r.enumerable});return n};var D=(n,t,e)=>(e=n!=null?b(T(n)):{},h(t||!n||!n.__esModule?d(e,"default",{value:n,enumerable:!0}):e,n)),w=n=>h(d({},"__esModule",{value:!0}),n);var K={};k(K,{ConnectorRunnerEzMes:()=>g});module.exports=w(K);var c=D(require("node:process")),u=class{#e="connector-runtime";#t;constructor(t,e){this.#t=e,c.default.on?c.default.on("message",r=>{r.cmd===this.#e&&e.logger.verbose(`${c.default.pid} Received message from parent process:`,r)}):e.logger.warn("IPC channel is not available. process.on is undefined."),c.default.send||e.logger.warn("IPC channel is not available. process.send is undefined."),t.actions?.forEach(r=>{if(r.config.templates===void 0)return;let a={};Object.entries(r.config.templates).forEach(([i,s])=>{try{a[i]=e.templating.compile(s)}catch(C){e.logger.error(`Error compiling template ${i} for action ${r.identifier}`,C)}}),r.config.parsedTemplates=a})}init=()=>Promise.resolve();start=()=>Promise.resolve();stop=()=>Promise.resolve();set callbackFunction(t){this.connectorSDK.receiver.registerCallback(this.#r(t))}get connectorSDK(){return this.#t}#r(t){return async e=>{let r=await this.#t.receiver.getActionConfig(e);return r?t(e,r):this.#t.receiver.responses.badRequest("Action not found")(e)}}};var P=require("node:events");var o=class{constructor(t){this.travelerId=t}travelerId;static NAME="extract.travelers"};var E=require("node:events");var p=class extends E.EventEmitter{static TYPE="traveler.next-step";#e;constructor(t){super(),this.#e=t}async execute(t){let{travelerId:e}=t;if(typeof e!="string")throw new Error("travelerId parameter is required and must be a string");let r=await this.#e.post("/api/V1.2-INTEGRATION/nextStep",{TravelerId:e});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass)throw new Error(`Failed to move traveler to next step: ${JSON.stringify(r.data.arErrors)}`);this.emit(o.NAME,new o(e))}};var x=require("node:events");var m=class extends x.EventEmitter{static TYPE="traveler.start-step";#e;constructor(t){super(),this.#e=t}async execute(t){let{travelerId:e}=t;if(typeof e!="string")throw new Error("travelerId parameter is required and must be a string");let r=await this.#e.post("/api/V1.2-INTEGRATION/startTraveler",{TravelerId:e});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass)throw new Error(`Failed to start traveler: ${JSON.stringify(r.data.arErrors)}`);this.emit(o.NAME,new o(e))}};var y=require("node:events");var l=class extends y.EventEmitter{static TYPE="traveler.stop-step";#e;constructor(t){super(),this.#e=t}async execute(t){let{travelerId:e}=t;if(typeof e!="string")throw new Error("travelerId parameter is required and must be a string");let r=await this.#e.post("/api/V1.2-INTEGRATION/stopTraveler",{TravelerId:e});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass)throw new Error(`Failed to stop traveler: ${JSON.stringify(r.data.arErrors)}`);this.emit(o.NAME,new o(e))}};var I=class extends P.EventEmitter{#e;#t;constructor(t,e){super(),this.#e=t,this.#t={[p.TYPE]:this.#r(new p(e)),[m.TYPE]:this.#r(new m(e)),[l.TYPE]:this.#r(new l(e))}}get callbackFunctionChain(){return this.#n(this.#e.receiver.emitEventType(this.#e.receiver.responses.ok()))}removeAllListeners(t){return Object.values(this.#t).forEach(e=>e.removeAllListeners()),super.removeAllListeners(t)}#r(t){return t.on(o.NAME,e=>this.emit(o.NAME,e))}#n(t){return async(e,r)=>{let a=r.identifier,i=this.#t[a];if(!i)return this.#e.receiver.responses.badRequest(`Action ${a} does not exist.`)(e);try{await i.execute(e.payload),this.#e.logger.info(`Action ${a} executed successfully`)}catch(s){return this.#e.logger.error(`Action ${a} execution failed: ${s}`),this.#e.receiver.responses.internalServerError(`Action ${a} execution failed: ${s?.message??s}`)(e)}return t(e)}}};var f=class{static INTERVAL=300;#e;#t;name="ez-mes-traveler-extraction";constructor(t,e){this.#e=t,this.#t=e}async onRun(t){let e=new URLSearchParams;typeof t=="string"&&e.append("travelerId",t);let r=await this.#t.get("/api/V1.2-INTEGRATION/travelerInformation",{params:Object.fromEntries(e.entries())});if(r.status!==200||!r.data?.bPass&&!r.data?.Result?.bPass){this.#e.logger.error(`Failed to fetch traveler information: ${JSON.stringify(r.data?.arErrors)}`);return}let a=r.data.Travelers??r.data.Result?.Travelers,i=typeof t=="string"?{level:"priority"}:void 0;await this.#e.sender.documents(a,{keyField:"TravelerId",collection:"ez-mes-travelers"},i)}};var v=class n{static TOKEN_EXPIRY_BUFFER=600;#e;#t;#r;constructor(t,e){this.#e=t,this.#t=e}async format(t){return{...t,params:{...t.params,User:this.#e.username,PassKey:await this.#n()}}}errorResponseCallback(t,e){return new Promise(async(r,a)=>{if(t.status!==401)throw t;this.#r=void 0;try{await this.#n()}catch(i){a(i);return}e.client.request(e.method,e.url,e.options).then(i=>r(i)).catch(i=>a(i))})}async#n(){let t=this.#r;if(t&&t.expiresAt>Date.now())return t.token;let e=new URLSearchParams;e.set("user",this.#e.username),e.set("password",this.#e.password);let r=await this.#t.get(`/api/V2.0-EZBRM/auth/currentkey?${e.toString()}`).catch(()=>null);if((!r||!r.data)&&(r=await this.#t.get(`/api/V2.0-EZBRM/auth/login?${e.toString()}`)),!r||!r.data)throw new Error("Failed to authenticate and retrieve authentication token");return this.#r={token:r.data,expiresAt:Date.now()+n.TOKEN_EXPIRY_BUFFER*1e3},r.data}};var g=class extends u{#e;#t;#r;constructor(t,e){super(t,e);let{config:r}=this.connectorSDK,a=new v(r,this.connectorSDK.httpClient({baseUrl:r.hostname}));this.#e=this.connectorSDK.httpClient({baseUrl:r.hostname}).setRequestOptionsFormatter(a.format.bind(a)).setErrorResponseHandler(a.errorResponseCallback.bind(a)),this.#t=new f(this.connectorSDK,this.#e),this.#r=new I(this.connectorSDK,this.#e).on(o.NAME,i=>this.#n(i)),this.callbackFunction=this.#r.callbackFunctionChain}init=async()=>{await Promise.all([this.connectorSDK.processing.registerInterval(f.INTERVAL,this.#t,{immediate:!0})])};stop=async()=>{this.#r.removeAllListeners()};#n=async t=>{await this.#t.onRun(t.travelerId)}};0&&(module.exports={ConnectorRunnerEzMes});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -24,4 +24,9 @@ export type Result = boolean | {
24
24
  export interface SenderSDKInterface {
25
25
  metrics<T = never>(metrics: Array<T>, metadata?: Metadata & SenderMetadata, context?: Context, topic?: string): Promise<Result>;
26
26
  documents<T = object>(documents: Array<T>, metadata?: Metadata & SenderMetadata, context?: Context): Promise<Result>;
27
+ /**
28
+ * Moves this runner's documents and metrics to the ingestion api for tenants that have it enabled.
29
+ * Without it, or for other tenants, they keep going to Kafka.
30
+ */
31
+ useIngestionApi(): void;
27
32
  }
@@ -2,6 +2,12 @@ export declare enum ConnectorOrigin {
2
2
  from_template = "from_template",
3
3
  manual = "manual"
4
4
  }
5
+ export declare enum ActionOrigin {
6
+ manual = "manual",
7
+ from_template = "from_template",
8
+ overridden = "overridden",
9
+ custom = "custom"
10
+ }
5
11
  export interface LegacyOutputParameterInterface {
6
12
  [key: string]: string;
7
13
  }
@@ -57,7 +63,7 @@ export interface ActionInterface {
57
63
  };
58
64
  inputParameters: Array<InputParameterInterface>;
59
65
  outputParameters: LegacyOutputParameterInterface | OutputParameterInterface;
60
- mode?: ConnectorOrigin;
66
+ mode?: ActionOrigin;
61
67
  createdAt: Date;
62
68
  }
63
69
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transai/connector-runner-ez-mes",
3
- "version": "0.29.3",
3
+ "version": "0.29.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },