piral-urql 0.15.0-alpha.3555 → 0.15.0-alpha.3640

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/esm/pilets.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PiletMetadata } from 'piral-base';
1
+ import type { PiletMetadata } from 'piral-core';
2
2
  import { UrqlClient } from './types';
3
3
  export interface PiletQueryResult {
4
4
  pilets: Array<PiletMetadata>;
package/lib/pilets.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PiletMetadata } from 'piral-base';
1
+ import type { PiletMetadata } from 'piral-core';
2
2
  import { UrqlClient } from './types';
3
3
  export interface PiletQueryResult {
4
4
  pilets: Array<PiletMetadata>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-urql",
3
- "version": "0.15.0-alpha.3555",
3
+ "version": "0.15.0-alpha.3640",
4
4
  "description": "Plugin for providing a GraphQL client in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -28,7 +28,8 @@
28
28
  "files": [
29
29
  "esm",
30
30
  "lib",
31
- "src"
31
+ "src",
32
+ "piral-urql.min.js"
32
33
  ],
33
34
  "repository": {
34
35
  "type": "git",
@@ -38,23 +39,27 @@
38
39
  "url": "https://github.com/smapiot/piral/issues"
39
40
  },
40
41
  "scripts": {
41
- "build": "yarn build:commonjs && yarn build:esnext",
42
+ "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
43
+ "build:bundle": "esbuild src/index.ts --outfile=piral-urql.min.js --bundle --external:piral-core --external:graphql --external:react --minify --global-name=piralUrql",
42
44
  "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
43
45
  "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
44
46
  "typedoc": "typedoc --json ../../../docs/types/piral-urql.json src --exclude \"src/**/*.test.*\"",
45
47
  "test": "echo \"Error: run tests from root\" && exit 1"
46
48
  },
47
49
  "devDependencies": {
50
+ "@types/react": "^17.0.0",
48
51
  "graphql": "14.6.0",
49
- "piral-core": "0.15.0-alpha.3555"
52
+ "piral-core": "0.15.0-alpha.3640",
53
+ "react": "^17.0.1"
50
54
  },
51
55
  "peerDependencies": {
52
56
  "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0",
53
- "piral-core": "0.14.x"
57
+ "piral-core": "0.14.x",
58
+ "react": ">=16.8.0"
54
59
  },
55
60
  "dependencies": {
56
61
  "subscriptions-transport-ws": "^0.9.16",
57
62
  "urql": "^1.0.4"
58
63
  },
59
- "gitHead": "0727a5c782dd1bbc7ccaa11a036a9f16e616bf10"
64
+ "gitHead": "29ee91f865f9ee42229e58a7804cba6ab5e9145b"
60
65
  }
