@libp2p/record 3.0.3 → 3.0.4-3dfc236e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.min.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/validators.d.ts.map +1 -1
- package/dist/src/validators.js +1 -1
- package/dist/src/validators.js.map +1 -1
- package/package.json +15 -103
- package/src/index.ts +1 -1
- package/src/validators.ts +2 -2
- package/dist/typedoc-urls.json +0 -11
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://libp2p.io/)
|
|
4
4
|
[](https://discuss.libp2p.io)
|
|
5
|
-
[](https://codecov.io/gh/libp2p/js-libp2p)
|
|
6
|
+
[](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster)
|
|
7
7
|
|
|
8
8
|
> libp2p record implementation
|
|
9
9
|
|
|
@@ -36,7 +36,7 @@ Implementation of [go-libp2p-record](https://github.com/libp2p/go-libp2p-record)
|
|
|
36
36
|
|
|
37
37
|
## API Docs
|
|
38
38
|
|
|
39
|
-
- <https://libp2p.github.io/js-libp2p
|
|
39
|
+
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_record.html>
|
|
40
40
|
|
|
41
41
|
## License
|
|
42
42
|
|
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PRecord = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PRecord=(()=>{var Yt=Object.create;var R=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var g=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ie=(r,t)=>{for(var e in t)R(r,e,{get:t[e],enumerable:!0})},st=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ee(t))!ne.call(r,i)&&i!==e&&R(r,i,{get:()=>t[i],enumerable:!(n=te(t,i))||n.enumerable});return r};var D=(r,t,e)=>(e=r!=null?Yt(re(r)):{},st(t||!r||!r.__esModule?R(e,"default",{value:r,enumerable:!0}):e,r)),oe=r=>st(R({},"__esModule",{value:!0}),r);var at=g((Be,ut)=>{"use strict";ut.exports=se;function se(r,t){for(var e=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)e[n++]=arguments[i++];return new Promise(function(f,o){e[n]=function(c){if(s)if(s=!1,c)o(c);else{for(var y=new Array(arguments.length-1),A=0;A<y.length;)y[A++]=arguments[A];f.apply(null,y)}};try{r.apply(t||null,e)}catch(u){s&&(s=!1,o(u))}})}});var lt=g(ct=>{"use strict";var z=ct;z.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var L=new Array(64),ht=new Array(123);for(w=0;w<64;)ht[L[w]=w<26?w+65:w<52?w+71:w<62?w-4:w-59|43]=w++;var w;z.encode=function(t,e,n){for(var i=null,s=[],a=0,f=0,o;e<n;){var u=t[e++];switch(f){case 0:s[a++]=L[u>>2],o=(u&3)<<4,f=1;break;case 1:s[a++]=L[o|u>>4],o=(u&15)<<2,f=2;break;case 2:s[a++]=L[o|u>>6],s[a++]=L[u&63],f=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return f&&(s[a++]=L[o],s[a++]=61,f===1&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var ft="invalid encoding";z.decode=function(t,e,n){for(var i=n,s=0,a,f=0;f<t.length;){var o=t.charCodeAt(f++);if(o===61&&s>1)break;if((o=ht[o])===void 0)throw Error(ft);switch(s){case 0:a=o,s=1;break;case 1:e[n++]=a<<2|(o&48)>>4,a=o,s=2;break;case 2:e[n++]=(a&15)<<4|(o&60)>>2,a=o,s=3;break;case 3:e[n++]=(a&3)<<6|o,s=0;break}}if(s===1)throw Error(ft);return n-i};z.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var dt=g((be,pt)=>{"use strict";pt.exports=U;function U(){this._listeners={}}U.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};U.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this};U.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this}});var xt=g((ve,Bt)=>{"use strict";Bt.exports=gt(gt);function gt(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function i(o,u,c){t[0]=o,u[c]=e[0],u[c+1]=e[1],u[c+2]=e[2],u[c+3]=e[3]}function s(o,u,c){t[0]=o,u[c]=e[3],u[c+1]=e[2],u[c+2]=e[1],u[c+3]=e[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function a(o,u){return e[0]=o[u],e[1]=o[u+1],e[2]=o[u+2],e[3]=o[u+3],t[0]}function f(o,u){return e[3]=o[u],e[2]=o[u+1],e[1]=o[u+2],e[0]=o[u+3],t[0]}r.readFloatLE=n?a:f,r.readFloatBE=n?f:a}():function(){function t(n,i,s,a){var f=i<0?1:0;if(f&&(i=-i),i===0)n(1/i>0?0:2147483648,s,a);else if(isNaN(i))n(2143289344,s,a);else if(i>34028234663852886e22)n((f<<31|2139095040)>>>0,s,a);else if(i<11754943508222875e-54)n((f<<31|Math.round(i/1401298464324817e-60))>>>0,s,a);else{var o=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-o)*8388608)&8388607;n((f<<31|o+127<<23|u)>>>0,s,a)}}r.writeFloatLE=t.bind(null,yt),r.writeFloatBE=t.bind(null,mt);function e(n,i,s){var a=n(i,s),f=(a>>31)*2+1,o=a>>>23&255,u=a&8388607;return o===255?u?NaN:f*(1/0):o===0?f*1401298464324817e-60*u:f*Math.pow(2,o-150)*(u+8388608)}r.readFloatLE=e.bind(null,wt),r.readFloatBE=e.bind(null,_t)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function i(o,u,c){t[0]=o,u[c]=e[0],u[c+1]=e[1],u[c+2]=e[2],u[c+3]=e[3],u[c+4]=e[4],u[c+5]=e[5],u[c+6]=e[6],u[c+7]=e[7]}function s(o,u,c){t[0]=o,u[c]=e[7],u[c+1]=e[6],u[c+2]=e[5],u[c+3]=e[4],u[c+4]=e[3],u[c+5]=e[2],u[c+6]=e[1],u[c+7]=e[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function a(o,u){return e[0]=o[u],e[1]=o[u+1],e[2]=o[u+2],e[3]=o[u+3],e[4]=o[u+4],e[5]=o[u+5],e[6]=o[u+6],e[7]=o[u+7],t[0]}function f(o,u){return e[7]=o[u],e[6]=o[u+1],e[5]=o[u+2],e[4]=o[u+3],e[3]=o[u+4],e[2]=o[u+5],e[1]=o[u+6],e[0]=o[u+7],t[0]}r.readDoubleLE=n?a:f,r.readDoubleBE=n?f:a}():function(){function t(n,i,s,a,f,o){var u=a<0?1:0;if(u&&(a=-a),a===0)n(0,f,o+i),n(1/a>0?0:2147483648,f,o+s);else if(isNaN(a))n(0,f,o+i),n(2146959360,f,o+s);else if(a>17976931348623157e292)n(0,f,o+i),n((u<<31|2146435072)>>>0,f,o+s);else{var c;if(a<22250738585072014e-324)c=a/5e-324,n(c>>>0,f,o+i),n((u<<31|c/4294967296)>>>0,f,o+s);else{var y=Math.floor(Math.log(a)/Math.LN2);y===1024&&(y=1023),c=a*Math.pow(2,-y),n(c*4503599627370496>>>0,f,o+i),n((u<<31|y+1023<<20|c*1048576&1048575)>>>0,f,o+s)}}}r.writeDoubleLE=t.bind(null,yt,0,4),r.writeDoubleBE=t.bind(null,mt,4,0);function e(n,i,s,a,f){var o=n(a,f+i),u=n(a,f+s),c=(u>>31)*2+1,y=u>>>20&2047,A=4294967296*(u&1048575)+o;return y===2047?A?NaN:c*(1/0):y===0?c*5e-324*A:c*Math.pow(2,y-1075)*(A+4503599627370496)}r.readDoubleLE=e.bind(null,wt,0,4),r.readDoubleBE=e.bind(null,_t,4,0)}(),r}function yt(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function mt(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function wt(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function _t(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var bt=g((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var At=g(vt=>{"use strict";var q=vt;q.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,e+=4):e+=3;return e};q.read=function(t,e,n){var i=n-e;if(i<1)return"";for(var s=null,a=[],f=0,o;e<n;)o=t[e++],o<128?a[f++]=o:o>191&&o<224?a[f++]=(o&31)<<6|t[e++]&63:o>239&&o<365?(o=((o&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,a[f++]=55296+(o>>10),a[f++]=56320+(o&1023)):a[f++]=(o&15)<<12|(t[e++]&63)<<6|t[e++]&63,f>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),f=0);return s?(f&&s.push(String.fromCharCode.apply(String,a.slice(0,f))),s.join("")):String.fromCharCode.apply(String,a.slice(0,f))};q.write=function(t,e,n){for(var i=n,s,a,f=0;f<t.length;++f)s=t.charCodeAt(f),s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&((a=t.charCodeAt(f+1))&64512)===56320?(s=65536+((s&1023)<<10)+(a&1023),++f,e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128);return n-i}});var kt=g((Ee,Et)=>{"use strict";Et.exports=ue;function ue(r,t,e){var n=e||8192,i=n>>>1,s=null,a=n;return function(o){if(o<1||o>i)return r(o);a+o>n&&(s=r(n),a=0);var u=t.call(s,a,a+=o);return a&7&&(a=(a|7)+1),u}}});var Lt=g((ke,St)=>{"use strict";St.exports=d;var C=k();function d(r,t){this.lo=r>>>0,this.hi=t>>>0}var E=d.zero=new d(0,0);E.toNumber=function(){return 0};E.zzEncode=E.zzDecode=function(){return this};E.length=function(){return 1};var ae=d.zeroHash="\0\0\0\0\0\0\0\0";d.fromNumber=function(t){if(t===0)return E;var e=t<0;e&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new d(n,i)};d.from=function(t){if(typeof t=="number")return d.fromNumber(t);if(C.isString(t))if(C.Long)t=C.Long.fromString(t);else return d.fromNumber(parseInt(t,10));return t.low||t.high?new d(t.low>>>0,t.high>>>0):E};d.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};d.prototype.toLong=function(t){return C.Long?new C.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var b=String.prototype.charCodeAt;d.fromHash=function(t){return t===ae?E:new d((b.call(t,0)|b.call(t,1)<<8|b.call(t,2)<<16|b.call(t,3)<<24)>>>0,(b.call(t,4)|b.call(t,5)<<8|b.call(t,6)<<16|b.call(t,7)<<24)>>>0)};d.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};d.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};d.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};d.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}});var k=g(H=>{"use strict";var h=H;h.asPromise=at();h.base64=lt();h.EventEmitter=dt();h.float=xt();h.inquire=bt();h.utf8=At();h.pool=kt();h.LongBits=Lt();h.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);h.global=h.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||H;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};h.isString=function(t){return typeof t=="string"||t instanceof String};h.isObject=function(t){return t&&typeof t=="object"};h.isset=h.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};h.Buffer=function(){try{var r=h.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(t){return typeof t=="number"?h.Buffer?h._Buffer_allocUnsafe(t):new h.Array(t):h.Buffer?h._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(t){return t?h.LongBits.from(t).toHash():h.LongBits.zeroHash};h.longFromHash=function(t,e){var n=h.LongBits.fromHash(t);return h.Long?h.Long.fromBits(n.lo,n.hi,e):n.toNumber(!!e)};function Ft(r,t,e){for(var n=Object.keys(t),i=0;i<n.length;++i)(r[n[i]]===void 0||!e)&&(r[n[i]]=t[n[i]]);return r}h.merge=Ft;h.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Dt(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Ft(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}h.newError=Dt;h.ProtocolError=Dt("ProtocolError");h.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(e[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};h.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var r=h.Buffer;if(!r){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},h._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var V=g((Le,Rt)=>{"use strict";Rt.exports=p;var B=k(),W,Mt=B.LongBits,fe=B.utf8;function _(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function p(r){this.buf=r,this.pos=0,this.len=r.length}var Ct=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new p(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new p(t);throw Error("illegal buffer")},Nt=function(){return B.Buffer?function(e){return(p.create=function(i){return B.Buffer.isBuffer(i)?new W(i):Ct(i)})(e)}:Ct};p.create=Nt();p.prototype._slice=B.Array.prototype.subarray||B.Array.prototype.slice;p.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,_(this,10);return t}}();p.prototype.int32=function(){return this.uint32()|0};p.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function $(){var r=new Mt(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw _(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw _(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}p.prototype.bool=function(){return this.uint32()!==0};function O(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}p.prototype.fixed32=function(){if(this.pos+4>this.len)throw _(this,4);return O(this.buf,this.pos+=4)};p.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _(this,4);return O(this.buf,this.pos+=4)|0};function It(){if(this.pos+8>this.len)throw _(this,8);return new Mt(O(this.buf,this.pos+=4),O(this.buf,this.pos+=4))}p.prototype.float=function(){if(this.pos+4>this.len)throw _(this,4);var t=B.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};p.prototype.double=function(){if(this.pos+8>this.len)throw _(this,4);var t=B.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};p.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw _(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)};p.prototype.string=function(){var t=this.bytes();return fe.read(t,0,t.length)};p.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw _(this,t);this.pos+=t}else do if(this.pos>=this.len)throw _(this);while(this.buf[this.pos++]&128);return this};p.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};p._configure=function(r){W=r,p.create=Nt(),W._configure();var t=B.Long?"toLong":"toNumber";B.merge(p.prototype,{int64:function(){return $.call(this)[t](!1)},uint64:function(){return $.call(this)[t](!0)},sint64:function(){return $.call(this).zzDecode()[t](!1)},fixed64:function(){return It.call(this)[t](!0)},sfixed64:function(){return It.call(this)[t](!1)}})}});var Tt=g((Fe,Ot)=>{"use strict";Ot.exports=S;var Ut=V();(S.prototype=Object.create(Ut.prototype)).constructor=S;var zt=k();function S(r){Ut.call(this,r)}S._configure=function(){zt.Buffer&&(S.prototype._slice=zt.Buffer.prototype.slice)};S.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};S._configure()});var K=g((De,Wt)=>{"use strict";Wt.exports=l;var m=k(),G,T=m.LongBits,qt=m.base64,Ht=m.utf8;function I(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function Z(){}function he(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function l(){this.len=0,this.head=new I(Z,0,0),this.tail=this.head,this.states=null}var $t=function(){return m.Buffer?function(){return(l.create=function(){return new G})()}:function(){return new l}};l.create=$t();l.alloc=function(t){return new m.Array(t)};m.Array!==Array&&(l.alloc=m.pool(l.alloc,m.Array.prototype.subarray));l.prototype._push=function(t,e,n){return this.tail=this.tail.next=new I(t,e,n),this.len+=e,this};function P(r,t,e){t[e]=r&255}function ce(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function J(r,t){this.len=r,this.next=void 0,this.val=t}J.prototype=Object.create(I.prototype);J.prototype.fn=ce;l.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new J((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};l.prototype.int32=function(t){return t<0?this._push(X,10,T.fromNumber(t)):this.uint32(t)};l.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function X(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}l.prototype.uint64=function(t){var e=T.from(t);return this._push(X,e.length(),e)};l.prototype.int64=l.prototype.uint64;l.prototype.sint64=function(t){var e=T.from(t).zzEncode();return this._push(X,e.length(),e)};l.prototype.bool=function(t){return this._push(P,1,t?1:0)};function j(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}l.prototype.fixed32=function(t){return this._push(j,4,t>>>0)};l.prototype.sfixed32=l.prototype.fixed32;l.prototype.fixed64=function(t){var e=T.from(t);return this._push(j,4,e.lo)._push(j,4,e.hi)};l.prototype.sfixed64=l.prototype.fixed64;l.prototype.float=function(t){return this._push(m.float.writeFloatLE,4,t)};l.prototype.double=function(t){return this._push(m.float.writeDoubleLE,8,t)};var le=m.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};l.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(P,1,0);if(m.isString(t)){var n=l.alloc(e=qt.length(t));qt.decode(t,n,0),t=n}return this.uint32(e)._push(le,e,t)};l.prototype.string=function(t){var e=Ht.length(t);return e?this.uint32(e)._push(Ht.write,e,t):this._push(P,1,0)};l.prototype.fork=function(){return this.states=new he(this),this.head=this.tail=new I(Z,0,0),this.len=0,this};l.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new I(Z,0,0),this.len=0),this};l.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};l.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};l._configure=function(r){G=r,l.create=$t(),G._configure()}});var jt=g((Ce,Gt)=>{"use strict";Gt.exports=x;var Vt=K();(x.prototype=Object.create(Vt.prototype)).constructor=x;var v=k();function x(){Vt.call(this)}x._configure=function(){x.alloc=v._Buffer_allocUnsafe,x.writeBytesBuffer=v.Buffer&&v.Buffer.prototype instanceof Uint8Array&&v.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}};x.prototype.bytes=function(t){v.isString(t)&&(t=v._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(x.writeBytesBuffer,e,t),this};function pe(r,t,e){r.length<40?v.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}x.prototype.string=function(t){var e=v.Buffer.byteLength(t);return this.uint32(e),e&&this._push(pe,e,t),this};x._configure()});var we={};ie(we,{Libp2pRecord:()=>F});var Q=D(V(),1),Zt=D(Tt(),1),Pt=D(k(),1),Y=D(K(),1),Jt=D(jt(),1);function de(){Pt.default._configure(),Q.default._configure(Zt.default),Y.default._configure(Jt.default)}de();var Xt=["uint64","int64","sint64","fixed64","sfixed64"];function ge(r){for(let t of Xt){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function tt(r){return ge(new Q.default(r))}function ye(r){for(let t of Xt){if(r[t]==null)continue;let e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function et(){return ye(Y.default.create())}function rt(r,t){let e=tt(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function nt(r,t){let e=et();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var M;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(M||(M={}));function it(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function ot(r,t){return it("message",M.LENGTH_DELIMITED,r,t)}var N;(function(r){let t;r.codec=()=>(t==null&&(t=ot((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.key!=null&&e.key.byteLength>0&&(n.uint32(10),n.bytes(e.key)),e.value!=null&&e.value.byteLength>0&&(n.uint32(18),n.bytes(e.value)),e.timeReceived!=null&&e.timeReceived!==""&&(n.uint32(42),n.string(e.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={key:new Uint8Array(0),value:new Uint8Array(0),timeReceived:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.key=e.bytes();break;case 2:i.value=e.bytes();break;case 5:i.timeReceived=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>nt(e,r.codec()),r.decode=e=>rt(e,r.codec())})(N||(N={}));function Kt(r){let t=r.getUTCFullYear(),e=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0"),i=String(r.getUTCHours()).padStart(2,"0"),s=String(r.getUTCMinutes()).padStart(2,"0"),a=String(r.getUTCSeconds()).padStart(2,"0"),f=r.getUTCMilliseconds(),o=String(f*1e3*1e3).padStart(9,"0");return`${t}-${e}-${n}T${i}:${s}:${a}.${o}Z`}function Qt(r){let t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),e=String(r).trim().match(t);if(e==null)throw new Error("Invalid format");let n=parseInt(e[1],10),i=parseInt(e[2],10)-1,s=parseInt(e[3],10),a=parseInt(e[4],10),f=parseInt(e[5],10),o=parseInt(e[6],10),u=parseInt(e[7].slice(0,-6),10);return new Date(Date.UTC(n,i,s,a,f,o,u))}var F=class{constructor(t,e,n){if(!(t instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(e instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=t,this.value=e,this.timeReceived=n}serialize(){return N.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:Kt(this.timeReceived)}}static deserialize(t){let e=N.decode(t);return new F(e.key,e.value,new Date(e.timeReceived))}static fromDeserialized(t){let e=Qt(t.timeReceived);if(t.key==null)throw new Error("key missing from deserialized object");if(t.value==null)throw new Error("value missing from deserialized object");return new F(t.key,t.value,e)}};return oe(we);})();
|
|
2
|
+
"use strict";var Libp2PRecord=(()=>{var Yt=Object.create;var N=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var g=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ie=(r,t)=>{for(var e in t)N(r,e,{get:t[e],enumerable:!0})},st=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ee(t))!ne.call(r,i)&&i!==e&&N(r,i,{get:()=>t[i],enumerable:!(n=te(t,i))||n.enumerable});return r};var D=(r,t,e)=>(e=r!=null?Yt(re(r)):{},st(t||!r||!r.__esModule?N(e,"default",{value:r,enumerable:!0}):e,r)),oe=r=>st(N({},"__esModule",{value:!0}),r);var at=g((Be,ut)=>{"use strict";ut.exports=se;function se(r,t){for(var e=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)e[n++]=arguments[i++];return new Promise(function(f,o){e[n]=function(c){if(s)if(s=!1,c)o(c);else{for(var y=new Array(arguments.length-1),A=0;A<y.length;)y[A++]=arguments[A];f.apply(null,y)}};try{r.apply(t||null,e)}catch(u){s&&(s=!1,o(u))}})}});var lt=g(ct=>{"use strict";var z=ct;z.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var L=new Array(64),ht=new Array(123);for(w=0;w<64;)ht[L[w]=w<26?w+65:w<52?w+71:w<62?w-4:w-59|43]=w++;var w;z.encode=function(t,e,n){for(var i=null,s=[],a=0,f=0,o;e<n;){var u=t[e++];switch(f){case 0:s[a++]=L[u>>2],o=(u&3)<<4,f=1;break;case 1:s[a++]=L[o|u>>4],o=(u&15)<<2,f=2;break;case 2:s[a++]=L[o|u>>6],s[a++]=L[u&63],f=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return f&&(s[a++]=L[o],s[a++]=61,f===1&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var ft="invalid encoding";z.decode=function(t,e,n){for(var i=n,s=0,a,f=0;f<t.length;){var o=t.charCodeAt(f++);if(o===61&&s>1)break;if((o=ht[o])===void 0)throw Error(ft);switch(s){case 0:a=o,s=1;break;case 1:e[n++]=a<<2|(o&48)>>4,a=o,s=2;break;case 2:e[n++]=(a&15)<<4|(o&60)>>2,a=o,s=3;break;case 3:e[n++]=(a&3)<<6|o,s=0;break}}if(s===1)throw Error(ft);return n-i};z.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var dt=g((xe,pt)=>{"use strict";pt.exports=U;function U(){this._listeners={}}U.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};U.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this};U.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this}});var vt=g((be,Bt)=>{"use strict";Bt.exports=gt(gt);function gt(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function i(o,u,c){t[0]=o,u[c]=e[0],u[c+1]=e[1],u[c+2]=e[2],u[c+3]=e[3]}function s(o,u,c){t[0]=o,u[c]=e[3],u[c+1]=e[2],u[c+2]=e[1],u[c+3]=e[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function a(o,u){return e[0]=o[u],e[1]=o[u+1],e[2]=o[u+2],e[3]=o[u+3],t[0]}function f(o,u){return e[3]=o[u],e[2]=o[u+1],e[1]=o[u+2],e[0]=o[u+3],t[0]}r.readFloatLE=n?a:f,r.readFloatBE=n?f:a}():function(){function t(n,i,s,a){var f=i<0?1:0;if(f&&(i=-i),i===0)n(1/i>0?0:2147483648,s,a);else if(isNaN(i))n(2143289344,s,a);else if(i>34028234663852886e22)n((f<<31|2139095040)>>>0,s,a);else if(i<11754943508222875e-54)n((f<<31|Math.round(i/1401298464324817e-60))>>>0,s,a);else{var o=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-o)*8388608)&8388607;n((f<<31|o+127<<23|u)>>>0,s,a)}}r.writeFloatLE=t.bind(null,yt),r.writeFloatBE=t.bind(null,mt);function e(n,i,s){var a=n(i,s),f=(a>>31)*2+1,o=a>>>23&255,u=a&8388607;return o===255?u?NaN:f*(1/0):o===0?f*1401298464324817e-60*u:f*Math.pow(2,o-150)*(u+8388608)}r.readFloatLE=e.bind(null,wt),r.readFloatBE=e.bind(null,_t)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function i(o,u,c){t[0]=o,u[c]=e[0],u[c+1]=e[1],u[c+2]=e[2],u[c+3]=e[3],u[c+4]=e[4],u[c+5]=e[5],u[c+6]=e[6],u[c+7]=e[7]}function s(o,u,c){t[0]=o,u[c]=e[7],u[c+1]=e[6],u[c+2]=e[5],u[c+3]=e[4],u[c+4]=e[3],u[c+5]=e[2],u[c+6]=e[1],u[c+7]=e[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function a(o,u){return e[0]=o[u],e[1]=o[u+1],e[2]=o[u+2],e[3]=o[u+3],e[4]=o[u+4],e[5]=o[u+5],e[6]=o[u+6],e[7]=o[u+7],t[0]}function f(o,u){return e[7]=o[u],e[6]=o[u+1],e[5]=o[u+2],e[4]=o[u+3],e[3]=o[u+4],e[2]=o[u+5],e[1]=o[u+6],e[0]=o[u+7],t[0]}r.readDoubleLE=n?a:f,r.readDoubleBE=n?f:a}():function(){function t(n,i,s,a,f,o){var u=a<0?1:0;if(u&&(a=-a),a===0)n(0,f,o+i),n(1/a>0?0:2147483648,f,o+s);else if(isNaN(a))n(0,f,o+i),n(2146959360,f,o+s);else if(a>17976931348623157e292)n(0,f,o+i),n((u<<31|2146435072)>>>0,f,o+s);else{var c;if(a<22250738585072014e-324)c=a/5e-324,n(c>>>0,f,o+i),n((u<<31|c/4294967296)>>>0,f,o+s);else{var y=Math.floor(Math.log(a)/Math.LN2);y===1024&&(y=1023),c=a*Math.pow(2,-y),n(c*4503599627370496>>>0,f,o+i),n((u<<31|y+1023<<20|c*1048576&1048575)>>>0,f,o+s)}}}r.writeDoubleLE=t.bind(null,yt,0,4),r.writeDoubleBE=t.bind(null,mt,4,0);function e(n,i,s,a,f){var o=n(a,f+i),u=n(a,f+s),c=(u>>31)*2+1,y=u>>>20&2047,A=4294967296*(u&1048575)+o;return y===2047?A?NaN:c*(1/0):y===0?c*5e-324*A:c*Math.pow(2,y-1075)*(A+4503599627370496)}r.readDoubleLE=e.bind(null,wt,0,4),r.readDoubleBE=e.bind(null,_t,4,0)}(),r}function yt(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function mt(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function wt(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function _t(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var xt=g((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var At=g(bt=>{"use strict";var q=bt;q.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,e+=4):e+=3;return e};q.read=function(t,e,n){var i=n-e;if(i<1)return"";for(var s=null,a=[],f=0,o;e<n;)o=t[e++],o<128?a[f++]=o:o>191&&o<224?a[f++]=(o&31)<<6|t[e++]&63:o>239&&o<365?(o=((o&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,a[f++]=55296+(o>>10),a[f++]=56320+(o&1023)):a[f++]=(o&15)<<12|(t[e++]&63)<<6|t[e++]&63,f>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),f=0);return s?(f&&s.push(String.fromCharCode.apply(String,a.slice(0,f))),s.join("")):String.fromCharCode.apply(String,a.slice(0,f))};q.write=function(t,e,n){for(var i=n,s,a,f=0;f<t.length;++f)s=t.charCodeAt(f),s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&((a=t.charCodeAt(f+1))&64512)===56320?(s=65536+((s&1023)<<10)+(a&1023),++f,e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128);return n-i}});var kt=g((Ee,Et)=>{"use strict";Et.exports=ue;function ue(r,t,e){var n=e||8192,i=n>>>1,s=null,a=n;return function(o){if(o<1||o>i)return r(o);a+o>n&&(s=r(n),a=0);var u=t.call(s,a,a+=o);return a&7&&(a=(a|7)+1),u}}});var Lt=g((ke,St)=>{"use strict";St.exports=d;var C=k();function d(r,t){this.lo=r>>>0,this.hi=t>>>0}var E=d.zero=new d(0,0);E.toNumber=function(){return 0};E.zzEncode=E.zzDecode=function(){return this};E.length=function(){return 1};var ae=d.zeroHash="\0\0\0\0\0\0\0\0";d.fromNumber=function(t){if(t===0)return E;var e=t<0;e&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new d(n,i)};d.from=function(t){if(typeof t=="number")return d.fromNumber(t);if(C.isString(t))if(C.Long)t=C.Long.fromString(t);else return d.fromNumber(parseInt(t,10));return t.low||t.high?new d(t.low>>>0,t.high>>>0):E};d.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};d.prototype.toLong=function(t){return C.Long?new C.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var x=String.prototype.charCodeAt;d.fromHash=function(t){return t===ae?E:new d((x.call(t,0)|x.call(t,1)<<8|x.call(t,2)<<16|x.call(t,3)<<24)>>>0,(x.call(t,4)|x.call(t,5)<<8|x.call(t,6)<<16|x.call(t,7)<<24)>>>0)};d.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};d.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};d.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};d.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}});var k=g(H=>{"use strict";var h=H;h.asPromise=at();h.base64=lt();h.EventEmitter=dt();h.float=vt();h.inquire=xt();h.utf8=At();h.pool=kt();h.LongBits=Lt();h.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);h.global=h.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||H;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};h.isString=function(t){return typeof t=="string"||t instanceof String};h.isObject=function(t){return t&&typeof t=="object"};h.isset=h.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};h.Buffer=function(){try{var r=h.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(t){return typeof t=="number"?h.Buffer?h._Buffer_allocUnsafe(t):new h.Array(t):h.Buffer?h._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(t){return t?h.LongBits.from(t).toHash():h.LongBits.zeroHash};h.longFromHash=function(t,e){var n=h.LongBits.fromHash(t);return h.Long?h.Long.fromBits(n.lo,n.hi,e):n.toNumber(!!e)};function Ft(r,t,e){for(var n=Object.keys(t),i=0;i<n.length;++i)(r[n[i]]===void 0||!e)&&(r[n[i]]=t[n[i]]);return r}h.merge=Ft;h.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Dt(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Ft(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}h.newError=Dt;h.ProtocolError=Dt("ProtocolError");h.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(e[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};h.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var r=h.Buffer;if(!r){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},h._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var V=g((Le,Nt)=>{"use strict";Nt.exports=p;var B=k(),W,Rt=B.LongBits,fe=B.utf8;function _(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function p(r){this.buf=r,this.pos=0,this.len=r.length}var Ct=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new p(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new p(t);throw Error("illegal buffer")},Mt=function(){return B.Buffer?function(e){return(p.create=function(i){return B.Buffer.isBuffer(i)?new W(i):Ct(i)})(e)}:Ct};p.create=Mt();p.prototype._slice=B.Array.prototype.subarray||B.Array.prototype.slice;p.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,_(this,10);return t}}();p.prototype.int32=function(){return this.uint32()|0};p.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function $(){var r=new Rt(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw _(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw _(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}p.prototype.bool=function(){return this.uint32()!==0};function O(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}p.prototype.fixed32=function(){if(this.pos+4>this.len)throw _(this,4);return O(this.buf,this.pos+=4)};p.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _(this,4);return O(this.buf,this.pos+=4)|0};function It(){if(this.pos+8>this.len)throw _(this,8);return new Rt(O(this.buf,this.pos+=4),O(this.buf,this.pos+=4))}p.prototype.float=function(){if(this.pos+4>this.len)throw _(this,4);var t=B.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};p.prototype.double=function(){if(this.pos+8>this.len)throw _(this,4);var t=B.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};p.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw _(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)};p.prototype.string=function(){var t=this.bytes();return fe.read(t,0,t.length)};p.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw _(this,t);this.pos+=t}else do if(this.pos>=this.len)throw _(this);while(this.buf[this.pos++]&128);return this};p.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};p._configure=function(r){W=r,p.create=Mt(),W._configure();var t=B.Long?"toLong":"toNumber";B.merge(p.prototype,{int64:function(){return $.call(this)[t](!1)},uint64:function(){return $.call(this)[t](!0)},sint64:function(){return $.call(this).zzDecode()[t](!1)},fixed64:function(){return It.call(this)[t](!0)},sfixed64:function(){return It.call(this)[t](!1)}})}});var Tt=g((Fe,Ot)=>{"use strict";Ot.exports=S;var Ut=V();(S.prototype=Object.create(Ut.prototype)).constructor=S;var zt=k();function S(r){Ut.call(this,r)}S._configure=function(){zt.Buffer&&(S.prototype._slice=zt.Buffer.prototype.slice)};S.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};S._configure()});var K=g((De,Wt)=>{"use strict";Wt.exports=l;var m=k(),G,T=m.LongBits,qt=m.base64,Ht=m.utf8;function I(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function Z(){}function he(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function l(){this.len=0,this.head=new I(Z,0,0),this.tail=this.head,this.states=null}var $t=function(){return m.Buffer?function(){return(l.create=function(){return new G})()}:function(){return new l}};l.create=$t();l.alloc=function(t){return new m.Array(t)};m.Array!==Array&&(l.alloc=m.pool(l.alloc,m.Array.prototype.subarray));l.prototype._push=function(t,e,n){return this.tail=this.tail.next=new I(t,e,n),this.len+=e,this};function P(r,t,e){t[e]=r&255}function ce(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function J(r,t){this.len=r,this.next=void 0,this.val=t}J.prototype=Object.create(I.prototype);J.prototype.fn=ce;l.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new J((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};l.prototype.int32=function(t){return t<0?this._push(X,10,T.fromNumber(t)):this.uint32(t)};l.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function X(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}l.prototype.uint64=function(t){var e=T.from(t);return this._push(X,e.length(),e)};l.prototype.int64=l.prototype.uint64;l.prototype.sint64=function(t){var e=T.from(t).zzEncode();return this._push(X,e.length(),e)};l.prototype.bool=function(t){return this._push(P,1,t?1:0)};function j(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}l.prototype.fixed32=function(t){return this._push(j,4,t>>>0)};l.prototype.sfixed32=l.prototype.fixed32;l.prototype.fixed64=function(t){var e=T.from(t);return this._push(j,4,e.lo)._push(j,4,e.hi)};l.prototype.sfixed64=l.prototype.fixed64;l.prototype.float=function(t){return this._push(m.float.writeFloatLE,4,t)};l.prototype.double=function(t){return this._push(m.float.writeDoubleLE,8,t)};var le=m.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};l.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(P,1,0);if(m.isString(t)){var n=l.alloc(e=qt.length(t));qt.decode(t,n,0),t=n}return this.uint32(e)._push(le,e,t)};l.prototype.string=function(t){var e=Ht.length(t);return e?this.uint32(e)._push(Ht.write,e,t):this._push(P,1,0)};l.prototype.fork=function(){return this.states=new he(this),this.head=this.tail=new I(Z,0,0),this.len=0,this};l.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new I(Z,0,0),this.len=0),this};l.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};l.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};l._configure=function(r){G=r,l.create=$t(),G._configure()}});var jt=g((Ce,Gt)=>{"use strict";Gt.exports=v;var Vt=K();(v.prototype=Object.create(Vt.prototype)).constructor=v;var b=k();function v(){Vt.call(this)}v._configure=function(){v.alloc=b._Buffer_allocUnsafe,v.writeBytesBuffer=b.Buffer&&b.Buffer.prototype instanceof Uint8Array&&b.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}};v.prototype.bytes=function(t){b.isString(t)&&(t=b._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(v.writeBytesBuffer,e,t),this};function pe(r,t,e){r.length<40?b.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}v.prototype.string=function(t){var e=b.Buffer.byteLength(t);return this.uint32(e),e&&this._push(pe,e,t),this};v._configure()});var we={};ie(we,{Libp2pRecord:()=>F});var Q=D(V(),1),Zt=D(Tt(),1),Pt=D(k(),1),Y=D(K(),1),Jt=D(jt(),1);function de(){Pt.default._configure(),Q.default._configure(Zt.default),Y.default._configure(Jt.default)}de();var Xt=["uint64","int64","sint64","fixed64","sfixed64"];function ge(r){for(let t of Xt){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function tt(r){return ge(new Q.default(r))}function ye(r){for(let t of Xt){if(r[t]==null)continue;let e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function et(){return ye(Y.default.create())}function rt(r,t){let e=tt(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function nt(r,t){let e=et();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var R;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(R||(R={}));function it(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function ot(r,t){return it("message",R.LENGTH_DELIMITED,r,t)}var M;(function(r){let t;r.codec=()=>(t==null&&(t=ot((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.key!=null&&e.key.byteLength>0&&(n.uint32(10),n.bytes(e.key)),e.value!=null&&e.value.byteLength>0&&(n.uint32(18),n.bytes(e.value)),e.timeReceived!=null&&e.timeReceived!==""&&(n.uint32(42),n.string(e.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={key:new Uint8Array(0),value:new Uint8Array(0),timeReceived:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.key=e.bytes();break;case 2:i.value=e.bytes();break;case 5:i.timeReceived=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>nt(e,r.codec()),r.decode=e=>rt(e,r.codec())})(M||(M={}));function Kt(r){let t=r.getUTCFullYear(),e=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0"),i=String(r.getUTCHours()).padStart(2,"0"),s=String(r.getUTCMinutes()).padStart(2,"0"),a=String(r.getUTCSeconds()).padStart(2,"0"),f=r.getUTCMilliseconds(),o=String(f*1e3*1e3).padStart(9,"0");return`${t}-${e}-${n}T${i}:${s}:${a}.${o}Z`}function Qt(r){let t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),e=String(r).trim().match(t);if(e==null)throw new Error("Invalid format");let n=parseInt(e[1],10),i=parseInt(e[2],10)-1,s=parseInt(e[3],10),a=parseInt(e[4],10),f=parseInt(e[5],10),o=parseInt(e[6],10),u=parseInt(e[7].slice(0,-6),10);return new Date(Date.UTC(n,i,s,a,f,o,u))}var F=class{key;value;timeReceived;constructor(t,e,n){if(!(t instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(e instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=t,this.value=e,this.timeReceived=n}serialize(){return M.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:Kt(this.timeReceived)}}static deserialize(t){let e=M.decode(t);return new F(e.key,e.value,new Date(e.timeReceived))}static fromDeserialized(t){let e=Qt(t.timeReceived);if(t.key==null)throw new Error("key missing from deserialized object");if(t.value==null)throw new Error("value missing from deserialized object");return new F(t.key,t.value,e)}};return oe(we);})();
|
|
3
3
|
return Libp2PRecord}));
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,qBAAa,YAAY;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,IAAI,CAAA;gBAEZ,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI;IAcnE,SAAS,IAAK,UAAU;IAIxB;;OAEG;IACH,gBAAgB,IAAK,MAAM;IAQ3B;;OAEG;IACH,MAAM,CAAC,WAAW,CAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,YAAY;IAMnE;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAE,GAAG,EAAE,MAAM,GAAG,YAAY;CAiBpD"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Record } from './record.js';
|
|
2
2
|
import * as utils from './utils.js';
|
|
3
3
|
export class Libp2pRecord {
|
|
4
|
+
key;
|
|
5
|
+
value;
|
|
6
|
+
timeReceived;
|
|
4
7
|
constructor(key, value, timeReceived) {
|
|
5
8
|
if (!(key instanceof Uint8Array)) {
|
|
6
9
|
throw new Error('key must be a Uint8Array');
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAGnC,MAAM,OAAO,YAAY;IAChB,GAAG,CAAY;IACf,KAAK,CAAY;IACjB,YAAY,CAAM;IAEzB,YAAa,GAAe,EAAE,KAAiB,EAAE,YAAkB;QACjE,IAAI,CAAC,CAAC,GAAG,YAAY,UAAU,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;SAC5C;QAED,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC9C;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,SAAS;QACP,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAC/C,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;SACjD,CAAA;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAE,GAAgC;QAClD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAE9B,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA;IACzE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAE,GAAW;QAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAErD,IAAI,GAAG,CAAC,GAAG,IAAI,IAAI,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;SACxD;QAED,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;SAC1D;QAED,MAAM,GAAG,GAAG,IAAI,YAAY,CAC1B,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,CAC7B,CAAA;QAED,OAAO,GAAG,CAAA;IACZ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;;;GAIG;AACH,wBAAsB,YAAY,CAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB/F;AAmCD,eAAO,MAAM,UAAU,EAAE,UAExB,CAAA"}
|
package/dist/src/validators.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CodeError } from '@libp2p/interfaces/errors';
|
|
2
|
-
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
3
2
|
import { sha256 } from 'multiformats/hashes/sha2';
|
|
4
3
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
|
|
4
|
+
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
5
5
|
/**
|
|
6
6
|
* Checks a record and ensures it is still valid.
|
|
7
7
|
* It runs the needed validators.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAItE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAE,UAAsB,EAAE,MAAoB;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;IACtB,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAElC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,yBAAyB;QACzB,OAAM;KACP;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;IAEjD,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,MAAM,MAAM,GAAG,wBAAwB,CAAA;QAEvC,MAAM,IAAI,SAAS,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAA;KAC3D;IAED,MAAM,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,uBAAuB,GAAG,KAAK,EAAE,GAAe,EAAE,SAAqB,EAAiB,EAAE;IAC9F,IAAI,CAAC,CAAC,GAAG,YAAY,UAAU,CAAC,EAAE;QAChC,MAAM,IAAI,SAAS,CAAC,4BAA4B,EAAE,mCAAmC,CAAC,CAAA;KACvF;IAED,IAAI,GAAG,CAAC,UAAU,GAAG,CAAC,EAAE;QACtB,MAAM,IAAI,SAAS,CAAC,2BAA2B,EAAE,kCAAkC,CAAC,CAAA;KACrF;IAED,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAErD,IAAI,MAAM,KAAK,MAAM,EAAE;QACrB,MAAM,IAAI,SAAS,CAAC,gCAAgC,EAAE,mCAAmC,CAAC,CAAA;KAC3F;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAE5B,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAEpD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;QACnD,MAAM,IAAI,SAAS,CAAC,yCAAyC,EAAE,kCAAkC,CAAC,CAAA;KACnG;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,EAAE,EAAE,uBAAuB;CAC5B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/record",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4-3dfc236e",
|
|
4
4
|
"description": "libp2p record implementation",
|
|
5
5
|
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
7
|
-
"homepage": "https://github.com/libp2p/js-libp2p
|
|
7
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/record#readme",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/libp2p/js-libp2p
|
|
10
|
+
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/libp2p/js-libp2p
|
|
13
|
+
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"IPFS"
|
|
17
17
|
],
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=16.0.0",
|
|
20
|
-
"npm": ">=7.0.0"
|
|
21
|
-
},
|
|
22
18
|
"type": "module",
|
|
23
19
|
"types": "./dist/src/index.d.ts",
|
|
24
20
|
"typesVersions": {
|
|
@@ -66,91 +62,6 @@
|
|
|
66
62
|
"src/record.d.ts"
|
|
67
63
|
]
|
|
68
64
|
},
|
|
69
|
-
"release": {
|
|
70
|
-
"branches": [
|
|
71
|
-
"master"
|
|
72
|
-
],
|
|
73
|
-
"plugins": [
|
|
74
|
-
[
|
|
75
|
-
"@semantic-release/commit-analyzer",
|
|
76
|
-
{
|
|
77
|
-
"preset": "conventionalcommits",
|
|
78
|
-
"releaseRules": [
|
|
79
|
-
{
|
|
80
|
-
"breaking": true,
|
|
81
|
-
"release": "major"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"revert": true,
|
|
85
|
-
"release": "patch"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"type": "feat",
|
|
89
|
-
"release": "minor"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"type": "fix",
|
|
93
|
-
"release": "patch"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"type": "docs",
|
|
97
|
-
"release": "patch"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"type": "test",
|
|
101
|
-
"release": "patch"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"type": "deps",
|
|
105
|
-
"release": "patch"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"scope": "no-release",
|
|
109
|
-
"release": false
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
[
|
|
115
|
-
"@semantic-release/release-notes-generator",
|
|
116
|
-
{
|
|
117
|
-
"preset": "conventionalcommits",
|
|
118
|
-
"presetConfig": {
|
|
119
|
-
"types": [
|
|
120
|
-
{
|
|
121
|
-
"type": "feat",
|
|
122
|
-
"section": "Features"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"type": "fix",
|
|
126
|
-
"section": "Bug Fixes"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"type": "chore",
|
|
130
|
-
"section": "Trivial Changes"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
"type": "docs",
|
|
134
|
-
"section": "Documentation"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"type": "deps",
|
|
138
|
-
"section": "Dependencies"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"type": "test",
|
|
142
|
-
"section": "Tests"
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
"@semantic-release/changelog",
|
|
149
|
-
"@semantic-release/npm",
|
|
150
|
-
"@semantic-release/github",
|
|
151
|
-
"@semantic-release/git"
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
65
|
"scripts": {
|
|
155
66
|
"clean": "aegir clean",
|
|
156
67
|
"lint": "aegir lint",
|
|
@@ -162,21 +73,22 @@
|
|
|
162
73
|
"test:firefox": "aegir test -t browser -- --browser firefox",
|
|
163
74
|
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
|
|
164
75
|
"build": "aegir build",
|
|
165
|
-
"generate": "protons ./src/record.proto"
|
|
166
|
-
"release": "aegir release",
|
|
167
|
-
"docs": "aegir docs"
|
|
76
|
+
"generate": "protons ./src/record.proto"
|
|
168
77
|
},
|
|
169
78
|
"dependencies": {
|
|
170
|
-
"@libp2p/interface-dht": "
|
|
171
|
-
"@libp2p/interfaces": "
|
|
172
|
-
"multiformats": "^11.0.
|
|
79
|
+
"@libp2p/interface-dht": "2.0.3-3dfc236e",
|
|
80
|
+
"@libp2p/interfaces": "3.3.2-3dfc236e",
|
|
81
|
+
"multiformats": "^11.0.2",
|
|
173
82
|
"protons-runtime": "^5.0.0",
|
|
174
|
-
"uint8arraylist": "^2.
|
|
175
|
-
"uint8arrays": "^4.0.
|
|
83
|
+
"uint8arraylist": "^2.4.3",
|
|
84
|
+
"uint8arrays": "^4.0.3"
|
|
176
85
|
},
|
|
177
86
|
"devDependencies": {
|
|
178
|
-
"@libp2p/crypto": "
|
|
179
|
-
"aegir": "^
|
|
87
|
+
"@libp2p/crypto": "1.0.17-3dfc236e",
|
|
88
|
+
"aegir": "^39.0.10",
|
|
180
89
|
"protons": "^7.0.2"
|
|
90
|
+
},
|
|
91
|
+
"typedoc": {
|
|
92
|
+
"entryPoint": "./src/index.ts"
|
|
181
93
|
}
|
|
182
94
|
}
|
package/src/index.ts
CHANGED
package/src/validators.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CodeError } from '@libp2p/interfaces/errors'
|
|
2
|
+
import { sha256 } from 'multiformats/hashes/sha2'
|
|
3
|
+
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
2
4
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
3
5
|
import type { Libp2pRecord } from './index.js'
|
|
4
6
|
import type { Validators } from '@libp2p/interface-dht'
|
|
5
|
-
import { sha256 } from 'multiformats/hashes/sha2'
|
|
6
|
-
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Checks a record and ensures it is still valid.
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"codec": "https://libp2p.github.io/js-libp2p-record/functions/index._internal_.Record.codec.html",
|
|
3
|
-
"decode": "https://libp2p.github.io/js-libp2p-record/functions/index._internal_.Record.decode.html",
|
|
4
|
-
"encode": "https://libp2p.github.io/js-libp2p-record/functions/index._internal_.Record.encode.html",
|
|
5
|
-
"Record": "https://libp2p.github.io/js-libp2p-record/interfaces/index._internal_.Record-1.html",
|
|
6
|
-
"Libp2pRecord": "https://libp2p.github.io/js-libp2p-record/classes/index.Libp2pRecord.html",
|
|
7
|
-
"selectors": "https://libp2p.github.io/js-libp2p-record/variables/selectors.selectors.html",
|
|
8
|
-
"bestRecord": "https://libp2p.github.io/js-libp2p-record/functions/selectors.bestRecord.html",
|
|
9
|
-
"validators": "https://libp2p.github.io/js-libp2p-record/variables/validators.validators.html",
|
|
10
|
-
"verifyRecord": "https://libp2p.github.io/js-libp2p-record/functions/validators.verifyRecord.html"
|
|
11
|
-
}
|