@libp2p/record 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/src/record.d.ts +2 -2
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.js +4 -3
- package/dist/src/record.js.map +1 -1
- package/package.json +4 -4
- package/src/record.ts +6 -5
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(),j,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 j})()}: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 G(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(G,4,t>>>0)};l.prototype.sfixed32=l.prototype.fixed32;l.prototype.fixed64=function(t){var e=T.from(t);return this._push(G,4,e.lo)._push(G,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){j=r,l.create=$t(),j._configure()}});var Gt=g((Ce,jt)=>{"use strict";jt.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),Y=D(K(),1),Pt=D(Gt(),1),Jt=D(k(),1);function de(){Jt.default._configure(),Q.default._configure(Zt.default),Y.default._configure(Pt.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(),(i.writeDefaults===!0||e.key!=null&&e.key.byteLength>0)&&(n.uint32(10),n.bytes(e.key)),(i.writeDefaults===!0||e.value!=null&&e.value.byteLength>0)&&(n.uint32(18),n.bytes(e.value)),(i.writeDefaults===!0||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 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);})();
|
|
3
3
|
return Libp2PRecord}));
|
package/dist/src/record.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
2
1
|
import type { Codec } from 'protons-runtime';
|
|
2
|
+
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
3
3
|
export interface Record {
|
|
4
4
|
key: Uint8Array;
|
|
5
5
|
value: Uint8Array;
|
|
@@ -7,7 +7,7 @@ export interface Record {
|
|
|
7
7
|
}
|
|
8
8
|
export declare namespace Record {
|
|
9
9
|
const codec: () => Codec<Record>;
|
|
10
|
-
const encode: (obj: Record) => Uint8Array;
|
|
10
|
+
const encode: (obj: Partial<Record>) => Uint8Array;
|
|
11
11
|
const decode: (buf: Uint8Array | Uint8ArrayList) => Record;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=record.d.ts.map
|
package/dist/src/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,yBAAiB,MAAM,CAAC;IAGf,MAAM,KAAK,QAAO,MAAM,MAAM,CA0DpC,CAAA;IAEM,MAAM,MAAM,QAAS,QAAQ,MAAM,CAAC,KAAG,UAE7C,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,MAEzD,CAAA;CACF"}
|
package/dist/src/record.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable complexity */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
5
6
|
import { encodeMessage, decodeMessage, message } from 'protons-runtime';
|
|
6
7
|
export var Record;
|
|
7
8
|
(function (Record) {
|
|
@@ -12,15 +13,15 @@ export var Record;
|
|
|
12
13
|
if (opts.lengthDelimited !== false) {
|
|
13
14
|
w.fork();
|
|
14
15
|
}
|
|
15
|
-
if (
|
|
16
|
+
if ((obj.key != null && obj.key.byteLength > 0)) {
|
|
16
17
|
w.uint32(10);
|
|
17
18
|
w.bytes(obj.key);
|
|
18
19
|
}
|
|
19
|
-
if (
|
|
20
|
+
if ((obj.value != null && obj.value.byteLength > 0)) {
|
|
20
21
|
w.uint32(18);
|
|
21
22
|
w.bytes(obj.value);
|
|
22
23
|
}
|
|
23
|
-
if (
|
|
24
|
+
if ((obj.timeReceived != null && obj.timeReceived !== '')) {
|
|
24
25
|
w.uint32(42);
|
|
25
26
|
w.string(obj.timeReceived);
|
|
26
27
|
}
|
package/dist/src/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+BAA+B;AAC/B,oDAAoD;AACpD,8EAA8E;
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+BAA+B;AAC/B,oDAAoD;AACpD,8EAA8E;AAC9E,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAUvE,MAAM,KAAW,MAAM,CAsEtB;AAtED,WAAiB,MAAM;IACrB,IAAI,MAAqB,CAAA;IAEZ,YAAK,GAAG,GAAkB,EAAE;QACvC,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,OAAO,CAAS,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;gBAC7C,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;oBAClC,CAAC,CAAC,IAAI,EAAE,CAAA;iBACT;gBAED,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE;oBAC/C,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;oBACZ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;iBACjB;gBAED,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE;oBACnD,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;oBACZ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;iBACnB;gBAED,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,IAAI,GAAG,CAAC,YAAY,KAAK,EAAE,CAAC,EAAE;oBACzD,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;oBACZ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;iBAC3B;gBAED,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;oBAClC,CAAC,CAAC,MAAM,EAAE,CAAA;iBACX;YACH,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;gBACpB,MAAM,GAAG,GAAQ;oBACf,GAAG,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;oBACtB,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;oBACxB,YAAY,EAAE,EAAE;iBACjB,CAAA;gBAED,MAAM,GAAG,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAA;gBAE7D,OAAO,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE;oBACvB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;oBAE3B,QAAQ,GAAG,KAAK,CAAC,EAAE;wBACjB,KAAK,CAAC;4BACJ,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;4BACxB,MAAK;wBACP,KAAK,CAAC;4BACJ,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;4BAC1B,MAAK;wBACP,KAAK,CAAC;4BACJ,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;4BAClC,MAAK;wBACP;4BACE,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;4BACxB,MAAK;qBACR;iBACF;gBAED,OAAO,GAAG,CAAA;YACZ,CAAC,CAAC,CAAA;SACH;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAEY,aAAM,GAAG,CAAC,GAAoB,EAAc,EAAE;QACzD,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;IAC3C,CAAC,CAAA;IAEY,aAAM,GAAG,CAAC,GAAgC,EAAU,EAAE;QACjE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;IAC3C,CAAC,CAAA;AACH,CAAC,EAtEgB,MAAM,KAAN,MAAM,QAsEtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/record",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "libp2p record implementation",
|
|
5
5
|
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"exports": {
|
|
47
47
|
".": {
|
|
48
|
-
"types": "./src/index.d.ts",
|
|
48
|
+
"types": "./dist/src/index.d.ts",
|
|
49
49
|
"import": "./dist/src/index.js"
|
|
50
50
|
},
|
|
51
51
|
"./selectors": {
|
|
@@ -170,13 +170,13 @@
|
|
|
170
170
|
"@libp2p/interface-dht": "^2.0.0",
|
|
171
171
|
"@libp2p/interfaces": "^3.2.0",
|
|
172
172
|
"multiformats": "^11.0.0",
|
|
173
|
-
"protons-runtime": "^
|
|
173
|
+
"protons-runtime": "^5.0.0",
|
|
174
174
|
"uint8arraylist": "^2.1.1",
|
|
175
175
|
"uint8arrays": "^4.0.2"
|
|
176
176
|
},
|
|
177
177
|
"devDependencies": {
|
|
178
178
|
"@libp2p/crypto": "^1.0.11",
|
|
179
179
|
"aegir": "^38.1.7",
|
|
180
|
-
"protons": "^
|
|
180
|
+
"protons": "^7.0.2"
|
|
181
181
|
}
|
|
182
182
|
}
|
package/src/record.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
/* eslint-disable complexity */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
5
6
|
|
|
6
7
|
import { encodeMessage, decodeMessage, message } from 'protons-runtime'
|
|
7
|
-
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
8
8
|
import type { Codec } from 'protons-runtime'
|
|
9
|
+
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
9
10
|
|
|
10
11
|
export interface Record {
|
|
11
12
|
key: Uint8Array
|
|
@@ -23,17 +24,17 @@ export namespace Record {
|
|
|
23
24
|
w.fork()
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
if (
|
|
27
|
+
if ((obj.key != null && obj.key.byteLength > 0)) {
|
|
27
28
|
w.uint32(10)
|
|
28
29
|
w.bytes(obj.key)
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
if (
|
|
32
|
+
if ((obj.value != null && obj.value.byteLength > 0)) {
|
|
32
33
|
w.uint32(18)
|
|
33
34
|
w.bytes(obj.value)
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
if (
|
|
37
|
+
if ((obj.timeReceived != null && obj.timeReceived !== '')) {
|
|
37
38
|
w.uint32(42)
|
|
38
39
|
w.string(obj.timeReceived)
|
|
39
40
|
}
|
|
@@ -76,7 +77,7 @@ export namespace Record {
|
|
|
76
77
|
return _codec
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
export const encode = (obj: Record): Uint8Array => {
|
|
80
|
+
export const encode = (obj: Partial<Record>): Uint8Array => {
|
|
80
81
|
return encodeMessage(obj, Record.codec())
|
|
81
82
|
}
|
|
82
83
|
|