UNPKG

@interopio/gateway

Version:

[![npm version](https://img.shields.io/npm/v/@interopio/gateway.svg)](https://www.npmjs.com/package/@interopio/gateway)

3 lines (2 loc) 1 kB
"use strict";var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var y=(a,t)=>{for(var o in t)c(a,o,{get:t[o],enumerable:!0})},h=(a,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of l(t))!p.call(a,e)&&e!==o&&c(a,e,{get:()=>t[e],enumerable:!(n=f(t,e))||n.enumerable});return a};var m=a=>h(c({},"__esModule",{value:!0}),a);var b={};y(b,{create:()=>g,name:()=>w});module.exports=m(b);var w="custom";async function g(a,t){let{file:o,configuration:n}=a.publisher,e;try{e=await import(o),typeof e.default=="function"&&(e=e.default)}catch(i){t.error(`failed to load publisher from ${o}`,i);return}let s=n,u=typeof t.child=="function"?t.child(`[${o}]`):t,r=e(s,u);return async i=>{if(i==="start"){if(r.startup)return await r.startup(a.context)}else if(i==="stop"){if(r.cleanup)return r.cleanup??(()=>{})}else return await r.function(i)}}0&&(module.exports={create,name}); //# sourceMappingURL=custom.cjs.map