@helia/strings 3.0.6 → 4.0.0-1b2934b
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 +2 -1
- package/dist/index.min.js +1 -1
- package/dist/src/index.d.ts +6 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -4
- package/src/index.ts +6 -1
- package/dist/typedoc-urls.json +0 -12
package/README.md
CHANGED
|
@@ -41,8 +41,9 @@ import { createHelia } from 'helia'
|
|
|
41
41
|
import { strings } from '@helia/strings'
|
|
42
42
|
import { CID } from 'multiformats/cid'
|
|
43
43
|
|
|
44
|
+
const helia = await createHelia()
|
|
44
45
|
const str = strings(helia)
|
|
45
|
-
const cid = await str.
|
|
46
|
+
const cid = await str.add('hello world')
|
|
46
47
|
const string = await str.get(cid)
|
|
47
48
|
|
|
48
49
|
console.info(string)
|
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaStrings = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var HeliaStrings=(()=>{var X=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Re=Object.prototype.hasOwnProperty;var h=(r,e)=>{for(var t in e)X(r,t,{get:e[t],enumerable:!0})},Je=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of qe(e))!Re.call(r,o)&&o!==t&&X(r,o,{get:()=>e[o],enumerable:!(n=je(e,o))||n.enumerable});return r};var Xe=r=>Je(X({},"__esModule",{value:!0}),r);var rr={};h(rr,{strings:()=>tr});var W={};h(W,{base32:()=>T,base32hex:()=>et,base32hexpad:()=>rt,base32hexpadupper:()=>nt,base32hexupper:()=>tt,base32pad:()=>Ye,base32padupper:()=>_e,base32upper:()=>Ze,base32z:()=>ot});var or=new Uint8Array(0);function le(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function x(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function xe(r){return new TextEncoder().encode(r)}function we(r){return new TextDecoder().decode(r)}function Qe(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var c=r.length,d=r.charAt(0),D=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function z(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var p=0,E=0,b=0,w=a.length;b!==w&&a[b]===0;)b++,p++;for(var g=(w-b)*u+1>>>0,m=new Uint8Array(g);b!==w;){for(var y=a[b],S=0,l=g-1;(y!==0||S<E)&&l!==-1;l--,S++)y+=256*m[l]>>>0,m[l]=y%c>>>0,y=y/c>>>0;if(y!==0)throw new Error("Non-zero carry");E=S,b++}for(var C=g-E;C!==g&&m[C]===0;)C++;for(var j=d.repeat(p);C<g;++C)j+=r.charAt(m[C]);return j}function $(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var p=0;if(a[p]!==" "){for(var E=0,b=0;a[p]===d;)E++,p++;for(var w=(a.length-p)*D+1>>>0,g=new Uint8Array(w);a[p];){var m=t[a.charCodeAt(p)];if(m===255)return;for(var y=0,S=w-1;(m!==0||y<b)&&S!==-1;S--,y++)m+=c*g[S]>>>0,g[S]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");b=y,p++}if(a[p]!==" "){for(var l=w-b;l!==w&&g[l]===0;)l++;for(var C=new Uint8Array(E+(w-l)),j=E;l!==w;)C[j++]=g[l++];return C}}}function $e(a){var p=$(a);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:z,decodeUnsafe:$,decode:$e}}var Ge=Qe,Ke=Ge,ye=Ke;var Q=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},G=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ve(this,e)}},K=class{decoders;constructor(e){this.decoders=e}or(e){return ve(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ve(r,e){return new K({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var H=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Q(e,t,n),this.decoder=new G(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function I({name:r,prefix:e,encode:t,decode:n}){return new H(r,e,t,n)}function A({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=ye(t,r);return I({prefix:e,name:r,encode:n,decode:s=>x(o(s))})}function He(r,e,t,n){let o={};for(let u=0;u<e.length;++u)o[e[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,d=0,D=0;for(let u=0;u<s;++u){let z=o[r[u]];if(z===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<t|z,c+=t,c>=8&&(c-=8,i[D++]=255&d>>c)}if(c>=t||255&d<<8-c)throw new SyntaxError("Unexpected end of data");return i}function We(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],i+=8;i>t;)i-=t,s+=e[o&c>>i];if(i!==0&&(s+=e[o&c<<t-i]),n)for(;s.length*t&7;)s+="=";return s}function f({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return I({prefix:e,name:r,encode(o){return We(o,n,t)},decode(o){return He(o,n,t,r)}})}var T=f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ze=f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ye=f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_e=f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),et=f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tt=f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rt=f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),nt=f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ot=f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Z={};h(Z,{base36:()=>V,base36upper:()=>st});var V=A({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),st=A({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Y={};h(Y,{base58btc:()=>v,base58flickr:()=>it});var v=A({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),it=A({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var at=Ae,Ce=128,ct=127,ft=~ct,dt=Math.pow(2,31);function Ae(r,e,t){e=e||[],t=t||0;for(var n=t;r>=dt;)e[t++]=r&255|Ce,r/=128;for(;r&ft;)e[t++]=r&255|Ce,r>>>=7;return e[t]=r|0,Ae.bytes=t-n+1,e}var pt=_,ht=128,Se=127;function _(r,n){var t=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw _.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Se)<<o:(i&Se)*Math.pow(2,o),o+=7}while(i>=ht);return _.bytes=s-n,t}var ut=Math.pow(2,7),mt=Math.pow(2,14),bt=Math.pow(2,21),lt=Math.pow(2,28),xt=Math.pow(2,35),wt=Math.pow(2,42),gt=Math.pow(2,49),yt=Math.pow(2,56),vt=Math.pow(2,63),Ct=function(r){return r<ut?1:r<mt?2:r<bt?3:r<lt?4:r<xt?5:r<wt?6:r<gt?7:r<yt?8:r<vt?9:10},St={encode:at,decode:pt,encodingLength:Ct},At=St,L=At;function P(r,e=0){return[L.decode(r,e),L.decode.bytes]}function M(r,e,t=0){return L.encode(r,e,t),e}function N(r){return L.encodingLength(r)}function U(r,e){let t=e.byteLength,n=N(r),o=n+N(t),s=new Uint8Array(o+t);return M(r,s,0),M(t,s,n),s.set(e,o),new O(r,t,e,s)}function Ee(r){let e=x(r),[t,n]=P(e),[o,s]=P(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new O(t,o,i,e)}function Ue(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&le(r.bytes,t.bytes)}}var O=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};function De(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Ut(t,ee(r),e??v.encoder);default:return Dt(t,ee(r),e??T.encoder)}}var ze=new WeakMap;function ee(r){let e=ze.get(r);if(e==null){let t=new Map;return ze.set(r,t),t}return e}var B=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==F)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==zt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=U(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&Ue(e.multihash,n.multihash)}toString(e){return De(this,e)}toJSON(){return{"/":De(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Ie(n,o,s.bytes))}else if(t[It]===!0){let{version:n,multihash:o,code:s}=t,i=Ee(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==F)throw new Error(`Version 0 CID must use dag-pb (code: ${F}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Ie(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,F,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=x(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new O(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[z,$]=P(e.subarray(t));return t+=$,z},o=n(),s=F;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,c=n(),d=n(),D=t+d,u=D-i;return{version:o,codec:s,multihashCode:c,digestSize:d,multihashSize:u,size:D}}static parse(e,t){let[n,o]=Et(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ee(s).set(n,e),s}};function Et(r,e){switch(r[0]){case"Q":{let t=e??v;return[v.prefix,t.decode(`${v.prefix}${r}`)]}case v.prefix:{let t=e??v;return[v.prefix,t.decode(r)]}case T.prefix:{let t=e??T;return[T.prefix,t.decode(r)]}case V.prefix:{let t=e??V;return[V.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function Ut(r,e,t){let{prefix:n}=t;if(n!==v.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function Dt(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}var F=112,zt=18;function Ie(r,e,t){let n=N(r),o=n+N(e),s=new Uint8Array(o+t.byteLength);return M(r,s,0),M(e,s,n),s.set(t,o),s}var It=Symbol.for("@ipld/js-cid/CID");var R={};h(R,{code:()=>Mt,decode:()=>Ot,encode:()=>Nt,name:()=>Tt});var Tt="raw",Mt=85;function Nt(r){return x(r)}function Ot(r){return x(r)}var oe={};h(oe,{sha256:()=>ne,sha512:()=>Bt});function re({name:r,code:e,encode:t}){return new te(r,e,t)}var te=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?U(this.code,t):t.then(n=>U(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Me(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var ne=re({name:"sha2-256",code:18,encode:Me("SHA-256")}),Bt=re({name:"sha2-512",code:19,encode:Me("SHA-512")});var se={};h(se,{base10:()=>Vt});var Vt=A({prefix:"9",name:"base10",alphabet:"0123456789"});var ie={};h(ie,{base16:()=>Lt,base16upper:()=>Pt});var Lt=f({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Pt=f({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ae={};h(ae,{base2:()=>kt});var kt=f({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ce={};h(ce,{base256emoji:()=>Rt});var Ne=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Ft=Ne.reduce((r,e,t)=>(r[t]=e,r),[]),$t=Ne.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function jt(r){return r.reduce((e,t)=>(e+=Ft[t],e),"")}function qt(r){let e=[];for(let t of r){let n=$t[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Rt=I({prefix:"\u{1F680}",name:"base256emoji",encode:jt,decode:qt});var fe={};h(fe,{base64:()=>Jt,base64pad:()=>Xt,base64url:()=>Qt,base64urlpad:()=>Gt});var Jt=f({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Xt=f({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Qt=f({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gt=f({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var de={};h(de,{base8:()=>Kt});var Kt=f({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var pe={};h(pe,{identity:()=>Ht});var Ht=I({prefix:"\0",name:"identity",encode:r=>we(r),decode:r=>xe(r)});var Mr=new TextEncoder,Nr=new TextDecoder;var he={};h(he,{identity:()=>_t});var Oe=0,Zt="identity",Be=x;function Yt(r){return U(Oe,Be(r))}var _t={code:Oe,name:Zt,encode:Be,digest:Yt};var ue={...pe,...ae,...de,...se,...ie,...W,...Z,...Y,...fe,...ce},Rr={...oe,...he};function Ve(r=0){return new Uint8Array(r)}function Pe(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Le=Pe("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),me=Pe("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Ve(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),er={utf8:Le,"utf-8":Le,hex:ue.base16,latin1:me,ascii:me,binary:me,...ue},J=er;function ke(r,e="utf8"){let t=J[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function Fe(r,e="utf8"){let t=J[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var be=class{components;constructor(e){this.components=e}async add(e,t={}){let n=ke(e),o=await(t.hasher??ne).digest(n),s=t.codec??R,i=B.createV1(s.code,o);return await this.components.blockstore.put(i,n,t),i}async get(e,t={}){let n=await this.components.blockstore.get(e,t);return Fe(n)}};function tr(r){return new be(r)}return Xe(rr);})();
|
|
2
|
+
"use strict";var HeliaStrings=(()=>{var X=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Re=Object.prototype.hasOwnProperty;var h=(r,e)=>{for(var t in e)X(r,t,{get:e[t],enumerable:!0})},Je=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qe(e))!Re.call(r,n)&&n!==t&&X(r,n,{get:()=>e[n],enumerable:!(o=je(e,n))||o.enumerable});return r};var Xe=r=>Je(X({},"__esModule",{value:!0}),r);var rr={};h(rr,{strings:()=>tr});var W={};h(W,{base32:()=>T,base32hex:()=>et,base32hexpad:()=>rt,base32hexpadupper:()=>ot,base32hexupper:()=>tt,base32pad:()=>Ye,base32padupper:()=>_e,base32upper:()=>Ze,base32z:()=>nt});var nr=new Uint8Array(0);function be(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function x(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function xe(r){return new TextEncoder().encode(r)}function we(r){return new TextDecoder().decode(r)}function Qe(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),o=0;o<t.length;o++)t[o]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=n}var c=r.length,d=r.charAt(0),D=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function z(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var p=0,E=0,l=0,w=a.length;l!==w&&a[l]===0;)l++,p++;for(var g=(w-l)*u+1>>>0,m=new Uint8Array(g);l!==w;){for(var y=a[l],S=0,b=g-1;(y!==0||S<E)&&b!==-1;b--,S++)y+=256*m[b]>>>0,m[b]=y%c>>>0,y=y/c>>>0;if(y!==0)throw new Error("Non-zero carry");E=S,l++}for(var C=g-E;C!==g&&m[C]===0;)C++;for(var j=d.repeat(p);C<g;++C)j+=r.charAt(m[C]);return j}function F(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var p=0;if(a[p]!==" "){for(var E=0,l=0;a[p]===d;)E++,p++;for(var w=(a.length-p)*D+1>>>0,g=new Uint8Array(w);a[p];){var m=t[a.charCodeAt(p)];if(m===255)return;for(var y=0,S=w-1;(m!==0||y<l)&&S!==-1;S--,y++)m+=c*g[S]>>>0,g[S]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");l=y,p++}if(a[p]!==" "){for(var b=w-l;b!==w&&g[b]===0;)b++;for(var C=new Uint8Array(E+(w-b)),j=E;b!==w;)C[j++]=g[b++];return C}}}function Fe(a){var p=F(a);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:z,decodeUnsafe:F,decode:Fe}}var Ge=Qe,Ke=Ge,ye=Ke;var Q=class{name;prefix;baseEncode;constructor(e,t,o){this.name=e,this.prefix=t,this.baseEncode=o}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},G=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,o){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=o}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ve(this,e)}},K=class{decoders;constructor(e){this.decoders=e}or(e){return ve(this,e)}decode(e){let t=e[0],o=this.decoders[t];if(o!=null)return o.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ve(r,e){return new K({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var H=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,o,n){this.name=e,this.prefix=t,this.baseEncode=o,this.baseDecode=n,this.encoder=new Q(e,t,o),this.decoder=new G(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function I({name:r,prefix:e,encode:t,decode:o}){return new H(r,e,t,o)}function A({name:r,prefix:e,alphabet:t}){let{encode:o,decode:n}=ye(t,r);return I({prefix:e,name:r,encode:o,decode:s=>x(n(s))})}function He(r,e,t,o){let n={};for(let u=0;u<e.length;++u)n[e[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),c=0,d=0,D=0;for(let u=0;u<s;++u){let z=n[r[u]];if(z===void 0)throw new SyntaxError(`Non-${o} character`);d=d<<t|z,c+=t,c>=8&&(c-=8,i[D++]=255&d>>c)}if(c>=t||255&d<<8-c)throw new SyntaxError("Unexpected end of data");return i}function We(r,e,t){let o=e[e.length-1]==="=",n=(1<<t)-1,s="",i=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],i+=8;i>t;)i-=t,s+=e[n&c>>i];if(i!==0&&(s+=e[n&c<<t-i]),o)for(;s.length*t&7;)s+="=";return s}function f({name:r,prefix:e,bitsPerChar:t,alphabet:o}){return I({prefix:e,name:r,encode(n){return We(n,o,t)},decode(n){return He(n,o,t,r)}})}var T=f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ze=f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ye=f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_e=f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),et=f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tt=f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rt=f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ot=f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),nt=f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Z={};h(Z,{base36:()=>V,base36upper:()=>st});var V=A({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),st=A({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Y={};h(Y,{base58btc:()=>v,base58flickr:()=>it});var v=A({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),it=A({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var at=Ae,Ce=128,ct=127,ft=~ct,dt=Math.pow(2,31);function Ae(r,e,t){e=e||[],t=t||0;for(var o=t;r>=dt;)e[t++]=r&255|Ce,r/=128;for(;r&ft;)e[t++]=r&255|Ce,r>>>=7;return e[t]=r|0,Ae.bytes=t-o+1,e}var pt=_,ht=128,Se=127;function _(r,o){var t=0,o=o||0,n=0,s=o,i,c=r.length;do{if(s>=c)throw _.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=n<28?(i&Se)<<n:(i&Se)*Math.pow(2,n),n+=7}while(i>=ht);return _.bytes=s-o,t}var ut=Math.pow(2,7),mt=Math.pow(2,14),lt=Math.pow(2,21),bt=Math.pow(2,28),xt=Math.pow(2,35),wt=Math.pow(2,42),gt=Math.pow(2,49),yt=Math.pow(2,56),vt=Math.pow(2,63),Ct=function(r){return r<ut?1:r<mt?2:r<lt?3:r<bt?4:r<xt?5:r<wt?6:r<gt?7:r<yt?8:r<vt?9:10},St={encode:at,decode:pt,encodingLength:Ct},At=St,L=At;function P(r,e=0){return[L.decode(r,e),L.decode.bytes]}function M(r,e,t=0){return L.encode(r,e,t),e}function N(r){return L.encodingLength(r)}function U(r,e){let t=e.byteLength,o=N(r),n=o+N(t),s=new Uint8Array(n+t);return M(r,s,0),M(t,s,o),s.set(e,n),new O(r,t,e,s)}function Ee(r){let e=x(r),[t,o]=P(e),[n,s]=P(e.subarray(o)),i=e.subarray(o+s);if(i.byteLength!==n)throw new Error("Incorrect length");return new O(t,n,i,e)}function Ue(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&be(r.bytes,t.bytes)}}var O=class{code;size;digest;bytes;constructor(e,t,o,n){this.code=e,this.size=t,this.digest=o,this.bytes=n}};function De(r,e){let{bytes:t,version:o}=r;switch(o){case 0:return Ut(t,ee(r),e??v.encoder);default:return Dt(t,ee(r),e??T.encoder)}}var ze=new WeakMap;function ee(r){let e=ze.get(r);if(e==null){let t=new Map;return ze.set(r,t),t}return e}var B=class r{code;version;multihash;bytes;"/";constructor(e,t,o,n){this.code=t,this.version=e,this.multihash=o,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==k)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==zt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,o=U(e,t);return r.createV1(this.code,o)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let o=t;return o!=null&&e.code===o.code&&e.version===o.version&&Ue(e.multihash,o.multihash)}toString(e){return De(this,e)}toJSON(){return{"/":De(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:o,code:n,multihash:s,bytes:i}=t;return new r(o,n,s,i??Ie(o,n,s.bytes))}else if(t[It]===!0){let{version:o,multihash:n,code:s}=t,i=Ee(n);return r.create(o,s,i)}else return null}static create(e,t,o){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(o.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==k)throw new Error(`Version 0 CID must use dag-pb (code: ${k}) block encoding`);return new r(e,t,o,o.bytes)}case 1:{let n=Ie(e,t,o.bytes);return new r(e,t,o,n)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,k,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,o]=r.decodeFirst(e);if(o.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),o=t.size-t.multihashSize,n=x(e.subarray(o,o+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),i=new O(t.multihashCode,t.digestSize,s,n);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,o=()=>{let[z,F]=P(e.subarray(t));return t+=F,z},n=o(),s=k;if(n===18?(n=0,t=0):s=o(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let i=t,c=o(),d=o(),D=t+d,u=D-i;return{version:n,codec:s,multihashCode:c,digestSize:d,multihashSize:u,size:D}}static parse(e,t){let[o,n]=Et(e,t),s=r.decode(n);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ee(s).set(o,e),s}};function Et(r,e){switch(r[0]){case"Q":{let t=e??v;return[v.prefix,t.decode(`${v.prefix}${r}`)]}case v.prefix:{let t=e??v;return[v.prefix,t.decode(r)]}case T.prefix:{let t=e??T;return[T.prefix,t.decode(r)]}case V.prefix:{let t=e??V;return[V.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function Ut(r,e,t){let{prefix:o}=t;if(o!==v.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(o);if(n==null){let s=t.encode(r).slice(1);return e.set(o,s),s}else return n}function Dt(r,e,t){let{prefix:o}=t,n=e.get(o);if(n==null){let s=t.encode(r);return e.set(o,s),s}else return n}var k=112,zt=18;function Ie(r,e,t){let o=N(r),n=o+N(e),s=new Uint8Array(n+t.byteLength);return M(r,s,0),M(e,s,o),s.set(t,n),s}var It=Symbol.for("@ipld/js-cid/CID");var R={};h(R,{code:()=>Mt,decode:()=>Ot,encode:()=>Nt,name:()=>Tt});var Tt="raw",Mt=85;function Nt(r){return x(r)}function Ot(r){return x(r)}var ne={};h(ne,{sha256:()=>oe,sha512:()=>Bt});function re({name:r,code:e,encode:t}){return new te(r,e,t)}var te=class{name;code;encode;constructor(e,t,o){this.name=e,this.code=t,this.encode=o}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?U(this.code,t):t.then(o=>U(this.code,o))}else throw Error("Unknown type, must be binary type")}};function Me(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var oe=re({name:"sha2-256",code:18,encode:Me("SHA-256")}),Bt=re({name:"sha2-512",code:19,encode:Me("SHA-512")});var se={};h(se,{base10:()=>Vt});var Vt=A({prefix:"9",name:"base10",alphabet:"0123456789"});var ie={};h(ie,{base16:()=>Lt,base16upper:()=>Pt});var Lt=f({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Pt=f({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ae={};h(ae,{base2:()=>$t});var $t=f({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ce={};h(ce,{base256emoji:()=>Rt});var Ne=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),kt=Ne.reduce((r,e,t)=>(r[t]=e,r),[]),Ft=Ne.reduce((r,e,t)=>{let o=e.codePointAt(0);if(o==null)throw new Error(`Invalid character: ${e}`);return r[o]=t,r},[]);function jt(r){return r.reduce((e,t)=>(e+=kt[t],e),"")}function qt(r){let e=[];for(let t of r){let o=t.codePointAt(0);if(o==null)throw new Error(`Invalid character: ${t}`);let n=Ft[o];if(n==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Rt=I({prefix:"\u{1F680}",name:"base256emoji",encode:jt,decode:qt});var fe={};h(fe,{base64:()=>Jt,base64pad:()=>Xt,base64url:()=>Qt,base64urlpad:()=>Gt});var Jt=f({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Xt=f({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Qt=f({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gt=f({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var de={};h(de,{base8:()=>Kt});var Kt=f({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var pe={};h(pe,{identity:()=>Ht});var Ht=I({prefix:"\0",name:"identity",encode:r=>we(r),decode:r=>xe(r)});var Mr=new TextEncoder,Nr=new TextDecoder;var he={};h(he,{identity:()=>_t});var Oe=0,Zt="identity",Be=x;function Yt(r){return U(Oe,Be(r))}var _t={code:Oe,name:Zt,encode:Be,digest:Yt};var ue={...pe,...ae,...de,...se,...ie,...W,...Z,...Y,...fe,...ce},Rr={...ne,...he};function Ve(r=0){return new Uint8Array(r)}function Pe(r,e,t,o){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:o}}}var Le=Pe("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),me=Pe("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Ve(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),er={utf8:Le,"utf-8":Le,hex:ue.base16,latin1:me,ascii:me,binary:me,...ue},J=er;function $e(r,e="utf8"){let t=J[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function ke(r,e="utf8"){let t=J[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var le=class{components;constructor(e){this.components=e}async add(e,t={}){let o=$e(e),n=await(t.hasher??oe).digest(o),s=t.codec??R,i=B.createV1(s.code,n);return await this.components.blockstore.put(i,o,t),i}async get(e,t={}){let o=await this.components.blockstore.get(e,t);return ke(o)}};function tr(r){return new le(r)}return Xe(rr);})();
|
|
3
3
|
return HeliaStrings}));
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* import { strings } from '@helia/strings'
|
|
13
13
|
* import { CID } from 'multiformats/cid'
|
|
14
14
|
*
|
|
15
|
+
* const helia = await createHelia()
|
|
15
16
|
* const str = strings(helia)
|
|
16
|
-
* const cid = await str.
|
|
17
|
+
* const cid = await str.add('hello world')
|
|
17
18
|
* const string = await str.get(cid)
|
|
18
19
|
*
|
|
19
20
|
* console.info(string)
|
|
@@ -49,8 +50,10 @@ export interface Strings {
|
|
|
49
50
|
* @example
|
|
50
51
|
*
|
|
51
52
|
* ```typescript
|
|
53
|
+
* import { createHelia } from 'helia'
|
|
52
54
|
* import { strings } from '@helia/strings'
|
|
53
55
|
*
|
|
56
|
+
* const helia = wait createHelia()
|
|
54
57
|
* const str = strings(helia)
|
|
55
58
|
* const cid = await str.add('hello world')
|
|
56
59
|
*
|
|
@@ -66,9 +69,11 @@ export interface Strings {
|
|
|
66
69
|
* @example
|
|
67
70
|
*
|
|
68
71
|
* ```typescript
|
|
72
|
+
* import { createHelia } from 'helia'
|
|
69
73
|
* import { strings } from '@helia/strings'
|
|
70
74
|
* import { CID } from 'multiformats/cid'
|
|
71
75
|
*
|
|
76
|
+
* const helia = await createHelia()
|
|
72
77
|
* const str = strings(helia)
|
|
73
78
|
* const cid = CID.parse('bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e')
|
|
74
79
|
* const string = await str.get(cid)
|
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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAKtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,sBAAsB,CAAC;IACvF,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,sBAAsB,CAAC;IACvF,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAE7D;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC9D;AA2BD;;GAEG;AACH,wBAAgB,OAAO,CAAE,KAAK,EAAE;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAEnE"}
|
package/dist/src/index.js
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* import { strings } from '@helia/strings'
|
|
13
13
|
* import { CID } from 'multiformats/cid'
|
|
14
14
|
*
|
|
15
|
+
* const helia = await createHelia()
|
|
15
16
|
* const str = strings(helia)
|
|
16
|
-
* const cid = await str.
|
|
17
|
+
* const cid = await str.add('hello world')
|
|
17
18
|
* const string = await str.get(cid)
|
|
18
19
|
*
|
|
19
20
|
* console.info(string)
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAqEtE,MAAM,cAAc;IACD,UAAU,CAAmB;IAE9C,YAAa,UAA6B;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,MAAc,EAAE,UAA+B,EAAE;QAC1D,MAAM,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;QACxC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACzD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,GAAG,CAAA;QAClC,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAE1C,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;QAEvD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,GAAQ,EAAE,UAA+B,EAAE;QACpD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAE9D,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAE,KAAiC;IACxD,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,CAAA;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/strings",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-1b2934b",
|
|
4
4
|
"description": "Add/get IPLD blocks containing strings with your Helia node",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia/tree/main/packages/strings#readme",
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
"clean": "aegir clean",
|
|
130
130
|
"lint": "aegir lint",
|
|
131
131
|
"dep-check": "aegir dep-check",
|
|
132
|
+
"doc-check": "aegir doc-check",
|
|
132
133
|
"build": "aegir build",
|
|
133
134
|
"docs": "aegir docs",
|
|
134
135
|
"test": "aegir test",
|
|
@@ -141,8 +142,8 @@
|
|
|
141
142
|
"release": "aegir release"
|
|
142
143
|
},
|
|
143
144
|
"dependencies": {
|
|
144
|
-
"@helia/interface": "
|
|
145
|
-
"@libp2p/interface": "^
|
|
145
|
+
"@helia/interface": "5.0.0-1b2934b",
|
|
146
|
+
"@libp2p/interface": "^2.0.0",
|
|
146
147
|
"interface-blockstore": "^5.2.10",
|
|
147
148
|
"multiformats": "^13.1.0",
|
|
148
149
|
"progress-events": "^1.0.0",
|
|
@@ -150,7 +151,7 @@
|
|
|
150
151
|
},
|
|
151
152
|
"devDependencies": {
|
|
152
153
|
"aegir": "^44.0.1",
|
|
153
|
-
"blockstore-core": "^
|
|
154
|
+
"blockstore-core": "^5.0.0"
|
|
154
155
|
},
|
|
155
156
|
"sideEffects": false
|
|
156
157
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* import { strings } from '@helia/strings'
|
|
13
13
|
* import { CID } from 'multiformats/cid'
|
|
14
14
|
*
|
|
15
|
+
* const helia = await createHelia()
|
|
15
16
|
* const str = strings(helia)
|
|
16
|
-
* const cid = await str.
|
|
17
|
+
* const cid = await str.add('hello world')
|
|
17
18
|
* const string = await str.get(cid)
|
|
18
19
|
*
|
|
19
20
|
* console.info(string)
|
|
@@ -58,8 +59,10 @@ export interface Strings {
|
|
|
58
59
|
* @example
|
|
59
60
|
*
|
|
60
61
|
* ```typescript
|
|
62
|
+
* import { createHelia } from 'helia'
|
|
61
63
|
* import { strings } from '@helia/strings'
|
|
62
64
|
*
|
|
65
|
+
* const helia = wait createHelia()
|
|
63
66
|
* const str = strings(helia)
|
|
64
67
|
* const cid = await str.add('hello world')
|
|
65
68
|
*
|
|
@@ -76,9 +79,11 @@ export interface Strings {
|
|
|
76
79
|
* @example
|
|
77
80
|
*
|
|
78
81
|
* ```typescript
|
|
82
|
+
* import { createHelia } from 'helia'
|
|
79
83
|
* import { strings } from '@helia/strings'
|
|
80
84
|
* import { CID } from 'multiformats/cid'
|
|
81
85
|
*
|
|
86
|
+
* const helia = await createHelia()
|
|
82
87
|
* const str = strings(helia)
|
|
83
88
|
* const cid = CID.parse('bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e')
|
|
84
89
|
* const string = await str.get(cid)
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AddOptions": "https://ipfs.github.io/helia/interfaces/_helia_strings.AddOptions.html",
|
|
3
|
-
".:AddOptions": "https://ipfs.github.io/helia/interfaces/_helia_strings.AddOptions.html",
|
|
4
|
-
"GetOptions": "https://ipfs.github.io/helia/interfaces/_helia_strings.GetOptions.html",
|
|
5
|
-
".:GetOptions": "https://ipfs.github.io/helia/interfaces/_helia_strings.GetOptions.html",
|
|
6
|
-
"Strings": "https://ipfs.github.io/helia/interfaces/_helia_strings.Strings.html",
|
|
7
|
-
".:Strings": "https://ipfs.github.io/helia/interfaces/_helia_strings.Strings.html",
|
|
8
|
-
"StringsComponents": "https://ipfs.github.io/helia/interfaces/_helia_strings.StringsComponents.html",
|
|
9
|
-
".:StringsComponents": "https://ipfs.github.io/helia/interfaces/_helia_strings.StringsComponents.html",
|
|
10
|
-
"strings": "https://ipfs.github.io/helia/functions/_helia_strings.strings-1.html",
|
|
11
|
-
".:strings": "https://ipfs.github.io/helia/functions/_helia_strings.strings-1.html"
|
|
12
|
-
}
|