diff --git a/components/forms/MultisigForm.js b/components/forms/MultisigForm.js index a2ccdd8..3d3c096 100644 --- a/components/forms/MultisigForm.js +++ b/components/forms/MultisigForm.js @@ -82,10 +82,7 @@ class MultiSigForm extends React.Component { }; }), }; - const res = await axios.post( - "/.netlify/functions/create-multisig", - multisig - ); + const res = await axios.post("/api/multisig", multisig); const multiAddress = res.data.data.address; this.props.router.push(`/multi/${multiAddress}`); }; diff --git a/lambda-build/create-multisig.js b/lambda-build/create-multisig.js deleted file mode 100644 index 725d57b..0000000 --- a/lambda-build/create-multisig.js +++ /dev/null @@ -1,6 +0,0 @@ -!function(e,t){for(var n in t)e[n]=t[n]}(exports,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}([function(e,t){e.exports=require("stream")},function(e,t,n){"use strict";function r(e,t){return"object"==typeof e&&null!==e&&Boolean(e[t])}function o(e,t){t=t||"";var n,o,a=[];for(o in"string"!=typeof t&&(t="?"),e)if(r(e,o)){if((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=i(o),n=i(n),null===o||null===n)continue;a.push(o+"="+n)}return a.length?t+a.join("&"):""}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}e.exports={mergeObjects:function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},formatUrl:function(e,t,n){return n="object"==typeof n?o(n):n,[e,t?"/"===t.charAt(0)?"":"/"+t:"",n?"?"===n.charAt(0)?"":"?"+n:""].join("")},querystringify:o,inherits:function(e,t){if(null==e)throw new TypeError('The constructor to "inherits" must not be null or undefined');if(null==t)throw new TypeError('The super constructor to "inherits" must not be null or undefined');if(void 0===t.prototype)throw new TypeError('The super constructor to "inherits" must have a prototype');e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},isNodeEnv:function(){return"undefined"==typeof window&&"undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node},defaults:function(e,t){return void 0===e?t:e},applyDefaults:function(e,t){var n={};for(var r in e){if(!(r in t))throw new Error("No such option "+r);n[r]=e[r]}for(var o in t)o in n||(n[o]=t[o]);return n},removeNullAndUndefinedValues:function(e){var t={};for(var n in e){var r=e[n];null!=r&&(t[n]=r)}return t},removeUndefinedValues:function(e){var t={};for(var n in e){var r=e[n];void 0!==r&&(t[n]=r)}return t},checkInstanceHasProperty:r}},function(e,t){e.exports=require("zlib")},function(e,t,n){"use strict";var r=n(1);function o(e,t,n){Error.call(this),this.name=e,this.message=t,this.description=n}function i(e){o.call(this,"InvalidValue",e)}function a(e,t,n,r){var i=`${r} function requires ${function(e,t){return null===t?"at least "+e:null===e?"up to "+t:e===t?e:"from "+e+" to "+t}(e,t)} argument(s) but ${n} were given`,a="For more info, see the docs: https://docs.fauna.com/fauna/current/api/fql/functions/"+r.toLowerCase();o.call(this,"InvalidArity",`${i}\n${a}`),this.min=e,this.max=t,this.actual=n}function s(e,t){var n=t.responseContent.errors,r=0===n.length?'(empty "errors")':n[0].code,i=0===n.length?'(empty "errors")':n[0].description;o.call(this,e,r,i),this.requestResult=t}function u(e){s.call(this,"BadRequest",e)}function c(e){s.call(this,"Unauthorized",e)}function l(e){s.call(this,"PermissionDenied",e)}function f(e){s.call(this,"NotFound",e)}function p(e){s.call(this,"MethodNotAllowed",e)}function d(e){s.call(this,"InternalError",e)}function h(e){s.call(this,"UnavailableError",e)}function m(e,t,n){o.call(this,e,t,n)}function y(e){o.call(this,"StreamsNotSupported","streams not supported",e)}function b(e){var t=e.data||{};o.call(this,"StreamErrorEvent",t.code,t.description),this.event=e}r.inherits(o,Error),r.inherits(i,o),r.inherits(a,o),r.inherits(s,o),s.prototype.errors=function(){return this.requestResult.responseContent.errors},s.raiseForStatusCode=function(e){var t=e.statusCode;if(t<200||t>=300)switch(t){case 400:throw new u(e);case 401:throw new c(e);case 403:throw new l(e);case 404:throw new f(e);case 405:throw new p(e);case 500:throw new d(e);case 503:throw new h(e);default:throw new s("UnknownError",e)}},r.inherits(u,s),r.inherits(c,s),r.inherits(l,s),r.inherits(f,s),r.inherits(p,s),r.inherits(d,s),r.inherits(h,s),r.inherits(m,o),r.inherits(y,m),r.inherits(b,m),e.exports={FaunaError:o,FaunaHTTPError:s,InvalidValue:i,InvalidArity:a,BadRequest:u,Unauthorized:c,PermissionDenied:l,NotFound:f,MethodNotAllowed:p,InternalError:d,UnavailableError:h,StreamError:m,StreamsNotSupported:y,StreamErrorEvent:b}},function(e,t,n){"use strict";var r=n(22),o=n(14),i=n(8),a=n(3),s=n(5),u=n(16),c=n(1);function l(e){return m.exact(1,arguments,l.name),new i({var:v(e)})}var f=function(e){return m.exact(1,arguments,f.name),new i({object:g(e)})};function p(){switch(m.between(1,2,arguments,p.name),arguments.length){case 1:var e=arguments[0];if("function"==typeof e)return d(e);if(e instanceof i||c.checkInstanceHasProperty(e,"_isFaunaExpr"))return e;throw new a.InvalidValue("Lambda function takes either a Function or an Expr.");case 2:var t=arguments[0],n=arguments[1];return h(t,n)}}function d(e){var t=r(e);switch(t.length){case 0:throw new a.InvalidValue("Provided Function must take at least 1 argument.");case 1:return h(t[0],e(l(t[0])));default:return h(t,e.apply(null,t.map((function(e){return l(e)}))))}}function h(e,t){return new i({lambda:v(e),expr:v(t)})}function m(e,t,n,r){if(null!==e&&n.lengtht)throw new a.InvalidArity(e,t,n.length,r)}function y(e,t){for(var n in t){var r=t[n];null!==r&&(e[n]=r)}return e}function b(e){var t=Array.isArray(e)?e:Array.prototype.slice.call(e);return 1===e.length?e[0]:t}function w(e){var t=[];return t.push.apply(t,e),t}function v(e){return m.exact(1,arguments,v.name),null===e?null:e instanceof i||c.checkInstanceHasProperty(e,"_isFaunaExpr")?e:"symbol"==typeof e?e.toString().replace(/Symbol\((.*)\)/,(function(e,t){return t})):"function"==typeof e?p(e):Array.isArray(e)?new i(e.map((function(e){return v(e)}))):e instanceof Uint8Array||e instanceof ArrayBuffer?new s.Bytes(e):"object"==typeof e?new i({object:g(e)}):e}function g(e){if(null!==e){var t={};return Object.keys(e).forEach((function(n){t[n]=v(e[n])})),t}return null}m.exact=function(e,t,n){m(e,e,t,n)},m.max=function(e,t,n){m(null,e,t,n)},m.min=function(e,t,n){m(e,null,t,n)},m.between=function(e,t,n,r){m(e,t,n,r)},e.exports={Ref:function e(){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({"@ref":v(arguments[0])});case 2:return new i({ref:v(arguments[0]),id:v(arguments[1])})}},Bytes:function e(t){return m.exact(1,arguments,e.name),new s.Bytes(t)},Abort:function e(t){return m.exact(1,arguments,e.name),new i({abort:v(t)})},At:function e(t,n){return m.exact(2,arguments,e.name),new i({at:v(t),expr:v(n)})},Let:function e(t,n){m.exact(2,arguments,e.name);var r=[];if(r=Array.isArray(t)?t.map((function(e){return g(e)})):Object.keys(t).map((function(e){var n={};return n[e]=v(t[e]),n})),"function"==typeof n)if(Array.isArray(t)){var o=[];t.forEach((function(e){Object.keys(e).forEach((function(e){o.push(l(e))}))})),n=n.apply(null,o)}else n=n.apply(null,Object.keys(t).map((function(e){return l(e)})));return new i({let:r,in:v(n)})},Var:l,If:function e(t,n,r){return m.exact(3,arguments,e.name),new i({if:v(t),then:v(n),else:v(r)})},Do:function e(){m.min(1,arguments,e.name);var t=w(arguments);return new i({do:v(t)})},Object:f,Lambda:p,Call:function e(t){m.min(1,arguments,e.name);var n=w(arguments);return n.shift(),new i({call:v(t),arguments:v(b(n))})},Query:function e(t){return m.exact(1,arguments,e.name),new i({query:v(t)})},Map:function e(t,n){return m.exact(2,arguments,e.name),new i({map:v(n),collection:v(t)})},Foreach:function e(t,n){return m.exact(2,arguments,e.name),new i({foreach:v(n),collection:v(t)})},Filter:function e(t,n){return m.exact(2,arguments,e.name),new i({filter:v(n),collection:v(t)})},Take:function e(t,n){return m.exact(2,arguments,e.name),new i({take:v(t),collection:v(n)})},Drop:function e(t,n){return m.exact(2,arguments,e.name),new i({drop:v(t),collection:v(n)})},Prepend:function e(t,n){return m.exact(2,arguments,e.name),new i({prepend:v(t),collection:v(n)})},Append:function e(t,n){return m.exact(2,arguments,e.name),new i({append:v(t),collection:v(n)})},IsEmpty:function e(t){return m.exact(1,arguments,e.name),new i({is_empty:v(t)})},IsNonEmpty:function e(t){return m.exact(1,arguments,e.name),new i({is_nonempty:v(t)})},IsNumber:function e(t){return m.exact(1,arguments,e.name),new i({is_number:v(t)})},IsDouble:function e(t){return m.exact(1,arguments,e.name),new i({is_double:v(t)})},IsInteger:function e(t){return m.exact(1,arguments,e.name),new i({is_integer:v(t)})},IsBoolean:function e(t){return m.exact(1,arguments,e.name),new i({is_boolean:v(t)})},IsNull:function e(t){return m.exact(1,arguments,e.name),new i({is_null:v(t)})},IsBytes:function e(t){return m.exact(1,arguments,e.name),new i({is_bytes:v(t)})},IsTimestamp:function e(t){return m.exact(1,arguments,e.name),new i({is_timestamp:v(t)})},IsDate:function e(t){return m.exact(1,arguments,e.name),new i({is_date:v(t)})},IsString:function e(t){return m.exact(1,arguments,e.name),new i({is_string:v(t)})},IsArray:function e(t){return m.exact(1,arguments,e.name),new i({is_array:v(t)})},IsObject:function e(t){return m.exact(1,arguments,e.name),new i({is_object:v(t)})},IsRef:function e(t){return m.exact(1,arguments,e.name),new i({is_ref:v(t)})},IsSet:function e(t){return m.exact(1,arguments,e.name),new i({is_set:v(t)})},IsDoc:function e(t){return m.exact(1,arguments,e.name),new i({is_doc:v(t)})},IsLambda:function e(t){return m.exact(1,arguments,e.name),new i({is_lambda:v(t)})},IsCollection:function e(t){return m.exact(1,arguments,e.name),new i({is_collection:v(t)})},IsDatabase:function e(t){return m.exact(1,arguments,e.name),new i({is_database:v(t)})},IsIndex:function e(t){return m.exact(1,arguments,e.name),new i({is_index:v(t)})},IsFunction:function e(t){return m.exact(1,arguments,e.name),new i({is_function:v(t)})},IsKey:function e(t){return m.exact(1,arguments,e.name),new i({is_key:v(t)})},IsToken:function e(t){return m.exact(1,arguments,e.name),new i({is_token:v(t)})},IsCredentials:function e(t){return m.exact(1,arguments,e.name),new i({is_credentials:v(t)})},IsRole:function e(t){return m.exact(1,arguments,e.name),new i({is_role:v(t)})},Get:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({get:v(t)},{ts:v(n)}))},KeyFromSecret:function e(t){return m.exact(1,arguments,e.name),new i({key_from_secret:v(t)})},Reduce:function e(t,n,r){return m.exact(3,arguments,e.name),new i({reduce:v(t),initial:v(n),collection:v(r)})},Paginate:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,{}),new i(u({paginate:v(t)},g(n)))},Exists:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({exists:v(t)},{ts:v(n)}))},Create:function e(t,n){return m.between(1,2,arguments,e.name),new i({create:v(t),params:v(n)})},Update:function e(t,n){return m.exact(2,arguments,e.name),new i({update:v(t),params:v(n)})},Replace:function e(t,n){return m.exact(2,arguments,e.name),new i({replace:v(t),params:v(n)})},Delete:function e(t){return m.exact(1,arguments,e.name),new i({delete:v(t)})},Insert:function e(t,n,r,o){return m.exact(4,arguments,e.name),new i({insert:v(t),ts:v(n),action:v(r),params:v(o)})},Remove:function e(t,n,r){return m.exact(3,arguments,e.name),new i({remove:v(t),ts:v(n),action:v(r)})},CreateClass:o((function e(t){return m.exact(1,arguments,e.name),new i({create_class:v(t)})}),"CreateClass() is deprecated, use CreateCollection() instead"),CreateCollection:function e(t){return m.exact(1,arguments,e.name),new i({create_collection:v(t)})},CreateDatabase:function e(t){return m.exact(1,arguments,e.name),new i({create_database:v(t)})},CreateIndex:function e(t){return m.exact(1,arguments,e.name),new i({create_index:v(t)})},CreateKey:function e(t){return m.exact(1,arguments,e.name),new i({create_key:v(t)})},CreateFunction:function e(t){return m.exact(1,arguments,e.name),new i({create_function:v(t)})},CreateRole:function e(t){return m.exact(1,arguments,e.name),new i({create_role:v(t)})},CreateAccessProvider:function e(t){return m.exact(1,arguments,e.name),new i({create_access_provider:v(t)})},Singleton:function e(t){return m.exact(1,arguments,e.name),new i({singleton:v(t)})},Events:function e(t){return m.exact(1,arguments,e.name),new i({events:v(t)})},Match:function e(t){m.min(1,arguments,e.name);var n=w(arguments);return n.shift(),new i({match:v(t),terms:v(b(n))})},Union:function e(){return m.min(1,arguments,e.name),new i({union:v(b(arguments))})},Merge:function e(t,n,r){return m.between(2,3,arguments,e.name),new i(y({merge:v(t),with:v(n)},{lambda:v(r)}))},Intersection:function e(){return m.min(1,arguments,e.name),new i({intersection:v(b(arguments))})},Difference:function e(){return m.min(1,arguments,e.name),new i({difference:v(b(arguments))})},Distinct:function e(t){return m.exact(1,arguments,e.name),new i({distinct:v(t)})},Join:function e(t,n){return m.exact(2,arguments,e.name),new i({join:v(t),with:v(n)})},Range:function e(t,n,r){return m.exact(3,arguments,e.name),new i({range:v(t),from:v(n),to:v(r)})},Login:function e(t,n){return m.exact(2,arguments,e.name),new i({login:v(t),params:v(n)})},Logout:function e(t){return m.exact(1,arguments,e.name),new i({logout:v(t)})},Identify:function e(t,n){return m.exact(2,arguments,e.name),new i({identify:v(t),password:v(n)})},Identity:o((function e(){return m.exact(0,arguments,e.name),new i({identity:null})}),"Identity() is deprecated, use CurrentIdentity() instead"),CurrentIdentity:function e(){return m.exact(0,arguments,e.name),new i({current_identity:null})},HasIdentity:o((function e(){return m.exact(0,arguments,e.name),new i({has_identity:null})}),"HasIdentity() is deprecated, use HasCurrentIdentity() instead"),HasCurrentIdentity:function e(){return m.exact(0,arguments,e.name),new i({has_current_identity:null})},CurrentToken:function e(){return m.exact(0,arguments,e.name),new i({current_token:null})},HasCurrentToken:function e(){return m.exact(0,arguments,e.name),new i({has_current_token:null})},Concat:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({concat:v(t)},{separator:v(n)}))},Casefold:function e(t,n){return m.min(1,arguments,e.name),new i(y({casefold:v(t)},{normalizer:v(n)}))},ContainsStr:function e(t,n){return m.exact(2,arguments,e.name),new i({containsstr:v(t),search:v(n)})},ContainsStrRegex:function e(t,n){return m.exact(2,arguments,e.name),new i({containsstrregex:v(t),pattern:v(n)})},StartsWith:function e(t,n){return m.exact(2,arguments,e.name),new i({startswith:v(t),search:v(n)})},EndsWith:function e(t,n){return m.exact(2,arguments,e.name),new i({endswith:v(t),search:v(n)})},FindStr:function e(t,n,r){return m.between(2,3,arguments,e.name),r=c.defaults(r,null),new i(y({findstr:v(t),find:v(n)},{start:v(r)}))},FindStrRegex:function e(t,n,r,o){return m.between(2,4,arguments,e.name),r=c.defaults(r,null),new i(y({findstrregex:v(t),pattern:v(n)},{start:v(r),num_results:v(o)}))},Length:function e(t){return m.exact(1,arguments,e.name),new i({length:v(t)})},LowerCase:function e(t){return m.exact(1,arguments,e.name),new i({lowercase:v(t)})},LTrim:function e(t){return m.exact(1,arguments,e.name),new i({ltrim:v(t)})},NGram:function e(t,n,r){return m.between(1,3,arguments,e.name),n=c.defaults(n,null),r=c.defaults(r,null),new i(y({ngram:v(t)},{min:v(n),max:v(r)}))},Repeat:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({repeat:v(t)},{number:v(n)}))},ReplaceStr:function e(t,n,r){return m.exact(3,arguments,e.name),new i({replacestr:v(t),find:v(n),replace:v(r)})},ReplaceStrRegex:function e(t,n,r,o){return m.between(3,4,arguments,e.name),o=c.defaults(o,null),new i(y({replacestrregex:v(t),pattern:v(n),replace:v(r)},{first:v(o)}))},RegexEscape:function e(t){return m.exact(1,arguments,e.name),new i({regexescape:v(t)})},RTrim:function e(t){return m.exact(1,arguments,e.name),new i({rtrim:v(t)})},Space:function e(t){return m.exact(1,arguments,e.name),new i({space:v(t)})},SubString:function e(t,n,r){return m.between(1,3,arguments,e.name),n=c.defaults(n,null),r=c.defaults(r,null),new i(y({substring:v(t)},{start:v(n),length:v(r)}))},TitleCase:function e(t){return m.exact(1,arguments,e.name),new i({titlecase:v(t)})},Trim:function e(t){return m.exact(1,arguments,e.name),new i({trim:v(t)})},UpperCase:function e(t){return m.exact(1,arguments,e.name),new i({uppercase:v(t)})},Format:function e(t){m.min(1,arguments,e.name);var n=w(arguments);return n.shift(),new i({format:v(t),values:v(b(n))})},Time:function e(t){return m.exact(1,arguments,e.name),new i({time:v(t)})},TimeAdd:function e(t,n,r){return m.exact(3,arguments,e.name),new i({time_add:v(t),offset:v(n),unit:v(r)})},TimeSubtract:function e(t,n,r){return m.exact(3,arguments,e.name),new i({time_subtract:v(t),offset:v(n),unit:v(r)})},TimeDiff:function e(t,n,r){return m.exact(3,arguments,e.name),new i({time_diff:v(t),other:v(n),unit:v(r)})},Epoch:function e(t,n){return m.exact(2,arguments,e.name),new i({epoch:v(t),unit:v(n)})},Date:function e(t){return m.exact(1,arguments,e.name),new i({date:v(t)})},Now:function e(){return m.exact(0,arguments,e.name),new i({now:v(null)})},NextId:o((function e(){return m.exact(0,arguments,e.name),new i({next_id:null})}),"NextId() is deprecated, use NewId() instead"),NewId:function e(){return m.exact(0,arguments,e.name),new i({new_id:null})},Database:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({database:v(t)});case 2:return new i({database:v(t),scope:v(n)})}},Index:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({index:v(t)});case 2:return new i({index:v(t),scope:v(n)})}},Class:o((function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({class:v(t)});case 2:return new i({class:v(t),scope:v(n)})}}),"Class() is deprecated, use Collection() instead"),Collection:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({collection:v(t)});case 2:return new i({collection:v(t),scope:v(n)})}},Function:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({function:v(t)});case 2:return new i({function:v(t),scope:v(n)})}},Role:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({role:v(t)},{scope:v(n)}))},AccessProviders:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({access_providers:v(t)})},Classes:o((function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({classes:v(t)})}),"Classes() is deprecated, use Collections() instead"),Collections:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({collections:v(t)})},Databases:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({databases:v(t)})},Indexes:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({indexes:v(t)})},Functions:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({functions:v(t)})},Roles:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({roles:v(t)})},Keys:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({keys:v(t)})},Tokens:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({tokens:v(t)})},Credentials:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({credentials:v(t)})},Equals:function e(){return m.min(1,arguments,e.name),new i({equals:v(b(arguments))})},Contains:o((function e(t,n){return m.exact(2,arguments,e.name),new i({contains:v(t),in:v(n)})}),"Contains() is deprecated, use ContainsPath() instead"),ContainsPath:function e(t,n){return m.exact(2,arguments,e.name),new i({contains_path:v(t),in:v(n)})},ContainsField:function e(t,n){return m.exact(2,arguments,e.name),new i({contains_field:v(t),in:v(n)})},ContainsValue:function e(t,n){return m.exact(2,arguments,e.name),new i({contains_value:v(t),in:v(n)})},Select:function e(t,n,r){m.between(2,3,arguments,e.name);var o={select:v(t),from:v(n)};return void 0!==r&&(o.default=v(r)),new i(o)},SelectAll:o((function e(t,n){return m.exact(2,arguments,e.name),new i({select_all:v(t),from:v(n)})}),"SelectAll() is deprecated. Avoid use."),Abs:function e(t){return m.exact(1,arguments,e.name),new i({abs:v(t)})},Add:function e(){return m.min(1,arguments,e.name),new i({add:v(b(arguments))})},BitAnd:function e(){return m.min(1,arguments,e.name),new i({bitand:v(b(arguments))})},BitNot:function e(t){return m.exact(1,arguments,e.name),new i({bitnot:v(t)})},BitOr:function e(){return m.min(1,arguments,e.name),new i({bitor:v(b(arguments))})},BitXor:function e(){return m.min(1,arguments,e.name),new i({bitxor:v(b(arguments))})},Ceil:function e(t){return m.exact(1,arguments,e.name),new i({ceil:v(t)})},Divide:function e(){return m.min(1,arguments,e.name),new i({divide:v(b(arguments))})},Floor:function e(t){return m.exact(1,arguments,e.name),new i({floor:v(t)})},Max:function e(){return m.min(1,arguments,e.name),new i({max:v(b(arguments))})},Min:function e(){return m.min(1,arguments,e.name),new i({min:v(b(arguments))})},Modulo:function e(){return m.min(1,arguments,e.name),new i({modulo:v(b(arguments))})},Multiply:function e(){return m.min(1,arguments,e.name),new i({multiply:v(b(arguments))})},Round:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({round:v(t)},{precision:v(n)}))},Subtract:function e(){return m.min(1,arguments,e.name),new i({subtract:v(b(arguments))})},Sign:function e(t){return m.exact(1,arguments,e.name),new i({sign:v(t)})},Sqrt:function e(t){return m.exact(1,arguments,e.name),new i({sqrt:v(t)})},Trunc:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({trunc:v(t)},{precision:v(n)}))},Count:function e(t){return m.exact(1,arguments,e.name),new i({count:v(t)})},Sum:function e(t){return m.exact(1,arguments,e.name),new i({sum:v(t)})},Mean:function e(t){return m.exact(1,arguments,e.name),new i({mean:v(t)})},Any:function e(t){return m.exact(1,arguments,e.name),new i({any:v(t)})},All:function e(t){return m.exact(1,arguments,e.name),new i({all:v(t)})},Acos:function e(t){return m.exact(1,arguments,e.name),new i({acos:v(t)})},Asin:function e(t){return m.exact(1,arguments,e.name),new i({asin:v(t)})},Atan:function e(t){return m.exact(1,arguments,e.name),new i({atan:v(t)})},Cos:function e(t){return m.exact(1,arguments,e.name),new i({cos:v(t)})},Cosh:function e(t){return m.exact(1,arguments,e.name),new i({cosh:v(t)})},Degrees:function e(t){return m.exact(1,arguments,e.name),new i({degrees:v(t)})},Exp:function e(t){return m.exact(1,arguments,e.name),new i({exp:v(t)})},Hypot:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({hypot:v(t)},{b:v(n)}))},Ln:function e(t){return m.exact(1,arguments,e.name),new i({ln:v(t)})},Log:function e(t){return m.exact(1,arguments,e.name),new i({log:v(t)})},Pow:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({pow:v(t)},{exp:v(n)}))},Radians:function e(t){return m.exact(1,arguments,e.name),new i({radians:v(t)})},Sin:function e(t){return m.exact(1,arguments,e.name),new i({sin:v(t)})},Sinh:function e(t){return m.exact(1,arguments,e.name),new i({sinh:v(t)})},Tan:function e(t){return m.exact(1,arguments,e.name),new i({tan:v(t)})},Tanh:function e(t){return m.exact(1,arguments,e.name),new i({tanh:v(t)})},LT:function e(){return m.min(1,arguments,e.name),new i({lt:v(b(arguments))})},LTE:function e(){return m.min(1,arguments,e.name),new i({lte:v(b(arguments))})},GT:function e(){return m.min(1,arguments,e.name),new i({gt:v(b(arguments))})},GTE:function e(){return m.min(1,arguments,e.name),new i({gte:v(b(arguments))})},And:function e(){return m.min(1,arguments,e.name),new i({and:v(b(arguments))})},Or:function e(){return m.min(1,arguments,e.name),new i({or:v(b(arguments))})},Not:function e(t){return m.exact(1,arguments,e.name),new i({not:v(t)})},ToString:function e(t){return m.exact(1,arguments,e.name),new i({to_string:v(t)})},ToNumber:function e(t){return m.exact(1,arguments,e.name),new i({to_number:v(t)})},ToObject:function e(t){return m.exact(1,arguments,e.name),new i({to_object:v(t)})},ToArray:function e(t){return m.exact(1,arguments,e.name),new i({to_array:v(t)})},ToDouble:function e(t){return m.exact(1,arguments,e.name),new i({to_double:v(t)})},ToInteger:function e(t){return m.exact(1,arguments,e.name),new i({to_integer:v(t)})},ToTime:function e(t){return m.exact(1,arguments,e.name),new i({to_time:v(t)})},ToSeconds:function e(t){return m.exact(1,arguments,e.name),new i({to_seconds:v(t)})},ToMicros:function e(t){return m.exact(1,arguments,e.name),new i({to_micros:v(t)})},ToMillis:function e(t){return m.exact(1,arguments,e.name),new i({to_millis:v(t)})},DayOfMonth:function e(t){return m.exact(1,arguments,e.name),new i({day_of_month:v(t)})},DayOfWeek:function e(t){return m.exact(1,arguments,e.name),new i({day_of_week:v(t)})},DayOfYear:function e(t){return m.exact(1,arguments,e.name),new i({day_of_year:v(t)})},Second:function e(t){return m.exact(1,arguments,e.name),new i({second:v(t)})},Minute:function e(t){return m.exact(1,arguments,e.name),new i({minute:v(t)})},Hour:function e(t){return m.exact(1,arguments,e.name),new i({hour:v(t)})},Month:function e(t){return m.exact(1,arguments,e.name),new i({month:v(t)})},Year:function e(t){return m.exact(1,arguments,e.name),new i({year:v(t)})},ToDate:function e(t){return m.exact(1,arguments,e.name),new i({to_date:v(t)})},MoveDatabase:function e(t,n){return m.exact(2,arguments,e.name),new i({move_database:v(t),to:v(n)})},Documents:function e(t){return m.exact(1,arguments,e.name),new i({documents:v(t)})},Reverse:function e(t){return m.exact(1,arguments,e.name),new i({reverse:v(t)})},AccessProvider:function e(t){return m.exact(1,arguments,e.name),new i({access_provider:v(t)})},wrap:v}},function(e,t,n){"use strict";var r=n(23),o=n(14),i=n(3),a=n(8),s=n(1),u=s.isNodeEnv()?n(15):null,c=u&&u.inspect.custom,l=u?u.inspect:JSON.stringify;function f(){}function p(e,t,n){if(!e)throw new i.InvalidValue("id cannot be null or undefined");this.value={id:e},t&&(this.value.collection=t),n&&(this.value.database=n)}f.prototype._isFaunaValue=!0,s.inherits(f,a),p.prototype._isFaunaRef=!0,s.inherits(p,f),Object.defineProperty(p.prototype,"collection",{get:function(){return this.value.collection}}),Object.defineProperty(p.prototype,"class",{get:o((function(){return this.value.collection}),"class is deprecated, use collection instead")}),Object.defineProperty(p.prototype,"database",{get:function(){return this.value.database}}),Object.defineProperty(p.prototype,"id",{get:function(){return this.value.id}}),p.prototype.toJSON=function(){return{"@ref":this.value}},v(p,(function(){var e={collections:"Collection",databases:"Database",indexes:"Index",functions:"Function",roles:"Role",access_providers:"AccessProvider"},t=function(e){return void 0===e.collection},n=function(r){if(t(r)){var o=void 0!==r.database?r.database.toString():"";return"access_providers"===r.id?"AccessProviders("+o+")":r.id.charAt(0).toUpperCase()+r.id.slice(1)+"("+o+")"}if(t(r.collection)){var i=e[r.collection.id];if(void 0!==i){o=void 0!==r.database?", "+r.database.toString():"";return i+'("'+r.id+'"'+o+")"}}return"Ref("+n(r.collection)+', "'+r.id+'")'};return n(this)})),p.prototype.valueOf=function(){return this.value},p.prototype.equals=function(e){return(e instanceof p||s.checkInstanceHasProperty(e,"_isFaunaRef"))&&this.id===e.id&&(void 0===this.collection&&void 0===e.collection||this.collection.equals(e.collection))&&(void 0===this.database&&void 0===e.database||this.database.equals(e.database))};var d={COLLECTIONS:new p("collections"),INDEXES:new p("indexes"),DATABASES:new p("databases"),FUNCTIONS:new p("functions"),ROLES:new p("roles"),KEYS:new p("keys"),ACCESS_PROVIDERS:new p("access_providers")};function h(e){this.value=e}function m(e){if(e instanceof Date)e=e.toISOString();else if("Z"!==e.charAt(e.length-1))throw new i.InvalidValue("Only allowed timezone is 'Z', got: "+e);this.value=e}function y(e){e instanceof Date&&(e=e.toISOString().slice(0,10)),this.value=e}function b(e){if(e instanceof ArrayBuffer)this.value=new Uint8Array(e);else if("string"==typeof e)this.value=r.toByteArray(e);else{if(!(e instanceof Uint8Array))throw new i.InvalidValue("Bytes type expect argument to be either Uint8Array|ArrayBuffer|string, got: "+l(e));this.value=e}}function w(e){this.value=e}function v(e,t){e.prototype.toString=t,e.prototype.inspect=t,c&&(e.prototype[c]=t)}d.fromName=function(e){switch(e){case"collections":return d.COLLECTIONS;case"indexes":return d.INDEXES;case"databases":return d.DATABASES;case"functions":return d.FUNCTIONS;case"roles":return d.ROLES;case"keys":return d.KEYS;case"access_providers":return d.ACCESS_PROVIDERS}return new p(e)},s.inherits(h,f),v(h,(function(){return a.toString(this.value)})),h.prototype.toJSON=function(){return{"@set":this.value}},s.inherits(m,f),Object.defineProperty(m.prototype,"date",{get:function(){return new Date(this.value)}}),v(m,(function(){return'Time("'+this.value+'")'})),m.prototype.toJSON=function(){return{"@ts":this.value}},s.inherits(y,f),Object.defineProperty(y.prototype,"date",{get:function(){return new Date(this.value)}}),v(y,(function(){return'Date("'+this.value+'")'})),y.prototype.toJSON=function(){return{"@date":this.value}},s.inherits(b,f),v(b,(function(){return'Bytes("'+r.fromByteArray(this.value)+'")'})),b.prototype.toJSON=function(){return{"@bytes":r.fromByteArray(this.value)}},s.inherits(w,f),v(w,(function(){return"Query("+a.toString(this.value)+")"})),w.prototype.toJSON=function(){return{"@query":this.value}},e.exports={Value:f,Ref:p,Native:d,SetRef:h,FaunaTime:m,FaunaDate:y,Bytes:b,Query:w}},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";var r=n(1);function o(e){this.raw=e}o.prototype._isFaunaExpr=!0,o.prototype.toJSON=function(){return this.raw},o.prototype.toFQL=function(){return l(this.raw)};var i=["Do","Call","Union","Intersection","Difference","Equals","Add","BitAnd","BitOr","BitXor","Divide","Max","Min","Modulo","Multiply","Subtract","LT","LTE","GT","GTE","And","Or"],a={containsstrregex:"ContainsStrRegex",endswith:"EndsWith",findstr:"FindStr",findstrregex:"FindStrRegex",gt:"GT",gte:"GTE",is_nonempty:"is_non_empty",lowercase:"LowerCase",lt:"LT",lte:"LTE",ltrim:"LTrim",rtrim:"RTrim",regexescape:"RegexEscape",replacestr:"ReplaceStr",replacestrregex:"ReplaceStrRegex",startswith:"StartsWith",substring:"SubString",titlecase:"TitleCase",uppercase:"UpperCase"};function s(e){return e instanceof o||r.checkInstanceHasProperty(e,"_isFaunaExpr")}function u(e){return"{"+Object.keys(e).map((function(t){return t+": "+l(e[t])})).join(", ")+"}"}function c(e,t){return e.map((function(e){return t(e)})).join(", ")}var l=function(e,t){if(s(e)){if("value"in e)return e.toString();e=e.raw}if(null===e)return"null";switch(typeof e){case"string":return JSON.stringify(e);case"symbol":case"number":case"boolean":return e.toString();case"undefined":return"undefined"}if(Array.isArray(e)){var n=c(e,l);return-1!=i.indexOf(t)?n:"["+n+"]"}if("match"in e){var r=l(e.match),o=e.terms||[];return s(o)&&(o=o.raw),Array.isArray(o)&&0==o.length?"Match("+r+")":Array.isArray(o)?"Match("+r+", ["+c(o,l)+"])":"Match("+r+", "+l(o)+")"}if("paginate"in e){if(1===Object.keys(e).length)return"Paginate("+l(e.paginate)+")";var f=Object.assign({},e);return delete f.paginate,"Paginate("+l(e.paginate)+", "+u(f)+")"}if("let"in e&&"in"in e){return"Let("+(Array.isArray(e.let)?"["+c(e.let,u)+"]":u(e.let))+", "+l(e.in)+")"}if("object"in e)return u(e.object);if("lambda"in e)return"Lambda("+l(e.lambda)+", "+l(e.expr)+")";if("filter"in e)return"Filter("+l(e.collection)+", "+l(e.filter)+")";if("call"in e)return"Call("+l(e.call)+", "+l(e.arguments)+")";if("map"in e)return"Map("+l(e.collection)+", "+l(e.map)+")";if("foreach"in e)return"Foreach("+l(e.collection)+", "+l(e.foreach)+")";var p=Object.keys(e),d=p[0];d=function(e){return e in a&&(e=a[e]),e.split("_").map((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})).join("")}(d);var h=p.filter(t=>null!==e[t]||p.length>1).map(t=>l(e[t],d)).join(", ");return d+"("+h+")"};o.toString=l,e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,s,u,c,l){this.method=e,this.path=t,this.query=n,this.requestRaw=r,this.requestContent=o,this.responseRaw=i,this.responseContent=a,this.statusCode=s,this.responseHeaders=u,this.startTime=c,this.endTime=l}Object.defineProperty(r.prototype,"timeTaken",{get:function(){return this.endTime-this.startTime}}),e.exports=r},function(e,t,n){"use strict";var r=n(1);function o(e){Error.call(this),this.message=e||"Request aborted due to timeout",this.isTimeoutError=!0}function i(e){Error.call(this),this.message=e||"Request aborted",this.isAbortError=!0}r.inherits(o,Error),r.inherits(i,Error),e.exports={TimeoutError:o,AbortError:i}},function(e,t,n){"use strict";var r=n(5);function o(e){return JSON.parse(e,i)}function i(e,t){if("object"!=typeof t||null===t)return t;if("@ref"in t){var n=t["@ref"];if(!("collection"in n)&&!("database"in n))return r.Native.fromName(n.id);var o=i("collection",n.collection),a=i("database",n.database);return new r.Ref(n.id,o,a)}return"@obj"in t?t["@obj"]:"@set"in t?new r.SetRef(t["@set"]):"@ts"in t?new r.FaunaTime(t["@ts"]):"@date"in t?new r.FaunaDate(t["@date"]):"@bytes"in t?new r.Bytes(t["@bytes"]):"@query"in t?new r.Query(t["@query"]):t}e.exports={toJSON:function(e,t){return(t=void 0!==t&&t)?JSON.stringify(e,null," "):JSON.stringify(e)},parseJSON:o,parseJSONStreaming:function(e){var t=[];try{t.push(o(e)),e=""}catch(i){for(;;){var n=e.indexOf("\n")+1;if(n<=0)break;var r=e.slice(0,n).trim();r.length>0&&t.push(o(r)),e=e.slice(n)}}return{values:t,buffer:e}}}},function(e,t){e.exports=require("https")},function(e,t,n){var r=n(4),o=n(1);e.exports=o.mergeObjects({Client:n(24),Expr:n(8),PageHelper:n(17),RequestResult:n(9),clientLogger:n(32),errors:n(3),values:n(5),query:r},r)},function(e,t,n){e.exports=n(15).deprecate},function(e,t){e.exports=require("util")},function(e,t,n){"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=a(e),c=1;c0&&this._faunaFunctions.forEach((function(e){a=e(a)})),this.client.query(a,this.options)},i.prototype._clone=function(){return Object.create(i.prototype,{client:{value:this.client},set:{value:this.set},_faunaFunctions:{value:this._faunaFunctions},before:{value:this.before},after:{value:this.after}})},e.exports=i},function(e,t,n){"use strict";var r=n(25),o=n(1),i=n(10);function a(e){var t="https"===e.scheme;null==e.port&&(e.port=t?443:80);var i=!e.fetch&&o.isNodeEnv()&&function(){try{return n(19),!0}catch(e){return!1}}();this._adapter=i?new(n(26)):new(n(27))({isHttps:t,fetch:e.fetch,keepAlive:e.keepAlive}),this._baseUrl=e.scheme+"://"+e.domain+":"+e.port,this._secret=e.secret,this._headers=Object.assign({},e.headers,function(){var e={"X-Fauna-Driver":"Javascript","X-FaunaDB-API-Version":r.apiVersion};o.isNodeEnv()&&(e["X-Fauna-Driver-Version"]=r.version,e["X-Runtime-Environment"]=(t=[{name:"Netlify",check:()=>process.env.hasOwnProperty("NETLIFY_IMAGES_CDN_DOMAIN")},{name:"Vercel",check:()=>process.env.hasOwnProperty("VERCEL")},{name:"Heroku",check:()=>process.env.hasOwnProperty("PATH")&&-1!==process.env.PATH.indexOf(".heroku")},{name:"AWS Lambda",check:()=>process.env.hasOwnProperty("AWS_LAMBDA_FUNCTION_VERSION")},{name:"GCP Cloud Functions",check:()=>process.env.hasOwnProperty("_")&&-1!==process.env._.indexOf("google")},{name:"GCP Compute Instances",check:()=>process.env.hasOwnProperty("GOOGLE_CLOUD_PROJECT")},{name:"Azure Cloud Functions",check:()=>process.env.hasOwnProperty("WEBSITE_FUNCTIONS_AZUREMONITOR_CATEGORIES")},{name:"Azure Compute",check:()=>process.env.hasOwnProperty("ORYX_ENV_TYPE")&&process.env.hasOwnProperty("WEBSITE_INSTANCE_ID")&&"AppService"===process.env.ORYX_ENV_TYPE},{name:"Worker",check:()=>{try{return global instanceof ServiceWorkerGlobalScope}catch(e){return!1}}},{name:"Mongo Stitch",check:()=>"function"==typeof global.StitchError},{name:"Render",check:()=>process.env.hasOwnProperty("RENDER_SERVICE_ID")},{name:"Begin",check:()=>process.env.hasOwnProperty("BEGIN_DATA_SCOPE_ID")}].find(e=>e.check()))?t.name:"Unknown",e["X-Runtime-Environment-OS"]=n(30).platform(),e["X-NodeJS-Version"]=process.version);var t;return e}()),this._queryTimeout=e.queryTimeout,this._lastSeen=null,this._timeout=Math.floor(1e3*e.timeout)}a.prototype.getLastTxnTime=function(){return this._lastSeen},a.prototype.syncLastTxnTime=function(e){(null==this._lastSeen||this._lastSeen0){const e=new Array(arguments.length);for(let t=0;t{const r=JSON.parse(e.body);console.log("Function `createMultisig` invoked",r);const o={data:r};try{const e=await a.query(i.Create(i.Collection("Multisig"),o));return console.log("success",e),{statusCode:200,body:JSON.stringify(e)}}catch(e){return console.log("error",e),{statusCode:400,body:JSON.stringify(e)}}}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new Error("Could not parse function signature for injection dependencies: Object is not a function");if(!e.length)return[];var t=/^()\(?([^)=]*)\)? *=>/.exec(e+"")||/^[^(]+([^ \(]*) *\(([^\)]*)\)/.exec(e+"");if(!t)throw new Error("Could not parse function signature for injection dependencies: "+e);var n=t[2].replace(/\/\*[\S\s]*?\*\//g," ").replace(/\/\/.*/g," ");function r(e,t,n){return t+n.split(",").map((function(e){return e&&e.trim()})).filter(Boolean).join("@")}return(n=(n=n.replace(/(\{)([^}]*)\}/g,r)).replace(/(\[)([^}]*)\]/g,r)).split(",").map((function(e){return e&&e.trim()})).map((function(e){return"{"===e[0]?e.substring(1).split("@"):"["===e[0]?{items:e.substring(1).split("@")}:e})).filter(Boolean)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),a=r[0],s=r[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t,n){"use strict";var r=n(17),o=n(9),i=n(3),a=n(18),s=n(11),u=n(4),c=n(31),l=n(1),f=n(5);function p(e){e=l.applyDefaults(e,{domain:"db.fauna.com",scheme:"https",port:null,secret:null,timeout:60,observer:null,keepAlive:!0,headers:{},fetch:void 0,queryTimeout:null}),this._observer=e.observer,this._http=new a.HttpClient(e),this.stream=c.StreamAPI(this)}p.prototype.query=function(e,t){return this._execute("POST","",u.wrap(e),null,t)},p.prototype.paginate=function(e,t,n){return t=l.defaults(t,{}),n=l.defaults(n,{}),new r(this,e,t,n)},p.prototype.ping=function(e,t){return this._execute("GET","ping",null,{scope:e,timeout:t})},p.prototype.getLastTxnTime=function(){return this._http.getLastTxnTime()},p.prototype.syncLastTxnTime=function(e){this._http.syncLastTxnTime(e)},p.prototype._execute=function(e,t,n,r,i){r=l.defaults(r,null),(t instanceof f.Ref||l.checkInstanceHasProperty(t,"_isFaunaRef"))&&(t=t.value),null!==r&&(r=l.removeUndefinedValues(r));var a=Date.now(),u=this,c=["GET","HEAD"].indexOf(e)>=0?void 0:JSON.stringify(n);return this._http.execute(Object.assign({},i,{path:t,query:r,method:e,body:c})).then((function(l){var f=Date.now(),p=s.parseJSON(l.body),d=new o(e,t,r,c,n,l.body,p,l.status,l.headers,a,f);return u._handleRequestResult(l,d,i),p.resource}))},p.prototype._handleRequestResult=function(e,t,n){null!=e.headers["x-txn-time"]&&this.syncLastTxnTime(parseInt(e.headers["x-txn-time"],10)),[this._observer,n&&n.observer].forEach(e=>{"function"==typeof e&&e(t,this)}),i.FaunaHTTPError.raiseForStatusCode(t)},e.exports=p},function(e){e.exports=JSON.parse('{"_from":"faunadb","_id":"faunadb@4.1.1","_inBundle":false,"_integrity":"sha512-ekHtUgt+heYbaZXMWMB00Q7+DCiPKAubs2zbpNc4oMKamRxbL39MyzdNQNnCcSGOAJcLHPJbgOlDHK4y0Rkwrw==","_location":"/faunadb","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"faunadb","name":"faunadb","escapedName":"faunadb","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/faunadb/-/faunadb-4.1.1.tgz","_shasum":"c505aae1171abb18b7e8bf98bfe6b7bc1785e446","_spec":"faunadb","_where":"/Users/sampanter/projects/cosmos-legacy-multisig","apiVersion":"4","browser":{"http2":false,"http":false,"https":false,"os":false,"util":false},"bugs":{"url":"https://github.com/fauna/faunadb-js/issues"},"bundleDependencies":false,"dependencies":{"abort-controller":"^3.0.0","base64-js":"^1.2.0","browser-detect":"^0.2.28","btoa-lite":"^1.0.0","cross-fetch":"^3.0.6","dotenv":"^8.2.0","fn-annotate":"^1.1.3","object-assign":"^4.1.0","util-deprecate":"^1.0.2"},"deprecated":false,"description":"FaunaDB Javascript driver for Node.JS and Browsers","devDependencies":{"browserify":"^16.2.2","eslint":"^5.3.0","eslint-config-prettier":"^6.5.0","eslint-plugin-prettier":"^3.1.1","husky":">=1","ink-docstrap":"^1.2.1","jest":"^24.9.0","jsdoc":"^3.6.3","lint-staged":">=8","prettier":"1.18.2","semantic-release":"^17.1.2","terser":"^4.3.9","webpack":"^5.23.0","webpack-cli":"^4.5.0"},"files":["index.d.ts","src/","dist/"],"homepage":"https://fauna.com","husky":{"hooks":{"pre-commit":"lint-staged"}},"keywords":["database","fauna","official","driver"],"license":"MPL-2.0","lint-staged":{"*.{js,css,json,md}":["prettier --write","git add"],"*.js":["eslint --fix","git add"]},"main":"index.js","name":"faunadb","release":{"branches":["master"]},"repository":{"type":"git","url":"git+https://github.com/fauna/faunadb-js.git"},"scripts":{"browserify":"browserify index.js --standalone faunadb -o dist/faunadb.js","browserify-min":"browserify index.js --standalone faunadb | terser -c -m --keep-fnames --keep-classnames -o dist/faunadb-min.js","doc":"jsdoc -c ./jsdoc.json","prettify":"prettier --write \\"{src,test}/**/*.{js,ts}\\"","semantic-release":"semantic-release","test":"jest --env=node --verbose=false ./test","wp":"webpack"},"types":"index.d.ts","version":"4.1.1"}')},function(e,t,n){"use strict";var r=n(19),o=n(10),i=n(1);function a(){this.type="http2",this._sessionMap={}}a.prototype._resolveSessionFor=function(e,t){var n=t?"stream::"+e:e;if(!this._sessionMap[n]){var o=this,i=function(){o._cleanupSessionFor(e,t)};this._sessionMap[n]=r.connect(e).once("error",i).once("goaway",i).setTimeout(6e4,i)}return this._sessionMap[n]},a.prototype._cleanupSessionFor=function(e,t){var n=t?"stream::"+e:e;this._sessionMap[n]&&(this._sessionMap[n].close(),delete this._sessionMap[n])},a.prototype.execute=function(e){var t=this,n=null!=e.streamConsumer;return new Promise((function(a,s){var u=!1,c=!1,l=function(e){u=!0,a(e)},f=function(t){if(u&&n)return e.streamConsumer.onError(t);u=!0,s(t)},p=function(){e.signal&&e.signal.removeEventListener("abort",d)},d=function(){c=!0,p(),y.close(r.constants.NGHTTP2_CANCEL),f(new o.AbortError)};try{var h=("/"===e.path[0]?e.path:"/"+e.path)+i.querystringify(e.query,"?"),m=Object.assign({},e.headers,{[r.constants.HTTP2_HEADER_PATH]:h,[r.constants.HTTP2_HEADER_METHOD]:e.method}),y=t._resolveSessionFor(e.origin,n).request(m).setEncoding("utf8").on("error",(function(e){p(),f(e)})).on("response",(function(t){var o=t[r.constants.HTTP2_HEADER_STATUS],i=o>=200&&o<400&&n,a="";i&&l({body:"[stream]",headers:t,status:o}),y.on("data",(function(t){if(i)return e.streamConsumer.onData(t);a+=t})).on("end",(function(){if(p(),!i)return l({body:a,headers:t,status:o});c||e.streamConsumer.onError(new TypeError("network error"))}))}));!e.signal&&e.timeout&&y.setTimeout(e.timeout,(function(){c=!0,p(),y.close(r.constants.NGHTTP2_CANCEL),f(new o.TimeoutError)})),e.signal&&e.signal.addEventListener("abort",d),null!=e.body&&y.write(e.body),y.end()}catch(r){t._cleanupSessionFor(e.origin,n),f(r)}}))},e.exports=a},function(e,t,n){"use strict";n(20);var r=n(1),o=n(3),i=n(10);function a(e){e=e||{},this.type="fetch",this._fetch=function(e){if("function"==typeof e)return e;if("function"==typeof global.fetch)return global.fetch.bind(global);return n(28)}(e.fetch),r.isNodeEnv()&&e.keepAlive&&(this._keepAliveEnabledAgent=new((e.isHttps?n(12):n(6)).Agent)({keepAlive:!0}))}function s(e,t){return e&&"AbortError"===e.name?t?new i.TimeoutError:new i.AbortError:e}a.prototype.execute=function(e){var t,n=e.signal,i=!e.signal&&!!e.timeout,a=function(){t&&clearTimeout(t)};if(i){var u=new AbortController;n=u.signal,t=setTimeout(u.abort.bind(u),e.timeout)}return this._fetch(r.formatUrl(e.origin,e.path,e.query),{method:e.method,headers:e.headers,body:e.body,agent:this._keepAliveEnabledAgent,signal:n}).then((function(t){a();var n=function(e){var t={};for(var n of e.entries()){var r=n[0],o=n[1];t[r]=o}return t}(t.headers);return t.ok&&null!=e.streamConsumer?(function(e,t){var n=function(e){t.onError(s(e))};if(r.isNodeEnv())return void e.body.on("error",n).on("data",t.onData).on("end",(function(){t.onError(new TypeError("network error"))}));try{var i=e.body.getReader(),a=new TextDecoder("utf-8");(function e(){return i.read().then((function(n){if(!n.done){var r=a.decode(n.value,{stream:!0});return t.onData(r),e()}t.onError(new TypeError("network error"))}))})().catch(n)}catch(e){throw new o.StreamsNotSupported("Please, consider providing a Fetch API-compatible function with streamable response bodies. "+e)}}(t,e.streamConsumer),{body:"[stream]",headers:n,status:t.status}):t.text().then((function(e){return{body:e,headers:n,status:t.status}}))})).catch((function(e){return a(),Promise.reject(s(e,i))}))},e.exports=a},function(e,t,n){var r=n(29),o=r.default||r,i=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),o.call(this,e,t)};e.exports=t=i,t.fetch=i,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,t.default=i},function(e,t,n){"use strict";n.r(t),n.d(t,"Headers",(function(){return j})),n.d(t,"Request",(function(){return J})),n.d(t,"Response",(function(){return L})),n.d(t,"FetchError",(function(){return p}));var r=n(0),o=n(6),i=n(7),a=n(12),s=n(2);const u=r.Readable,c=Symbol("buffer"),l=Symbol("type");class f{constructor(){this[l]="";const e=arguments[0],t=arguments[1],n=[];let r=0;if(e){const t=e,o=Number(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},o=n.size;let i=void 0===o?0:o;var a=n.timeout;let s=void 0===a?0:a;null==e?e=null:w(e)?e=Buffer.from(e.toString()):v(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof r||(e=Buffer.from(String(e)))),this[h]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=s,e instanceof r&&e.on("error",(function(e){const n="AbortError"===e.name?e:new p(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[h].error=n}))}function b(){var e=this;if(this[h].disturbed)return y.Promise.reject(new TypeError("body used already for: "+this.url));if(this[h].disturbed=!0,this[h].error)return y.Promise.reject(this[h].error);let t=this.body;if(null===t)return y.Promise.resolve(Buffer.alloc(0));if(v(t)&&(t=t.stream()),Buffer.isBuffer(t))return y.Promise.resolve(t);if(!(t instanceof r))return y.Promise.resolve(Buffer.alloc(0));let n=[],o=0,i=!1;return new y.Promise((function(r,a){let s;e.timeout&&(s=setTimeout((function(){i=!0,a(new p(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(i=!0,a(t)):a(new p(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!i&&null!==t){if(e.size&&o+t.length>e.size)return i=!0,void a(new p(`content size at ${e.url} over limit: ${e.size}`,"max-size"));o+=t.length,n.push(t)}})),t.on("end",(function(){if(!i){clearTimeout(s);try{r(Buffer.concat(n,o))}catch(t){a(new p(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function w(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function v(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function g(e){let t,n,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof r&&"function"!=typeof o.getBoundary&&(t=new m,n=new m,o.pipe(t),o.pipe(n),e[h].body=t,o=n),o}function x(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":w(e)?"application/x-www-form-urlencoded;charset=UTF-8":v(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?"multipart/form-data;boundary="+e.getBoundary():e instanceof r?null:"text/plain;charset=UTF-8"}function _(e){const t=e.body;return null===t?0:v(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}y.prototype={get body(){return this[h].body},get bodyUsed(){return this[h].disturbed},arrayBuffer(){return b.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return b.call(this).then((function(t){return Object.assign(new f([],{type:e.toLowerCase()}),{[c]:t})}))},json(){var e=this;return b.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return y.Promise.reject(new p(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return b.call(this).then((function(e){return e.toString()}))},buffer(){return b.call(this)},textConverted(){var e=this;return b.call(this).then((function(t){return function(e,t){if("function"!=typeof d)throw new Error("The package `encoding` must be installed to use the textConverted() function");const n=t.get("content-type");let r,o,i="utf-8";n&&(r=/charset=([^;]*)/i.exec(n));o=e.slice(0,1024).toString(),!r&&o&&(r=/0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[C]=Object.create(null),e instanceof j){const t=e.raw(),n=Object.keys(t);for(const e of n)for(const n of t[e])this.append(e,n)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const n=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");n.push(Array.from(t))}for(const e of n){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const n=e[t];this.append(t,n)}}}}get(e){T(e=""+e);const t=A(this[C],e);return void 0===t?null:this[C][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=P(this),r=0;for(;r1&&void 0!==arguments[1]?arguments[1]:"key+value";const n=Object.keys(e[C]).sort();return n.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[C][t].join(", ")}:function(t){return[t.toLowerCase(),e[C][t].join(", ")]})}j.prototype.entries=j.prototype[Symbol.iterator],Object.defineProperty(j.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(j.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const k=Symbol("internal");function R(e,t){const n=Object.create(I);return n[k]={target:e,kind:t,index:0},n}const I=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==I)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[k];const t=e.target,n=e.kind,r=e.index,o=P(t,n);return r>=o.length?{value:void 0,done:!0}:(this[k].index=r+1,{value:o[r],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function N(e){const t=Object.assign({__proto__:null},e[C]),n=A(e[C],"Host");return void 0!==n&&(t[n]=t[n][0]),t}Object.defineProperty(I,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const B=Symbol("Response internals"),D=o.STATUS_CODES;class L{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y.call(this,e,t);const n=t.status||200,r=new j(t.headers);if(null!=e&&!r.has("Content-Type")){const t=x(e);t&&r.append("Content-Type",t)}this[B]={url:t.url,status:n,statusText:t.statusText||D[n],headers:r,counter:t.counter}}get url(){return this[B].url||""}get status(){return this[B].status}get ok(){return this[B].status>=200&&this[B].status<300}get redirected(){return this[B].counter>0}get statusText(){return this[B].statusText}get headers(){return this[B].headers}clone(){return new L(g(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}y.mixIn(L.prototype),Object.defineProperties(L.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(L.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const q=Symbol("Request internals"),F=i.parse,U=i.format,M="destroy"in r.Readable.prototype;function H(e){return"object"==typeof e&&"object"==typeof e[q]}class J{constructor(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};H(e)?t=F(e.url):(t=e&&e.href?F(e.href):F(""+e),e={});let r=n.method||e.method||"GET";if(r=r.toUpperCase(),(null!=n.body||H(e)&&null!==e.body)&&("GET"===r||"HEAD"===r))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=n.body?n.body:H(e)&&null!==e.body?g(e):null;y.call(this,o,{timeout:n.timeout||e.timeout||0,size:n.size||e.size||0});const i=new j(n.headers||e.headers||{});if(null!=o&&!i.has("Content-Type")){const e=x(o);e&&i.append("Content-Type",e)}let a=H(e)?e.signal:null;if("signal"in n&&(a=n.signal),null!=a&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(a))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[q]={method:r,redirect:n.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:a},this.follow=void 0!==n.follow?n.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==n.compress?n.compress:void 0===e.compress||e.compress,this.counter=n.counter||e.counter||0,this.agent=n.agent||e.agent}get method(){return this[q].method}get url(){return U(this[q].parsedURL)}get headers(){return this[q].headers}get redirect(){return this[q].redirect}get signal(){return this[q].signal}clone(){return new J(this)}}function z(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}y.mixIn(J.prototype),Object.defineProperty(J.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(J.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),z.prototype=Object.create(Error.prototype),z.prototype.constructor=z,z.prototype.name="AbortError";const V=r.PassThrough,G=i.resolve;function $(e,t){if(!$.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return y.Promise=$.Promise,new $.Promise((function(n,i){const u=new J(e,t),c=function(e){const t=e[q].parsedURL,n=new j(e[q].headers);if(n.has("Accept")||n.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof r.Readable&&!M)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=_(e);"number"==typeof t&&(o=String(t))}o&&n.set("Content-Length",o),n.has("User-Agent")||n.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!n.has("Accept-Encoding")&&n.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),n.has("Connection")||i||n.set("Connection","close"),Object.assign({},t,{method:e.method,headers:N(n),agent:i})}(u),l=("https:"===c.protocol?a:o).request,f=u.signal;let d=null;const h=function(){let e=new z("The user aborted a request.");i(e),u.body&&u.body instanceof r.Readable&&u.body.destroy(e),d&&d.body&&d.body.emit("error",e)};if(f&&f.aborted)return void h();const m=function(){h(),w()},y=l(c);let b;function w(){y.abort(),f&&f.removeEventListener("abort",m),clearTimeout(b)}f&&f.addEventListener("abort",m),u.timeout&&y.once("socket",(function(e){b=setTimeout((function(){i(new p("network timeout at: "+u.url,"request-timeout")),w()}),u.timeout)})),y.on("error",(function(e){i(new p(`request to ${u.url} failed, reason: ${e.message}`,"system",e)),w()})),y.on("response",(function(e){clearTimeout(b);const t=function(e){const t=new j;for(const n of Object.keys(e))if(!S.test(n))if(Array.isArray(e[n]))for(const r of e[n])E.test(r)||(void 0===t[C][n]?t[C][n]=[r]:t[C][n].push(r));else E.test(e[n])||(t[C][n]=[e[n]]);return t}(e.headers);if($.isRedirect(e.statusCode)){const r=t.get("Location"),o=null===r?null:G(u.url,r);switch(u.redirect){case"error":return i(new p("uri requested responds with a redirect, redirect mode is set to error: "+u.url,"no-redirect")),void w();case"manual":if(null!==o)try{t.set("Location",o)}catch(e){i(e)}break;case"follow":if(null===o)break;if(u.counter>=u.follow)return i(new p("maximum redirect reached at: "+u.url,"max-redirect")),void w();const r={headers:new j(u.headers),follow:u.follow,counter:u.counter+1,agent:u.agent,compress:u.compress,method:u.method,body:u.body,signal:u.signal,timeout:u.timeout,size:u.size};return 303!==e.statusCode&&u.body&&null===_(u)?(i(new p("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void w()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==u.method)||(r.method="GET",r.body=void 0,r.headers.delete("content-length")),n($(new J(o,r))),void w())}}e.once("end",(function(){f&&f.removeEventListener("abort",m)}));let r=e.pipe(new V);const o={url:u.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:u.size,timeout:u.timeout,counter:u.counter},a=t.get("Content-Encoding");if(!u.compress||"HEAD"===u.method||null===a||204===e.statusCode||304===e.statusCode)return d=new L(r,o),void n(d);const c={flush:s.Z_SYNC_FLUSH,finishFlush:s.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return r=r.pipe(s.createGunzip(c)),d=new L(r,o),void n(d);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof s.createBrotliDecompress)return r=r.pipe(s.createBrotliDecompress()),d=new L(r,o),void n(d);d=new L(r,o),n(d)}else{e.pipe(new V).once("data",(function(e){r=8==(15&e[0])?r.pipe(s.createInflate()):r.pipe(s.createInflateRaw()),d=new L(r,o),n(d)}))}})),function(e,t){const n=t.body;null===n?e.end():v(n)?n.stream().pipe(e):Buffer.isBuffer(n)?(e.write(n),e.end()):n.pipe(e)}(y,u)}))}$.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},$.Promise=global.Promise,t.default=$},function(e,t){e.exports=require("os")},function(e,t,n){"use strict";n(20);var r=n(9),o=n(3),i=n(11),a=n(18),s=n(4),u=n(1),c=["start","error","version","history_rewrite"],l=c.concat(["snapshot"]);function f(e,t,n,r){n=u.applyDefaults(n,{fields:null}),this._client=e,this._onEvent=r,this._query=s.wrap(t),this._urlParams=n.fields?{fields:n.fields.join(",")}:null,this._abort=new AbortController,this._state="idle"}function p(e){this._allowedEvents=e,this._listeners={}}function d(e,t){this._client=e,this._dispatcher=t}f.prototype.snapshot=function(){var e=this;e._client.query(s.Get(e._query)).then((function(t){e._onEvent({type:"snapshot",event:t})})).catch((function(t){e._onEvent({type:"error",event:t})}))},f.prototype.subscribe=function(){var e=this;if("idle"!==e._state)throw new Error("Subscription#start should not be called several times, consider instantiating a new stream instead.");e._state="open";var t=JSON.stringify(e._query),n=Date.now(),s="";function u(t){t instanceof a.AbortError||e._onEvent({type:"error",event:t})}e._client._http.execute({method:"POST",path:"stream",body:t,query:e._urlParams,signal:this._abort.signal,streamConsumer:{onError:u,onData:function(t){var n=i.parseJSONStreaming(s+t);s=n.buffer,n.values.forEach((function(t){void 0!==t.txn&&e._client.syncLastTxnTime(t.txn),"error"===t.event?u(new o.StreamErrorEvent(t)):e._onEvent(t)}))}}}).then((function(o){var a,s=Date.now();try{a=i.parseJSON(o.body)}catch(e){a=o.body}var u=new r("POST","stream",e._urlParams,t,e._query,o.body,a,o.status,o.headers,n,s);e._client._handleRequestResult(o,u)})).catch(u)},f.prototype.close=function(){"closed"!==this._state&&(this._state="closed",this._abort.abort())},p.prototype.on=function(e,t){if(-1===this._allowedEvents.indexOf(e))throw new Error("Unknown event type: "+e);void 0===this._listeners[e]&&(this._listeners[e]=[]),this._listeners[e].push(t)},p.prototype.dispatch=function(e){var t=this._listeners[e.type];if(t)for(var n=0;ne.event.ts&&i.dispatch(n)}o=!1,r=null}(e);break;case"error":i.dispatch(e);break;default:o?r.push(e):i.dispatch(e)}}));return new d(a,i)},t}}},function(e,t,n){"use strict";var r=n(11);function o(e){var t=e.query,n=e.method,r=e.path,o=e.requestContent,a=e.responseHeaders,s=e.responseContent,u=e.statusCode,c=e.timeTaken,l="";function f(e){l+=e}return f("Fauna "+n+" /"+r+function(e){if(null==e)return"";var t=Object.keys(e);if(0===t.length)return"";return"?"+t.map((function(t){return t+"="+e[t]})).join("&")}(t)+"\n"),null!=o&&f(" Request JSON: "+i(o)+"\n"),f(" Response headers: "+i(a)+"\n"),f(" Response JSON: "+i(s)+"\n"),f(" Response ("+u+"): Network latency "+c+"ms\n"),l}function i(e){return r.toJSON(e,!0).split("\n").join("\n ")}e.exports={logger:function(e){return function(t,n){return e(o(t),n)}},showRequestResult:o}}])); \ No newline at end of file diff --git a/lambda-build/createMultisig.js b/lambda-build/createMultisig.js deleted file mode 100644 index b7b6511..0000000 --- a/lambda-build/createMultisig.js +++ /dev/null @@ -1,6 +0,0 @@ -!function(e,t){for(var n in t)e[n]=t[n]}(exports,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}([function(e,t){e.exports=require("stream")},function(e,t,n){"use strict";function r(e,t){return"object"==typeof e&&null!==e&&Boolean(e[t])}function o(e,t){t=t||"";var n,o,a=[];for(o in"string"!=typeof t&&(t="?"),e)if(r(e,o)){if((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=i(o),n=i(n),null===o||null===n)continue;a.push(o+"="+n)}return a.length?t+a.join("&"):""}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}e.exports={mergeObjects:function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},formatUrl:function(e,t,n){return n="object"==typeof n?o(n):n,[e,t?"/"===t.charAt(0)?"":"/"+t:"",n?"?"===n.charAt(0)?"":"?"+n:""].join("")},querystringify:o,inherits:function(e,t){if(null==e)throw new TypeError('The constructor to "inherits" must not be null or undefined');if(null==t)throw new TypeError('The super constructor to "inherits" must not be null or undefined');if(void 0===t.prototype)throw new TypeError('The super constructor to "inherits" must have a prototype');e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},isNodeEnv:function(){return"undefined"==typeof window&&"undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node},defaults:function(e,t){return void 0===e?t:e},applyDefaults:function(e,t){var n={};for(var r in e){if(!(r in t))throw new Error("No such option "+r);n[r]=e[r]}for(var o in t)o in n||(n[o]=t[o]);return n},removeNullAndUndefinedValues:function(e){var t={};for(var n in e){var r=e[n];null!=r&&(t[n]=r)}return t},removeUndefinedValues:function(e){var t={};for(var n in e){var r=e[n];void 0!==r&&(t[n]=r)}return t},checkInstanceHasProperty:r}},function(e,t){e.exports=require("zlib")},function(e,t,n){"use strict";var r=n(1);function o(e,t,n){Error.call(this),this.name=e,this.message=t,this.description=n}function i(e){o.call(this,"InvalidValue",e)}function a(e,t,n,r){var i=`${r} function requires ${function(e,t){return null===t?"at least "+e:null===e?"up to "+t:e===t?e:"from "+e+" to "+t}(e,t)} argument(s) but ${n} were given`,a="For more info, see the docs: https://docs.fauna.com/fauna/current/api/fql/functions/"+r.toLowerCase();o.call(this,"InvalidArity",`${i}\n${a}`),this.min=e,this.max=t,this.actual=n}function s(e,t){var n=t.responseContent.errors,r=0===n.length?'(empty "errors")':n[0].code,i=0===n.length?'(empty "errors")':n[0].description;o.call(this,e,r,i),this.requestResult=t}function u(e){s.call(this,"BadRequest",e)}function c(e){s.call(this,"Unauthorized",e)}function l(e){s.call(this,"PermissionDenied",e)}function f(e){s.call(this,"NotFound",e)}function p(e){s.call(this,"MethodNotAllowed",e)}function d(e){s.call(this,"InternalError",e)}function h(e){s.call(this,"UnavailableError",e)}function m(e,t,n){o.call(this,e,t,n)}function y(e){o.call(this,"StreamsNotSupported","streams not supported",e)}function b(e){var t=e.data||{};o.call(this,"StreamErrorEvent",t.code,t.description),this.event=e}r.inherits(o,Error),r.inherits(i,o),r.inherits(a,o),r.inherits(s,o),s.prototype.errors=function(){return this.requestResult.responseContent.errors},s.raiseForStatusCode=function(e){var t=e.statusCode;if(t<200||t>=300)switch(t){case 400:throw new u(e);case 401:throw new c(e);case 403:throw new l(e);case 404:throw new f(e);case 405:throw new p(e);case 500:throw new d(e);case 503:throw new h(e);default:throw new s("UnknownError",e)}},r.inherits(u,s),r.inherits(c,s),r.inherits(l,s),r.inherits(f,s),r.inherits(p,s),r.inherits(d,s),r.inherits(h,s),r.inherits(m,o),r.inherits(y,m),r.inherits(b,m),e.exports={FaunaError:o,FaunaHTTPError:s,InvalidValue:i,InvalidArity:a,BadRequest:u,Unauthorized:c,PermissionDenied:l,NotFound:f,MethodNotAllowed:p,InternalError:d,UnavailableError:h,StreamError:m,StreamsNotSupported:y,StreamErrorEvent:b}},function(e,t,n){"use strict";var r=n(22),o=n(14),i=n(8),a=n(3),s=n(5),u=n(16),c=n(1);function l(e){return m.exact(1,arguments,l.name),new i({var:v(e)})}var f=function(e){return m.exact(1,arguments,f.name),new i({object:g(e)})};function p(){switch(m.between(1,2,arguments,p.name),arguments.length){case 1:var e=arguments[0];if("function"==typeof e)return d(e);if(e instanceof i||c.checkInstanceHasProperty(e,"_isFaunaExpr"))return e;throw new a.InvalidValue("Lambda function takes either a Function or an Expr.");case 2:var t=arguments[0],n=arguments[1];return h(t,n)}}function d(e){var t=r(e);switch(t.length){case 0:throw new a.InvalidValue("Provided Function must take at least 1 argument.");case 1:return h(t[0],e(l(t[0])));default:return h(t,e.apply(null,t.map((function(e){return l(e)}))))}}function h(e,t){return new i({lambda:v(e),expr:v(t)})}function m(e,t,n,r){if(null!==e&&n.lengtht)throw new a.InvalidArity(e,t,n.length,r)}function y(e,t){for(var n in t){var r=t[n];null!==r&&(e[n]=r)}return e}function b(e){var t=Array.isArray(e)?e:Array.prototype.slice.call(e);return 1===e.length?e[0]:t}function w(e){var t=[];return t.push.apply(t,e),t}function v(e){return m.exact(1,arguments,v.name),null===e?null:e instanceof i||c.checkInstanceHasProperty(e,"_isFaunaExpr")?e:"symbol"==typeof e?e.toString().replace(/Symbol\((.*)\)/,(function(e,t){return t})):"function"==typeof e?p(e):Array.isArray(e)?new i(e.map((function(e){return v(e)}))):e instanceof Uint8Array||e instanceof ArrayBuffer?new s.Bytes(e):"object"==typeof e?new i({object:g(e)}):e}function g(e){if(null!==e){var t={};return Object.keys(e).forEach((function(n){t[n]=v(e[n])})),t}return null}m.exact=function(e,t,n){m(e,e,t,n)},m.max=function(e,t,n){m(null,e,t,n)},m.min=function(e,t,n){m(e,null,t,n)},m.between=function(e,t,n,r){m(e,t,n,r)},e.exports={Ref:function e(){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({"@ref":v(arguments[0])});case 2:return new i({ref:v(arguments[0]),id:v(arguments[1])})}},Bytes:function e(t){return m.exact(1,arguments,e.name),new s.Bytes(t)},Abort:function e(t){return m.exact(1,arguments,e.name),new i({abort:v(t)})},At:function e(t,n){return m.exact(2,arguments,e.name),new i({at:v(t),expr:v(n)})},Let:function e(t,n){m.exact(2,arguments,e.name);var r=[];if(r=Array.isArray(t)?t.map((function(e){return g(e)})):Object.keys(t).map((function(e){var n={};return n[e]=v(t[e]),n})),"function"==typeof n)if(Array.isArray(t)){var o=[];t.forEach((function(e){Object.keys(e).forEach((function(e){o.push(l(e))}))})),n=n.apply(null,o)}else n=n.apply(null,Object.keys(t).map((function(e){return l(e)})));return new i({let:r,in:v(n)})},Var:l,If:function e(t,n,r){return m.exact(3,arguments,e.name),new i({if:v(t),then:v(n),else:v(r)})},Do:function e(){m.min(1,arguments,e.name);var t=w(arguments);return new i({do:v(t)})},Object:f,Lambda:p,Call:function e(t){m.min(1,arguments,e.name);var n=w(arguments);return n.shift(),new i({call:v(t),arguments:v(b(n))})},Query:function e(t){return m.exact(1,arguments,e.name),new i({query:v(t)})},Map:function e(t,n){return m.exact(2,arguments,e.name),new i({map:v(n),collection:v(t)})},Foreach:function e(t,n){return m.exact(2,arguments,e.name),new i({foreach:v(n),collection:v(t)})},Filter:function e(t,n){return m.exact(2,arguments,e.name),new i({filter:v(n),collection:v(t)})},Take:function e(t,n){return m.exact(2,arguments,e.name),new i({take:v(t),collection:v(n)})},Drop:function e(t,n){return m.exact(2,arguments,e.name),new i({drop:v(t),collection:v(n)})},Prepend:function e(t,n){return m.exact(2,arguments,e.name),new i({prepend:v(t),collection:v(n)})},Append:function e(t,n){return m.exact(2,arguments,e.name),new i({append:v(t),collection:v(n)})},IsEmpty:function e(t){return m.exact(1,arguments,e.name),new i({is_empty:v(t)})},IsNonEmpty:function e(t){return m.exact(1,arguments,e.name),new i({is_nonempty:v(t)})},IsNumber:function e(t){return m.exact(1,arguments,e.name),new i({is_number:v(t)})},IsDouble:function e(t){return m.exact(1,arguments,e.name),new i({is_double:v(t)})},IsInteger:function e(t){return m.exact(1,arguments,e.name),new i({is_integer:v(t)})},IsBoolean:function e(t){return m.exact(1,arguments,e.name),new i({is_boolean:v(t)})},IsNull:function e(t){return m.exact(1,arguments,e.name),new i({is_null:v(t)})},IsBytes:function e(t){return m.exact(1,arguments,e.name),new i({is_bytes:v(t)})},IsTimestamp:function e(t){return m.exact(1,arguments,e.name),new i({is_timestamp:v(t)})},IsDate:function e(t){return m.exact(1,arguments,e.name),new i({is_date:v(t)})},IsString:function e(t){return m.exact(1,arguments,e.name),new i({is_string:v(t)})},IsArray:function e(t){return m.exact(1,arguments,e.name),new i({is_array:v(t)})},IsObject:function e(t){return m.exact(1,arguments,e.name),new i({is_object:v(t)})},IsRef:function e(t){return m.exact(1,arguments,e.name),new i({is_ref:v(t)})},IsSet:function e(t){return m.exact(1,arguments,e.name),new i({is_set:v(t)})},IsDoc:function e(t){return m.exact(1,arguments,e.name),new i({is_doc:v(t)})},IsLambda:function e(t){return m.exact(1,arguments,e.name),new i({is_lambda:v(t)})},IsCollection:function e(t){return m.exact(1,arguments,e.name),new i({is_collection:v(t)})},IsDatabase:function e(t){return m.exact(1,arguments,e.name),new i({is_database:v(t)})},IsIndex:function e(t){return m.exact(1,arguments,e.name),new i({is_index:v(t)})},IsFunction:function e(t){return m.exact(1,arguments,e.name),new i({is_function:v(t)})},IsKey:function e(t){return m.exact(1,arguments,e.name),new i({is_key:v(t)})},IsToken:function e(t){return m.exact(1,arguments,e.name),new i({is_token:v(t)})},IsCredentials:function e(t){return m.exact(1,arguments,e.name),new i({is_credentials:v(t)})},IsRole:function e(t){return m.exact(1,arguments,e.name),new i({is_role:v(t)})},Get:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({get:v(t)},{ts:v(n)}))},KeyFromSecret:function e(t){return m.exact(1,arguments,e.name),new i({key_from_secret:v(t)})},Reduce:function e(t,n,r){return m.exact(3,arguments,e.name),new i({reduce:v(t),initial:v(n),collection:v(r)})},Paginate:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,{}),new i(u({paginate:v(t)},g(n)))},Exists:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({exists:v(t)},{ts:v(n)}))},Create:function e(t,n){return m.between(1,2,arguments,e.name),new i({create:v(t),params:v(n)})},Update:function e(t,n){return m.exact(2,arguments,e.name),new i({update:v(t),params:v(n)})},Replace:function e(t,n){return m.exact(2,arguments,e.name),new i({replace:v(t),params:v(n)})},Delete:function e(t){return m.exact(1,arguments,e.name),new i({delete:v(t)})},Insert:function e(t,n,r,o){return m.exact(4,arguments,e.name),new i({insert:v(t),ts:v(n),action:v(r),params:v(o)})},Remove:function e(t,n,r){return m.exact(3,arguments,e.name),new i({remove:v(t),ts:v(n),action:v(r)})},CreateClass:o((function e(t){return m.exact(1,arguments,e.name),new i({create_class:v(t)})}),"CreateClass() is deprecated, use CreateCollection() instead"),CreateCollection:function e(t){return m.exact(1,arguments,e.name),new i({create_collection:v(t)})},CreateDatabase:function e(t){return m.exact(1,arguments,e.name),new i({create_database:v(t)})},CreateIndex:function e(t){return m.exact(1,arguments,e.name),new i({create_index:v(t)})},CreateKey:function e(t){return m.exact(1,arguments,e.name),new i({create_key:v(t)})},CreateFunction:function e(t){return m.exact(1,arguments,e.name),new i({create_function:v(t)})},CreateRole:function e(t){return m.exact(1,arguments,e.name),new i({create_role:v(t)})},CreateAccessProvider:function e(t){return m.exact(1,arguments,e.name),new i({create_access_provider:v(t)})},Singleton:function e(t){return m.exact(1,arguments,e.name),new i({singleton:v(t)})},Events:function e(t){return m.exact(1,arguments,e.name),new i({events:v(t)})},Match:function e(t){m.min(1,arguments,e.name);var n=w(arguments);return n.shift(),new i({match:v(t),terms:v(b(n))})},Union:function e(){return m.min(1,arguments,e.name),new i({union:v(b(arguments))})},Merge:function e(t,n,r){return m.between(2,3,arguments,e.name),new i(y({merge:v(t),with:v(n)},{lambda:v(r)}))},Intersection:function e(){return m.min(1,arguments,e.name),new i({intersection:v(b(arguments))})},Difference:function e(){return m.min(1,arguments,e.name),new i({difference:v(b(arguments))})},Distinct:function e(t){return m.exact(1,arguments,e.name),new i({distinct:v(t)})},Join:function e(t,n){return m.exact(2,arguments,e.name),new i({join:v(t),with:v(n)})},Range:function e(t,n,r){return m.exact(3,arguments,e.name),new i({range:v(t),from:v(n),to:v(r)})},Login:function e(t,n){return m.exact(2,arguments,e.name),new i({login:v(t),params:v(n)})},Logout:function e(t){return m.exact(1,arguments,e.name),new i({logout:v(t)})},Identify:function e(t,n){return m.exact(2,arguments,e.name),new i({identify:v(t),password:v(n)})},Identity:o((function e(){return m.exact(0,arguments,e.name),new i({identity:null})}),"Identity() is deprecated, use CurrentIdentity() instead"),CurrentIdentity:function e(){return m.exact(0,arguments,e.name),new i({current_identity:null})},HasIdentity:o((function e(){return m.exact(0,arguments,e.name),new i({has_identity:null})}),"HasIdentity() is deprecated, use HasCurrentIdentity() instead"),HasCurrentIdentity:function e(){return m.exact(0,arguments,e.name),new i({has_current_identity:null})},CurrentToken:function e(){return m.exact(0,arguments,e.name),new i({current_token:null})},HasCurrentToken:function e(){return m.exact(0,arguments,e.name),new i({has_current_token:null})},Concat:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({concat:v(t)},{separator:v(n)}))},Casefold:function e(t,n){return m.min(1,arguments,e.name),new i(y({casefold:v(t)},{normalizer:v(n)}))},ContainsStr:function e(t,n){return m.exact(2,arguments,e.name),new i({containsstr:v(t),search:v(n)})},ContainsStrRegex:function e(t,n){return m.exact(2,arguments,e.name),new i({containsstrregex:v(t),pattern:v(n)})},StartsWith:function e(t,n){return m.exact(2,arguments,e.name),new i({startswith:v(t),search:v(n)})},EndsWith:function e(t,n){return m.exact(2,arguments,e.name),new i({endswith:v(t),search:v(n)})},FindStr:function e(t,n,r){return m.between(2,3,arguments,e.name),r=c.defaults(r,null),new i(y({findstr:v(t),find:v(n)},{start:v(r)}))},FindStrRegex:function e(t,n,r,o){return m.between(2,4,arguments,e.name),r=c.defaults(r,null),new i(y({findstrregex:v(t),pattern:v(n)},{start:v(r),num_results:v(o)}))},Length:function e(t){return m.exact(1,arguments,e.name),new i({length:v(t)})},LowerCase:function e(t){return m.exact(1,arguments,e.name),new i({lowercase:v(t)})},LTrim:function e(t){return m.exact(1,arguments,e.name),new i({ltrim:v(t)})},NGram:function e(t,n,r){return m.between(1,3,arguments,e.name),n=c.defaults(n,null),r=c.defaults(r,null),new i(y({ngram:v(t)},{min:v(n),max:v(r)}))},Repeat:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({repeat:v(t)},{number:v(n)}))},ReplaceStr:function e(t,n,r){return m.exact(3,arguments,e.name),new i({replacestr:v(t),find:v(n),replace:v(r)})},ReplaceStrRegex:function e(t,n,r,o){return m.between(3,4,arguments,e.name),o=c.defaults(o,null),new i(y({replacestrregex:v(t),pattern:v(n),replace:v(r)},{first:v(o)}))},RegexEscape:function e(t){return m.exact(1,arguments,e.name),new i({regexescape:v(t)})},RTrim:function e(t){return m.exact(1,arguments,e.name),new i({rtrim:v(t)})},Space:function e(t){return m.exact(1,arguments,e.name),new i({space:v(t)})},SubString:function e(t,n,r){return m.between(1,3,arguments,e.name),n=c.defaults(n,null),r=c.defaults(r,null),new i(y({substring:v(t)},{start:v(n),length:v(r)}))},TitleCase:function e(t){return m.exact(1,arguments,e.name),new i({titlecase:v(t)})},Trim:function e(t){return m.exact(1,arguments,e.name),new i({trim:v(t)})},UpperCase:function e(t){return m.exact(1,arguments,e.name),new i({uppercase:v(t)})},Format:function e(t){m.min(1,arguments,e.name);var n=w(arguments);return n.shift(),new i({format:v(t),values:v(b(n))})},Time:function e(t){return m.exact(1,arguments,e.name),new i({time:v(t)})},TimeAdd:function e(t,n,r){return m.exact(3,arguments,e.name),new i({time_add:v(t),offset:v(n),unit:v(r)})},TimeSubtract:function e(t,n,r){return m.exact(3,arguments,e.name),new i({time_subtract:v(t),offset:v(n),unit:v(r)})},TimeDiff:function e(t,n,r){return m.exact(3,arguments,e.name),new i({time_diff:v(t),other:v(n),unit:v(r)})},Epoch:function e(t,n){return m.exact(2,arguments,e.name),new i({epoch:v(t),unit:v(n)})},Date:function e(t){return m.exact(1,arguments,e.name),new i({date:v(t)})},Now:function e(){return m.exact(0,arguments,e.name),new i({now:v(null)})},NextId:o((function e(){return m.exact(0,arguments,e.name),new i({next_id:null})}),"NextId() is deprecated, use NewId() instead"),NewId:function e(){return m.exact(0,arguments,e.name),new i({new_id:null})},Database:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({database:v(t)});case 2:return new i({database:v(t),scope:v(n)})}},Index:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({index:v(t)});case 2:return new i({index:v(t),scope:v(n)})}},Class:o((function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({class:v(t)});case 2:return new i({class:v(t),scope:v(n)})}}),"Class() is deprecated, use Collection() instead"),Collection:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({collection:v(t)});case 2:return new i({collection:v(t),scope:v(n)})}},Function:function e(t,n){switch(m.between(1,2,arguments,e.name),arguments.length){case 1:return new i({function:v(t)});case 2:return new i({function:v(t),scope:v(n)})}},Role:function e(t,n){return m.between(1,2,arguments,e.name),n=c.defaults(n,null),new i(y({role:v(t)},{scope:v(n)}))},AccessProviders:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({access_providers:v(t)})},Classes:o((function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({classes:v(t)})}),"Classes() is deprecated, use Collections() instead"),Collections:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({collections:v(t)})},Databases:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({databases:v(t)})},Indexes:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({indexes:v(t)})},Functions:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({functions:v(t)})},Roles:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({roles:v(t)})},Keys:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({keys:v(t)})},Tokens:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({tokens:v(t)})},Credentials:function e(t){return m.max(1,arguments,e.name),t=c.defaults(t,null),new i({credentials:v(t)})},Equals:function e(){return m.min(1,arguments,e.name),new i({equals:v(b(arguments))})},Contains:o((function e(t,n){return m.exact(2,arguments,e.name),new i({contains:v(t),in:v(n)})}),"Contains() is deprecated, use ContainsPath() instead"),ContainsPath:function e(t,n){return m.exact(2,arguments,e.name),new i({contains_path:v(t),in:v(n)})},ContainsField:function e(t,n){return m.exact(2,arguments,e.name),new i({contains_field:v(t),in:v(n)})},ContainsValue:function e(t,n){return m.exact(2,arguments,e.name),new i({contains_value:v(t),in:v(n)})},Select:function e(t,n,r){m.between(2,3,arguments,e.name);var o={select:v(t),from:v(n)};return void 0!==r&&(o.default=v(r)),new i(o)},SelectAll:o((function e(t,n){return m.exact(2,arguments,e.name),new i({select_all:v(t),from:v(n)})}),"SelectAll() is deprecated. Avoid use."),Abs:function e(t){return m.exact(1,arguments,e.name),new i({abs:v(t)})},Add:function e(){return m.min(1,arguments,e.name),new i({add:v(b(arguments))})},BitAnd:function e(){return m.min(1,arguments,e.name),new i({bitand:v(b(arguments))})},BitNot:function e(t){return m.exact(1,arguments,e.name),new i({bitnot:v(t)})},BitOr:function e(){return m.min(1,arguments,e.name),new i({bitor:v(b(arguments))})},BitXor:function e(){return m.min(1,arguments,e.name),new i({bitxor:v(b(arguments))})},Ceil:function e(t){return m.exact(1,arguments,e.name),new i({ceil:v(t)})},Divide:function e(){return m.min(1,arguments,e.name),new i({divide:v(b(arguments))})},Floor:function e(t){return m.exact(1,arguments,e.name),new i({floor:v(t)})},Max:function e(){return m.min(1,arguments,e.name),new i({max:v(b(arguments))})},Min:function e(){return m.min(1,arguments,e.name),new i({min:v(b(arguments))})},Modulo:function e(){return m.min(1,arguments,e.name),new i({modulo:v(b(arguments))})},Multiply:function e(){return m.min(1,arguments,e.name),new i({multiply:v(b(arguments))})},Round:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({round:v(t)},{precision:v(n)}))},Subtract:function e(){return m.min(1,arguments,e.name),new i({subtract:v(b(arguments))})},Sign:function e(t){return m.exact(1,arguments,e.name),new i({sign:v(t)})},Sqrt:function e(t){return m.exact(1,arguments,e.name),new i({sqrt:v(t)})},Trunc:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({trunc:v(t)},{precision:v(n)}))},Count:function e(t){return m.exact(1,arguments,e.name),new i({count:v(t)})},Sum:function e(t){return m.exact(1,arguments,e.name),new i({sum:v(t)})},Mean:function e(t){return m.exact(1,arguments,e.name),new i({mean:v(t)})},Any:function e(t){return m.exact(1,arguments,e.name),new i({any:v(t)})},All:function e(t){return m.exact(1,arguments,e.name),new i({all:v(t)})},Acos:function e(t){return m.exact(1,arguments,e.name),new i({acos:v(t)})},Asin:function e(t){return m.exact(1,arguments,e.name),new i({asin:v(t)})},Atan:function e(t){return m.exact(1,arguments,e.name),new i({atan:v(t)})},Cos:function e(t){return m.exact(1,arguments,e.name),new i({cos:v(t)})},Cosh:function e(t){return m.exact(1,arguments,e.name),new i({cosh:v(t)})},Degrees:function e(t){return m.exact(1,arguments,e.name),new i({degrees:v(t)})},Exp:function e(t){return m.exact(1,arguments,e.name),new i({exp:v(t)})},Hypot:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({hypot:v(t)},{b:v(n)}))},Ln:function e(t){return m.exact(1,arguments,e.name),new i({ln:v(t)})},Log:function e(t){return m.exact(1,arguments,e.name),new i({log:v(t)})},Pow:function e(t,n){return m.min(1,arguments,e.name),n=c.defaults(n,null),new i(y({pow:v(t)},{exp:v(n)}))},Radians:function e(t){return m.exact(1,arguments,e.name),new i({radians:v(t)})},Sin:function e(t){return m.exact(1,arguments,e.name),new i({sin:v(t)})},Sinh:function e(t){return m.exact(1,arguments,e.name),new i({sinh:v(t)})},Tan:function e(t){return m.exact(1,arguments,e.name),new i({tan:v(t)})},Tanh:function e(t){return m.exact(1,arguments,e.name),new i({tanh:v(t)})},LT:function e(){return m.min(1,arguments,e.name),new i({lt:v(b(arguments))})},LTE:function e(){return m.min(1,arguments,e.name),new i({lte:v(b(arguments))})},GT:function e(){return m.min(1,arguments,e.name),new i({gt:v(b(arguments))})},GTE:function e(){return m.min(1,arguments,e.name),new i({gte:v(b(arguments))})},And:function e(){return m.min(1,arguments,e.name),new i({and:v(b(arguments))})},Or:function e(){return m.min(1,arguments,e.name),new i({or:v(b(arguments))})},Not:function e(t){return m.exact(1,arguments,e.name),new i({not:v(t)})},ToString:function e(t){return m.exact(1,arguments,e.name),new i({to_string:v(t)})},ToNumber:function e(t){return m.exact(1,arguments,e.name),new i({to_number:v(t)})},ToObject:function e(t){return m.exact(1,arguments,e.name),new i({to_object:v(t)})},ToArray:function e(t){return m.exact(1,arguments,e.name),new i({to_array:v(t)})},ToDouble:function e(t){return m.exact(1,arguments,e.name),new i({to_double:v(t)})},ToInteger:function e(t){return m.exact(1,arguments,e.name),new i({to_integer:v(t)})},ToTime:function e(t){return m.exact(1,arguments,e.name),new i({to_time:v(t)})},ToSeconds:function e(t){return m.exact(1,arguments,e.name),new i({to_seconds:v(t)})},ToMicros:function e(t){return m.exact(1,arguments,e.name),new i({to_micros:v(t)})},ToMillis:function e(t){return m.exact(1,arguments,e.name),new i({to_millis:v(t)})},DayOfMonth:function e(t){return m.exact(1,arguments,e.name),new i({day_of_month:v(t)})},DayOfWeek:function e(t){return m.exact(1,arguments,e.name),new i({day_of_week:v(t)})},DayOfYear:function e(t){return m.exact(1,arguments,e.name),new i({day_of_year:v(t)})},Second:function e(t){return m.exact(1,arguments,e.name),new i({second:v(t)})},Minute:function e(t){return m.exact(1,arguments,e.name),new i({minute:v(t)})},Hour:function e(t){return m.exact(1,arguments,e.name),new i({hour:v(t)})},Month:function e(t){return m.exact(1,arguments,e.name),new i({month:v(t)})},Year:function e(t){return m.exact(1,arguments,e.name),new i({year:v(t)})},ToDate:function e(t){return m.exact(1,arguments,e.name),new i({to_date:v(t)})},MoveDatabase:function e(t,n){return m.exact(2,arguments,e.name),new i({move_database:v(t),to:v(n)})},Documents:function e(t){return m.exact(1,arguments,e.name),new i({documents:v(t)})},Reverse:function e(t){return m.exact(1,arguments,e.name),new i({reverse:v(t)})},AccessProvider:function e(t){return m.exact(1,arguments,e.name),new i({access_provider:v(t)})},wrap:v}},function(e,t,n){"use strict";var r=n(23),o=n(14),i=n(3),a=n(8),s=n(1),u=s.isNodeEnv()?n(15):null,c=u&&u.inspect.custom,l=u?u.inspect:JSON.stringify;function f(){}function p(e,t,n){if(!e)throw new i.InvalidValue("id cannot be null or undefined");this.value={id:e},t&&(this.value.collection=t),n&&(this.value.database=n)}f.prototype._isFaunaValue=!0,s.inherits(f,a),p.prototype._isFaunaRef=!0,s.inherits(p,f),Object.defineProperty(p.prototype,"collection",{get:function(){return this.value.collection}}),Object.defineProperty(p.prototype,"class",{get:o((function(){return this.value.collection}),"class is deprecated, use collection instead")}),Object.defineProperty(p.prototype,"database",{get:function(){return this.value.database}}),Object.defineProperty(p.prototype,"id",{get:function(){return this.value.id}}),p.prototype.toJSON=function(){return{"@ref":this.value}},v(p,(function(){var e={collections:"Collection",databases:"Database",indexes:"Index",functions:"Function",roles:"Role",access_providers:"AccessProvider"},t=function(e){return void 0===e.collection},n=function(r){if(t(r)){var o=void 0!==r.database?r.database.toString():"";return"access_providers"===r.id?"AccessProviders("+o+")":r.id.charAt(0).toUpperCase()+r.id.slice(1)+"("+o+")"}if(t(r.collection)){var i=e[r.collection.id];if(void 0!==i){o=void 0!==r.database?", "+r.database.toString():"";return i+'("'+r.id+'"'+o+")"}}return"Ref("+n(r.collection)+', "'+r.id+'")'};return n(this)})),p.prototype.valueOf=function(){return this.value},p.prototype.equals=function(e){return(e instanceof p||s.checkInstanceHasProperty(e,"_isFaunaRef"))&&this.id===e.id&&(void 0===this.collection&&void 0===e.collection||this.collection.equals(e.collection))&&(void 0===this.database&&void 0===e.database||this.database.equals(e.database))};var d={COLLECTIONS:new p("collections"),INDEXES:new p("indexes"),DATABASES:new p("databases"),FUNCTIONS:new p("functions"),ROLES:new p("roles"),KEYS:new p("keys"),ACCESS_PROVIDERS:new p("access_providers")};function h(e){this.value=e}function m(e){if(e instanceof Date)e=e.toISOString();else if("Z"!==e.charAt(e.length-1))throw new i.InvalidValue("Only allowed timezone is 'Z', got: "+e);this.value=e}function y(e){e instanceof Date&&(e=e.toISOString().slice(0,10)),this.value=e}function b(e){if(e instanceof ArrayBuffer)this.value=new Uint8Array(e);else if("string"==typeof e)this.value=r.toByteArray(e);else{if(!(e instanceof Uint8Array))throw new i.InvalidValue("Bytes type expect argument to be either Uint8Array|ArrayBuffer|string, got: "+l(e));this.value=e}}function w(e){this.value=e}function v(e,t){e.prototype.toString=t,e.prototype.inspect=t,c&&(e.prototype[c]=t)}d.fromName=function(e){switch(e){case"collections":return d.COLLECTIONS;case"indexes":return d.INDEXES;case"databases":return d.DATABASES;case"functions":return d.FUNCTIONS;case"roles":return d.ROLES;case"keys":return d.KEYS;case"access_providers":return d.ACCESS_PROVIDERS}return new p(e)},s.inherits(h,f),v(h,(function(){return a.toString(this.value)})),h.prototype.toJSON=function(){return{"@set":this.value}},s.inherits(m,f),Object.defineProperty(m.prototype,"date",{get:function(){return new Date(this.value)}}),v(m,(function(){return'Time("'+this.value+'")'})),m.prototype.toJSON=function(){return{"@ts":this.value}},s.inherits(y,f),Object.defineProperty(y.prototype,"date",{get:function(){return new Date(this.value)}}),v(y,(function(){return'Date("'+this.value+'")'})),y.prototype.toJSON=function(){return{"@date":this.value}},s.inherits(b,f),v(b,(function(){return'Bytes("'+r.fromByteArray(this.value)+'")'})),b.prototype.toJSON=function(){return{"@bytes":r.fromByteArray(this.value)}},s.inherits(w,f),v(w,(function(){return"Query("+a.toString(this.value)+")"})),w.prototype.toJSON=function(){return{"@query":this.value}},e.exports={Value:f,Ref:p,Native:d,SetRef:h,FaunaTime:m,FaunaDate:y,Bytes:b,Query:w}},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";var r=n(1);function o(e){this.raw=e}o.prototype._isFaunaExpr=!0,o.prototype.toJSON=function(){return this.raw},o.prototype.toFQL=function(){return l(this.raw)};var i=["Do","Call","Union","Intersection","Difference","Equals","Add","BitAnd","BitOr","BitXor","Divide","Max","Min","Modulo","Multiply","Subtract","LT","LTE","GT","GTE","And","Or"],a={containsstrregex:"ContainsStrRegex",endswith:"EndsWith",findstr:"FindStr",findstrregex:"FindStrRegex",gt:"GT",gte:"GTE",is_nonempty:"is_non_empty",lowercase:"LowerCase",lt:"LT",lte:"LTE",ltrim:"LTrim",rtrim:"RTrim",regexescape:"RegexEscape",replacestr:"ReplaceStr",replacestrregex:"ReplaceStrRegex",startswith:"StartsWith",substring:"SubString",titlecase:"TitleCase",uppercase:"UpperCase"};function s(e){return e instanceof o||r.checkInstanceHasProperty(e,"_isFaunaExpr")}function u(e){return"{"+Object.keys(e).map((function(t){return t+": "+l(e[t])})).join(", ")+"}"}function c(e,t){return e.map((function(e){return t(e)})).join(", ")}var l=function(e,t){if(s(e)){if("value"in e)return e.toString();e=e.raw}if(null===e)return"null";switch(typeof e){case"string":return JSON.stringify(e);case"symbol":case"number":case"boolean":return e.toString();case"undefined":return"undefined"}if(Array.isArray(e)){var n=c(e,l);return-1!=i.indexOf(t)?n:"["+n+"]"}if("match"in e){var r=l(e.match),o=e.terms||[];return s(o)&&(o=o.raw),Array.isArray(o)&&0==o.length?"Match("+r+")":Array.isArray(o)?"Match("+r+", ["+c(o,l)+"])":"Match("+r+", "+l(o)+")"}if("paginate"in e){if(1===Object.keys(e).length)return"Paginate("+l(e.paginate)+")";var f=Object.assign({},e);return delete f.paginate,"Paginate("+l(e.paginate)+", "+u(f)+")"}if("let"in e&&"in"in e){return"Let("+(Array.isArray(e.let)?"["+c(e.let,u)+"]":u(e.let))+", "+l(e.in)+")"}if("object"in e)return u(e.object);if("lambda"in e)return"Lambda("+l(e.lambda)+", "+l(e.expr)+")";if("filter"in e)return"Filter("+l(e.collection)+", "+l(e.filter)+")";if("call"in e)return"Call("+l(e.call)+", "+l(e.arguments)+")";if("map"in e)return"Map("+l(e.collection)+", "+l(e.map)+")";if("foreach"in e)return"Foreach("+l(e.collection)+", "+l(e.foreach)+")";var p=Object.keys(e),d=p[0];d=function(e){return e in a&&(e=a[e]),e.split("_").map((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})).join("")}(d);var h=p.filter(t=>null!==e[t]||p.length>1).map(t=>l(e[t],d)).join(", ");return d+"("+h+")"};o.toString=l,e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,s,u,c,l){this.method=e,this.path=t,this.query=n,this.requestRaw=r,this.requestContent=o,this.responseRaw=i,this.responseContent=a,this.statusCode=s,this.responseHeaders=u,this.startTime=c,this.endTime=l}Object.defineProperty(r.prototype,"timeTaken",{get:function(){return this.endTime-this.startTime}}),e.exports=r},function(e,t,n){"use strict";var r=n(1);function o(e){Error.call(this),this.message=e||"Request aborted due to timeout",this.isTimeoutError=!0}function i(e){Error.call(this),this.message=e||"Request aborted",this.isAbortError=!0}r.inherits(o,Error),r.inherits(i,Error),e.exports={TimeoutError:o,AbortError:i}},function(e,t,n){"use strict";var r=n(5);function o(e){return JSON.parse(e,i)}function i(e,t){if("object"!=typeof t||null===t)return t;if("@ref"in t){var n=t["@ref"];if(!("collection"in n)&&!("database"in n))return r.Native.fromName(n.id);var o=i("collection",n.collection),a=i("database",n.database);return new r.Ref(n.id,o,a)}return"@obj"in t?t["@obj"]:"@set"in t?new r.SetRef(t["@set"]):"@ts"in t?new r.FaunaTime(t["@ts"]):"@date"in t?new r.FaunaDate(t["@date"]):"@bytes"in t?new r.Bytes(t["@bytes"]):"@query"in t?new r.Query(t["@query"]):t}e.exports={toJSON:function(e,t){return(t=void 0!==t&&t)?JSON.stringify(e,null," "):JSON.stringify(e)},parseJSON:o,parseJSONStreaming:function(e){var t=[];try{t.push(o(e)),e=""}catch(i){for(;;){var n=e.indexOf("\n")+1;if(n<=0)break;var r=e.slice(0,n).trim();r.length>0&&t.push(o(r)),e=e.slice(n)}}return{values:t,buffer:e}}}},function(e,t){e.exports=require("https")},function(e,t,n){var r=n(4),o=n(1);e.exports=o.mergeObjects({Client:n(24),Expr:n(8),PageHelper:n(17),RequestResult:n(9),clientLogger:n(32),errors:n(3),values:n(5),query:r},r)},function(e,t,n){e.exports=n(15).deprecate},function(e,t){e.exports=require("util")},function(e,t,n){"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=a(e),c=1;c0&&this._faunaFunctions.forEach((function(e){a=e(a)})),this.client.query(a,this.options)},i.prototype._clone=function(){return Object.create(i.prototype,{client:{value:this.client},set:{value:this.set},_faunaFunctions:{value:this._faunaFunctions},before:{value:this.before},after:{value:this.after}})},e.exports=i},function(e,t,n){"use strict";var r=n(25),o=n(1),i=n(10);function a(e){var t="https"===e.scheme;null==e.port&&(e.port=t?443:80);var i=!e.fetch&&o.isNodeEnv()&&function(){try{return n(19),!0}catch(e){return!1}}();this._adapter=i?new(n(26)):new(n(27))({isHttps:t,fetch:e.fetch,keepAlive:e.keepAlive}),this._baseUrl=e.scheme+"://"+e.domain+":"+e.port,this._secret=e.secret,this._headers=Object.assign({},e.headers,function(){var e={"X-Fauna-Driver":"Javascript","X-FaunaDB-API-Version":r.apiVersion};o.isNodeEnv()&&(e["X-Fauna-Driver-Version"]=r.version,e["X-Runtime-Environment"]=(t=[{name:"Netlify",check:()=>process.env.hasOwnProperty("NETLIFY_IMAGES_CDN_DOMAIN")},{name:"Vercel",check:()=>process.env.hasOwnProperty("VERCEL")},{name:"Heroku",check:()=>process.env.hasOwnProperty("PATH")&&-1!==process.env.PATH.indexOf(".heroku")},{name:"AWS Lambda",check:()=>process.env.hasOwnProperty("AWS_LAMBDA_FUNCTION_VERSION")},{name:"GCP Cloud Functions",check:()=>process.env.hasOwnProperty("_")&&-1!==process.env._.indexOf("google")},{name:"GCP Compute Instances",check:()=>process.env.hasOwnProperty("GOOGLE_CLOUD_PROJECT")},{name:"Azure Cloud Functions",check:()=>process.env.hasOwnProperty("WEBSITE_FUNCTIONS_AZUREMONITOR_CATEGORIES")},{name:"Azure Compute",check:()=>process.env.hasOwnProperty("ORYX_ENV_TYPE")&&process.env.hasOwnProperty("WEBSITE_INSTANCE_ID")&&"AppService"===process.env.ORYX_ENV_TYPE},{name:"Worker",check:()=>{try{return global instanceof ServiceWorkerGlobalScope}catch(e){return!1}}},{name:"Mongo Stitch",check:()=>"function"==typeof global.StitchError},{name:"Render",check:()=>process.env.hasOwnProperty("RENDER_SERVICE_ID")},{name:"Begin",check:()=>process.env.hasOwnProperty("BEGIN_DATA_SCOPE_ID")}].find(e=>e.check()))?t.name:"Unknown",e["X-Runtime-Environment-OS"]=n(30).platform(),e["X-NodeJS-Version"]=process.version);var t;return e}()),this._queryTimeout=e.queryTimeout,this._lastSeen=null,this._timeout=Math.floor(1e3*e.timeout)}a.prototype.getLastTxnTime=function(){return this._lastSeen},a.prototype.syncLastTxnTime=function(e){(null==this._lastSeen||this._lastSeen0){const e=new Array(arguments.length);for(let t=0;t{const r=JSON.parse(e.body);console.log("Function `createMultisig` invoked",r);const o={data:r};return a.query(i.Create(i.Ref("Multisig"),o)).then(e=>(console.log("success",e),n(null,{statusCode:200,body:JSON.stringify(e)}))).catch(e=>(console.log("error",e),n(null,{statusCode:400,body:JSON.stringify(e)})))}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new Error("Could not parse function signature for injection dependencies: Object is not a function");if(!e.length)return[];var t=/^()\(?([^)=]*)\)? *=>/.exec(e+"")||/^[^(]+([^ \(]*) *\(([^\)]*)\)/.exec(e+"");if(!t)throw new Error("Could not parse function signature for injection dependencies: "+e);var n=t[2].replace(/\/\*[\S\s]*?\*\//g," ").replace(/\/\/.*/g," ");function r(e,t,n){return t+n.split(",").map((function(e){return e&&e.trim()})).filter(Boolean).join("@")}return(n=(n=n.replace(/(\{)([^}]*)\}/g,r)).replace(/(\[)([^}]*)\]/g,r)).split(",").map((function(e){return e&&e.trim()})).map((function(e){return"{"===e[0]?e.substring(1).split("@"):"["===e[0]?{items:e.substring(1).split("@")}:e})).filter(Boolean)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),a=r[0],s=r[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t,n){"use strict";var r=n(17),o=n(9),i=n(3),a=n(18),s=n(11),u=n(4),c=n(31),l=n(1),f=n(5);function p(e){e=l.applyDefaults(e,{domain:"db.fauna.com",scheme:"https",port:null,secret:null,timeout:60,observer:null,keepAlive:!0,headers:{},fetch:void 0,queryTimeout:null}),this._observer=e.observer,this._http=new a.HttpClient(e),this.stream=c.StreamAPI(this)}p.prototype.query=function(e,t){return this._execute("POST","",u.wrap(e),null,t)},p.prototype.paginate=function(e,t,n){return t=l.defaults(t,{}),n=l.defaults(n,{}),new r(this,e,t,n)},p.prototype.ping=function(e,t){return this._execute("GET","ping",null,{scope:e,timeout:t})},p.prototype.getLastTxnTime=function(){return this._http.getLastTxnTime()},p.prototype.syncLastTxnTime=function(e){this._http.syncLastTxnTime(e)},p.prototype._execute=function(e,t,n,r,i){r=l.defaults(r,null),(t instanceof f.Ref||l.checkInstanceHasProperty(t,"_isFaunaRef"))&&(t=t.value),null!==r&&(r=l.removeUndefinedValues(r));var a=Date.now(),u=this,c=["GET","HEAD"].indexOf(e)>=0?void 0:JSON.stringify(n);return this._http.execute(Object.assign({},i,{path:t,query:r,method:e,body:c})).then((function(l){var f=Date.now(),p=s.parseJSON(l.body),d=new o(e,t,r,c,n,l.body,p,l.status,l.headers,a,f);return u._handleRequestResult(l,d,i),p.resource}))},p.prototype._handleRequestResult=function(e,t,n){null!=e.headers["x-txn-time"]&&this.syncLastTxnTime(parseInt(e.headers["x-txn-time"],10)),[this._observer,n&&n.observer].forEach(e=>{"function"==typeof e&&e(t,this)}),i.FaunaHTTPError.raiseForStatusCode(t)},e.exports=p},function(e){e.exports=JSON.parse('{"_from":"faunadb","_id":"faunadb@4.1.1","_inBundle":false,"_integrity":"sha512-ekHtUgt+heYbaZXMWMB00Q7+DCiPKAubs2zbpNc4oMKamRxbL39MyzdNQNnCcSGOAJcLHPJbgOlDHK4y0Rkwrw==","_location":"/faunadb","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"faunadb","name":"faunadb","escapedName":"faunadb","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/faunadb/-/faunadb-4.1.1.tgz","_shasum":"c505aae1171abb18b7e8bf98bfe6b7bc1785e446","_spec":"faunadb","_where":"/Users/sampanter/projects/cosmos-legacy-multisig","apiVersion":"4","browser":{"http2":false,"http":false,"https":false,"os":false,"util":false},"bugs":{"url":"https://github.com/fauna/faunadb-js/issues"},"bundleDependencies":false,"dependencies":{"abort-controller":"^3.0.0","base64-js":"^1.2.0","browser-detect":"^0.2.28","btoa-lite":"^1.0.0","cross-fetch":"^3.0.6","dotenv":"^8.2.0","fn-annotate":"^1.1.3","object-assign":"^4.1.0","util-deprecate":"^1.0.2"},"deprecated":false,"description":"FaunaDB Javascript driver for Node.JS and Browsers","devDependencies":{"browserify":"^16.2.2","eslint":"^5.3.0","eslint-config-prettier":"^6.5.0","eslint-plugin-prettier":"^3.1.1","husky":">=1","ink-docstrap":"^1.2.1","jest":"^24.9.0","jsdoc":"^3.6.3","lint-staged":">=8","prettier":"1.18.2","semantic-release":"^17.1.2","terser":"^4.3.9","webpack":"^5.23.0","webpack-cli":"^4.5.0"},"files":["index.d.ts","src/","dist/"],"homepage":"https://fauna.com","husky":{"hooks":{"pre-commit":"lint-staged"}},"keywords":["database","fauna","official","driver"],"license":"MPL-2.0","lint-staged":{"*.{js,css,json,md}":["prettier --write","git add"],"*.js":["eslint --fix","git add"]},"main":"index.js","name":"faunadb","release":{"branches":["master"]},"repository":{"type":"git","url":"git+https://github.com/fauna/faunadb-js.git"},"scripts":{"browserify":"browserify index.js --standalone faunadb -o dist/faunadb.js","browserify-min":"browserify index.js --standalone faunadb | terser -c -m --keep-fnames --keep-classnames -o dist/faunadb-min.js","doc":"jsdoc -c ./jsdoc.json","prettify":"prettier --write \\"{src,test}/**/*.{js,ts}\\"","semantic-release":"semantic-release","test":"jest --env=node --verbose=false ./test","wp":"webpack"},"types":"index.d.ts","version":"4.1.1"}')},function(e,t,n){"use strict";var r=n(19),o=n(10),i=n(1);function a(){this.type="http2",this._sessionMap={}}a.prototype._resolveSessionFor=function(e,t){var n=t?"stream::"+e:e;if(!this._sessionMap[n]){var o=this,i=function(){o._cleanupSessionFor(e,t)};this._sessionMap[n]=r.connect(e).once("error",i).once("goaway",i).setTimeout(6e4,i)}return this._sessionMap[n]},a.prototype._cleanupSessionFor=function(e,t){var n=t?"stream::"+e:e;this._sessionMap[n]&&(this._sessionMap[n].close(),delete this._sessionMap[n])},a.prototype.execute=function(e){var t=this,n=null!=e.streamConsumer;return new Promise((function(a,s){var u=!1,c=!1,l=function(e){u=!0,a(e)},f=function(t){if(u&&n)return e.streamConsumer.onError(t);u=!0,s(t)},p=function(){e.signal&&e.signal.removeEventListener("abort",d)},d=function(){c=!0,p(),y.close(r.constants.NGHTTP2_CANCEL),f(new o.AbortError)};try{var h=("/"===e.path[0]?e.path:"/"+e.path)+i.querystringify(e.query,"?"),m=Object.assign({},e.headers,{[r.constants.HTTP2_HEADER_PATH]:h,[r.constants.HTTP2_HEADER_METHOD]:e.method}),y=t._resolveSessionFor(e.origin,n).request(m).setEncoding("utf8").on("error",(function(e){p(),f(e)})).on("response",(function(t){var o=t[r.constants.HTTP2_HEADER_STATUS],i=o>=200&&o<400&&n,a="";i&&l({body:"[stream]",headers:t,status:o}),y.on("data",(function(t){if(i)return e.streamConsumer.onData(t);a+=t})).on("end",(function(){if(p(),!i)return l({body:a,headers:t,status:o});c||e.streamConsumer.onError(new TypeError("network error"))}))}));!e.signal&&e.timeout&&y.setTimeout(e.timeout,(function(){c=!0,p(),y.close(r.constants.NGHTTP2_CANCEL),f(new o.TimeoutError)})),e.signal&&e.signal.addEventListener("abort",d),null!=e.body&&y.write(e.body),y.end()}catch(r){t._cleanupSessionFor(e.origin,n),f(r)}}))},e.exports=a},function(e,t,n){"use strict";n(20);var r=n(1),o=n(3),i=n(10);function a(e){e=e||{},this.type="fetch",this._fetch=function(e){if("function"==typeof e)return e;if("function"==typeof global.fetch)return global.fetch.bind(global);return n(28)}(e.fetch),r.isNodeEnv()&&e.keepAlive&&(this._keepAliveEnabledAgent=new((e.isHttps?n(12):n(6)).Agent)({keepAlive:!0}))}function s(e,t){return e&&"AbortError"===e.name?t?new i.TimeoutError:new i.AbortError:e}a.prototype.execute=function(e){var t,n=e.signal,i=!e.signal&&!!e.timeout,a=function(){t&&clearTimeout(t)};if(i){var u=new AbortController;n=u.signal,t=setTimeout(u.abort.bind(u),e.timeout)}return this._fetch(r.formatUrl(e.origin,e.path,e.query),{method:e.method,headers:e.headers,body:e.body,agent:this._keepAliveEnabledAgent,signal:n}).then((function(t){a();var n=function(e){var t={};for(var n of e.entries()){var r=n[0],o=n[1];t[r]=o}return t}(t.headers);return t.ok&&null!=e.streamConsumer?(function(e,t){var n=function(e){t.onError(s(e))};if(r.isNodeEnv())return void e.body.on("error",n).on("data",t.onData).on("end",(function(){t.onError(new TypeError("network error"))}));try{var i=e.body.getReader(),a=new TextDecoder("utf-8");(function e(){return i.read().then((function(n){if(!n.done){var r=a.decode(n.value,{stream:!0});return t.onData(r),e()}t.onError(new TypeError("network error"))}))})().catch(n)}catch(e){throw new o.StreamsNotSupported("Please, consider providing a Fetch API-compatible function with streamable response bodies. "+e)}}(t,e.streamConsumer),{body:"[stream]",headers:n,status:t.status}):t.text().then((function(e){return{body:e,headers:n,status:t.status}}))})).catch((function(e){return a(),Promise.reject(s(e,i))}))},e.exports=a},function(e,t,n){var r=n(29),o=r.default||r,i=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),o.call(this,e,t)};e.exports=t=i,t.fetch=i,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,t.default=i},function(e,t,n){"use strict";n.r(t),n.d(t,"Headers",(function(){return C})),n.d(t,"Request",(function(){return J})),n.d(t,"Response",(function(){return L})),n.d(t,"FetchError",(function(){return p}));var r=n(0),o=n(6),i=n(7),a=n(12),s=n(2);const u=r.Readable,c=Symbol("buffer"),l=Symbol("type");class f{constructor(){this[l]="";const e=arguments[0],t=arguments[1],n=[];let r=0;if(e){const t=e,o=Number(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},o=n.size;let i=void 0===o?0:o;var a=n.timeout;let s=void 0===a?0:a;null==e?e=null:w(e)?e=Buffer.from(e.toString()):v(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof r||(e=Buffer.from(String(e)))),this[h]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=s,e instanceof r&&e.on("error",(function(e){const n="AbortError"===e.name?e:new p(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[h].error=n}))}function b(){var e=this;if(this[h].disturbed)return y.Promise.reject(new TypeError("body used already for: "+this.url));if(this[h].disturbed=!0,this[h].error)return y.Promise.reject(this[h].error);let t=this.body;if(null===t)return y.Promise.resolve(Buffer.alloc(0));if(v(t)&&(t=t.stream()),Buffer.isBuffer(t))return y.Promise.resolve(t);if(!(t instanceof r))return y.Promise.resolve(Buffer.alloc(0));let n=[],o=0,i=!1;return new y.Promise((function(r,a){let s;e.timeout&&(s=setTimeout((function(){i=!0,a(new p(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(i=!0,a(t)):a(new p(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!i&&null!==t){if(e.size&&o+t.length>e.size)return i=!0,void a(new p(`content size at ${e.url} over limit: ${e.size}`,"max-size"));o+=t.length,n.push(t)}})),t.on("end",(function(){if(!i){clearTimeout(s);try{r(Buffer.concat(n,o))}catch(t){a(new p(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function w(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function v(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function g(e){let t,n,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof r&&"function"!=typeof o.getBoundary&&(t=new m,n=new m,o.pipe(t),o.pipe(n),e[h].body=t,o=n),o}function x(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":w(e)?"application/x-www-form-urlencoded;charset=UTF-8":v(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?"multipart/form-data;boundary="+e.getBoundary():e instanceof r?null:"text/plain;charset=UTF-8"}function _(e){const t=e.body;return null===t?0:v(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}y.prototype={get body(){return this[h].body},get bodyUsed(){return this[h].disturbed},arrayBuffer(){return b.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return b.call(this).then((function(t){return Object.assign(new f([],{type:e.toLowerCase()}),{[c]:t})}))},json(){var e=this;return b.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return y.Promise.reject(new p(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return b.call(this).then((function(e){return e.toString()}))},buffer(){return b.call(this)},textConverted(){var e=this;return b.call(this).then((function(t){return function(e,t){if("function"!=typeof d)throw new Error("The package `encoding` must be installed to use the textConverted() function");const n=t.get("content-type");let r,o,i="utf-8";n&&(r=/charset=([^;]*)/i.exec(n));o=e.slice(0,1024).toString(),!r&&o&&(r=/0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[j]=Object.create(null),e instanceof C){const t=e.raw(),n=Object.keys(t);for(const e of n)for(const n of t[e])this.append(e,n)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const n=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");n.push(Array.from(t))}for(const e of n){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const n=e[t];this.append(t,n)}}}}get(e){T(e=""+e);const t=A(this[j],e);return void 0===t?null:this[j][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=P(this),r=0;for(;r1&&void 0!==arguments[1]?arguments[1]:"key+value";const n=Object.keys(e[j]).sort();return n.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[j][t].join(", ")}:function(t){return[t.toLowerCase(),e[j][t].join(", ")]})}C.prototype.entries=C.prototype[Symbol.iterator],Object.defineProperty(C.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(C.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const k=Symbol("internal");function R(e,t){const n=Object.create(I);return n[k]={target:e,kind:t,index:0},n}const I=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==I)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[k];const t=e.target,n=e.kind,r=e.index,o=P(t,n);return r>=o.length?{value:void 0,done:!0}:(this[k].index=r+1,{value:o[r],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function N(e){const t=Object.assign({__proto__:null},e[j]),n=A(e[j],"Host");return void 0!==n&&(t[n]=t[n][0]),t}Object.defineProperty(I,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const B=Symbol("Response internals"),D=o.STATUS_CODES;class L{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y.call(this,e,t);const n=t.status||200,r=new C(t.headers);if(null!=e&&!r.has("Content-Type")){const t=x(e);t&&r.append("Content-Type",t)}this[B]={url:t.url,status:n,statusText:t.statusText||D[n],headers:r,counter:t.counter}}get url(){return this[B].url||""}get status(){return this[B].status}get ok(){return this[B].status>=200&&this[B].status<300}get redirected(){return this[B].counter>0}get statusText(){return this[B].statusText}get headers(){return this[B].headers}clone(){return new L(g(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}y.mixIn(L.prototype),Object.defineProperties(L.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(L.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const q=Symbol("Request internals"),F=i.parse,U=i.format,M="destroy"in r.Readable.prototype;function H(e){return"object"==typeof e&&"object"==typeof e[q]}class J{constructor(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};H(e)?t=F(e.url):(t=e&&e.href?F(e.href):F(""+e),e={});let r=n.method||e.method||"GET";if(r=r.toUpperCase(),(null!=n.body||H(e)&&null!==e.body)&&("GET"===r||"HEAD"===r))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=n.body?n.body:H(e)&&null!==e.body?g(e):null;y.call(this,o,{timeout:n.timeout||e.timeout||0,size:n.size||e.size||0});const i=new C(n.headers||e.headers||{});if(null!=o&&!i.has("Content-Type")){const e=x(o);e&&i.append("Content-Type",e)}let a=H(e)?e.signal:null;if("signal"in n&&(a=n.signal),null!=a&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(a))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[q]={method:r,redirect:n.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:a},this.follow=void 0!==n.follow?n.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==n.compress?n.compress:void 0===e.compress||e.compress,this.counter=n.counter||e.counter||0,this.agent=n.agent||e.agent}get method(){return this[q].method}get url(){return U(this[q].parsedURL)}get headers(){return this[q].headers}get redirect(){return this[q].redirect}get signal(){return this[q].signal}clone(){return new J(this)}}function z(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}y.mixIn(J.prototype),Object.defineProperty(J.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(J.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),z.prototype=Object.create(Error.prototype),z.prototype.constructor=z,z.prototype.name="AbortError";const V=r.PassThrough,G=i.resolve;function $(e,t){if(!$.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return y.Promise=$.Promise,new $.Promise((function(n,i){const u=new J(e,t),c=function(e){const t=e[q].parsedURL,n=new C(e[q].headers);if(n.has("Accept")||n.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof r.Readable&&!M)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=_(e);"number"==typeof t&&(o=String(t))}o&&n.set("Content-Length",o),n.has("User-Agent")||n.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!n.has("Accept-Encoding")&&n.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),n.has("Connection")||i||n.set("Connection","close"),Object.assign({},t,{method:e.method,headers:N(n),agent:i})}(u),l=("https:"===c.protocol?a:o).request,f=u.signal;let d=null;const h=function(){let e=new z("The user aborted a request.");i(e),u.body&&u.body instanceof r.Readable&&u.body.destroy(e),d&&d.body&&d.body.emit("error",e)};if(f&&f.aborted)return void h();const m=function(){h(),w()},y=l(c);let b;function w(){y.abort(),f&&f.removeEventListener("abort",m),clearTimeout(b)}f&&f.addEventListener("abort",m),u.timeout&&y.once("socket",(function(e){b=setTimeout((function(){i(new p("network timeout at: "+u.url,"request-timeout")),w()}),u.timeout)})),y.on("error",(function(e){i(new p(`request to ${u.url} failed, reason: ${e.message}`,"system",e)),w()})),y.on("response",(function(e){clearTimeout(b);const t=function(e){const t=new C;for(const n of Object.keys(e))if(!S.test(n))if(Array.isArray(e[n]))for(const r of e[n])E.test(r)||(void 0===t[j][n]?t[j][n]=[r]:t[j][n].push(r));else E.test(e[n])||(t[j][n]=[e[n]]);return t}(e.headers);if($.isRedirect(e.statusCode)){const r=t.get("Location"),o=null===r?null:G(u.url,r);switch(u.redirect){case"error":return i(new p("uri requested responds with a redirect, redirect mode is set to error: "+u.url,"no-redirect")),void w();case"manual":if(null!==o)try{t.set("Location",o)}catch(e){i(e)}break;case"follow":if(null===o)break;if(u.counter>=u.follow)return i(new p("maximum redirect reached at: "+u.url,"max-redirect")),void w();const r={headers:new C(u.headers),follow:u.follow,counter:u.counter+1,agent:u.agent,compress:u.compress,method:u.method,body:u.body,signal:u.signal,timeout:u.timeout,size:u.size};return 303!==e.statusCode&&u.body&&null===_(u)?(i(new p("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void w()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==u.method)||(r.method="GET",r.body=void 0,r.headers.delete("content-length")),n($(new J(o,r))),void w())}}e.once("end",(function(){f&&f.removeEventListener("abort",m)}));let r=e.pipe(new V);const o={url:u.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:u.size,timeout:u.timeout,counter:u.counter},a=t.get("Content-Encoding");if(!u.compress||"HEAD"===u.method||null===a||204===e.statusCode||304===e.statusCode)return d=new L(r,o),void n(d);const c={flush:s.Z_SYNC_FLUSH,finishFlush:s.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return r=r.pipe(s.createGunzip(c)),d=new L(r,o),void n(d);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof s.createBrotliDecompress)return r=r.pipe(s.createBrotliDecompress()),d=new L(r,o),void n(d);d=new L(r,o),n(d)}else{e.pipe(new V).once("data",(function(e){r=8==(15&e[0])?r.pipe(s.createInflate()):r.pipe(s.createInflateRaw()),d=new L(r,o),n(d)}))}})),function(e,t){const n=t.body;null===n?e.end():v(n)?n.stream().pipe(e):Buffer.isBuffer(n)?(e.write(n),e.end()):n.pipe(e)}(y,u)}))}$.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},$.Promise=global.Promise,t.default=$},function(e,t){e.exports=require("os")},function(e,t,n){"use strict";n(20);var r=n(9),o=n(3),i=n(11),a=n(18),s=n(4),u=n(1),c=["start","error","version","history_rewrite"],l=c.concat(["snapshot"]);function f(e,t,n,r){n=u.applyDefaults(n,{fields:null}),this._client=e,this._onEvent=r,this._query=s.wrap(t),this._urlParams=n.fields?{fields:n.fields.join(",")}:null,this._abort=new AbortController,this._state="idle"}function p(e){this._allowedEvents=e,this._listeners={}}function d(e,t){this._client=e,this._dispatcher=t}f.prototype.snapshot=function(){var e=this;e._client.query(s.Get(e._query)).then((function(t){e._onEvent({type:"snapshot",event:t})})).catch((function(t){e._onEvent({type:"error",event:t})}))},f.prototype.subscribe=function(){var e=this;if("idle"!==e._state)throw new Error("Subscription#start should not be called several times, consider instantiating a new stream instead.");e._state="open";var t=JSON.stringify(e._query),n=Date.now(),s="";function u(t){t instanceof a.AbortError||e._onEvent({type:"error",event:t})}e._client._http.execute({method:"POST",path:"stream",body:t,query:e._urlParams,signal:this._abort.signal,streamConsumer:{onError:u,onData:function(t){var n=i.parseJSONStreaming(s+t);s=n.buffer,n.values.forEach((function(t){void 0!==t.txn&&e._client.syncLastTxnTime(t.txn),"error"===t.event?u(new o.StreamErrorEvent(t)):e._onEvent(t)}))}}}).then((function(o){var a,s=Date.now();try{a=i.parseJSON(o.body)}catch(e){a=o.body}var u=new r("POST","stream",e._urlParams,t,e._query,o.body,a,o.status,o.headers,n,s);e._client._handleRequestResult(o,u)})).catch(u)},f.prototype.close=function(){"closed"!==this._state&&(this._state="closed",this._abort.abort())},p.prototype.on=function(e,t){if(-1===this._allowedEvents.indexOf(e))throw new Error("Unknown event type: "+e);void 0===this._listeners[e]&&(this._listeners[e]=[]),this._listeners[e].push(t)},p.prototype.dispatch=function(e){var t=this._listeners[e.type];if(t)for(var n=0;ne.event.ts&&i.dispatch(n)}o=!1,r=null}(e);break;case"error":i.dispatch(e);break;default:o?r.push(e):i.dispatch(e)}}));return new d(a,i)},t}}},function(e,t,n){"use strict";var r=n(11);function o(e){var t=e.query,n=e.method,r=e.path,o=e.requestContent,a=e.responseHeaders,s=e.responseContent,u=e.statusCode,c=e.timeTaken,l="";function f(e){l+=e}return f("Fauna "+n+" /"+r+function(e){if(null==e)return"";var t=Object.keys(e);if(0===t.length)return"";return"?"+t.map((function(t){return t+"="+e[t]})).join("&")}(t)+"\n"),null!=o&&f(" Request JSON: "+i(o)+"\n"),f(" Response headers: "+i(a)+"\n"),f(" Response JSON: "+i(s)+"\n"),f(" Response ("+u+"): Network latency "+c+"ms\n"),l}function i(e){return r.toJSON(e,!0).split("\n").join("\n ")}e.exports={logger:function(e){return function(t,n){return e(o(t),n)}},showRequestResult:o}}])); \ No newline at end of file diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index 3b99077..0000000 --- a/netlify.toml +++ /dev/null @@ -1,5 +0,0 @@ -# example netlify.toml -[build] -command = "npm run build && npm run export" -functions = "lambda-build" -publish = "out" diff --git a/package.json b/package.json index 7d4b540..1b8fef4 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,9 @@ { "name": "create-next-example-app", "scripts": { - "dev": "next", - "build": "npm-run-all --parallel build:**", - "build:app": "next build", - "build:functions": "netlify-lambda build lambda", - "start": "npm-run-all --parallel start:app start:server", - "start:app": "PORT=3000 node server.js", - "start:server": "netlify-lambda serve lambda", - "export": "next export" + "dev": "next dev", + "build": "next build", + "start": "next start" }, "dependencies": { "@cosmjs/launchpad": "^0.23.2", @@ -22,19 +17,5 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "uuid": "^8.3.0" - }, - "devDependencies": { - "express": "^4.17.1", - "http-proxy-middleware": "^1.0.6", - "netlify-lambda": "^2.0.3", - "npm-run-all": "^4.1.5" - }, - "proxy": { - "/.netlify/functions": { - "target": "http://localhost:9000", - "pathRewrite": { - "^/\\.netlify/functions": "" - } - } } } diff --git a/pages/api/multisig/index.js b/pages/api/multisig/index.js new file mode 100644 index 0000000..2a07acc --- /dev/null +++ b/pages/api/multisig/index.js @@ -0,0 +1,34 @@ +import faunadb from "faunadb"; + +export default async function (req, res) { + return new Promise(async (resolve) => { + switch (req.method) { + case "POST": + const q = faunadb.query; + const client = new faunadb.Client({ + secret: process.env.FAUNADB_SECRET, + }); + console.log(req.body); + try { + const data = req.body; + console.log("Function `createMultisig` invoked", data); + const multisig = { + data: data, + }; + const faunaRes = await client.query( + q.Create(q.Collection("Multisig"), multisig) + ); + console.log("success", faunaRes); + res.status(200).send(faunaRes); + return resolve(); + } catch (err) { + console.log(err); + res.status(400).send(err.message); + return resolve(); + } + } + // no route matched + res.status(405).end(); + return resolve(); + }); +} diff --git a/server.js b/server.js deleted file mode 100644 index afccf02..0000000 --- a/server.js +++ /dev/null @@ -1,50 +0,0 @@ -// server.js -/* eslint-disable no-console */ -const express = require("express"); -const next = require("next"); - -const devProxy = { - "/.netlify": { - target: "http://localhost:9000", - pathRewrite: { "^/.netlify/functions": "" }, - }, -}; - -const port = parseInt(process.env.PORT, 10) || 3000; -const env = process.env.NODE_ENV; -const dev = env !== "production"; -const app = next({ - dir: ".", // base directory where everything is, could move to src later - dev, -}); - -const handle = app.getRequestHandler(); - -let server; -app - .prepare() - .then(() => { - server = express(); - - // Set up the proxy. - if (dev && devProxy) { - const { createProxyMiddleware } = require("http-proxy-middleware"); - Object.keys(devProxy).forEach(function (context) { - server.use(createProxyMiddleware(context, devProxy[context])); - }); - } - - // Default catch-all handler to allow Next.js to handle all other routes - server.all("*", (req, res) => handle(req, res)); - - server.listen(port, (err) => { - if (err) { - throw err; - } - console.log(`> Ready on port ${port}`); - }); - }) - .catch((err) => { - console.log("An error occurred, unable to start the server"); - console.log(err); - });