@streamlayer/sdk-web 0.29.2 → 0.29.3
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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/package.json +4 -4
package/lib/cjs/index.js
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
`),c=`
|
|
17
17
|
`+r+(u.length?s("│"):" ")+" ";return r+f.join(c)+`
|
|
18
18
|
`+u.map(function(h,b){var g=b===u.length-1,m=h.nodes&&h.nodes.length,E=r+(g?" ":s("│"))+" ";return r+s(g?"└":"├")+s("─")+s(m?"┬":"─")+" "+t(h,E,o).slice(r.length+2)}).join("")};const Ds=js,Dr=Symbol("avvio.TimeTree.untrackNode"),Gt=Symbol("avvio.TimeTree.trackNode"),Vr=Symbol("avvio.TimeTree.getParent"),Mr=Symbol("avvio.TimeTree.getNode"),qr=Symbol("avvio.TimeTree.addNode");let Vs=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[Gt](e){this.tableId.set(e.id,e),this.tableLabel.has(e.label)?this.tableLabel.get(e.label).push(e):this.tableLabel.set(e.label,[e])}[Dr](e){this.tableId.delete(e.id);const r=this.tableLabel.get(e.label);if(r.id){this.tableLabel.delete(e.label);return}r.pop(),r.length===0&&this.tableLabel.delete(e.label)}[Vr](e){if(e===null)return this.root;const r=this.tableLabel.get(e);return r.id?r:r[r.length-1]}[Mr](e){return this.tableId.get(e)}[qr](e,r,o){if(e===null)return this.root={id:"root",label:r,start:o,nodes:[]},this[Gt](this.root),this.root.id;const u=this[Vr](e),f=`${r}-${Math.random()}`,c={id:f,parent:e,start:o,label:r,nodes:[]};return u.nodes.push(c),this[Gt](c),f}start(e,r,o=Date.now()){return this[qr](e,r,o)}stop(e,r=Date.now()){const o=this[Mr](e);o&&(o.stop=r,o.diff=o.stop-o.start||0,this[Dr](o))}toJSON(){return Object.assign({},this.root)}prittyPrint(){const e=o=>(o.label=`${o.label} ${o.diff} ms`,o.nodes.length>0&&(o.nodes=o.nodes.map(s=>e(s))),o),r=e(this.toJSON());return Ds(r)}};var Ms=Vs,Er={exports:{}},ur={exports:{}},zt,Qr;function qs(){if(Qr)return zt;Qr=1;var t=1e3,e=t*60,r=e*60,o=r*24,s=o*7,u=o*365.25;zt=function(g,m){m=m||{};var E=typeof g;if(E==="string"&&g.length>0)return f(g);if(E==="number"&&isFinite(g))return m.long?h(g):c(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))};function f(g){if(g=String(g),!(g.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g);if(m){var E=parseFloat(m[1]),T=(m[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return E*u;case"weeks":case"week":case"w":return E*s;case"days":case"day":case"d":return E*o;case"hours":case"hour":case"hrs":case"hr":case"h":return E*r;case"minutes":case"minute":case"mins":case"min":case"m":return E*e;case"seconds":case"second":case"secs":case"sec":case"s":return E*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return E;default:return}}}}function c(g){var m=Math.abs(g);return m>=o?Math.round(g/o)+"d":m>=r?Math.round(g/r)+"h":m>=e?Math.round(g/e)+"m":m>=t?Math.round(g/t)+"s":g+"ms"}function h(g){var m=Math.abs(g);return m>=o?b(g,m,o,"day"):m>=r?b(g,m,r,"hour"):m>=e?b(g,m,e,"minute"):m>=t?b(g,m,t,"second"):g+" ms"}function b(g,m,E,T){var L=m>=E*1.5;return Math.round(g/E)+" "+T+(L?"s":"")}return zt}function Qs(t){r.debug=r,r.default=r,r.coerce=h,r.disable=u,r.enable=s,r.enabled=f,r.humanize=qs(),r.destroy=b,Object.keys(t).forEach(g=>{r[g]=t[g]}),r.names=[],r.skips=[],r.formatters={};function e(g){let m=0;for(let E=0;E<g.length;E++)m=(m<<5)-m+g.charCodeAt(E),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(g){let m,E=null,T,L;function P(...K){if(!P.enabled)return;const I=P,_=Number(new Date),j=_-(m||_);I.diff=j,I.prev=m,I.curr=_,m=_,K[0]=r.coerce(K[0]),typeof K[0]!="string"&&K.unshift("%O");let U=0;K[0]=K[0].replace(/%([a-zA-Z%])/g,(x,k)=>{if(x==="%%")return"%";U++;const G=r.formatters[k];if(typeof G=="function"){const oe=K[U];x=G.call(I,oe),K.splice(U,1),U--}return x}),r.formatArgs.call(I,K),(I.log||r.log).apply(I,K)}return P.namespace=g,P.useColors=r.useColors(),P.color=r.selectColor(g),P.extend=o,P.destroy=r.destroy,Object.defineProperty(P,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(T!==r.namespaces&&(T=r.namespaces,L=r.enabled(g)),L),set:K=>{E=K}}),typeof r.init=="function"&&r.init(P),P}function o(g,m){const E=r(this.namespace+(typeof m>"u"?":":m)+g);return E.log=this.log,E}function s(g){r.save(g),r.namespaces=g,r.names=[],r.skips=[];let m;const E=(typeof g=="string"?g:"").split(/[\s,]+/),T=E.length;for(m=0;m<T;m++)E[m]&&(g=E[m].replace(/\*/g,".*?"),g[0]==="-"?r.skips.push(new RegExp("^"+g.slice(1)+"$")):r.names.push(new RegExp("^"+g+"$")))}function u(){const g=[...r.names.map(c),...r.skips.map(c).map(m=>"-"+m)].join(",");return r.enable(""),g}function f(g){if(g[g.length-1]==="*")return!0;let m,E;for(m=0,E=r.skips.length;m<E;m++)if(r.skips[m].test(g))return!1;for(m=0,E=r.names.length;m<E;m++)if(r.names[m].test(g))return!0;return!1}function c(g){return g.toString().substring(2,g.toString().length-2).replace(/\.\*\?$/,"*")}function h(g){return g instanceof Error?g.stack||g.message:g}function b(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var Gs=Qs;(function(t,e){e.formatArgs=o,e.save=s,e.load=u,e.useColors=r,e.storage=f(),e.destroy=(()=>{let h=!1;return()=>{h||(h=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(h){if(h[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+h[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const b="color: "+this.color;h.splice(1,0,b,"color: inherit");let g=0,m=0;h[0].replace(/%[a-zA-Z%]/g,E=>{E!=="%%"&&(g++,E==="%c"&&(m=g))}),h.splice(m,0,b)}e.log=console.debug||console.log||(()=>{});function s(h){try{h?e.storage.setItem("debug",h):e.storage.removeItem("debug")}catch{}}function u(){let h;try{h=e.storage.getItem("debug")}catch{}return!h&&typeof O.process<"u"&&"env"in O.process&&(h=O.process.env.DEBUG),h}function f(){try{return localStorage}catch{}}t.exports=Gs(e);const{formatters:c}=t.exports;c.j=function(h){try{return JSON.stringify(h)}catch(b){return"[UnexpectedJSONParseError]: "+b.message}}})(ur,ur.exports);var Nn=ur.exports;const zs=un,Ks=mn.EventEmitter,Hs=Bt.inherits,Z=Nn("avvio"),{AVV_ERR_READY_TIMEOUT:Ws}=Ln,Kt=Symbol.for("plugin-meta");function Js(t,e){return t[Kt]&&t[Kt].name?t[Kt].name:typeof e<"u"&&typeof e!="function"&&e.name?e.name:t.name?t.name:t.toString().split(`
|
|
19
|
-
`).slice(0,2).map(r=>r.trim()).join(" -- ")}function Ys(){const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}function rt(t,e,r,o,s){this.started=!1,this.func=e,this.opts=r,this.onFinish=null,this.parent=t,this.timeout=s===void 0?t._timeout:s,this.name=Js(e,r),this.isAfter=o,this.q=zs(t,Xs,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Hs(rt,Ks);rt.prototype.exec=function(t,e){const r=this.func;let o=!1;const s=this.name;if(this.parent._error&&!this.isAfter){Z("skipping loading of plugin as parent errored and it is not an after",s),O.process.nextTick(e);return}if(this.isAfter)this.server=t;else try{this.server=this.parent.override(t,r,this.opts)}catch(h){return Z("override errored",s),e(h)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,Z("exec",s);let u;const f=h=>{if(o){Z("loading complete",s);return}this._error=h,Z(h?"exec errored":"exec completed",s),o=!0,u&&clearTimeout(u),e(h)};this.timeout>0&&(Z("setting up timeout",s,this.timeout),u=setTimeout(function(){Z("timed out",s),u=null;const h=new Ws(s);h.fn=r,f(h)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const c=r(this.server,this.opts,f);c&&typeof c.then=="function"&&(Z("exec: resolving promise",s),c.then(()=>O.process.nextTick(f),h=>O.process.nextTick(f,h)))};rt.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const t=()=>{this.server.after((r,o)=>{this._error=r,this.q.pause(),r?(Z("rejecting promise",this.name,r),this._promise.reject(r)):(Z("resolving promise",this.name),this._promise.resolve()),this._promise=null,O.process.nextTick(o,r)}),this.q.resume()};let e;return this._promise?e=Promise.resolve():(this._promise=Ys(),e=this._promise.promise,this.server?t():this.on("start",t)),e};rt.prototype.enqueue=function(t,e){Z("enqueue",this.name,t.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(t,e)};rt.prototype.finish=function(t,e){Z("finish",this.name,t);const r=()=>{this.loaded||(Z("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,e(t))};if(t){this._promise&&(this._promise.reject(t),this._promise=null),r();return}const o=()=>{if(Z("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const s=()=>{Z("wrap"),queueMicrotask(o)};this._promise.resolve(),this._promise.promise.then(s,s),this._promise=null}else r();else Z("delayed",this.name),this.q.drain=()=>{Z("drain",this.name),this.q.drain=Zs,queueMicrotask(o)}};queueMicrotask(o),this.q.resume()};function Xs(t,e){const r=this;O.process.nextTick(Ir.bind(r),t,e)}function Ir(t,e){if(typeof t.func.then=="function"){t.func.then(o=>{typeof o.default=="function"&&(o=o.default),t.func=o,Ir.call(this,t,e)},e);return}const r=this._current[0];this._current.unshift(t),t.exec(r&&r.server||this._server,o=>{t.finish(o,s=>{this._current.shift(),e(s)})})}function Zs(){}Er.exports=rt;Er.exports.loadPlugin=Ir;var ea=Er.exports;const Gr=un,ta=mn.EventEmitter,ra=Bt.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:Ht,AVV_ERR_CALLBACK_NOT_FN:lt,AVV_ERR_PLUGIN_NOT_VALID:na,AVV_ERR_ROOT_PLG_BOOTED:ia,AVV_ERR_READY_TIMEOUT:oa}=Ln,sa=Ms,cr=ea,et=Nn("avvio"),_t=Symbol("kAvvio"),Wt=Symbol("kThenifyDoNotWrap");function aa(t,e,r){const o=e.expose||{},s=o.use||"use",u=o.after||"after",f=o.ready||"ready",c=o.onClose||"onClose",h=o.close||"close";if(t[s])throw new Ht(s);if(t[u])throw new Ht(u);if(t[f])throw new Ht(f);t[s]=function(b,g){return r.use(b,g),this},Object.defineProperty(t,"then",{get:Un.bind(r)}),t[_t]=!0,t[u]=function(b){return typeof b!="function"?r._loadRegistered():(r.after(Jt(b,this)),this)},t[f]=function(b){if(b&&typeof b!="function")throw new lt(f,typeof b);return r.ready(b?Jt(b,this):void 0)},t[c]=function(b){if(typeof b!="function")throw new lt(c,typeof b);return r.onClose(da(b,this)),this},t[h]=function(b){if(b&&typeof b!="function")throw new lt(h,typeof b);return b?(r.close(Jt(b,this)),this):r.close()}}function ee(t,e,r){if(typeof t=="function"&&arguments.length===1&&(r=t,e={},t=null),typeof e=="function"&&(r=e,e={}),e=e||{},!(this instanceof ee)){const o=new ee(t,e,r);return t&&aa(t,e,o),o}e.autostart!==!1&&(e.autostart=!0),t=t||this,this._timeout=Number(e.timeout)||0,this._server=t,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),r&&this.once("start",r),this.started=!1,this.booted=!1,this.pluginTree=new sa,this._readyQ=Gr(this,$n,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=zr},this._closeQ=Gr(this,fa,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=zr},this._doStart=null,this._root=new cr(this,ua.bind(this),e,!1,0),this._root.once("start",(o,s,u)=>{const f=this.pluginTree.start(null,s,u);this._root.once("loaded",(c,h,b)=>{this.pluginTree.stop(f,b)})}),cr.loadPlugin.call(this,this._root,o=>{et("root plugin ready");try{this.emit("preReady"),this._root=null}catch(s){o=o||this._error||s}if(o){if(this._error=o,this._readyQ.length()===0)throw o}else this.booted=!0;this._readyQ.resume()})}function ua(t,e,r){this._doStart=r,e.autostart&&this.start()}ra(ee,ta);ee.prototype.start=function(){return this.started=!0,O.process.nextTick(this._doStart),this};ee.prototype.override=function(t,e,r){return t};function ca(t){if(t&&typeof t=="object"&&typeof t.default=="function"&&(t=t.default),!(t&&(typeof t=="function"||typeof t.then=="function")))throw new na(typeof t);return t}ee.prototype[_t]=!0;ee.prototype.use=function(t,e){return this._lastUsed=this._addPlugin(t,e,!1),this};ee.prototype._loadRegistered=function(){const t=this._current[0];return!this.started&&!this.booted&&O.process.nextTick(()=>this._root.q.resume()),t?t.loadedSoFar():Promise.resolve()};Object.defineProperty(ee.prototype,"then",{get:Un});ee.prototype._addPlugin=function(t,e,r){if(t=ca(t),e=e||{},this.booted)throw new ia;const o=this._current[0],s=new cr(this,t,e,r);if(s.once("start",(u,f,c)=>{const h=this.pluginTree.start(o.name,f,c);s.once("loaded",(b,g,m)=>{this.pluginTree.stop(h,m)})}),o.loaded)throw new Error(s.name,o.name);return o.enqueue(s,u=>{u&&(this._error=u)}),s};ee.prototype.after=function(t){if(!t)return this._loadRegistered();this._addPlugin(e.bind(this),{},!0);function e(r,o,s){$n.call(this,t,s)}return this};ee.prototype.onClose=function(t){if(typeof t!="function")throw new Error("not a function");t[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(t,e.bind(this));function e(r){r&&(this._error=r)}return this};ee.prototype.close=function(t){let e;if(t){if(typeof t!="function")throw new lt("close",typeof t)}else e=new Promise(function(r,o){t=function(s){if(s)return o(s);r()}});return this.ready(()=>{this._error=null,this._closeQ.push(t),O.process.nextTick(this._closeQ.resume.bind(this._closeQ))}),e};ee.prototype.ready=function(t){if(t){if(typeof t!="function")throw new lt("ready",typeof t);this._readyQ.push(t),queueMicrotask(this.start.bind(this));return}return new Promise((e,r)=>{this._readyQ.push(s),this.start();const o=this._current[0].server;function s(u,f,c){u?r(u):e(o),O.process.nextTick(c)}})};ee.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};ee.prototype.toJSON=function(){return this.pluginTree.toJSON()};function zr(){}function Un(){if(this.booted){et("thenify returning null because we are already booted");return}if(this[Wt]){this[Wt]=!1;return}return et("thenify"),(t,e)=>this._loadRegistered().then(()=>(this[Wt]=!0,t(this._server)),e)}function $n(t,e){const r=this._server,o=this._error;let s;if(this._error=null,t.length===0)this._error=o,s=t(),s&&!s[_t]&&typeof s.then=="function"?s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u)):O.process.nextTick(e);else if(t.length===1)s=t(o),s&&!s[_t]&&typeof s.then=="function"?s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u)):O.process.nextTick(e);else if(this._timeout===0){const u=f=>{this._error=f,e(this._error)};t.length===2?t(o,u):t(o,r,u)}else la.call(this,t,o,r,e)}function la(t,e,r,o){const s=t.name;et("setting up ready timeout",s,this._timeout);let u=setTimeout(()=>{et("timed out",s),u=null;const c=new oa(s);c.fn=t,this._error=c,o(c)},this._timeout);t.length===2?t(e,f.bind(this)):t(e,r,f.bind(this));function f(c){u&&(clearTimeout(u),this._error=c,o(this._error))}}function fa(t,e){const r=this._server,o=t[this._isOnCloseHandlerKey];if(t.length===0||t.length===1){let s;o?s=t(r):s=t(this._error),s&&typeof s.then=="function"?(et("resolving close/onClose promise"),s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u))):O.process.nextTick(e)}else t.length===2?t(o?r:this._error,e):o?t(r,e):t(this._error,r,e)}function da(t,e){return r.bind(e);function r(o,s){let u;t.length===0?(u=t(),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t.length===1?(u=t(this),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t(this,s)}}function Jt(t,e){return r.bind(e);function r(o,s){let u;t?t.length===0?(u=t(),u&&u.then?u.then(function(){O.process.nextTick(s,o)},s):O.process.nextTick(s,o)):t.length===1?(u=t(o),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t.length===2?t(o,s):t(o,this,s):O.process.nextTick(s)}}yr.exports=ee;yr.exports.express=function(t){return ee(t,{expose:{use:"load"}})};var ha=yr.exports;const pa=Kn(ha);function ya(t,e=!0,r=!0){const o=e?"https://grpc-sdk.streamlayer.io:443":"https://grpc-
|
|
19
|
+
`).slice(0,2).map(r=>r.trim()).join(" -- ")}function Ys(){const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}function rt(t,e,r,o,s){this.started=!1,this.func=e,this.opts=r,this.onFinish=null,this.parent=t,this.timeout=s===void 0?t._timeout:s,this.name=Js(e,r),this.isAfter=o,this.q=zs(t,Xs,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Hs(rt,Ks);rt.prototype.exec=function(t,e){const r=this.func;let o=!1;const s=this.name;if(this.parent._error&&!this.isAfter){Z("skipping loading of plugin as parent errored and it is not an after",s),O.process.nextTick(e);return}if(this.isAfter)this.server=t;else try{this.server=this.parent.override(t,r,this.opts)}catch(h){return Z("override errored",s),e(h)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,Z("exec",s);let u;const f=h=>{if(o){Z("loading complete",s);return}this._error=h,Z(h?"exec errored":"exec completed",s),o=!0,u&&clearTimeout(u),e(h)};this.timeout>0&&(Z("setting up timeout",s,this.timeout),u=setTimeout(function(){Z("timed out",s),u=null;const h=new Ws(s);h.fn=r,f(h)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const c=r(this.server,this.opts,f);c&&typeof c.then=="function"&&(Z("exec: resolving promise",s),c.then(()=>O.process.nextTick(f),h=>O.process.nextTick(f,h)))};rt.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const t=()=>{this.server.after((r,o)=>{this._error=r,this.q.pause(),r?(Z("rejecting promise",this.name,r),this._promise.reject(r)):(Z("resolving promise",this.name),this._promise.resolve()),this._promise=null,O.process.nextTick(o,r)}),this.q.resume()};let e;return this._promise?e=Promise.resolve():(this._promise=Ys(),e=this._promise.promise,this.server?t():this.on("start",t)),e};rt.prototype.enqueue=function(t,e){Z("enqueue",this.name,t.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(t,e)};rt.prototype.finish=function(t,e){Z("finish",this.name,t);const r=()=>{this.loaded||(Z("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,e(t))};if(t){this._promise&&(this._promise.reject(t),this._promise=null),r();return}const o=()=>{if(Z("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const s=()=>{Z("wrap"),queueMicrotask(o)};this._promise.resolve(),this._promise.promise.then(s,s),this._promise=null}else r();else Z("delayed",this.name),this.q.drain=()=>{Z("drain",this.name),this.q.drain=Zs,queueMicrotask(o)}};queueMicrotask(o),this.q.resume()};function Xs(t,e){const r=this;O.process.nextTick(Ir.bind(r),t,e)}function Ir(t,e){if(typeof t.func.then=="function"){t.func.then(o=>{typeof o.default=="function"&&(o=o.default),t.func=o,Ir.call(this,t,e)},e);return}const r=this._current[0];this._current.unshift(t),t.exec(r&&r.server||this._server,o=>{t.finish(o,s=>{this._current.shift(),e(s)})})}function Zs(){}Er.exports=rt;Er.exports.loadPlugin=Ir;var ea=Er.exports;const Gr=un,ta=mn.EventEmitter,ra=Bt.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:Ht,AVV_ERR_CALLBACK_NOT_FN:lt,AVV_ERR_PLUGIN_NOT_VALID:na,AVV_ERR_ROOT_PLG_BOOTED:ia,AVV_ERR_READY_TIMEOUT:oa}=Ln,sa=Ms,cr=ea,et=Nn("avvio"),_t=Symbol("kAvvio"),Wt=Symbol("kThenifyDoNotWrap");function aa(t,e,r){const o=e.expose||{},s=o.use||"use",u=o.after||"after",f=o.ready||"ready",c=o.onClose||"onClose",h=o.close||"close";if(t[s])throw new Ht(s);if(t[u])throw new Ht(u);if(t[f])throw new Ht(f);t[s]=function(b,g){return r.use(b,g),this},Object.defineProperty(t,"then",{get:Un.bind(r)}),t[_t]=!0,t[u]=function(b){return typeof b!="function"?r._loadRegistered():(r.after(Jt(b,this)),this)},t[f]=function(b){if(b&&typeof b!="function")throw new lt(f,typeof b);return r.ready(b?Jt(b,this):void 0)},t[c]=function(b){if(typeof b!="function")throw new lt(c,typeof b);return r.onClose(da(b,this)),this},t[h]=function(b){if(b&&typeof b!="function")throw new lt(h,typeof b);return b?(r.close(Jt(b,this)),this):r.close()}}function ee(t,e,r){if(typeof t=="function"&&arguments.length===1&&(r=t,e={},t=null),typeof e=="function"&&(r=e,e={}),e=e||{},!(this instanceof ee)){const o=new ee(t,e,r);return t&&aa(t,e,o),o}e.autostart!==!1&&(e.autostart=!0),t=t||this,this._timeout=Number(e.timeout)||0,this._server=t,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),r&&this.once("start",r),this.started=!1,this.booted=!1,this.pluginTree=new sa,this._readyQ=Gr(this,$n,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=zr},this._closeQ=Gr(this,fa,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=zr},this._doStart=null,this._root=new cr(this,ua.bind(this),e,!1,0),this._root.once("start",(o,s,u)=>{const f=this.pluginTree.start(null,s,u);this._root.once("loaded",(c,h,b)=>{this.pluginTree.stop(f,b)})}),cr.loadPlugin.call(this,this._root,o=>{et("root plugin ready");try{this.emit("preReady"),this._root=null}catch(s){o=o||this._error||s}if(o){if(this._error=o,this._readyQ.length()===0)throw o}else this.booted=!0;this._readyQ.resume()})}function ua(t,e,r){this._doStart=r,e.autostart&&this.start()}ra(ee,ta);ee.prototype.start=function(){return this.started=!0,O.process.nextTick(this._doStart),this};ee.prototype.override=function(t,e,r){return t};function ca(t){if(t&&typeof t=="object"&&typeof t.default=="function"&&(t=t.default),!(t&&(typeof t=="function"||typeof t.then=="function")))throw new na(typeof t);return t}ee.prototype[_t]=!0;ee.prototype.use=function(t,e){return this._lastUsed=this._addPlugin(t,e,!1),this};ee.prototype._loadRegistered=function(){const t=this._current[0];return!this.started&&!this.booted&&O.process.nextTick(()=>this._root.q.resume()),t?t.loadedSoFar():Promise.resolve()};Object.defineProperty(ee.prototype,"then",{get:Un});ee.prototype._addPlugin=function(t,e,r){if(t=ca(t),e=e||{},this.booted)throw new ia;const o=this._current[0],s=new cr(this,t,e,r);if(s.once("start",(u,f,c)=>{const h=this.pluginTree.start(o.name,f,c);s.once("loaded",(b,g,m)=>{this.pluginTree.stop(h,m)})}),o.loaded)throw new Error(s.name,o.name);return o.enqueue(s,u=>{u&&(this._error=u)}),s};ee.prototype.after=function(t){if(!t)return this._loadRegistered();this._addPlugin(e.bind(this),{},!0);function e(r,o,s){$n.call(this,t,s)}return this};ee.prototype.onClose=function(t){if(typeof t!="function")throw new Error("not a function");t[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(t,e.bind(this));function e(r){r&&(this._error=r)}return this};ee.prototype.close=function(t){let e;if(t){if(typeof t!="function")throw new lt("close",typeof t)}else e=new Promise(function(r,o){t=function(s){if(s)return o(s);r()}});return this.ready(()=>{this._error=null,this._closeQ.push(t),O.process.nextTick(this._closeQ.resume.bind(this._closeQ))}),e};ee.prototype.ready=function(t){if(t){if(typeof t!="function")throw new lt("ready",typeof t);this._readyQ.push(t),queueMicrotask(this.start.bind(this));return}return new Promise((e,r)=>{this._readyQ.push(s),this.start();const o=this._current[0].server;function s(u,f,c){u?r(u):e(o),O.process.nextTick(c)}})};ee.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};ee.prototype.toJSON=function(){return this.pluginTree.toJSON()};function zr(){}function Un(){if(this.booted){et("thenify returning null because we are already booted");return}if(this[Wt]){this[Wt]=!1;return}return et("thenify"),(t,e)=>this._loadRegistered().then(()=>(this[Wt]=!0,t(this._server)),e)}function $n(t,e){const r=this._server,o=this._error;let s;if(this._error=null,t.length===0)this._error=o,s=t(),s&&!s[_t]&&typeof s.then=="function"?s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u)):O.process.nextTick(e);else if(t.length===1)s=t(o),s&&!s[_t]&&typeof s.then=="function"?s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u)):O.process.nextTick(e);else if(this._timeout===0){const u=f=>{this._error=f,e(this._error)};t.length===2?t(o,u):t(o,r,u)}else la.call(this,t,o,r,e)}function la(t,e,r,o){const s=t.name;et("setting up ready timeout",s,this._timeout);let u=setTimeout(()=>{et("timed out",s),u=null;const c=new oa(s);c.fn=t,this._error=c,o(c)},this._timeout);t.length===2?t(e,f.bind(this)):t(e,r,f.bind(this));function f(c){u&&(clearTimeout(u),this._error=c,o(this._error))}}function fa(t,e){const r=this._server,o=t[this._isOnCloseHandlerKey];if(t.length===0||t.length===1){let s;o?s=t(r):s=t(this._error),s&&typeof s.then=="function"?(et("resolving close/onClose promise"),s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u))):O.process.nextTick(e)}else t.length===2?t(o?r:this._error,e):o?t(r,e):t(this._error,r,e)}function da(t,e){return r.bind(e);function r(o,s){let u;t.length===0?(u=t(),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t.length===1?(u=t(this),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t(this,s)}}function Jt(t,e){return r.bind(e);function r(o,s){let u;t?t.length===0?(u=t(),u&&u.then?u.then(function(){O.process.nextTick(s,o)},s):O.process.nextTick(s,o)):t.length===1?(u=t(o),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t.length===2?t(o,s):t(o,this,s):O.process.nextTick(s)}}yr.exports=ee;yr.exports.express=function(t){return ee(t,{expose:{use:"load"}})};var ha=yr.exports;const pa=Kn(ha);function ya(t,e=!0,r=!0){const o=e?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",s=pa(Object.create({}),{autostart:!1});return s.use(Ci),s.use(vi,{sdkKey:t,host:o}),s.use(_i),s.use(Fi),s.use(so),s.use(Ki),r&&s.after(async(u,f,c)=>{if(u)throw u;await f.sdk.initializeApp(),c()}),s.onClose(()=>{console.log("close")}),s}exports.StreamLayer=ya;
|
package/lib/es/index.js
CHANGED
|
@@ -4923,7 +4923,7 @@ yr.exports.express = function(t) {
|
|
|
4923
4923
|
var ba = yr.exports;
|
|
4924
4924
|
const va = /* @__PURE__ */ Zn(ba);
|
|
4925
4925
|
function Da(t, e = !0, r = !0) {
|
|
4926
|
-
const o = e ? "https://grpc-sdk.streamlayer.io:443" : "https://grpc-
|
|
4926
|
+
const o = e ? "https://grpc-sdk.streamlayer.io:443" : "https://grpc-sdk.next.streamlayer.io:443", s = va(/* @__PURE__ */ Object.create({}), { autostart: !1 });
|
|
4927
4927
|
return s.use(Ri), s.use(Ti, { sdkKey: t, host: o }), s.use(Pi), s.use(ki), s.use(ho), s.use(Zi), r && s.after(async (u, l, c) => {
|
|
4928
4928
|
if (u)
|
|
4929
4929
|
throw u;
|
package/package.json
CHANGED
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"avvio": "^8.2.1",
|
|
27
27
|
"tslib": "^2.6.2",
|
|
28
28
|
"@streamlayer/sdk-web-api": "^0.1.0",
|
|
29
|
-
"@streamlayer/sdk-web-core": "^0.0.
|
|
29
|
+
"@streamlayer/sdk-web-core": "^0.0.6",
|
|
30
30
|
"@streamlayer/sdk-web-types": "^0.0.1",
|
|
31
31
|
"@streamlayer/sdk-web-logger": "^0.0.1",
|
|
32
32
|
"@streamlayer/sdk-web-storage": "^0.0.4",
|
|
33
|
-
"@streamlayer/sdk-web-features": "^0.10.
|
|
33
|
+
"@streamlayer/sdk-web-features": "^0.10.35",
|
|
34
34
|
"@streamlayer/sdk-web-interfaces": "^0.0.1",
|
|
35
35
|
"@streamlayer/sdk-web-notifications": "^0.13.4",
|
|
36
|
-
"@streamlayer/feature-gamification": "^0.27.
|
|
36
|
+
"@streamlayer/feature-gamification": "^0.27.2"
|
|
37
37
|
},
|
|
38
|
-
"version": "0.29.
|
|
38
|
+
"version": "0.29.3",
|
|
39
39
|
"type": "module",
|
|
40
40
|
"main": "./src/index.js",
|
|
41
41
|
"typings": "./src/index.d.ts"
|