@@ -0,0 +1,10 @@
1
+ var piralUrql=(()=>{var At=Object.create;var V=Object.defineProperty,Gt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptor,Qt=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertyNames,Le=Object.getOwnPropertySymbols,Dt=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var je=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X=(e,t)=>{for(var n in t||(t={}))Qe.call(t,n)&&je(e,n,t[n]);if(Le)for(var n of Le(t))$t.call(t,n)&&je(e,n,t[n]);return e},De=(e,t)=>Gt(e,Qt(t)),$e=e=>V(e,"__esModule",{value:!0});var x=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ut=(e,t)=>{$e(e);for(var n in t)V(e,n,{get:t[n],enumerable:!0})},Wt=(e,t,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jt(t))!Qe.call(e,r)&&r!=="default"&&V(e,r,{get:()=>t[r],enumerable:!(n=Lt(t,r))||n.enumerable});return e},C=e=>Wt($e(V(e!=null?At(Dt(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var mt=T((br,dt)=>{dt.exports=j;function j(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}j.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};j.prototype.reset=function(){this.attempts=0};j.prototype.setMin=function(e){this.ms=e};j.prototype.setMax=function(e){this.max=e};j.prototype.setJitter=function(e){this.jitter=e}});var vt=T((_r,Te)=>{"use strict";var qn=Object.prototype.hasOwnProperty,b="~";function Y(){}Object.create&&(Y.prototype=Object.create(null),new Y().__proto__||(b=!1));function Tn(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function yt(e,t,n,r,i){if(typeof n!="function")throw new TypeError("The listener must be a function");var o=new Tn(n,r||e,i),u=b?b+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],o]:e._events[u].push(o):(e._events[u]=o,e._eventsCount++),e}function ae(e,t){--e._eventsCount==0?e._events=new Y:delete e._events[t]}function v(){this._events=new Y,this._eventsCount=0}v.prototype.eventNames=function(){var t=[],n,r;if(this._eventsCount===0)return t;for(r in n=this._events)qn.call(n,r)&&t.push(b?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(n)):t};v.prototype.listeners=function(t){var n=b?b+t:t,r=this._events[n];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,u=new Array(o);i<o;i++)u[i]=r[i].fn;return u};v.prototype.listenerCount=function(t){var n=b?b+t:t,r=this._events[n];return r?r.fn?1:r.length:0};v.prototype.emit=function(t,n,r,i,o,u){var s=b?b+t:t;if(!this._events[s])return!1;var c=this._events[s],a=arguments.length,f,l;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),a){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,n),!0;case 3:return c.fn.call(c.context,n,r),!0;case 4:return c.fn.call(c.context,n,r,i),!0;case 5:return c.fn.call(c.context,n,r,i,o),!0;case 6:return c.fn.call(c.context,n,r,i,o,u),!0}for(l=1,f=new Array(a-1);l<a;l++)f[l-1]=arguments[l];c.fn.apply(c.context,f)}else{var p=c.length,h;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),a){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,n);break;case 3:c[l].fn.call(c[l].context,n,r);break;case 4:c[l].fn.call(c[l].context,n,r,i);break;default:if(!f)for(h=1,f=new Array(a-1);h<a;h++)f[h-1]=arguments[h];c[l].fn.apply(c[l].context,f)}}return!0};v.prototype.on=function(t,n,r){return yt(this,t,n,r,!1)};v.prototype.once=function(t,n,r){return yt(this,t,n,r,!0)};v.prototype.removeListener=function(t,n,r,i){var o=b?b+t:t;if(!this._events[o])return this;if(!n)return ae(this,o),this;var u=this._events[o];if(u.fn)u.fn===n&&(!i||u.once)&&(!r||u.context===r)&&ae(this,o);else{for(var s=0,c=[],a=u.length;s<a;s++)(u[s].fn!==n||i&&!u[s].once||r&&u[s].context!==r)&&c.push(u[s]);c.length?this._events[o]=c.length===1?c[0]:c:ae(this,o)}return this};v.prototype.removeAllListeners=function(t){var n;return t?(n=b?b+t:t,this._events[n]&&ae(this,n)):(this._events=new Y,this._eventsCount=0),this};v.prototype.off=v.prototype.removeListener;v.prototype.addListener=v.prototype.on;v.prefixed=b;v.EventEmitter=v;typeof Te!="undefined"&&(Te.exports=v)});var gt=T(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});function Cn(e){return typeof e=="string"}Ce.default=Cn});var bt=T(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});function Sn(e){return e!==null&&typeof e=="object"}Se.default=Sn});var _t=T(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.default=In;function In(e){var t,n=e.Symbol;return typeof n=="function"?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}});var kt=T((Ne,Me)=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});var Nn=_t(),Mn=Pn(Nn);function Pn(e){return e&&e.__esModule?e:{default:e}}var D;typeof self!="undefined"?D=self:typeof window!="undefined"?D=window:typeof global!="undefined"?D=global:typeof Me!="undefined"?D=Me:D=Function("return this")();var Rn=(0,Mn.default)(D);Ne.default=Rn});var Ot=T($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.GRAPHQL_SUBSCRIPTIONS=$.GRAPHQL_WS=void 0;var An="graphql-ws";$.GRAPHQL_WS=An;var Gn="graphql-subscriptions";$.GRAPHQL_SUBSCRIPTIONS=Gn});var Et=T(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.WS_TIMEOUT=U.MIN_WS_TIMEOUT=void 0;var Ln=1e3;U.MIN_WS_TIMEOUT=Ln;var Qn=3e4;U.WS_TIMEOUT=Qn});var wt=T(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});var jn=function(){function e(){throw new Error("Static Class")}return e.GQL_CONNECTION_INIT="connection_init",e.GQL_CONNECTION_ACK="connection_ack",e.GQL_CONNECTION_ERROR="connection_error",e.GQL_CONNECTION_KEEP_ALIVE="ka",e.GQL_CONNECTION_TERMINATE="connection_terminate",e.GQL_START="start",e.GQL_DATA="data",e.GQL_ERROR="error",e.GQL_COMPLETE="complete",e.GQL_STOP="stop",e.SUBSCRIPTION_START="subscription_start",e.SUBSCRIPTION_DATA="subscription_data",e.SUBSCRIPTION_SUCCESS="subscription_success",e.SUBSCRIPTION_FAIL="subscription_fail",e.SUBSCRIPTION_END="subscription_end",e.INIT="init",e.INIT_SUCCESS="init_success",e.INIT_FAIL="init_fail",e.KEEP_ALIVE="keepalive",e}();Pe.default=jn});var It=T(w=>{"use strict";var W=w&&w.__assign||function(){return W=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},W.apply(this,arguments)},Dn=w&&w.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(u){u(o)})}return new(n||(n=Promise))(function(o,u){function s(f){try{a(r.next(f))}catch(l){u(l)}}function c(f){try{a(r.throw(f))}catch(l){u(l)}}function a(f){f.done?o(f.value):i(f.value).then(s,c)}a((r=r.apply(e,t||[])).next())})},$n=w&&w.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(a){return function(f){return c([a,f])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=t.call(e,n)}catch(f){a=[6,f],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},xt=w&&w.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],u=0,s=o.length;u<s;u++,i++)r[i]=o[u];return r};Object.defineProperty(w,"__esModule",{value:!0});w.SubscriptionClient=void 0;var qt=typeof global!="undefined"?global:typeof window!="undefined"?window:{},Un=qt.WebSocket||qt.MozWebSocket,Tt=mt(),Wn=vt(),Ct=gt(),Vn=bt(),Fn=x("graphql/language/printer"),Bn=x("graphql/utilities/getOperationAST"),Jn=kt(),Kn=Ot(),St=Et(),_=wt(),Hn=function(){function e(t,n,r,i){var o=n||{},u=o.connectionCallback,s=u===void 0?void 0:u,c=o.connectionParams,a=c===void 0?{}:c,f=o.minTimeout,l=f===void 0?St.MIN_WS_TIMEOUT:f,p=o.timeout,h=p===void 0?St.WS_TIMEOUT:p,d=o.reconnect,O=d===void 0?!1:d,y=o.reconnectionAttempts,M=y===void 0?1/0:y,N=o.lazy,P=N===void 0?!1:N,R=o.inactivityTimeout,Pt=R===void 0?0:R,Ge=o.wsOptionArguments,Rt=Ge===void 0?[]:Ge;if(this.wsImpl=r||Un,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=i||Kn.GRAPHQL_WS,this.connectionCallback=s,this.url=t,this.operations={},this.nextOperationId=0,this.minWsTimeout=l,this.wsTimeout=h,this.unsentMessagesQueue=[],this.reconnect=O,this.reconnecting=!1,this.reconnectionAttempts=M,this.lazy=!!P,this.inactivityTimeout=Pt,this.closedByUser=!1,this.backoff=new Tt({jitter:.5}),this.eventEmitter=new Wn.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams(a),this.wsOptionArguments=Rt,this.lazy||this.connect()}return Object.defineProperty(e.prototype,"status",{get:function(){return this.client===null?this.wsImpl.CLOSED:this.client.readyState},enumerable:!1,configurable:!0}),e.prototype.close=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=!0),this.clearInactivityTimeout(),this.client!==null&&(this.closedByUser=n,t&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,_.default.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client.onopen=null,this.client.onclose=null,this.client.onerror=null,this.client.onmessage=null,this.client=null,this.eventEmitter.emit("disconnected"),t||this.tryReconnect())},e.prototype.request=function(t){var n,r=this.getObserver.bind(this),i=this.executeOperation.bind(this),o=this.unsubscribe.bind(this),u;return this.clearInactivityTimeout(),n={},n[Jn.default]=function(){return this},n.subscribe=function(s,c,a){var f=r(s,c,a);return u=i(t,function(l,p){l===null&&p===null?f.complete&&f.complete():l?f.error&&f.error(l[0]):f.next&&f.next(p)}),{unsubscribe:function(){u&&(o(u),u=null)}}},n},e.prototype.on=function(t,n,r){var i=this.eventEmitter.on(t,n,r);return function(){i.off(t,n,r)}},e.prototype.onConnected=function(t,n){return this.on("connected",t,n)},e.prototype.onConnecting=function(t,n){return this.on("connecting",t,n)},e.prototype.onDisconnected=function(t,n){return this.on("disconnected",t,n)},e.prototype.onReconnected=function(t,n){return this.on("reconnected",t,n)},e.prototype.onReconnecting=function(t,n){return this.on("reconnecting",t,n)},e.prototype.onError=function(t,n){return this.on("error",t,n)},e.prototype.unsubscribeAll=function(){var t=this;Object.keys(this.operations).forEach(function(n){t.unsubscribe(n)})},e.prototype.applyMiddlewares=function(t){var n=this;return new Promise(function(r,i){var o=function(u,s){var c=function(a){if(a)i(a);else if(u.length>0){var f=u.shift();f&&f.applyMiddleware.apply(s,[t,c])}else r(t)};c()};o(xt(n.middlewares),n)})},e.prototype.use=function(t){var n=this;return t.map(function(r){if(typeof r.applyMiddleware=="function")n.middlewares.push(r);else throw new Error("Middleware must implement the applyMiddleware function.")}),this},e.prototype.getConnectionParams=function(t){return function(){return new Promise(function(n,r){if(typeof t=="function")try{return n(t.call(null))}catch(i){return r(i)}n(t)})}},e.prototype.executeOperation=function(t,n){var r=this;this.client===null&&this.connect();var i=this.generateOperationId();return this.operations[i]={options:t,handler:n},this.applyMiddlewares(t).then(function(o){r.checkOperationOptions(o,n),r.operations[i]&&(r.operations[i]={options:o,handler:n},r.sendMessage(i,_.default.GQL_START,o))}).catch(function(o){r.unsubscribe(i),n(r.formatErrors(o))}),i},e.prototype.getObserver=function(t,n,r){return typeof t=="function"?{next:function(i){return t(i)},error:function(i){return n&&n(i)},complete:function(){return r&&r()}}:t},e.prototype.createMaxConnectTimeGenerator=function(){var t=this.minWsTimeout,n=this.wsTimeout;return new Tt({min:t,max:n,factor:1.2})},e.prototype.clearCheckConnectionInterval=function(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)},e.prototype.clearMaxConnectTimeout=function(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)},e.prototype.clearTryReconnectTimeout=function(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)},e.prototype.clearInactivityTimeout=function(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)},e.prototype.setInactivityTimeout=function(){var t=this;this.inactivityTimeout>0&&Object.keys(this.operations).length===0&&(this.inactivityTimeoutId=setTimeout(function(){Object.keys(t.operations).length===0&&t.close()},this.inactivityTimeout))},e.prototype.checkOperationOptions=function(t,n){var r=t.query,i=t.variables,o=t.operationName;if(!r)throw new Error("Must provide a query.");if(!n)throw new Error("Must provide an handler.");if(!Ct.default(r)&&!Bn.getOperationAST(r,o)||o&&!Ct.default(o)||i&&!Vn.default(i))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")},e.prototype.buildMessage=function(t,n,r){var i=r&&r.query?W(W({},r),{query:typeof r.query=="string"?r.query:Fn.print(r.query)}):r;return{id:t,type:n,payload:i}},e.prototype.formatErrors=function(t){return Array.isArray(t)?t:t&&t.errors?this.formatErrors(t.errors):t&&t.message?[t]:[{name:"FormatedError",message:"Unknown error",originalError:t}]},e.prototype.sendMessage=function(t,n,r){this.sendMessageRaw(this.buildMessage(t,n,r))},e.prototype.sendMessageRaw=function(t){switch(this.status){case this.wsImpl.OPEN:var n=JSON.stringify(t);try{JSON.parse(n)}catch{this.eventEmitter.emit("error",new Error("Message must be JSON-serializable. Got: "+t))}this.client.send(n);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(t);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(t)))}},e.prototype.generateOperationId=function(){return String(++this.nextOperationId)},e.prototype.tryReconnect=function(){var t=this;if(!(!this.reconnect||this.backoff.attempts>=this.reconnectionAttempts)){this.reconnecting||(Object.keys(this.operations).forEach(function(r){t.unsentMessagesQueue.push(t.buildMessage(r,_.default.GQL_START,t.operations[r].options))}),this.reconnecting=!0),this.clearTryReconnectTimeout();var n=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout(function(){t.connect()},n)}},e.prototype.flushUnsentMessagesQueue=function(){var t=this;this.unsentMessagesQueue.forEach(function(n){t.sendMessageRaw(n)}),this.unsentMessagesQueue=[]},e.prototype.checkConnection=function(){if(this.wasKeepAliveReceived){this.wasKeepAliveReceived=!1;return}this.reconnecting||this.close(!1,!0)},e.prototype.checkMaxConnectTimeout=function(){var t=this;this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout(function(){t.status!==t.wsImpl.OPEN&&(t.reconnecting=!0,t.close(!1,!0))},this.maxConnectTimeGenerator.duration())},e.prototype.connect=function(){var t,n=this;this.client=new((t=this.wsImpl).bind.apply(t,xt([void 0,this.url,this.wsProtocols],this.wsOptionArguments))),this.checkMaxConnectTimeout(),this.client.onopen=function(){return Dn(n,void 0,void 0,function(){var r,i;return $n(this,function(o){switch(o.label){case 0:if(this.status!==this.wsImpl.OPEN)return[3,4];this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.connectionParams()];case 2:return r=o.sent(),this.sendMessage(void 0,_.default.GQL_CONNECTION_INIT,r),this.flushUnsentMessagesQueue(),[3,4];case 3:return i=o.sent(),this.sendMessage(void 0,_.default.GQL_CONNECTION_ERROR,i),this.flushUnsentMessagesQueue(),[3,4];case 4:return[2]}})})},this.client.onclose=function(){n.closedByUser||n.close(!1,!1)},this.client.onerror=function(r){n.eventEmitter.emit("error",r)},this.client.onmessage=function(r){var i=r.data;n.processReceivedData(i)}},e.prototype.processReceivedData=function(t){var n,r;try{n=JSON.parse(t),r=n.id}catch{throw new Error("Message must be JSON-parseable. Got: "+t)}if([_.default.GQL_DATA,_.default.GQL_COMPLETE,_.default.GQL_ERROR].indexOf(n.type)!==-1&&!this.operations[r]){this.unsubscribe(r);return}switch(n.type){case _.default.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(n.payload);break;case _.default.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected",n.payload),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case _.default.GQL_COMPLETE:var i=this.operations[r].handler;delete this.operations[r],i.call(this,null,null);break;case _.default.GQL_ERROR:this.operations[r].handler(this.formatErrors(n.payload),null),delete this.operations[r];break;case _.default.GQL_DATA:var o=n.payload.errors?W(W({},n.payload),{errors:this.formatErrors(n.payload.errors)}):n.payload;this.operations[r].handler(null,o);break;case _.default.GQL_CONNECTION_KEEP_ALIVE:var u=typeof this.wasKeepAliveReceived=="undefined";this.wasKeepAliveReceived=!0,u&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}},e.prototype.unsubscribe=function(t){this.operations[t]&&(delete this.operations[t],this.setInactivityTimeout(),this.sendMessage(t,_.default.GQL_STOP,void 0))},e}();w.SubscriptionClient=Hn});var er={};Ut(er,{createGqlApi:()=>Yn,gqlMutation:()=>xe,gqlQuery:()=>z,gqlSubscription:()=>qe,requestPiletsFromGraphQL:()=>Zn,setupGqlClient:()=>Re});var Mt=C(x("react"));function m(e,t){return t.tag=e,t}function E(){}function Ue(e){return function(t){var n=e.length;let r=!1,i=!1,o=!1,u=0;t(m(0,[function(s){if(s)r=!0;else if(i)o=!0;else{for(i=o=!0;o&&!r;)u<n?(s=e[u],u=u+1|0,o=!1,t(m(1,[s]))):(r=!0,t(0));i=!1}}]))}}function Vt(){}function Ft(e){e(0)}function Bt(e){let t=!1;e(m(0,[function(n){n?t=!0:t||e(0)}]))}function Jt(e){return e(0)}function Z(e){return function(t){return function(n){let r=E,i=!1,o=[],u=!1;t(function(s){typeof s=="number"?u||(u=!0,o.length===0&&n(0)):s.tag?u||(i=!1,function(c){function a(p){typeof p=="number"?o.length!==0&&(o=o.filter(f),p=o.length===0,u&&p?n(0):!i&&p&&(i=!0,r(0))):p.tag?o.length!==0&&(n(m(1,[p[0]])),l(0)):(l=p=p[0],o=o.concat(p),p(0))}function f(p){return p!==l}let l=E;c.length===1?c(a):c.bind(null,a)}(e(s[0])),i||(i=!0,r(0))):r=s[0]}),n(m(0,[function(s){s?(u||(u=!0,r(s)),o.forEach(function(c){return c(s)}),o=[]):(i||u?i=!1:(i=!0,r(0)),o.forEach(Jt))}]))}}}function Kt(e){return e}function A(e){return function(t){return function(n){let r=!1;return t(function(i){if(typeof i=="number")r||(r=!0,n(i));else if(i.tag)r||(e(i[0]),n(i));else{var o=i[0];n(m(0,[function(u){if(!r)return u&&(r=!0),o(u)}]))}})}}}function Ht(e){e(0)}function We(e){return function(t){return function(n){function r(f){s&&(typeof f=="number"?(s=!1,a?n(f):o||(o=!0,i(0))):f.tag?(n(f),c?c=!1:u(0)):(u=f=f[0],c=!1,f(0)))}let i=E,o=!1,u=E,s=!1,c=!1,a=!1;t(function(f){typeof f=="number"?a||(a=!0,s||n(0)):f.tag?a||(s&&(u(1),u=E),o?o=!1:(o=!0,i(0)),f=e(f[0]),s=!0,f(r)):i=f[0]}),n(m(0,[function(f){if(f){if(a||(a=!0,i(1)),s)return s=!1,u(1)}else a||o||(o=!0,i(0)),s&&!c&&(c=!0,u(0))}]))}}}function zt(e){return function(t){return function(n){let r=[],i=E;return t(function(o){typeof o=="number"?Ue(r)(n):o.tag?(r.length>=e&&0<e&&r.shift(),r.push(o[0]),i(0)):(o=o[0],0>=e?(o(1),Bt(n)):(i=o,o(0)))})}}}function G(e){return function(t){let n=E,r=!1;return t(function(i){typeof i=="number"?r=!0:i.tag?r||(e(i[0]),n(0)):(n=i=i[0],i(0))}),{unsubscribe:function(){if(!r)return r=!0,n(1)}}}}function Yt(){}function g(e){return function(t){return function(n){let r=E;return t(function(i){typeof i=="number"?n(i):i.tag?e(i[0])?n(i):r(0):(r=i[0],n(i))})}}}function Ve(e){return function(t){let n=!1;t(m(0,[function(r){r?n=!0:n||(n=!0,t(m(1,[e])),t(0))}]))}}function Fe(e){return function(t){let n=0;var r=setInterval(function(){var i=n;n=n+1|0,t(m(1,[i]))},e);t(m(0,[function(i){i&&clearInterval(r)}]))}}function ee(e){return function(t){let n=Vt,r=!1;n=e({next:function(i){r||t(m(1,[i]))},complete:function(){r||(r=!0,t(0))}}),t(m(0,[function(i){if(i&&!r)return r=!0,n()}]))}}function Be(){let e=[],t=!1;return{source:function(n){function r(i){return i!==n}e=e.concat(n),n(m(0,[function(i){i&&(e=e.filter(r))}]))},next:function(n){t||e.forEach(function(r){r(m(1,[n]))})},complete:function(){t||(t=!0,e.forEach(Ft))}}}function F(e){return function(t){return function(n){return t(function(r){r=typeof r=="number"?0:r.tag?m(1,[e(r[0])]):m(0,[r[0]]),n(r)})}}}function L(e){return Z(Kt)(Ue(e))}function Je(e){return function(t){return function(n){let r=!1;return t(function(i){if(typeof i=="number")return r?void 0:(r=!0,n(i),e());if(i.tag)r||n(i);else{var o=i[0];n(m(0,[function(u){if(!r)return u?(r=!0,o(u),e()):o(u)}]))}})}}}function fe(e){return function(t){return function(n){return t(function(r){typeof r=="number"||r.tag?n(r):(n(r),e())})}}}function le(){for(var e=arguments,t=arguments[0],n=1,r=arguments.length;n<r;n++)t=e[n](t);return t}function Ke(e){return G(Yt)(e)}function B(e){function t(o){typeof o=="number"?(n.forEach(Ht),n=[]):o.tag?(i=!1,n.forEach(function(u){u(o)})):r=o[0]}let n=[],r=E,i=!1;return function(o){function u(s){return s!==o}n=n.concat(o),n.length===1&&e(t),o(m(0,[function(s){if(s){if(n=n.filter(u),n.length===0)return r(1)}else i||(i=!0,r(s))}]))}}function pe(e){return function(t){return function(n){let r=!1,i=0,o=E;t(function(u){typeof u=="number"?r||(r=!0,n(0)):u.tag?i<e&&!r&&(i=i+1|0,n(u),!r&&i>=e&&(r=!0,n(0),o(1))):(u=u[0],0>=e?(r=!0,n(0),u(1)):o=u)}),n(m(0,[function(u){if(!r){if(u)return r=!0,o(1);if(i<e)return o(0)}}]))}}}function te(e){return function(t){return function(n){function r(s){typeof s!="number"&&(s.tag?(i=!0,o(1),n(0)):(u=s=s[0],s(0)))}let i=!1,o=E,u=E;t(function(s){typeof s=="number"?i||(i=!0,u(1),n(0)):s.tag?i||n(s):(o=s[0],e(r))}),n(m(0,[function(s){if(!i)return s?(i=!0,o(1),u(1)):o(0)}]))}}}function He(e){return new Promise(function(t){zt(1)(e)(function(n){typeof n!="number"&&(n.tag?t(n[0]):n[0](0))})})}var nr=typeof Symbol=="function"?Symbol.observable||(Symbol.observable=Symbol("observable")):"@@observable";var ve=C(x("graphql/error/GraphQLError.mjs")),et=C(x("graphql/language/kinds.mjs")),tt=C(x("graphql/language/parser.mjs")),ge=C(x("graphql/language/printer.mjs"));function Xt(e){return typeof e=="string"?new ve.GraphQLError(e):typeof e=="object"&&e.message?new ve.GraphQLError(e.message,e.nodes,e.source,e.positions,e.path,e,e.extensions||{}):e}function Zt(){return this.message}function he(e,t){e|=0;for(var n=0,r=0|t.length;n<r;n++)e=(e<<5)+e+t.charCodeAt(n);return e}function J(e){var t,n,r,i,o,u;if(e===null||H.has(e))return"null";if(typeof e!="object")return JSON.stringify(e)||"";if(e.toJSON)return J(e.toJSON());if(Array.isArray(e)){for(t="[",n=0,r=e.length;n<r;n++)0<n&&(t+=","),t+=0<(i=J(e[n])).length?i:"null";return t+"]"}if(!(t=Object.keys(e).sort()).length&&e.constructor&&e.constructor!==Object)return t=ye.get(e)||Math.random().toString(36).slice(2),ye.set(e,t),'{"__key":"'+t+'"}';for(H.add(e),n="{",r=0,i=t.length;r<i;r++)(u=J(e[o=t[r]]))&&(1<n.length&&(n+=","),n+=J(o)+":"+u);return H.delete(e),n+"}"}function ne(e){return H.clear(),J(e)}function re(e){var t=(typeof e!="string"?e.loc&&e.loc.source.body||(0,ge.print)(e):e).replace(/([\s,]|#[^\n\r]+)+/g," ").trim();return typeof e!="string"&&(e.loc?(e="definitions"in e&&me(e))&&(t="# "+e+`
2
+ `+t):e.loc={start:0,end:t.length,source:{body:t,name:"gql",locationOffset:{line:1,column:1}}}),t}function de(e){if(typeof e=="string"){var t=he(5381,re(e))>>>0;e=ue.get(t)||(0,tt.parse)(e,{noLocation:!0})}else t=e.__key||he(5381,re(e))>>>0,e=ue.get(t)||e;return e.loc||re(e),e.__key=t,ue.set(t,e),e}function me(e){var t,n,r;for(t=0,n=e.definitions.length;t<n;t++)if((r=e.definitions[t]).kind===et.Kind.OPERATION_DEFINITION&&r.name)return r.name.value}function ie(e,t,n){return{operation:e,data:t.data,error:Array.isArray(t.errors)?new K({graphQLErrors:t.errors,response:n}):void 0,extensions:typeof t.extensions=="object"&&t.extensions||void 0}}function oe(e,t,n){return{operation:e,data:void 0,error:new K({networkError:t,response:n}),extensions:void 0}}function k(){return(k=Object.assign||function(e){var t,n,r;for(t=1;t<arguments.length;t++){n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ze(e){return{query:(0,ge.print)(e.query),operationName:me(e.query),variables:e.variables||void 0,extensions:void 0}}function Ye(e,t){var n=e.context.url;return e.kind!=="query"||!e.context.preferGetMethod||!t?n:(e=[],t.operationName&&e.push("operationName="+encodeURIComponent(t.operationName)),t.query&&e.push("query="+encodeURIComponent(t.query.replace(/([\s,]|#[^\n\r]+)+/g," ").trim())),t.variables&&e.push("variables="+encodeURIComponent(ne(t.variables))),t.extensions&&e.push("extensions="+encodeURIComponent(ne(t.extensions))),n+"?"+e.join("&"))}function Xe(e,t){var n=e.kind==="query"&&!!e.context.preferGetMethod;return k({},e=typeof e.context.fetchOptions=="function"?e.context.fetchOptions():e.context.fetchOptions||{},{body:!n&&t?JSON.stringify(t):void 0,method:n?"GET":"POST",headers:n?e.headers:k({},{"content-type":"application/json"},e.headers)})}function Ze(e,t,n){return ee(function(r){var i=r.next,o=r.complete,u=typeof AbortController!="undefined"?new AbortController:null,s=!1;return Promise.resolve().then(function(){if(!s)return u&&(n.signal=u.signal),function(a,f,l){var p,h=!1;return(a.context.fetch||fetch)(f,l).then(function(d){return p=d,h=200>d.status||d.status>=(l.redirect==="manual"?400:300),d.json()}).then(function(d){if(!("data"in d)&&!("errors"in d))throw Error("No Content");return ie(a,d,p)}).catch(function(d){if(d.name!=="AbortError")return oe(a,h?Error(p.statusText):d,p)})}(e,t,n)}).then(function(c){s||(s=!0,c&&i(c),o())}),function(){s=!0,u&&u.abort()}})}function q(e,t){return e=de(e),{key:t?he(e.__key,ne(t))>>>0:e.__key,query:e,variables:t||{}}}var K,H,ye,ue;K=function(e){function t(n){var r,i=n.networkError,o=n.response;r=function(s,c){var a="";return s!==void 0?a="[Network] "+s.message:(c!==void 0&&c.forEach(function(l){a+="[GraphQL] "+l.message+`
3
+ `}),a.trim())}(i,n=(n.graphQLErrors||[]).map(Xt)),e.call(this,r),this.name="CombinedError",this.message=r,this.graphQLErrors=n,this.networkError=i,this.response=o}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toString=Zt,t}(Error);H=new Set,ye=new WeakMap;ue=new Map;var ft=C(x("graphql/language/visitor.mjs")),ce=C(x("graphql/language/kinds.mjs")),lt=C(x("graphql/language/printer.mjs"));function be(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)be(e[n],t);else if(typeof e=="object"&&e!==null)for(n in e)n==="__typename"&&typeof e[n]=="string"?t[e[n]]=0:be(e[n],t);return t}function en(e){return e.kind===ce.Kind.FIELD&&e.name.value==="__typename"&&!e.alias}function nt(e){if(e.selectionSet&&!e.selectionSet.selections.some(en))return k({},e,{selectionSet:k({},e.selectionSet,{selections:e.selectionSet.selections.concat([{kind:ce.Kind.FIELD,name:{kind:ce.Kind.NAME,value:"__typename"}}])})})}function tn(e){e=de(e);var t=Oe.get(e.__key);return t||((t=(0,ft.visit)(e,{Field:nt,InlineFragment:nt})).__key=e.__key,Oe.set(e.__key,t)),t}function _e(e){return e&&typeof e=="object"?Object.keys(e).reduce(function(t,n){var r=e[n];return n==="__typename"?Object.defineProperty(t,"__typename",{enumerable:!1,value:r}):Array.isArray(r)?t[n]=r.map(_e):t[n]=r&&typeof r=="object"&&"__typename"in r?_e(r):r,t},{}):e}function rt(e){return e.toPromise=function(){return He(pe(1)(e))},e}function Q(e,t,n){return n||(n=t.context),{key:t.key,query:t.query,variables:t.variables,kind:e,context:n,get operationName(){if(!1)var r,i;return this.kind}}}function it(e,t){return Q(e.kind,e,k({},e.context,{meta:k({},e.context.meta,t)}))}function ot(){}function ke(e){return(e=e.kind)!=="mutation"&&e!=="query"}function nn(e){var t=Q(e.kind,e);return t.query=tn(e.query),t}function rn(e){return e.kind!=="query"||e.context.requestPolicy!=="cache-only"}function on(e){return it(e,{cacheOutcome:"miss"})}function un(e){return ke(e)}function sn(e){function t(l){var p=l.context.requestPolicy;return l.kind==="query"&&p!=="network-only"&&(p==="cache-only"||a.has(l.key))}function n(l){var p=a.get(l.key);return p=k({},p,{operation:it(l,{cacheOutcome:p?"hit":"miss"})}),l.context.requestPolicy==="cache-and-network"&&(p.stale=!0,ut(s,l)),p}function r(l){return!ke(l)&&t(l)}function i(l){function p(M){d.add(M)}var h,d,O,y=l.operation;if(y){if(h=Object.keys(be(l.data,{})).concat(y.context.additionalTypenames||[]),l.operation.kind==="mutation"){for(d=new Set,l=0;l<h.length;l++)(O=f[O=h[l]]||(f[O]=new Set)).forEach(p),O.clear();d.forEach(function(N){a.has(N)&&(y=a.get(N).operation,a.delete(N),ut(s,y))})}else if(y.kind==="query"&&l.data)for(a.set(y.key,l),l=0;l<h.length;l++)(f[O=h[l]]||(f[O]=new Set)).add(y.key)}}function o(l){return!ke(l)&&!t(l)}var u=e.forward,s=e.client,c=e.dispatchDebug,a=new Map,f=Object.create(null);return function(l){var p=B(l);return l=F(n)(g(r)(p)),p=A(i)(u(g(rn)(F(on)(L([F(nn)(g(o)(p)),g(un)(p)]))))),L([l,p])}}function ut(e,t){return e.reexecuteOperation(Q(t.kind,t,k({},t.context,{requestPolicy:"network-only"})))}function cn(e){function t(u){o.delete(u.operation.key)}function n(u){var s=u.key,c=u.kind;return c==="teardown"?(o.delete(s),!0):c!=="query"&&c!=="subscription"?!0:(c=o.has(s),o.add(s),!c)}var r=e.forward,i=e.dispatchDebug,o=new Set;return function(u){return u=g(n)(u),A(t)(r(u))}}function an(e){return e.kind==="query"||e.kind==="mutation"}function fn(e){return e.kind!=="query"&&e.kind!=="mutation"}function ln(e){var t=e.forward,n=e.dispatchDebug;return function(r){var i,o=B(r);return r=Z(function(u){var s=u.key,c=g(function(p){return p.kind==="teardown"&&p.key===s})(o),a=ze(u),f=Ye(u,a),l=Xe(u,a);return A(function(p){var h=p.data?void 0:p.error})(te(c)(Ze(u,f,l)))})(g(an)(o)),i=t(g(fn)(o)),L([r,i])}}function pn(){return!1}function st(e){function t(r){if(r.kind!=="teardown"&&!1)var i}var n=e.dispatchDebug;return function(r){return g(pn)(A(t)(r))}}function hn(e){return function(t){var n=t.client,r=t.dispatchDebug;return e.reduceRight(function(i,o){return o({client:n,forward:i,dispatchDebug:function(u){}})},t.forward)}}function S(e){var t,n,r,i,o,u=this;this.activeOperations=Object.create(null),this.queue=[],this.createOperationContext=function(s){return s||(s={}),k({},{url:u.url,fetchOptions:u.fetchOptions,fetch:u.fetch,preferGetMethod:u.preferGetMethod},s,{suspense:s.suspense||s.suspense!==!1&&u.suspense,requestPolicy:s.requestPolicy||u.requestPolicy})},this.createRequestOperation=function(s,c,a){return Q(s,c,u.createOperationContext(a))},this.executeQuery=function(s,c){return s=u.createRequestOperation("query",s,c),u.executeRequestOperation(s)},this.executeSubscription=function(s,c){return s=u.createRequestOperation("subscription",s,c),u.executeRequestOperation(s)},this.executeMutation=function(s,c){return s=u.createRequestOperation("mutation",s,c),u.executeRequestOperation(s)},t=ot,this.url=e.url,this.fetchOptions=e.fetchOptions,this.fetch=e.fetch,this.suspense=!!e.suspense,this.requestPolicy=e.requestPolicy||"cache-first",this.preferGetMethod=!!e.preferGetMethod,this.maskTypename=!!e.maskTypename,n=Be(),i=n.next,this.operations$=n.source,o=!1,this.dispatchOperation=function(s){for(o=!0,s&&i(s);s=u.queue.shift();)i(s);o=!1},this.reexecuteOperation=function(s){(s.kind==="mutation"||0<(u.activeOperations[s.key]||0))&&(u.queue.push(s),o||Promise.resolve().then(u.dispatchOperation))},e=hn(e.exchanges!==void 0?e.exchanges:se),this.results$=B(e({client:this,dispatchDebug:t,forward:st({dispatchDebug:t})})(this.operations$)),Ke(this.results$)}function dn(e){return e.data=_e(e.data),e}function ct(e){return new S(e)}function at(e){function t(i){return(i=i.kind)==="subscription"||!!r&&(i==="query"||i==="mutation")}var n=e.forwardSubscription,r=e.enableAllOperations;return function(i){function o(f){var l=n({key:f.key.toString(36),query:(0,lt.print)(f.query),variables:f.variables,context:k({},f.context)});return ee(function(p){function h(R){return M(ie(f,R))}function d(R){return M(oe(f,R))}function O(){P||(P=!0,f.kind==="subscription"&&s.reexecuteOperation(Q("teardown",f,f.context)),N())}var y,M=p.next,N=p.complete,P=!1;return Promise.resolve().then(function(){P||(y=l.subscribe({next:h,error:d,complete:O}))}),function(){P=!0,y&&y.unsubscribe()}})}function u(f){return!a(f)}var s=i.client,c=i.forward,a=t;return function(f){var l,p=B(f);return f=Z(function(h){var d=h.key,O=g(function(y){return y.kind==="teardown"&&y.key===d})(p);return te(O)(o(h))})(g(a)(p)),l=c(g(u)(p)),L([f,l])}}}var Oe,mn,yn,vn,se;Oe=new Map;mn={},yn={key:"Operation.operationName",message:'The "Operation.operationName" property has been deprecated and will be removed in a future release of urql. Use "Operation.kind" instead.'};vn=st({dispatchDebug:ot});se=[cn,sn,ln];S.prototype.onOperationStart=function(e){var t=e.key;this.activeOperations[t]=(this.activeOperations[t]||0)+1,this.dispatchOperation(e)};S.prototype.onOperationEnd=function(e){var t=e.key,n=this.activeOperations[t]||0;if(0>=(this.activeOperations[t]=0>=n?0:n-1)){for(t=this.queue.length-1;0<=t;t--)this.queue[t].key===e.key&&this.queue.splice(t,1);this.dispatchOperation(Q("teardown",e,e.context))}};S.prototype.executeRequestOperation=function(e){var t,n,r=this,i=g(function(o){return o.operation.key===e.key})(this.results$);return this.maskTypename&&(i=F(dn)(i)),e.kind==="mutation"?pe(1)(fe(function(){return r.dispatchOperation(e)})(i)):(t=g(function(o){return o.kind==="teardown"&&o.key===e.key})(this.operations$),n=Je(function(){r.onOperationEnd(e)})(fe(function(){r.onOperationStart(e)})(te(t)(i))),e.kind==="query"&&e.context.pollInterval?We(function(){return n})(L([Ve(0),Fe(e.context.pollInterval)])):n)};S.prototype.query=function(e,t,n){return n&&typeof n.suspense=="boolean"||(n=k({},n,{suspense:!1})),rt(this.executeQuery(q(e,t),n))};S.prototype.readQuery=function(e,t,n){var r=null;return G(function(i){r=i})(this.executeQuery(q(e,t),n)).unsubscribe(),r};S.prototype.subscription=function(e,t,n){return this.executeSubscription(q(e,t),n)};S.prototype.mutation=function(e,t,n){return rt(this.executeMutation(q(e,t),n))};var I=C(x("react"));var pt,Ee,we,gn,bn,_n,kn,On,En,wn,xn;pt=ct({url:"/graphql"});we=(Ee=(0,I.createContext)(pt)).Provider;gn=Ee.Consumer;bn=!1;_n=function(){var e=(0,I.useContext)(Ee);return e};kn={fetching:!1,stale:!1,error:void 0,data:void 0,extensions:void 0,operation:void 0};On=!1;En=function(e,t){var n,r;if(typeof e!="object"||typeof t!="object")return e!==t;for(n in e)if(!(n in t))return!0;for(r in t)if(e[r]!==t[r])return!0;return!1};wn=function(e,t){return e.suspense&&(!t||t.suspense!==!1)};xn=new Map;function ht(e){return new Promise((t,n)=>{le(e,G(({data:r,error:i})=>{i?n(i):t(r)}))})}function z(e,t,n={}){let{variables:r,cache:i,headers:o={}}=n,u=q(t,r),s=e.executeQuery(u,{requestPolicy:i,fetchOptions:{headers:o}});return ht(s)}function xe(e,t,n={}){let{variables:r,headers:i={}}=n,o=q(t,r),u=e.executeMutation(o,{fetchOptions:{headers:i}});return ht(u)}function qe(e,t,n,r={}){let{variables:i,headers:o={}}=r,u=q(t,i),s=e.executeSubscription(u,{fetchOptions:{headers:o}}),{unsubscribe:c}=le(s,G(({data:a,error:f})=>{n(a,f)}));return c}var Nt=C(It());function Re(e={}){let t=e.url||location.origin,n=(e.subscriptionUrl||t).replace(/^http/i,"ws"),r=e.subscriptionUrl!==!1&&new Nt.SubscriptionClient(n,{reconnect:!0,lazy:e.lazy||!1,inactivityTimeout:0,connectionCallback(u){let{onConnected:s,onDisconnected:c}=e,a=u&&(Array.isArray(u)?u:[u]);a&&a.length>0?typeof c=="function"&&c(a):typeof s=="function"&&s()}}),i=u=>r.request(u),o=[...se];return r&&o.push(at({forwardSubscription:i})),new S({url:t,fetchOptions:e.default||{},exchanges:o})}function Ae(e,t){let n=t.headers||{},r=[];return e.emit("before-fetch",{headers:n,setHeaders(i){i&&r.push(i)}}),Promise.all(r).then(i=>{let o=i.reduce((u,s)=>typeof s=="object"&&s?X(X({},u),s):u,n);return De(X({},t),{headers:o})})}function zn(){if(typeof window!="undefined")return Re()}function Yn(e=zn()){return t=>(t.includeProvider(Mt.createElement(we,{value:e})),{query(n,r={}){return Ae(t,r).then(i=>z(e,n,i))},mutate(n,r={}){return Ae(t,r).then(i=>xe(e,n,i))},subscribe(n,r,i={}){let o=Ae(t,i).then(u=>qe(e,n,r,u));return()=>o.then(u=>u())}})}var Xn=`query initialData {
4
+ pilets {
5
+ hash
6
+ link
7
+ name
8
+ version
9
+ }
10
+ }`;function Zn(e){return z(e,Xn).then(({pilets:t})=>t)}return er;})();
package/src/pilets.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PiletMetadata } from 'piral-base';
1
+ import type { PiletMetadata } from 'piral-core';
2
2
  import { gqlQuery } from './queries';
3
3
  import { UrqlClient } from './types';
4
4