@onflow/fcl
Advanced tools
Comparing version 0.0.27 to 0.0.28
@@ -5,2 +5,7 @@ ### Unreleased | ||
### 0.0.28 -- 2020-04-20 | ||
- 2020-04-20 -- VSN `@onflow/sdk` 0.0.12 -> 0.0.14 | ||
- 2020-04-20 -- Remove `@onflow/send` in favour of `@onflow/sdk` | ||
### 0.0.27 -- 2020-04-18 | ||
@@ -7,0 +12,0 @@ |
@@ -1,2 +0,2 @@ | ||
var e,r=(e=require("queue-microtask"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("@onflow/sdk"),t=require("@onflow/send");function o(){return(o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}const u=function(){function e(){}return e.prototype.then=function(r,n){const t=new e,o=this.s;if(o){const e=1&o?r:n;if(e){try{c(t,1,e(this.v))}catch(e){c(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?c(t,1,r?r(o):o):n?c(t,1,n(o)):c(t,2,o)}catch(e){c(t,2,e)}},t},e}();function c(e,r,n){if(!e.s){if(n instanceof u){if(!n.s)return void(n.o=c.bind(null,e,r));1&r&&(r=n.s),n=n.v}if(n&&n.then)return void n.then(c.bind(null,e,r),c.bind(null,e,2));e.s=r,e.v=n;const t=e.o;t&&t(e)}}function s(e){return e instanceof u&&1&e.s}function a(e,r,n){for(var t;;){var o=e();if(s(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!s(i)){t=1;break}i=i.s}if(r){var a=r();if(a&&a.then&&!s(a)){t=2;break}}}var f=new u,l=c.bind(null,f,2);return(0===t?o.then(d):1===t?i.then(v):a.then(h)).then(void 0,l),f;function v(t){i=t;do{if(r&&(a=r())&&a.then&&!s(a))return void a.then(h).then(void 0,l);if(!(o=e())||s(o)&&!o.v)return void c(f,1,i);if(o.then)return void o.then(d).then(void 0,l);s(i=n())&&(i=i.v)}while(!i||!i.then);i.then(v).then(void 0,l)}function d(e){e?(i=n())&&i.then?i.then(v).then(void 0,l):v(i):c(f,1,i)}function h(){(o=e())?o.then?o.then(d).then(void 0,l):d(o):c(f,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f={},l=0,v=function(e,r,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:t.from,tag:r,data:n,timeout:c,reply:o,reject:i};try{f[e].mailbox.deliver(s),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},d=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++l),null!=f[n])return n;var t,o;f[n]={addr:n,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var r=o.shift();if(r)return e(r);t=e})}}),subs:new Set,kvs:{}};var u={self:function(){return n},receive:function(){return f[n].mailbox.receive()},send:function(e,r,t,o){return void 0===o&&(o={}),o.from=n,v(e,r,t,o)},broadcast:function(e,r,t){void 0===t&&(t={}),t.from=n;for(var o,u=function(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(f[n].subs);!(o=u()).done;)v(o.value,e,r,t)},subscribe:function(e){return null!=e&&f[n].subs.add(e)},unsubscribe:function(e){return null!=e&&f[n].subs.delete(e)},put:function(e,r){null!=e&&(f[n].kvs[e]=r)},get:function(e,r){var t=f[n].kvs[e];return null==t?r:t},delete:function(e){delete f[n].kvs[e]},update:function(e,r){null!=e&&(f[n].kvs[e]=r(f[n].kvs[e]))},keys:function(){return Object.keys(f[n].kvs)}};return r(function(){try{return Promise.resolve(e(u)).then(function(){!function(e){delete f[e]}(n)})}catch(e){return Promise.reject(e)}}),n},h="config",m="PUT_CONFIG",y="GET_CONFIG",b="CONFIG/UPDATED";d(function(e){try{var r=function(r){return r.reduce(function(r,n){var t;return o({},r,((t={})[n]=e.get(n),t))},{})},n=a(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(n){var t=n.data;try{switch(n.tag){case m:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(b,r(e.keys()))));case y:return void(null!=t.key&&n.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(b,r(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(b,r(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(r(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(n.from),void e.send(n.from,b,r(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(n.from);default:return}}catch(e){return void console.error("Config Error",n,e)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},h);var p=function(e){return e},P=function(){return{put:function(e,r){v(h,m,{key:e,value:r})},get:function(e,r){return v(h,y,{key:e,fallback:r},{expectReply:!0,timeout:10})},update:function(e,r){void 0===r&&(r=p),v(h,"UPDATE_CONFIG",{key:e,fn:r})},delete:function(e){v(h,"DELETE_CONFIG",{key:e})},where:function(e){return v(h,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var r=d(function(r){try{var n=!1;return r.send(h,"SUBSCRIBE"),Promise.resolve(a(function(){return!n&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(t){if("@EXIT"===t.tag)return r.send(h,"UNSUBSCRIBE"),void(n=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return v(r,"@EXIT")}}}};P().put("accessNode.api","http://localhost:8080");var k,S=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},E=function(e,r){return r.reduce(function(r,n){var t;return o({},r,((t={})[n]=e.get(n),t))},{})},g=((k={}).SUBSCRIBE=function(e,r){e.subscribe(r.from),e.send(r.from,"USER/UPDATED",E(e,e.keys()))},k.UNSUBSCRIBE=function(e,r){e.unsubscribe(r.from)},k.SNAPSHOT=function(e,r){try{return r.reply(E(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}},k),I=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===r&&(r=10),new Promise(function(e){return setTimeout(e,r)}))).then(function(){return{acct:e,name:"bob the builder",avatar:S(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var r}(e.self())).then(function(r){!function(e,r){for(var n=0,t=Object.keys(r);n<t.length;n++){var o=t[n];e.put(o,r[o])}}(e,r);var n=a(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(g[r.tag](e,r)).then(function(){})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){console.error("User Error",r,e)})}catch(e){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(e,r){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},j=function(e){return d(I,e)};exports.authenticate=function(){return Promise.resolve()},exports.config=P,exports.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},exports.decode=function(e){return Promise.resolve()},exports.event=function(e,r){return{subscribe:function(e){return function(){}}}},exports.send=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{var o=function(o){return r.node=o,Array.isArray(e)&&(e=n.build(e)),Promise.resolve(n.pipe(e,[n.resolve([n.resolveParams,n.resolvePayload,n.resolveAuthorizations])])).then(function(e){return t.send(e,r)})},i=r.node;return Promise.resolve(i?o(i):Promise.resolve(P().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},exports.transaction=function(e){return{subscribe:function(e){return function(){}}}},exports.unauthenticate=function(){return Promise.resolve()},exports.user=function(e){return{authorization:function(){try{return j(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return j(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return j(e),Promise.resolve(v(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(r){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(r){j(e);var n=d(function(n){try{var t=!1;return n.send(e,"SUBSCRIBE"),Promise.resolve(a(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(e,"UNSUBSCRIBE"),void(t=!0);r(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return v(n,"@EXIT")}}}}; | ||
var e,r=(e=require("queue-microtask"))&&"object"==typeof e&&"default"in e?e.default:e,t=require("@onflow/sdk");function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}const i=function(){function e(){}return e.prototype.then=function(r,t){const n=new e,o=this.s;if(o){const e=1&o?r:t;if(e){try{u(n,1,e(this.v))}catch(e){u(n,2,e)}return n}return this}return this.o=function(e){try{const o=e.v;1&e.s?u(n,1,r?r(o):o):t?u(n,1,t(o)):u(n,2,o)}catch(e){u(n,2,e)}},n},e}();function u(e,r,t){if(!e.s){if(t instanceof i){if(!t.s)return void(t.o=u.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(u.bind(null,e,r),u.bind(null,e,2));e.s=r,e.v=t;const n=e.o;n&&n(e)}}function c(e){return e instanceof i&&1&e.s}function s(e,r,t){for(var n;;){var o=e();if(c(o)&&(o=o.v),!o)return s;if(o.then){n=0;break}var s=t();if(s&&s.then){if(!c(s)){n=1;break}s=s.s}if(r){var a=r();if(a&&a.then&&!c(a)){n=2;break}}}var f=new i,l=u.bind(null,f,2);return(0===n?o.then(d):1===n?s.then(v):a.then(h)).then(void 0,l),f;function v(n){s=n;do{if(r&&(a=r())&&a.then&&!c(a))return void a.then(h).then(void 0,l);if(!(o=e())||c(o)&&!o.v)return void u(f,1,s);if(o.then)return void o.then(d).then(void 0,l);c(s=t())&&(s=s.v)}while(!s||!s.then);s.then(v).then(void 0,l)}function d(e){e?(s=t())&&s.then?s.then(v).then(void 0,l):v(s):u(f,1,s)}function h(){(o=e())?o.then?o.then(d).then(void 0,l):d(o):u(f,1,s)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var a={},f=0,l=function(e,r,t,n){return void 0===n&&(n={}),new Promise(function(o,i){var u=n.expectReply||!1,c=null!=n.timeout?n.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:n.from,tag:r,data:t,timeout:c,reply:o,reject:i};try{a[e].mailbox.deliver(s),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},v=function(e,t){if(void 0===t&&(t=null),null==t&&(t=++f),null!=a[t])return t;var n,i;a[t]={addr:t,mailbox:(i=[],{deliver:function(e){try{return i.push(e),n&&(n(i.shift()),n=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var r=i.shift();if(r)return e(r);n=e})}}),subs:new Set,kvs:{}};var u={self:function(){return t},receive:function(){return a[t].mailbox.receive()},send:function(e,r,n,o){return void 0===o&&(o={}),o.from=t,l(e,r,n,o)},broadcast:function(e,r,n){void 0===n&&(n={}),n.from=t;for(var i,u=function(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return o(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(a[t].subs);!(i=u()).done;)l(i.value,e,r,n)},subscribe:function(e){return null!=e&&a[t].subs.add(e)},unsubscribe:function(e){return null!=e&&a[t].subs.delete(e)},put:function(e,r){null!=e&&(a[t].kvs[e]=r)},get:function(e,r){var n=a[t].kvs[e];return null==n?r:n},delete:function(e){delete a[t].kvs[e]},update:function(e,r){null!=e&&(a[t].kvs[e]=r(a[t].kvs[e]))},keys:function(){return Object.keys(a[t].kvs)}};return r(function(){try{return Promise.resolve(e(u)).then(function(){!function(e){delete a[e]}(t)})}catch(e){return Promise.reject(e)}}),t},d="config",h="PUT_CONFIG",m="GET_CONFIG",y="CONFIG/UPDATED";v(function(e){try{var r=function(r){return r.reduce(function(r,t){var o;return n({},r,((o={})[t]=e.get(t),o))},{})},t=s(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(t){var n=t.data;try{switch(t.tag){case h:return void(null!=n.key&&(e.put(n.key,n.value),e.broadcast(y,r(e.keys()))));case m:return void(null!=n.key&&t.reply(e.get(n.key,n.fallback)));case"UPDATE_CONFIG":return void(null!=n.key&&(e.update(n.key,n.fn),e.broadcast(y,r(e.keys()))));case"DELETE_CONFIG":return void(null!=n.key&&(e.delete(n.key),e.broadcast(y,r(e.keys()))));case"WHERE_CONFIG":return void(null!=n.pattern&&t.reply(r(e.keys().filter(function(e){return n.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(t.from),void e.send(t.from,y,r(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(t.from);default:return}}catch(e){return void console.error("Config Error",t,e)}})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},d);var b=function(e){return e},p=function(){return{put:function(e,r){l(d,h,{key:e,value:r})},get:function(e,r){return l(d,m,{key:e,fallback:r},{expectReply:!0,timeout:10})},update:function(e,r){void 0===r&&(r=b),l(d,"UPDATE_CONFIG",{key:e,fn:r})},delete:function(e){l(d,"DELETE_CONFIG",{key:e})},where:function(e){return l(d,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var r=v(function(r){try{var t=!1;return r.send(d,"SUBSCRIBE"),Promise.resolve(s(function(){return!t&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(n){if("@EXIT"===n.tag)return r.send(d,"UNSUBSCRIBE"),void(t=!0);e(n.data)})}))}catch(e){return Promise.reject(e)}});return function(){return l(r,"@EXIT")}}}};p().put("accessNode.api","http://localhost:8080");var P,k=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},S=function(e,r){return r.reduce(function(r,t){var o;return n({},r,((o={})[t]=e.get(t),o))},{})},E=((P={}).SUBSCRIBE=function(e,r){e.subscribe(r.from),e.send(r.from,"USER/UPDATED",S(e,e.keys()))},P.UNSUBSCRIBE=function(e,r){e.unsubscribe(r.from)},P.SNAPSHOT=function(e,r){try{return r.reply(S(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}},P),g=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===r&&(r=10),new Promise(function(e){return setTimeout(e,r)}))).then(function(){return{acct:e,name:"bob the builder",avatar:k(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var r}(e.self())).then(function(r){!function(e,r){for(var t=0,n=Object.keys(r);t<n.length;t++){var o=n[t];e.put(o,r[o])}}(e,r);var t=s(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var t=function(t,n){try{var o=function(t,n){try{var o=Promise.resolve(E[r.tag](e,r)).then(function(){})}catch(e){return n(e)}return o&&o.then?o.then(void 0,n):o}(0,function(e){console.error("User Error",r,e)})}catch(e){return}return o&&o.then?o.then(n.bind(null,!1),n.bind(null,!0)):void 0}(0,function(e,r){});if(t&&t.then)return t.then(function(){})})});return t&&t.then?t.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},I=function(e){return v(g,e)};exports.authenticate=function(){return Promise.resolve()},exports.config=p,exports.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},exports.decode=function(e){return Promise.resolve()},exports.event=function(e,r){return{subscribe:function(e){return function(){}}}},exports.send=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{var n=function(n){return r.node=n,Array.isArray(e)&&(e=t.build(e)),Promise.resolve(t.pipe(e,[t.resolve([t.resolveParams,t.resolveAuthorizations])])).then(function(e){return t.send(e,r)})},o=r.node;return Promise.resolve(o?n(o):Promise.resolve(p().get("accessNode.api")).then(n))}catch(e){return Promise.reject(e)}},exports.transaction=function(e){return{subscribe:function(e){return function(){}}}},exports.unauthenticate=function(){return Promise.resolve()},exports.user=function(e){return{authorization:function(){try{return I(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return I(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return I(e),Promise.resolve(l(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(r){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(r){I(e);var t=v(function(t){try{var n=!1;return t.send(e,"SUBSCRIBE"),Promise.resolve(s(function(){return!n&&1},void 0,function(){return Promise.resolve(t.receive()).then(function(o){if("@EXIT"===o.tag)return t.send(e,"UNSUBSCRIBE"),void(n=!0);r(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return l(t,"@EXIT")}}}}; | ||
//# sourceMappingURL=fcl.js.map |
@@ -1,2 +0,2 @@ | ||
import r from"queue-microtask";import{build as e,pipe as n,resolve as t,resolveParams as o,resolvePayload as i,resolveAuthorizations as u}from"@onflow/sdk";import{send as c}from"@onflow/send";function s(){return(s=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}const f=function(){function r(){}return r.prototype.then=function(e,n){const t=new r,o=this.s;if(o){const r=1&o?e:n;if(r){try{l(t,1,r(this.v))}catch(r){l(t,2,r)}return t}return this}return this.o=function(r){try{const o=r.v;1&r.s?l(t,1,e?e(o):o):n?l(t,1,n(o)):l(t,2,o)}catch(r){l(t,2,r)}},t},r}();function l(r,e,n){if(!r.s){if(n instanceof f){if(!n.s)return void(n.o=l.bind(null,r,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(l.bind(null,r,e),l.bind(null,r,2));r.s=e,r.v=n;const t=r.o;t&&t(r)}}function v(r){return r instanceof f&&1&r.s}function d(r,e,n){for(var t;;){var o=r();if(v(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!v(i)){t=1;break}i=i.s}if(e){var u=e();if(u&&u.then&&!v(u)){t=2;break}}}var c=new f,s=l.bind(null,c,2);return(0===t?o.then(d):1===t?i.then(a):u.then(h)).then(void 0,s),c;function a(t){i=t;do{if(e&&(u=e())&&u.then&&!v(u))return void u.then(h).then(void 0,s);if(!(o=r())||v(o)&&!o.v)return void l(c,1,i);if(o.then)return void o.then(d).then(void 0,s);v(i=n())&&(i=i.v)}while(!i||!i.then);i.then(a).then(void 0,s)}function d(r){r?(i=n())&&i.then?i.then(a).then(void 0,s):a(i):l(c,1,i)}function h(){(o=r())?o.then?o.then(d).then(void 0,s):d(o):l(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var h={},m=0,y=function(r,e,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:r,from:t.from,tag:e,data:n,timeout:c,reply:o,reject:i};try{h[r].mailbox.deliver(s),u||o(!0)}catch(r){console.error("FCL.Actor -- Could Not Deliver Message",s,r)}})},b=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++m),null!=h[n])return n;var t,o;h[n]={addr:n,mailbox:(o=[],{deliver:function(r){try{return o.push(r),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(r){return Promise.reject(r)}},receive:function(){return new Promise(function(r){var e=o.shift();if(e)return r(e);t=r})}}),subs:new Set,kvs:{}};var i={self:function(){return n},receive:function(){return h[n].mailbox.receive()},send:function(r,e,t,o){return void 0===o&&(o={}),o.from=n,y(r,e,t,o)},broadcast:function(r,e,t){void 0===t&&(t={}),t.from=n;for(var o,i=function(r){var e=0;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(r=function(r,e){if(r){if("string"==typeof r)return a(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(r,void 0):void 0}}(r)))return function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(e=r[Symbol.iterator]()).next.bind(e)}(h[n].subs);!(o=i()).done;)y(o.value,r,e,t)},subscribe:function(r){return null!=r&&h[n].subs.add(r)},unsubscribe:function(r){return null!=r&&h[n].subs.delete(r)},put:function(r,e){null!=r&&(h[n].kvs[r]=e)},get:function(r,e){var t=h[n].kvs[r];return null==t?e:t},delete:function(r){delete h[n].kvs[r]},update:function(r,e){null!=r&&(h[n].kvs[r]=e(h[n].kvs[r]))},keys:function(){return Object.keys(h[n].kvs)}};return r(function(){try{return Promise.resolve(e(i)).then(function(){!function(r){delete h[r]}(n)})}catch(r){return Promise.reject(r)}}),n},p="config",P="PUT_CONFIG",k="GET_CONFIG",S="CONFIG/UPDATED";b(function(r){try{var e=function(e){return e.reduce(function(e,n){var t;return s({},e,((t={})[n]=r.get(n),t))},{})},n=d(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(n){var t=n.data;try{switch(n.tag){case P:return void(null!=t.key&&(r.put(t.key,t.value),r.broadcast(S,e(r.keys()))));case k:return void(null!=t.key&&n.reply(r.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(r.update(t.key,t.fn),r.broadcast(S,e(r.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(r.delete(t.key),r.broadcast(S,e(r.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(e(r.keys().filter(function(r){return t.pattern.test(r)}))));case"SUBSCRIBE":return r.subscribe(n.from),void r.send(n.from,S,e(r.keys()));case"UNSUBSCRIBE":return void r.unsubscribe(n.from);default:return}}catch(r){return void console.error("Config Error",n,r)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(r){return Promise.reject(r)}},p);var E=function(r){return r},I=function(){return{put:function(r,e){y(p,P,{key:r,value:e})},get:function(r,e){return y(p,k,{key:r,fallback:e},{expectReply:!0,timeout:10})},update:function(r,e){void 0===e&&(e=E),y(p,"UPDATE_CONFIG",{key:r,fn:e})},delete:function(r){y(p,"DELETE_CONFIG",{key:r})},where:function(r){return y(p,"WHERE_CONFIG",{pattern:r},{expectReply:!0,timeout:10})},subscribe:function(r){var e=b(function(e){try{var n=!1;return e.send(p,"SUBSCRIBE"),Promise.resolve(d(function(){return!n&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(t){if("@EXIT"===t.tag)return e.send(p,"UNSUBSCRIBE"),void(n=!0);r(t.data)})}))}catch(r){return Promise.reject(r)}});return function(){return y(e,"@EXIT")}}}};I().put("accessNode.api","http://localhost:8080");var g,w=function(r,s){void 0===r&&(r=[]),void 0===s&&(s={});try{var a=function(a){return s.node=a,Array.isArray(r)&&(r=e(r)),Promise.resolve(n(r,[t([o,i,u])])).then(function(r){return c(r,s)})},f=s.node;return Promise.resolve(f?a(f):Promise.resolve(I().get("accessNode.api")).then(a))}catch(r){return Promise.reject(r)}},j=function(r){return"https://avatars.onflow.org/avatar/"+r+".svg"},C=function(r,e){return e.reduce(function(e,n){var t;return s({},e,((t={})[n]=r.get(n),t))},{})},U=((g={}).SUBSCRIBE=function(r,e){r.subscribe(e.from),r.send(e.from,"USER/UPDATED",C(r,r.keys()))},g.UNSUBSCRIBE=function(r,e){r.unsubscribe(e.from)},g.SNAPSHOT=function(r,e){try{return e.reply(C(r,r.keys())),Promise.resolve()}catch(r){return Promise.reject(r)}},g),A=function(r){try{return Promise.resolve(function(r){try{return Promise.resolve((void 0===e&&(e=10),new Promise(function(r){return setTimeout(r,e)}))).then(function(){return{acct:r,name:"bob the builder",avatar:j(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(r){return Promise.reject(r)}var e}(r.self())).then(function(e){!function(r,e){for(var n=0,t=Object.keys(e);n<t.length;n++){var o=t[n];r.put(o,e[o])}}(r,e);var n=d(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(e){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(U[e.tag](r,e)).then(function(){})}catch(r){return t(r)}return o&&o.then?o.then(void 0,t):o}(0,function(r){console.error("User Error",e,r)})}catch(r){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(r,e){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(r){return Promise.reject(r)}},N=function(r){return b(A,r)},O=function(r){return{authorization:function(){try{return N(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},payerAuthorization:function(){try{return N(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},snapshot:function(){try{return N(r),Promise.resolve(y(r,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(r){return Promise.reject(r)}},param:function(e){return{value:r,xform:{asParam:function(r){return r},asInjection:function(r){return r}}}},subscribe:function(e){N(r);var n=b(function(n){try{var t=!1;return n.send(r,"SUBSCRIBE"),Promise.resolve(d(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(r,"UNSUBSCRIBE"),void(t=!0);e(o.data)})}))}catch(r){return Promise.reject(r)}});return function(){return y(n,"@EXIT")}}}},T=function(){return Promise.resolve()},B=function(){return Promise.resolve()},R=function(){return{subscribe:function(r){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},F=function(r){return{subscribe:function(r){return function(){}}}},x=function(r,e){return{subscribe:function(r){return function(){}}}},G=function(r){return Promise.resolve()};export{T as authenticate,I as config,R as currentUser,G as decode,x as event,w as send,F as transaction,B as unauthenticate,O as user}; | ||
import r from"queue-microtask";import{build as e,pipe as n,resolve as t,resolveParams as o,resolveAuthorizations as i,send as u}from"@onflow/sdk";function c(){return(c=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}function s(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}const a=function(){function r(){}return r.prototype.then=function(e,n){const t=new r,o=this.s;if(o){const r=1&o?e:n;if(r){try{f(t,1,r(this.v))}catch(r){f(t,2,r)}return t}return this}return this.o=function(r){try{const o=r.v;1&r.s?f(t,1,e?e(o):o):n?f(t,1,n(o)):f(t,2,o)}catch(r){f(t,2,r)}},t},r}();function f(r,e,n){if(!r.s){if(n instanceof a){if(!n.s)return void(n.o=f.bind(null,r,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,r,e),f.bind(null,r,2));r.s=e,r.v=n;const t=r.o;t&&t(r)}}function l(r){return r instanceof a&&1&r.s}function v(r,e,n){for(var t;;){var o=r();if(l(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!l(i)){t=1;break}i=i.s}if(e){var u=e();if(u&&u.then&&!l(u)){t=2;break}}}var c=new a,s=f.bind(null,c,2);return(0===t?o.then(d):1===t?i.then(v):u.then(h)).then(void 0,s),c;function v(t){i=t;do{if(e&&(u=e())&&u.then&&!l(u))return void u.then(h).then(void 0,s);if(!(o=r())||l(o)&&!o.v)return void f(c,1,i);if(o.then)return void o.then(d).then(void 0,s);l(i=n())&&(i=i.v)}while(!i||!i.then);i.then(v).then(void 0,s)}function d(r){r?(i=n())&&i.then?i.then(v).then(void 0,s):v(i):f(c,1,i)}function h(){(o=r())?o.then?o.then(d).then(void 0,s):d(o):f(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var d={},h=0,m=function(r,e,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:r,from:t.from,tag:e,data:n,timeout:c,reply:o,reject:i};try{d[r].mailbox.deliver(s),u||o(!0)}catch(r){console.error("FCL.Actor -- Could Not Deliver Message",s,r)}})},y=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++h),null!=d[n])return n;var t,o;d[n]={addr:n,mailbox:(o=[],{deliver:function(r){try{return o.push(r),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(r){return Promise.reject(r)}},receive:function(){return new Promise(function(r){var e=o.shift();if(e)return r(e);t=r})}}),subs:new Set,kvs:{}};var i={self:function(){return n},receive:function(){return d[n].mailbox.receive()},send:function(r,e,t,o){return void 0===o&&(o={}),o.from=n,m(r,e,t,o)},broadcast:function(r,e,t){void 0===t&&(t={}),t.from=n;for(var o,i=function(r){var e=0;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(r=function(r,e){if(r){if("string"==typeof r)return s(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(r,void 0):void 0}}(r)))return function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(e=r[Symbol.iterator]()).next.bind(e)}(d[n].subs);!(o=i()).done;)m(o.value,r,e,t)},subscribe:function(r){return null!=r&&d[n].subs.add(r)},unsubscribe:function(r){return null!=r&&d[n].subs.delete(r)},put:function(r,e){null!=r&&(d[n].kvs[r]=e)},get:function(r,e){var t=d[n].kvs[r];return null==t?e:t},delete:function(r){delete d[n].kvs[r]},update:function(r,e){null!=r&&(d[n].kvs[r]=e(d[n].kvs[r]))},keys:function(){return Object.keys(d[n].kvs)}};return r(function(){try{return Promise.resolve(e(i)).then(function(){!function(r){delete d[r]}(n)})}catch(r){return Promise.reject(r)}}),n},b="config",p="PUT_CONFIG",P="GET_CONFIG",k="CONFIG/UPDATED";y(function(r){try{var e=function(e){return e.reduce(function(e,n){var t;return c({},e,((t={})[n]=r.get(n),t))},{})},n=v(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(n){var t=n.data;try{switch(n.tag){case p:return void(null!=t.key&&(r.put(t.key,t.value),r.broadcast(k,e(r.keys()))));case P:return void(null!=t.key&&n.reply(r.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(r.update(t.key,t.fn),r.broadcast(k,e(r.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(r.delete(t.key),r.broadcast(k,e(r.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(e(r.keys().filter(function(r){return t.pattern.test(r)}))));case"SUBSCRIBE":return r.subscribe(n.from),void r.send(n.from,k,e(r.keys()));case"UNSUBSCRIBE":return void r.unsubscribe(n.from);default:return}}catch(r){return void console.error("Config Error",n,r)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(r){return Promise.reject(r)}},b);var S=function(r){return r},E=function(){return{put:function(r,e){m(b,p,{key:r,value:e})},get:function(r,e){return m(b,P,{key:r,fallback:e},{expectReply:!0,timeout:10})},update:function(r,e){void 0===e&&(e=S),m(b,"UPDATE_CONFIG",{key:r,fn:e})},delete:function(r){m(b,"DELETE_CONFIG",{key:r})},where:function(r){return m(b,"WHERE_CONFIG",{pattern:r},{expectReply:!0,timeout:10})},subscribe:function(r){var e=y(function(e){try{var n=!1;return e.send(b,"SUBSCRIBE"),Promise.resolve(v(function(){return!n&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(t){if("@EXIT"===t.tag)return e.send(b,"UNSUBSCRIBE"),void(n=!0);r(t.data)})}))}catch(r){return Promise.reject(r)}});return function(){return m(e,"@EXIT")}}}};E().put("accessNode.api","http://localhost:8080");var I,g=function(r,c){void 0===r&&(r=[]),void 0===c&&(c={});try{var s=function(s){return c.node=s,Array.isArray(r)&&(r=e(r)),Promise.resolve(n(r,[t([o,i])])).then(function(r){return u(r,c)})},a=c.node;return Promise.resolve(a?s(a):Promise.resolve(E().get("accessNode.api")).then(s))}catch(r){return Promise.reject(r)}},j=function(r){return"https://avatars.onflow.org/avatar/"+r+".svg"},w=function(r,e){return e.reduce(function(e,n){var t;return c({},e,((t={})[n]=r.get(n),t))},{})},C=((I={}).SUBSCRIBE=function(r,e){r.subscribe(e.from),r.send(e.from,"USER/UPDATED",w(r,r.keys()))},I.UNSUBSCRIBE=function(r,e){r.unsubscribe(e.from)},I.SNAPSHOT=function(r,e){try{return e.reply(w(r,r.keys())),Promise.resolve()}catch(r){return Promise.reject(r)}},I),U=function(r){try{return Promise.resolve(function(r){try{return Promise.resolve((void 0===e&&(e=10),new Promise(function(r){return setTimeout(r,e)}))).then(function(){return{acct:r,name:"bob the builder",avatar:j(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(r){return Promise.reject(r)}var e}(r.self())).then(function(e){!function(r,e){for(var n=0,t=Object.keys(e);n<t.length;n++){var o=t[n];r.put(o,e[o])}}(r,e);var n=v(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(e){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(C[e.tag](r,e)).then(function(){})}catch(r){return t(r)}return o&&o.then?o.then(void 0,t):o}(0,function(r){console.error("User Error",e,r)})}catch(r){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(r,e){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(r){return Promise.reject(r)}},A=function(r){return y(U,r)},N=function(r){return{authorization:function(){try{return A(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},payerAuthorization:function(){try{return A(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},snapshot:function(){try{return A(r),Promise.resolve(m(r,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(r){return Promise.reject(r)}},param:function(e){return{value:r,xform:{asParam:function(r){return r},asInjection:function(r){return r}}}},subscribe:function(e){A(r);var n=y(function(n){try{var t=!1;return n.send(r,"SUBSCRIBE"),Promise.resolve(v(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(r,"UNSUBSCRIBE"),void(t=!0);e(o.data)})}))}catch(r){return Promise.reject(r)}});return function(){return m(n,"@EXIT")}}}},O=function(){return Promise.resolve()},T=function(){return Promise.resolve()},B=function(){return{subscribe:function(r){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},R=function(r){return{subscribe:function(r){return function(){}}}},F=function(r,e){return{subscribe:function(r){return function(){}}}},x=function(r){return Promise.resolve()};export{O as authenticate,E as config,B as currentUser,x as decode,F as event,g as send,R as transaction,T as unauthenticate,N as user}; | ||
//# sourceMappingURL=fcl.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import r from"queue-microtask";import{build as e,pipe as n,resolve as t,resolveParams as o,resolvePayload as i,resolveAuthorizations as u}from"@onflow/sdk";import{send as c}from"@onflow/send";function s(){return(s=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}const f=function(){function r(){}return r.prototype.then=function(e,n){const t=new r,o=this.s;if(o){const r=1&o?e:n;if(r){try{l(t,1,r(this.v))}catch(r){l(t,2,r)}return t}return this}return this.o=function(r){try{const o=r.v;1&r.s?l(t,1,e?e(o):o):n?l(t,1,n(o)):l(t,2,o)}catch(r){l(t,2,r)}},t},r}();function l(r,e,n){if(!r.s){if(n instanceof f){if(!n.s)return void(n.o=l.bind(null,r,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(l.bind(null,r,e),l.bind(null,r,2));r.s=e,r.v=n;const t=r.o;t&&t(r)}}function v(r){return r instanceof f&&1&r.s}function d(r,e,n){for(var t;;){var o=r();if(v(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!v(i)){t=1;break}i=i.s}if(e){var u=e();if(u&&u.then&&!v(u)){t=2;break}}}var c=new f,s=l.bind(null,c,2);return(0===t?o.then(d):1===t?i.then(a):u.then(h)).then(void 0,s),c;function a(t){i=t;do{if(e&&(u=e())&&u.then&&!v(u))return void u.then(h).then(void 0,s);if(!(o=r())||v(o)&&!o.v)return void l(c,1,i);if(o.then)return void o.then(d).then(void 0,s);v(i=n())&&(i=i.v)}while(!i||!i.then);i.then(a).then(void 0,s)}function d(r){r?(i=n())&&i.then?i.then(a).then(void 0,s):a(i):l(c,1,i)}function h(){(o=r())?o.then?o.then(d).then(void 0,s):d(o):l(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var h={},m=0,y=function(r,e,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:r,from:t.from,tag:e,data:n,timeout:c,reply:o,reject:i};try{h[r].mailbox.deliver(s),u||o(!0)}catch(r){console.error("FCL.Actor -- Could Not Deliver Message",s,r)}})},b=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++m),null!=h[n])return n;var t,o;h[n]={addr:n,mailbox:(o=[],{deliver:function(r){try{return o.push(r),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(r){return Promise.reject(r)}},receive:function(){return new Promise(function(r){var e=o.shift();if(e)return r(e);t=r})}}),subs:new Set,kvs:{}};var i={self:function(){return n},receive:function(){return h[n].mailbox.receive()},send:function(r,e,t,o){return void 0===o&&(o={}),o.from=n,y(r,e,t,o)},broadcast:function(r,e,t){void 0===t&&(t={}),t.from=n;for(var o,i=function(r){var e=0;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(r=function(r,e){if(r){if("string"==typeof r)return a(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(r,void 0):void 0}}(r)))return function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(e=r[Symbol.iterator]()).next.bind(e)}(h[n].subs);!(o=i()).done;)y(o.value,r,e,t)},subscribe:function(r){return null!=r&&h[n].subs.add(r)},unsubscribe:function(r){return null!=r&&h[n].subs.delete(r)},put:function(r,e){null!=r&&(h[n].kvs[r]=e)},get:function(r,e){var t=h[n].kvs[r];return null==t?e:t},delete:function(r){delete h[n].kvs[r]},update:function(r,e){null!=r&&(h[n].kvs[r]=e(h[n].kvs[r]))},keys:function(){return Object.keys(h[n].kvs)}};return r(function(){try{return Promise.resolve(e(i)).then(function(){!function(r){delete h[r]}(n)})}catch(r){return Promise.reject(r)}}),n},p="config",P="PUT_CONFIG",k="GET_CONFIG",S="CONFIG/UPDATED";b(function(r){try{var e=function(e){return e.reduce(function(e,n){var t;return s({},e,((t={})[n]=r.get(n),t))},{})},n=d(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(n){var t=n.data;try{switch(n.tag){case P:return void(null!=t.key&&(r.put(t.key,t.value),r.broadcast(S,e(r.keys()))));case k:return void(null!=t.key&&n.reply(r.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(r.update(t.key,t.fn),r.broadcast(S,e(r.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(r.delete(t.key),r.broadcast(S,e(r.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(e(r.keys().filter(function(r){return t.pattern.test(r)}))));case"SUBSCRIBE":return r.subscribe(n.from),void r.send(n.from,S,e(r.keys()));case"UNSUBSCRIBE":return void r.unsubscribe(n.from);default:return}}catch(r){return void console.error("Config Error",n,r)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(r){return Promise.reject(r)}},p);var E=function(r){return r},I=function(){return{put:function(r,e){y(p,P,{key:r,value:e})},get:function(r,e){return y(p,k,{key:r,fallback:e},{expectReply:!0,timeout:10})},update:function(r,e){void 0===e&&(e=E),y(p,"UPDATE_CONFIG",{key:r,fn:e})},delete:function(r){y(p,"DELETE_CONFIG",{key:r})},where:function(r){return y(p,"WHERE_CONFIG",{pattern:r},{expectReply:!0,timeout:10})},subscribe:function(r){var e=b(function(e){try{var n=!1;return e.send(p,"SUBSCRIBE"),Promise.resolve(d(function(){return!n&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(t){if("@EXIT"===t.tag)return e.send(p,"UNSUBSCRIBE"),void(n=!0);r(t.data)})}))}catch(r){return Promise.reject(r)}});return function(){return y(e,"@EXIT")}}}};I().put("accessNode.api","http://localhost:8080");var g,w=function(r,s){void 0===r&&(r=[]),void 0===s&&(s={});try{var a=function(a){return s.node=a,Array.isArray(r)&&(r=e(r)),Promise.resolve(n(r,[t([o,i,u])])).then(function(r){return c(r,s)})},f=s.node;return Promise.resolve(f?a(f):Promise.resolve(I().get("accessNode.api")).then(a))}catch(r){return Promise.reject(r)}},j=function(r){return"https://avatars.onflow.org/avatar/"+r+".svg"},C=function(r,e){return e.reduce(function(e,n){var t;return s({},e,((t={})[n]=r.get(n),t))},{})},U=((g={}).SUBSCRIBE=function(r,e){r.subscribe(e.from),r.send(e.from,"USER/UPDATED",C(r,r.keys()))},g.UNSUBSCRIBE=function(r,e){r.unsubscribe(e.from)},g.SNAPSHOT=function(r,e){try{return e.reply(C(r,r.keys())),Promise.resolve()}catch(r){return Promise.reject(r)}},g),A=function(r){try{return Promise.resolve(function(r){try{return Promise.resolve((void 0===e&&(e=10),new Promise(function(r){return setTimeout(r,e)}))).then(function(){return{acct:r,name:"bob the builder",avatar:j(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(r){return Promise.reject(r)}var e}(r.self())).then(function(e){!function(r,e){for(var n=0,t=Object.keys(e);n<t.length;n++){var o=t[n];r.put(o,e[o])}}(r,e);var n=d(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(e){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(U[e.tag](r,e)).then(function(){})}catch(r){return t(r)}return o&&o.then?o.then(void 0,t):o}(0,function(r){console.error("User Error",e,r)})}catch(r){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(r,e){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(r){return Promise.reject(r)}},N=function(r){return b(A,r)},O=function(r){return{authorization:function(){try{return N(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},payerAuthorization:function(){try{return N(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},snapshot:function(){try{return N(r),Promise.resolve(y(r,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(r){return Promise.reject(r)}},param:function(e){return{value:r,xform:{asParam:function(r){return r},asInjection:function(r){return r}}}},subscribe:function(e){N(r);var n=b(function(n){try{var t=!1;return n.send(r,"SUBSCRIBE"),Promise.resolve(d(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(r,"UNSUBSCRIBE"),void(t=!0);e(o.data)})}))}catch(r){return Promise.reject(r)}});return function(){return y(n,"@EXIT")}}}},T=function(){return Promise.resolve()},B=function(){return Promise.resolve()},R=function(){return{subscribe:function(r){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},F=function(r){return{subscribe:function(r){return function(){}}}},x=function(r,e){return{subscribe:function(r){return function(){}}}},G=function(r){return Promise.resolve()};export{T as authenticate,I as config,R as currentUser,G as decode,x as event,w as send,F as transaction,B as unauthenticate,O as user}; | ||
import r from"queue-microtask";import{build as e,pipe as n,resolve as t,resolveParams as o,resolveAuthorizations as i,send as u}from"@onflow/sdk";function c(){return(c=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}function s(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}const a=function(){function r(){}return r.prototype.then=function(e,n){const t=new r,o=this.s;if(o){const r=1&o?e:n;if(r){try{f(t,1,r(this.v))}catch(r){f(t,2,r)}return t}return this}return this.o=function(r){try{const o=r.v;1&r.s?f(t,1,e?e(o):o):n?f(t,1,n(o)):f(t,2,o)}catch(r){f(t,2,r)}},t},r}();function f(r,e,n){if(!r.s){if(n instanceof a){if(!n.s)return void(n.o=f.bind(null,r,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,r,e),f.bind(null,r,2));r.s=e,r.v=n;const t=r.o;t&&t(r)}}function l(r){return r instanceof a&&1&r.s}function v(r,e,n){for(var t;;){var o=r();if(l(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!l(i)){t=1;break}i=i.s}if(e){var u=e();if(u&&u.then&&!l(u)){t=2;break}}}var c=new a,s=f.bind(null,c,2);return(0===t?o.then(d):1===t?i.then(v):u.then(h)).then(void 0,s),c;function v(t){i=t;do{if(e&&(u=e())&&u.then&&!l(u))return void u.then(h).then(void 0,s);if(!(o=r())||l(o)&&!o.v)return void f(c,1,i);if(o.then)return void o.then(d).then(void 0,s);l(i=n())&&(i=i.v)}while(!i||!i.then);i.then(v).then(void 0,s)}function d(r){r?(i=n())&&i.then?i.then(v).then(void 0,s):v(i):f(c,1,i)}function h(){(o=r())?o.then?o.then(d).then(void 0,s):d(o):f(c,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var d={},h=0,m=function(r,e,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:r,from:t.from,tag:e,data:n,timeout:c,reply:o,reject:i};try{d[r].mailbox.deliver(s),u||o(!0)}catch(r){console.error("FCL.Actor -- Could Not Deliver Message",s,r)}})},y=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++h),null!=d[n])return n;var t,o;d[n]={addr:n,mailbox:(o=[],{deliver:function(r){try{return o.push(r),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(r){return Promise.reject(r)}},receive:function(){return new Promise(function(r){var e=o.shift();if(e)return r(e);t=r})}}),subs:new Set,kvs:{}};var i={self:function(){return n},receive:function(){return d[n].mailbox.receive()},send:function(r,e,t,o){return void 0===o&&(o={}),o.from=n,m(r,e,t,o)},broadcast:function(r,e,t){void 0===t&&(t={}),t.from=n;for(var o,i=function(r){var e=0;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(r=function(r,e){if(r){if("string"==typeof r)return s(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(r,void 0):void 0}}(r)))return function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(e=r[Symbol.iterator]()).next.bind(e)}(d[n].subs);!(o=i()).done;)m(o.value,r,e,t)},subscribe:function(r){return null!=r&&d[n].subs.add(r)},unsubscribe:function(r){return null!=r&&d[n].subs.delete(r)},put:function(r,e){null!=r&&(d[n].kvs[r]=e)},get:function(r,e){var t=d[n].kvs[r];return null==t?e:t},delete:function(r){delete d[n].kvs[r]},update:function(r,e){null!=r&&(d[n].kvs[r]=e(d[n].kvs[r]))},keys:function(){return Object.keys(d[n].kvs)}};return r(function(){try{return Promise.resolve(e(i)).then(function(){!function(r){delete d[r]}(n)})}catch(r){return Promise.reject(r)}}),n},b="config",p="PUT_CONFIG",P="GET_CONFIG",k="CONFIG/UPDATED";y(function(r){try{var e=function(e){return e.reduce(function(e,n){var t;return c({},e,((t={})[n]=r.get(n),t))},{})},n=v(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(n){var t=n.data;try{switch(n.tag){case p:return void(null!=t.key&&(r.put(t.key,t.value),r.broadcast(k,e(r.keys()))));case P:return void(null!=t.key&&n.reply(r.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(r.update(t.key,t.fn),r.broadcast(k,e(r.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(r.delete(t.key),r.broadcast(k,e(r.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(e(r.keys().filter(function(r){return t.pattern.test(r)}))));case"SUBSCRIBE":return r.subscribe(n.from),void r.send(n.from,k,e(r.keys()));case"UNSUBSCRIBE":return void r.unsubscribe(n.from);default:return}}catch(r){return void console.error("Config Error",n,r)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(r){return Promise.reject(r)}},b);var S=function(r){return r},E=function(){return{put:function(r,e){m(b,p,{key:r,value:e})},get:function(r,e){return m(b,P,{key:r,fallback:e},{expectReply:!0,timeout:10})},update:function(r,e){void 0===e&&(e=S),m(b,"UPDATE_CONFIG",{key:r,fn:e})},delete:function(r){m(b,"DELETE_CONFIG",{key:r})},where:function(r){return m(b,"WHERE_CONFIG",{pattern:r},{expectReply:!0,timeout:10})},subscribe:function(r){var e=y(function(e){try{var n=!1;return e.send(b,"SUBSCRIBE"),Promise.resolve(v(function(){return!n&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(t){if("@EXIT"===t.tag)return e.send(b,"UNSUBSCRIBE"),void(n=!0);r(t.data)})}))}catch(r){return Promise.reject(r)}});return function(){return m(e,"@EXIT")}}}};E().put("accessNode.api","http://localhost:8080");var I,g=function(r,c){void 0===r&&(r=[]),void 0===c&&(c={});try{var s=function(s){return c.node=s,Array.isArray(r)&&(r=e(r)),Promise.resolve(n(r,[t([o,i])])).then(function(r){return u(r,c)})},a=c.node;return Promise.resolve(a?s(a):Promise.resolve(E().get("accessNode.api")).then(s))}catch(r){return Promise.reject(r)}},j=function(r){return"https://avatars.onflow.org/avatar/"+r+".svg"},w=function(r,e){return e.reduce(function(e,n){var t;return c({},e,((t={})[n]=r.get(n),t))},{})},C=((I={}).SUBSCRIBE=function(r,e){r.subscribe(e.from),r.send(e.from,"USER/UPDATED",w(r,r.keys()))},I.UNSUBSCRIBE=function(r,e){r.unsubscribe(e.from)},I.SNAPSHOT=function(r,e){try{return e.reply(w(r,r.keys())),Promise.resolve()}catch(r){return Promise.reject(r)}},I),U=function(r){try{return Promise.resolve(function(r){try{return Promise.resolve((void 0===e&&(e=10),new Promise(function(r){return setTimeout(r,e)}))).then(function(){return{acct:r,name:"bob the builder",avatar:j(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(r){return Promise.reject(r)}var e}(r.self())).then(function(e){!function(r,e){for(var n=0,t=Object.keys(e);n<t.length;n++){var o=t[n];r.put(o,e[o])}}(r,e);var n=v(function(){return 1},void 0,function(){return Promise.resolve(r.receive()).then(function(e){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(C[e.tag](r,e)).then(function(){})}catch(r){return t(r)}return o&&o.then?o.then(void 0,t):o}(0,function(r){console.error("User Error",e,r)})}catch(r){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(r,e){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(r){return Promise.reject(r)}},A=function(r){return y(U,r)},N=function(r){return{authorization:function(){try{return A(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},payerAuthorization:function(){try{return A(r),Promise.resolve({acct:r,signFn:function(){try{throw new Error("fcl.user("+r+").payerAuthorization WIP error -- known missing functionality")}catch(r){return Promise.reject(r)}}})}catch(r){return Promise.reject(r)}},snapshot:function(){try{return A(r),Promise.resolve(m(r,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(r){return Promise.reject(r)}},param:function(e){return{value:r,xform:{asParam:function(r){return r},asInjection:function(r){return r}}}},subscribe:function(e){A(r);var n=y(function(n){try{var t=!1;return n.send(r,"SUBSCRIBE"),Promise.resolve(v(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(r,"UNSUBSCRIBE"),void(t=!0);e(o.data)})}))}catch(r){return Promise.reject(r)}});return function(){return m(n,"@EXIT")}}}},O=function(){return Promise.resolve()},T=function(){return Promise.resolve()},B=function(){return{subscribe:function(r){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},R=function(r){return{subscribe:function(r){return function(){}}}},F=function(r,e){return{subscribe:function(r){return function(){}}}},x=function(r){return Promise.resolve()};export{O as authenticate,E as config,B as currentUser,x as decode,F as event,g as send,R as transaction,T as unauthenticate,N as user}; | ||
//# sourceMappingURL=fcl.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("queue-microtask"),require("@onflow/sdk"),require("@onflow/send")):"function"==typeof define&&define.amd?define(["exports","queue-microtask","@onflow/sdk","@onflow/send"],r):r((e=e||self).fcl={},e.queueMicrotask,e.sdk,e.send$1)}(this,function(e,r,n,t){function o(){return(o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;const u=function(){function e(){}return e.prototype.then=function(r,n){const t=new e,o=this.s;if(o){const e=1&o?r:n;if(e){try{c(t,1,e(this.v))}catch(e){c(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?c(t,1,r?r(o):o):n?c(t,1,n(o)):c(t,2,o)}catch(e){c(t,2,e)}},t},e}();function c(e,r,n){if(!e.s){if(n instanceof u){if(!n.s)return void(n.o=c.bind(null,e,r));1&r&&(r=n.s),n=n.v}if(n&&n.then)return void n.then(c.bind(null,e,r),c.bind(null,e,2));e.s=r,e.v=n;const t=e.o;t&&t(e)}}function s(e){return e instanceof u&&1&e.s}function a(e,r,n){for(var t;;){var o=e();if(s(o)&&(o=o.v),!o)return i;if(o.then){t=0;break}var i=n();if(i&&i.then){if(!s(i)){t=1;break}i=i.s}if(r){var a=r();if(a&&a.then&&!s(a)){t=2;break}}}var f=new u,l=c.bind(null,f,2);return(0===t?o.then(d):1===t?i.then(v):a.then(h)).then(void 0,l),f;function v(t){i=t;do{if(r&&(a=r())&&a.then&&!s(a))return void a.then(h).then(void 0,l);if(!(o=e())||s(o)&&!o.v)return void c(f,1,i);if(o.then)return void o.then(d).then(void 0,l);s(i=n())&&(i=i.v)}while(!i||!i.then);i.then(v).then(void 0,l)}function d(e){e?(i=n())&&i.then?i.then(v).then(void 0,l):v(i):c(f,1,i)}function h(){(o=e())?o.then?o.then(d).then(void 0,l):d(o):c(f,1,i)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f={},l=0,v=function(e,r,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:t.from,tag:r,data:n,timeout:c,reply:o,reject:i};try{f[e].mailbox.deliver(s),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},d=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++l),null!=f[n])return n;var t,o;f[n]={addr:n,mailbox:(o=[],{deliver:function(e){try{return o.push(e),t&&(t(o.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var r=o.shift();if(r)return e(r);t=e})}}),subs:new Set,kvs:{}};var u={self:function(){return n},receive:function(){return f[n].mailbox.receive()},send:function(e,r,t,o){return void 0===o&&(o={}),o.from=n,v(e,r,t,o)},broadcast:function(e,r,t){void 0===t&&(t={}),t.from=n;for(var o,u=function(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(f[n].subs);!(o=u()).done;)v(o.value,e,r,t)},subscribe:function(e){return null!=e&&f[n].subs.add(e)},unsubscribe:function(e){return null!=e&&f[n].subs.delete(e)},put:function(e,r){null!=e&&(f[n].kvs[e]=r)},get:function(e,r){var t=f[n].kvs[e];return null==t?r:t},delete:function(e){delete f[n].kvs[e]},update:function(e,r){null!=e&&(f[n].kvs[e]=r(f[n].kvs[e]))},keys:function(){return Object.keys(f[n].kvs)}};return r(function(){try{return Promise.resolve(e(u)).then(function(){!function(e){delete f[e]}(n)})}catch(e){return Promise.reject(e)}}),n},h="config",m="PUT_CONFIG",y="GET_CONFIG",b="CONFIG/UPDATED";d(function(e){try{var r=function(r){return r.reduce(function(r,n){var t;return o({},r,((t={})[n]=e.get(n),t))},{})},n=a(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(n){var t=n.data;try{switch(n.tag){case m:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(b,r(e.keys()))));case y:return void(null!=t.key&&n.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(b,r(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(b,r(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(r(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(n.from),void e.send(n.from,b,r(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(n.from);default:return}}catch(e){return void console.error("Config Error",n,e)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},h);var p=function(e){return e},P=function(){return{put:function(e,r){v(h,m,{key:e,value:r})},get:function(e,r){return v(h,y,{key:e,fallback:r},{expectReply:!0,timeout:10})},update:function(e,r){void 0===r&&(r=p),v(h,"UPDATE_CONFIG",{key:e,fn:r})},delete:function(e){v(h,"DELETE_CONFIG",{key:e})},where:function(e){return v(h,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var r=d(function(r){try{var n=!1;return r.send(h,"SUBSCRIBE"),Promise.resolve(a(function(){return!n&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(t){if("@EXIT"===t.tag)return r.send(h,"UNSUBSCRIBE"),void(n=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return v(r,"@EXIT")}}}};P().put("accessNode.api","http://localhost:8080");var k,S=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},E=function(e,r){return r.reduce(function(r,n){var t;return o({},r,((t={})[n]=e.get(n),t))},{})},g=((k={}).SUBSCRIBE=function(e,r){e.subscribe(r.from),e.send(r.from,"USER/UPDATED",E(e,e.keys()))},k.UNSUBSCRIBE=function(e,r){e.unsubscribe(r.from)},k.SNAPSHOT=function(e,r){try{return r.reply(E(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}},k),I=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===r&&(r=10),new Promise(function(e){return setTimeout(e,r)}))).then(function(){return{acct:e,name:"bob the builder",avatar:S(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var r}(e.self())).then(function(r){!function(e,r){for(var n=0,t=Object.keys(r);n<t.length;n++){var o=t[n];e.put(o,r[o])}}(e,r);var n=a(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(g[r.tag](e,r)).then(function(){})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){console.error("User Error",r,e)})}catch(e){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(e,r){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},w=function(e){return d(I,e)};e.authenticate=function(){return Promise.resolve()},e.config=P,e.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},e.decode=function(e){return Promise.resolve()},e.event=function(e,r){return{subscribe:function(e){return function(){}}}},e.send=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{var o=function(o){return r.node=o,Array.isArray(e)&&(e=n.build(e)),Promise.resolve(n.pipe(e,[n.resolve([n.resolveParams,n.resolvePayload,n.resolveAuthorizations])])).then(function(e){return t.send(e,r)})},i=r.node;return Promise.resolve(i?o(i):Promise.resolve(P().get("accessNode.api")).then(o))}catch(e){return Promise.reject(e)}},e.transaction=function(e){return{subscribe:function(e){return function(){}}}},e.unauthenticate=function(){return Promise.resolve()},e.user=function(e){return{authorization:function(){try{return w(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return w(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return w(e),Promise.resolve(v(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(r){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(r){w(e);var n=d(function(n){try{var t=!1;return n.send(e,"SUBSCRIBE"),Promise.resolve(a(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(e,"UNSUBSCRIBE"),void(t=!0);r(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return v(n,"@EXIT")}}}}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("queue-microtask"),require("@onflow/sdk")):"function"==typeof define&&define.amd?define(["exports","queue-microtask","@onflow/sdk"],r):r((e=e||self).fcl={},e.queueMicrotask,e.sdk)}(this,function(e,r,n){function t(){return(t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;const i=function(){function e(){}return e.prototype.then=function(r,n){const t=new e,o=this.s;if(o){const e=1&o?r:n;if(e){try{u(t,1,e(this.v))}catch(e){u(t,2,e)}return t}return this}return this.o=function(e){try{const o=e.v;1&e.s?u(t,1,r?r(o):o):n?u(t,1,n(o)):u(t,2,o)}catch(e){u(t,2,e)}},t},e}();function u(e,r,n){if(!e.s){if(n instanceof i){if(!n.s)return void(n.o=u.bind(null,e,r));1&r&&(r=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,e,r),u.bind(null,e,2));e.s=r,e.v=n;const t=e.o;t&&t(e)}}function c(e){return e instanceof i&&1&e.s}function s(e,r,n){for(var t;;){var o=e();if(c(o)&&(o=o.v),!o)return s;if(o.then){t=0;break}var s=n();if(s&&s.then){if(!c(s)){t=1;break}s=s.s}if(r){var a=r();if(a&&a.then&&!c(a)){t=2;break}}}var f=new i,l=u.bind(null,f,2);return(0===t?o.then(d):1===t?s.then(v):a.then(h)).then(void 0,l),f;function v(t){s=t;do{if(r&&(a=r())&&a.then&&!c(a))return void a.then(h).then(void 0,l);if(!(o=e())||c(o)&&!o.v)return void u(f,1,s);if(o.then)return void o.then(d).then(void 0,l);c(s=n())&&(s=s.v)}while(!s||!s.then);s.then(v).then(void 0,l)}function d(e){e?(s=n())&&s.then?s.then(v).then(void 0,l):v(s):u(f,1,s)}function h(){(o=e())?o.then?o.then(d).then(void 0,l):d(o):u(f,1,s)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var a={},f=0,l=function(e,r,n,t){return void 0===t&&(t={}),new Promise(function(o,i){var u=t.expectReply||!1,c=null!=t.timeout?t.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:e,from:t.from,tag:r,data:n,timeout:c,reply:o,reject:i};try{a[e].mailbox.deliver(s),u||o(!0)}catch(e){console.error("FCL.Actor -- Could Not Deliver Message",s,e)}})},v=function(e,n){if(void 0===n&&(n=null),null==n&&(n=++f),null!=a[n])return n;var t,i;a[n]={addr:n,mailbox:(i=[],{deliver:function(e){try{return i.push(e),t&&(t(i.shift()),t=void 0),Promise.resolve()}catch(e){return Promise.reject(e)}},receive:function(){return new Promise(function(e){var r=i.shift();if(r)return e(r);t=e})}}),subs:new Set,kvs:{}};var u={self:function(){return n},receive:function(){return a[n].mailbox.receive()},send:function(e,r,t,o){return void 0===o&&(o={}),o.from=n,l(e,r,t,o)},broadcast:function(e,r,t){void 0===t&&(t={}),t.from=n;for(var i,u=function(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return o(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,void 0):void 0}}(e)))return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(a[n].subs);!(i=u()).done;)l(i.value,e,r,t)},subscribe:function(e){return null!=e&&a[n].subs.add(e)},unsubscribe:function(e){return null!=e&&a[n].subs.delete(e)},put:function(e,r){null!=e&&(a[n].kvs[e]=r)},get:function(e,r){var t=a[n].kvs[e];return null==t?r:t},delete:function(e){delete a[n].kvs[e]},update:function(e,r){null!=e&&(a[n].kvs[e]=r(a[n].kvs[e]))},keys:function(){return Object.keys(a[n].kvs)}};return r(function(){try{return Promise.resolve(e(u)).then(function(){!function(e){delete a[e]}(n)})}catch(e){return Promise.reject(e)}}),n},d="config",h="PUT_CONFIG",m="GET_CONFIG",y="CONFIG/UPDATED";v(function(e){try{var r=function(r){return r.reduce(function(r,n){var o;return t({},r,((o={})[n]=e.get(n),o))},{})},n=s(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(n){var t=n.data;try{switch(n.tag){case h:return void(null!=t.key&&(e.put(t.key,t.value),e.broadcast(y,r(e.keys()))));case m:return void(null!=t.key&&n.reply(e.get(t.key,t.fallback)));case"UPDATE_CONFIG":return void(null!=t.key&&(e.update(t.key,t.fn),e.broadcast(y,r(e.keys()))));case"DELETE_CONFIG":return void(null!=t.key&&(e.delete(t.key),e.broadcast(y,r(e.keys()))));case"WHERE_CONFIG":return void(null!=t.pattern&&n.reply(r(e.keys().filter(function(e){return t.pattern.test(e)}))));case"SUBSCRIBE":return e.subscribe(n.from),void e.send(n.from,y,r(e.keys()));case"UNSUBSCRIBE":return void e.unsubscribe(n.from);default:return}}catch(e){return void console.error("Config Error",n,e)}})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},d);var b=function(e){return e},p=function(){return{put:function(e,r){l(d,h,{key:e,value:r})},get:function(e,r){return l(d,m,{key:e,fallback:r},{expectReply:!0,timeout:10})},update:function(e,r){void 0===r&&(r=b),l(d,"UPDATE_CONFIG",{key:e,fn:r})},delete:function(e){l(d,"DELETE_CONFIG",{key:e})},where:function(e){return l(d,"WHERE_CONFIG",{pattern:e},{expectReply:!0,timeout:10})},subscribe:function(e){var r=v(function(r){try{var n=!1;return r.send(d,"SUBSCRIBE"),Promise.resolve(s(function(){return!n&&1},void 0,function(){return Promise.resolve(r.receive()).then(function(t){if("@EXIT"===t.tag)return r.send(d,"UNSUBSCRIBE"),void(n=!0);e(t.data)})}))}catch(e){return Promise.reject(e)}});return function(){return l(r,"@EXIT")}}}};p().put("accessNode.api","http://localhost:8080");var P,k=function(e){return"https://avatars.onflow.org/avatar/"+e+".svg"},S=function(e,r){return r.reduce(function(r,n){var o;return t({},r,((o={})[n]=e.get(n),o))},{})},E=((P={}).SUBSCRIBE=function(e,r){e.subscribe(r.from),e.send(r.from,"USER/UPDATED",S(e,e.keys()))},P.UNSUBSCRIBE=function(e,r){e.unsubscribe(r.from)},P.SNAPSHOT=function(e,r){try{return r.reply(S(e,e.keys())),Promise.resolve()}catch(e){return Promise.reject(e)}},P),g=function(e){try{return Promise.resolve(function(e){try{return Promise.resolve((void 0===r&&(r=10),new Promise(function(e){return setTimeout(e,r)}))).then(function(){return{acct:e,name:"bob the builder",avatar:k(),bio:"Can he fix it, yes he can.",hooks:{}}})}catch(e){return Promise.reject(e)}var r}(e.self())).then(function(r){!function(e,r){for(var n=0,t=Object.keys(r);n<t.length;n++){var o=t[n];e.put(o,r[o])}}(e,r);var n=s(function(){return 1},void 0,function(){return Promise.resolve(e.receive()).then(function(r){var n=function(n,t){try{var o=function(n,t){try{var o=Promise.resolve(E[r.tag](e,r)).then(function(){})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){console.error("User Error",r,e)})}catch(e){return}return o&&o.then?o.then(t.bind(null,!1),t.bind(null,!0)):void 0}(0,function(e,r){});if(n&&n.then)return n.then(function(){})})});return n&&n.then?n.then(function(){}):void 0})}catch(e){return Promise.reject(e)}},I=function(e){return v(g,e)};e.authenticate=function(){return Promise.resolve()},e.config=p,e.currentUser=function(){return{subscribe:function(e){return function(){}},authorization:function(){return Promise.resolve()},payerAuthorization:function(){return Promise.resolve()},param:function(){return Promise.resolve()}}},e.decode=function(e){return Promise.resolve()},e.event=function(e,r){return{subscribe:function(e){return function(){}}}},e.send=function(e,r){void 0===e&&(e=[]),void 0===r&&(r={});try{var t=function(t){return r.node=t,Array.isArray(e)&&(e=n.build(e)),Promise.resolve(n.pipe(e,[n.resolve([n.resolveParams,n.resolveAuthorizations])])).then(function(e){return n.send(e,r)})},o=r.node;return Promise.resolve(o?t(o):Promise.resolve(p().get("accessNode.api")).then(t))}catch(e){return Promise.reject(e)}},e.transaction=function(e){return{subscribe:function(e){return function(){}}}},e.unauthenticate=function(){return Promise.resolve()},e.user=function(e){return{authorization:function(){try{return I(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},payerAuthorization:function(){try{return I(e),Promise.resolve({acct:e,signFn:function(){try{throw new Error("fcl.user("+e+").payerAuthorization WIP error -- known missing functionality")}catch(e){return Promise.reject(e)}}})}catch(e){return Promise.reject(e)}},snapshot:function(){try{return I(e),Promise.resolve(l(e,"SNAPSHOT",null,{expectReply:!0,timeout:0}))}catch(e){return Promise.reject(e)}},param:function(r){return{value:e,xform:{asParam:function(e){return e},asInjection:function(e){return e}}}},subscribe:function(r){I(e);var n=v(function(n){try{var t=!1;return n.send(e,"SUBSCRIBE"),Promise.resolve(s(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(o){if("@EXIT"===o.tag)return n.send(e,"UNSUBSCRIBE"),void(t=!0);r(o.data)})}))}catch(e){return Promise.reject(e)}});return function(){return l(n,"@EXIT")}}}}}); | ||
//# sourceMappingURL=fcl.umd.js.map |
{ | ||
"name": "@onflow/fcl", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"description": "Flow Client Library", | ||
@@ -10,6 +10,6 @@ "license": "Apache-2.0", | ||
"type": "git", | ||
"url": "git+ssh://git@github.com/dapperlabs/flow-js-sdk.git" | ||
"url": "git+ssh://git@github.com/onflow/flow-js-sdk.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/dapperlabs/flow-js-sdk/issues" | ||
"url": "https://github.com/onflow/flow-js-sdk/issues" | ||
}, | ||
@@ -38,6 +38,5 @@ "jest": { | ||
"dependencies": { | ||
"@onflow/sdk": "0.0.12", | ||
"@onflow/send": "0.0.5", | ||
"@onflow/sdk": "0.0.14", | ||
"queue-microtask": "^1.1.2" | ||
} | ||
} |
import * as sdk from "@onflow/sdk" | ||
import {config} from "../config" | ||
import {send as baseSend} from "@onflow/send" | ||
@@ -13,3 +12,2 @@ export const send = async (args = [], opts = {}) => { | ||
sdk.resolveParams, | ||
sdk.resolvePayload, | ||
sdk.resolveAuthorizations, | ||
@@ -19,3 +17,3 @@ ]), | ||
return baseSend(ix, opts) | ||
return sdk.send(ix, opts) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
2
0
228161
741
+ Added@onflow/decode@0.0.5(transitive)
+ Added@onflow/encode@0.0.2(transitive)
+ Added@onflow/interaction@0.0.5(transitive)
+ Added@onflow/sdk@0.0.14(transitive)
+ Added@onflow/send@0.0.8(transitive)
- Removed@onflow/send@0.0.5
- Removed@onflow/bytes@0.0.10.0.2(transitive)
- Removed@onflow/decode@0.0.4(transitive)
- Removed@onflow/interaction@0.0.3(transitive)
- Removed@onflow/sdk@0.0.12(transitive)
- Removed@onflow/send@0.0.5(transitive)
Updated@onflow/sdk@0.0.14