@dxos/hypercore 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe
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/lib/browser/index.mjs +19 -32
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +19 -32
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -21
- package/src/hypercore.test.ts +8 -8
- package/src/iterator.test.ts +3 -3
- package/src/streams.test.ts +3 -3
- package/src/util.ts +2 -2
|
@@ -79,25 +79,29 @@ import { StorageType, createStorage } from "@dxos/random-access-storage";
|
|
|
79
79
|
import hypercore from "@dxos/vendor-hypercore/hypercore";
|
|
80
80
|
|
|
81
81
|
// src/util.ts
|
|
82
|
-
import
|
|
83
|
-
var py = (obj, fn) =>
|
|
82
|
+
import { promisify } from "@dxos/node-std/util";
|
|
83
|
+
var py = (obj, fn) => promisify(fn.bind(obj));
|
|
84
84
|
|
|
85
85
|
// src/hypercore-factory.ts
|
|
86
|
-
function _define_property(obj, key, value) {
|
|
87
|
-
if (key in obj) {
|
|
88
|
-
Object.defineProperty(obj, key, {
|
|
89
|
-
value,
|
|
90
|
-
enumerable: true,
|
|
91
|
-
configurable: true,
|
|
92
|
-
writable: true
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
obj[key] = value;
|
|
96
|
-
}
|
|
97
|
-
return obj;
|
|
98
|
-
}
|
|
99
86
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/hypercore/src/hypercore-factory.ts";
|
|
100
87
|
var HypercoreFactory = class {
|
|
88
|
+
_root;
|
|
89
|
+
_options;
|
|
90
|
+
constructor(_root = createStorage({
|
|
91
|
+
type: StorageType.RAM
|
|
92
|
+
}).createDirectory(), _options) {
|
|
93
|
+
this._root = _root;
|
|
94
|
+
this._options = _options;
|
|
95
|
+
invariant2(this._root, void 0, {
|
|
96
|
+
F: __dxlog_file2,
|
|
97
|
+
L: 20,
|
|
98
|
+
S: this,
|
|
99
|
+
A: [
|
|
100
|
+
"this._root",
|
|
101
|
+
""
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
101
105
|
/**
|
|
102
106
|
* Creates a feed using a storage factory prefixed with the feed's key.
|
|
103
107
|
* NOTE: We have to use our `random-access-storage` implementation since the native ones
|
|
@@ -116,23 +120,6 @@ var HypercoreFactory = class {
|
|
|
116
120
|
await py(feed, feed.open)();
|
|
117
121
|
return feed;
|
|
118
122
|
}
|
|
119
|
-
constructor(_root = createStorage({
|
|
120
|
-
type: StorageType.RAM
|
|
121
|
-
}).createDirectory(), _options) {
|
|
122
|
-
_define_property(this, "_root", void 0);
|
|
123
|
-
_define_property(this, "_options", void 0);
|
|
124
|
-
this._root = _root;
|
|
125
|
-
this._options = _options;
|
|
126
|
-
invariant2(this._root, void 0, {
|
|
127
|
-
F: __dxlog_file2,
|
|
128
|
-
L: 20,
|
|
129
|
-
S: this,
|
|
130
|
-
A: [
|
|
131
|
-
"this._root",
|
|
132
|
-
""
|
|
133
|
-
]
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
123
|
};
|
|
137
124
|
|
|
138
125
|
// src/iterator.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/crypto.ts", "../../../src/defaults.ts", "../../../src/hypercore-factory.ts", "../../../src/util.ts", "../../../src/iterator.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nexport { default as hypercore } from '@dxos/vendor-hypercore/hypercore';\nexport type {\n Hypercore,\n HypercoreOptions,\n HypercoreProperties,\n ReadStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\nexport * from './crypto';\nexport * from './defaults';\nexport * from './hypercore-factory';\nexport * from './iterator';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { callbackify } from 'node:util';\n\nimport { type Codec, type EncodingOptions } from '@dxos/codec-protobuf';\nimport { type Signer, verifySignature } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { type PublicKey } from '@dxos/keys';\nimport { arrayToBuffer } from '@dxos/util';\nimport { type AbstractValueEncoding, type Crypto } from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * Create encoding (e.g., from protobuf codec).\n */\nexport const createCodecEncoding = <T>(codec: Codec<T>, opts?: EncodingOptions): AbstractValueEncoding<T> => ({\n encode: (obj: T) => arrayToBuffer(codec.encode(obj, opts)),\n decode: (buffer: Buffer) => codec.decode(buffer, opts),\n});\n\n/**\n * Create a custom hypercore crypto signer.\n */\n// TODO(burdon): Create test without adding deps.\nexport const createCrypto = (signer: Signer, publicKey: PublicKey): Crypto => {\n invariant(signer);\n invariant(publicKey);\n\n return {\n sign: (message, secretKey, cb) => {\n callbackify(signer.sign.bind(signer!))(publicKey, message, (err, result) => {\n if (err) {\n cb(err, null);\n return;\n }\n\n cb(null, arrayToBuffer(result));\n });\n },\n\n verify: async (message, signature, key, cb) => {\n // NOTE: Uses the public key passed into function.\n callbackify(verifySignature)(publicKey, message, signature, cb);\n },\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type {\n HypercoreOptions,\n ReadStreamOptions,\n ReplicationOptions,\n WriteStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-feed--hypercorestorage-key-options\n */\nexport const defaultFeedOptions: HypercoreOptions = {\n createIfMissing: true,\n valueEncoding: 'binary',\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatereadstreamoptions\n */\nexport const defaultReadStreamOptions: ReadStreamOptions = {\n start: 0,\n end: Infinity,\n snapshot: true,\n tail: false,\n live: false,\n timeout: 0,\n wait: true,\n batch: 1,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatewritestreamopts\n */\nexport const defaultWriteStreamOptions: WriteStreamOptions = {\n maxBlockSize: Infinity,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedreplicateisinitiator-options\n */\nexport const defaultReplicateOptions: ReplicationOptions = {\n live: false,\n ack: false,\n download: true,\n upload: true,\n encrypted: true,\n noise: true,\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport { type Directory, StorageType, createStorage } from '@dxos/random-access-storage';\nimport hypercore from '@dxos/vendor-hypercore/hypercore';\nimport type { Hypercore, HypercoreOptions } from '@dxos/vendor-hypercore/hypercore';\n\nimport { py } from './util';\n\n/**\n * Creates feeds with default properties.\n */\nexport class HypercoreFactory<T> {\n constructor(\n private readonly _root: Directory = createStorage({ type: StorageType.RAM }).createDirectory(),\n private readonly _options?: HypercoreOptions,\n ) {\n invariant(this._root);\n }\n\n /**\n * Creates a feed using a storage factory prefixed with the feed's key.\n * NOTE: We have to use our `random-access-storage` implementation since the native ones\n * do not behave uniformly across platforms.\n */\n createFeed(publicKey: Buffer, options?: HypercoreOptions): Hypercore<T> {\n const directory = this._root.createDirectory(publicKey.toString('hex'));\n const storage = (filename: string) => directory.getOrCreateFile(filename).native;\n return hypercore(storage, publicKey, Object.assign({}, this._options, options));\n }\n\n /**\n * Creates and opens a feed.\n */\n async openFeed(publicKey: Buffer, options?: HypercoreOptions): Promise<Hypercore<T>> {\n const feed = this.createFeed(publicKey, options);\n await py(feed, feed.open)(); // TODO(burdon): Sometimes strange bug if done inside function.\n return feed;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";AAIA,SAAoBA,WAAXC,gBAA4B;;;ACArC,SAASC,mBAAmB;AAG5B,SAAsBC,uBAAuB;AAC7C,SAASC,iBAAiB;AAE1B,SAASC,qBAAqB;;AAMvB,IAAMC,sBAAsB,CAAIC,OAAiBC,UAAsD;EAC5GC,QAAQ,CAACC,QAAWL,cAAcE,MAAME,OAAOC,KAAKF,IAAAA,CAAAA;EACpDG,QAAQ,CAACC,WAAmBL,MAAMI,OAAOC,QAAQJ,IAAAA;AACnD;AAMO,IAAMK,eAAe,CAACC,QAAgBC,cAAAA;AAC3CX,YAAUU,QAAAA,QAAAA;;;;;;;;;AACVV,YAAUW,WAAAA,QAAAA;;;;;;;;;AAEV,SAAO;IACLC,MAAM,CAACC,SAASC,WAAWC,OAAAA;AACzBjB,kBAAYY,OAAOE,KAAKI,KAAKN,MAAAA,CAAAA,EAAUC,WAAWE,SAAS,CAACI,KAAKC,WAAAA;AAC/D,YAAID,KAAK;AACPF,aAAGE,KAAK,IAAA;AACR;QACF;AAEAF,WAAG,MAAMd,cAAciB,MAAAA,CAAAA;MACzB,CAAA;IACF;IAEAC,QAAQ,OAAON,SAASO,WAAWC,KAAKN,OAAAA;AAEtCjB,kBAAYC,eAAAA,EAAiBY,WAAWE,SAASO,WAAWL,EAAAA;IAC9D;EACF;AACF;;;AChCO,IAAMO,qBAAuC;EAClDC,iBAAiB;EACjBC,eAAe;AACjB;AAKO,IAAMC,2BAA8C;EACzDC,OAAO;EACPC,KAAKC;EACLC,UAAU;EACVC,MAAM;EACNC,MAAM;EACNC,SAAS;EACTC,MAAM;EACNC,OAAO;AACT;AAKO,IAAMC,4BAAgD;EAC3DC,cAAcR;AAChB;AAKO,IAAMS,0BAA8C;EACzDN,MAAM;EACNO,KAAK;EACLC,UAAU;EACVC,QAAQ;EACRC,WAAW;EACXC,OAAO;AACT;;;AC9CA,SAASC,aAAAA,kBAAiB;AAC1B,SAAyBC,aAAaC,qBAAqB;AAC3D,OAAOC,eAAe;;;ACFtB,
|
|
6
|
-
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "createCodecEncoding", "codec", "opts", "encode", "obj", "decode", "buffer", "createCrypto", "signer", "publicKey", "sign", "message", "secretKey", "cb", "bind", "err", "result", "verify", "signature", "key", "defaultFeedOptions", "createIfMissing", "valueEncoding", "defaultReadStreamOptions", "start", "end", "Infinity", "snapshot", "tail", "live", "timeout", "wait", "batch", "defaultWriteStreamOptions", "maxBlockSize", "defaultReplicateOptions", "ack", "download", "upload", "encrypted", "noise", "invariant", "StorageType", "createStorage", "hypercore", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nexport { default as hypercore } from '@dxos/vendor-hypercore/hypercore';\nexport type {\n Hypercore,\n HypercoreOptions,\n HypercoreProperties,\n ReadStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\nexport * from './crypto';\nexport * from './defaults';\nexport * from './hypercore-factory';\nexport * from './iterator';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { callbackify } from 'node:util';\n\nimport { type Codec, type EncodingOptions } from '@dxos/codec-protobuf';\nimport { type Signer, verifySignature } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { type PublicKey } from '@dxos/keys';\nimport { arrayToBuffer } from '@dxos/util';\nimport { type AbstractValueEncoding, type Crypto } from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * Create encoding (e.g., from protobuf codec).\n */\nexport const createCodecEncoding = <T>(codec: Codec<T>, opts?: EncodingOptions): AbstractValueEncoding<T> => ({\n encode: (obj: T) => arrayToBuffer(codec.encode(obj, opts)),\n decode: (buffer: Buffer) => codec.decode(buffer, opts),\n});\n\n/**\n * Create a custom hypercore crypto signer.\n */\n// TODO(burdon): Create test without adding deps.\nexport const createCrypto = (signer: Signer, publicKey: PublicKey): Crypto => {\n invariant(signer);\n invariant(publicKey);\n\n return {\n sign: (message, secretKey, cb) => {\n callbackify(signer.sign.bind(signer!))(publicKey, message, (err, result) => {\n if (err) {\n cb(err, null);\n return;\n }\n\n cb(null, arrayToBuffer(result));\n });\n },\n\n verify: async (message, signature, key, cb) => {\n // NOTE: Uses the public key passed into function.\n callbackify(verifySignature)(publicKey, message, signature, cb);\n },\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type {\n HypercoreOptions,\n ReadStreamOptions,\n ReplicationOptions,\n WriteStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-feed--hypercorestorage-key-options\n */\nexport const defaultFeedOptions: HypercoreOptions = {\n createIfMissing: true,\n valueEncoding: 'binary',\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatereadstreamoptions\n */\nexport const defaultReadStreamOptions: ReadStreamOptions = {\n start: 0,\n end: Infinity,\n snapshot: true,\n tail: false,\n live: false,\n timeout: 0,\n wait: true,\n batch: 1,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatewritestreamopts\n */\nexport const defaultWriteStreamOptions: WriteStreamOptions = {\n maxBlockSize: Infinity,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedreplicateisinitiator-options\n */\nexport const defaultReplicateOptions: ReplicationOptions = {\n live: false,\n ack: false,\n download: true,\n upload: true,\n encrypted: true,\n noise: true,\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport { type Directory, StorageType, createStorage } from '@dxos/random-access-storage';\nimport hypercore from '@dxos/vendor-hypercore/hypercore';\nimport type { Hypercore, HypercoreOptions } from '@dxos/vendor-hypercore/hypercore';\n\nimport { py } from './util';\n\n/**\n * Creates feeds with default properties.\n */\nexport class HypercoreFactory<T> {\n constructor(\n private readonly _root: Directory = createStorage({ type: StorageType.RAM }).createDirectory(),\n private readonly _options?: HypercoreOptions,\n ) {\n invariant(this._root);\n }\n\n /**\n * Creates a feed using a storage factory prefixed with the feed's key.\n * NOTE: We have to use our `random-access-storage` implementation since the native ones\n * do not behave uniformly across platforms.\n */\n createFeed(publicKey: Buffer, options?: HypercoreOptions): Hypercore<T> {\n const directory = this._root.createDirectory(publicKey.toString('hex'));\n const storage = (filename: string) => directory.getOrCreateFile(filename).native;\n return hypercore(storage, publicKey, Object.assign({}, this._options, options));\n }\n\n /**\n * Creates and opens a feed.\n */\n async openFeed(publicKey: Buffer, options?: HypercoreOptions): Promise<Hypercore<T>> {\n const feed = this.createFeed(publicKey, options);\n await py(feed, feed.open)(); // TODO(burdon): Sometimes strange bug if done inside function.\n return feed;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { promisify } from 'node:util';\n\nexport const py = (obj: any, fn: Function) => promisify(fn.bind(obj));\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { Readable } from 'readable-stream';\nimport { type Readable as StreamXReadable } from 'streamx';\n\n/**\n * Wraps streamx.Readable (hypercore.createReadStream) to a standard Readable stream.\n *\n * The read-stream package is mirror of the streams implementations in Node.js 18.9.0.\n * This function is here to standardize the cast in case there are incompatibilities\n * across different platforms.\n *\n * Hypercore createReadStream returns a `streamx` Readable, which does not close properly on destroy.\n *\n * https://github.com/nodejs/readable-stream\n * https://nodejs.org/api/stream.html#readable-streams\n * https://nodejs.org/dist/v18.9.0/docs/api/stream.html#readablewrapstream\n */\nexport const createReadable = (stream: StreamXReadable): Readable => {\n return new Readable({ objectMode: true }).wrap(stream as any);\n};\n\n/**\n * Converts streamx.Readable (hypercore.createReadStream) to an async iterator.\n *\n * https://github.com/tc39/proposal-async-iteration\n * https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#async-iteration\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols\n */\nexport const createAsyncIterator = (stream: Readable): AsyncIterator<any> => {\n return stream[Symbol.asyncIterator]();\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAoBA,WAAXC,gBAA4B;;;ACArC,SAASC,mBAAmB;AAG5B,SAAsBC,uBAAuB;AAC7C,SAASC,iBAAiB;AAE1B,SAASC,qBAAqB;;AAMvB,IAAMC,sBAAsB,CAAIC,OAAiBC,UAAsD;EAC5GC,QAAQ,CAACC,QAAWL,cAAcE,MAAME,OAAOC,KAAKF,IAAAA,CAAAA;EACpDG,QAAQ,CAACC,WAAmBL,MAAMI,OAAOC,QAAQJ,IAAAA;AACnD;AAMO,IAAMK,eAAe,CAACC,QAAgBC,cAAAA;AAC3CX,YAAUU,QAAAA,QAAAA;;;;;;;;;AACVV,YAAUW,WAAAA,QAAAA;;;;;;;;;AAEV,SAAO;IACLC,MAAM,CAACC,SAASC,WAAWC,OAAAA;AACzBjB,kBAAYY,OAAOE,KAAKI,KAAKN,MAAAA,CAAAA,EAAUC,WAAWE,SAAS,CAACI,KAAKC,WAAAA;AAC/D,YAAID,KAAK;AACPF,aAAGE,KAAK,IAAA;AACR;QACF;AAEAF,WAAG,MAAMd,cAAciB,MAAAA,CAAAA;MACzB,CAAA;IACF;IAEAC,QAAQ,OAAON,SAASO,WAAWC,KAAKN,OAAAA;AAEtCjB,kBAAYC,eAAAA,EAAiBY,WAAWE,SAASO,WAAWL,EAAAA;IAC9D;EACF;AACF;;;AChCO,IAAMO,qBAAuC;EAClDC,iBAAiB;EACjBC,eAAe;AACjB;AAKO,IAAMC,2BAA8C;EACzDC,OAAO;EACPC,KAAKC;EACLC,UAAU;EACVC,MAAM;EACNC,MAAM;EACNC,SAAS;EACTC,MAAM;EACNC,OAAO;AACT;AAKO,IAAMC,4BAAgD;EAC3DC,cAAcR;AAChB;AAKO,IAAMS,0BAA8C;EACzDN,MAAM;EACNO,KAAK;EACLC,UAAU;EACVC,QAAQ;EACRC,WAAW;EACXC,OAAO;AACT;;;AC9CA,SAASC,aAAAA,kBAAiB;AAC1B,SAAyBC,aAAaC,qBAAqB;AAC3D,OAAOC,eAAe;;;ACFtB,SAASC,iBAAiB;AAEnB,IAAMC,KAAK,CAACC,KAAUC,OAAiBC,UAAUD,GAAGE,KAAKH,GAAAA,CAAAA;;;;ADQzD,IAAMI,mBAAN,MAAMA;;;EACX,YACmBC,QAAmBC,cAAc;IAAEC,MAAMC,YAAYC;EAAI,CAAA,EAAGC,gBAAe,GAC3EC,UACjB;SAFiBN,QAAAA;SACAM,WAAAA;AAEjBC,IAAAA,WAAU,KAAKP,OAAK,QAAA;;;;;;;;;EACtB;;;;;;EAOAQ,WAAWC,WAAmBC,SAA0C;AACtE,UAAMC,YAAY,KAAKX,MAAMK,gBAAgBI,UAAUG,SAAS,KAAA,CAAA;AAChE,UAAMC,UAAU,CAACC,aAAqBH,UAAUI,gBAAgBD,QAAAA,EAAUE;AAC1E,WAAOC,UAAUJ,SAASJ,WAAWS,OAAOC,OAAO,CAAC,GAAG,KAAKb,UAAUI,OAAAA,CAAAA;EACxE;;;;EAKA,MAAMU,SAASX,WAAmBC,SAAmD;AACnF,UAAMW,OAAO,KAAKb,WAAWC,WAAWC,OAAAA;AACxC,UAAMY,GAAGD,MAAMA,KAAKE,IAAI,EAAA;AACxB,WAAOF;EACT;AACF;;;AErCA,SAASG,gBAAgB;AAgBlB,IAAMC,iBAAiB,CAACC,WAAAA;AAC7B,SAAO,IAAIC,SAAS;IAAEC,YAAY;EAAK,CAAA,EAAGC,KAAKH,MAAAA;AACjD;AAUO,IAAMI,sBAAsB,CAACJ,WAAAA;AAClC,SAAOA,OAAOK,OAAOC,aAAa,EAAC;AACrC;",
|
|
6
|
+
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "createCodecEncoding", "codec", "opts", "encode", "obj", "decode", "buffer", "createCrypto", "signer", "publicKey", "sign", "message", "secretKey", "cb", "bind", "err", "result", "verify", "signature", "key", "defaultFeedOptions", "createIfMissing", "valueEncoding", "defaultReadStreamOptions", "start", "end", "Infinity", "snapshot", "tail", "live", "timeout", "wait", "batch", "defaultWriteStreamOptions", "maxBlockSize", "defaultReplicateOptions", "ack", "download", "upload", "encrypted", "noise", "invariant", "StorageType", "createStorage", "hypercore", "promisify", "py", "obj", "fn", "promisify", "bind", "HypercoreFactory", "_root", "createStorage", "type", "StorageType", "RAM", "createDirectory", "_options", "invariant", "createFeed", "publicKey", "options", "directory", "toString", "storage", "filename", "getOrCreateFile", "native", "hypercore", "Object", "assign", "openFeed", "feed", "py", "open", "Readable", "createReadable", "stream", "Readable", "objectMode", "wrap", "createAsyncIterator", "Symbol", "asyncIterator"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/crypto.ts":{"bytes":4950,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/defaults.ts":{"bytes":3761,"imports":[],"format":"esm"},"src/util.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/crypto.ts":{"bytes":4950,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/defaults.ts":{"bytes":3761,"imports":[],"format":"esm"},"src/util.ts":{"bytes":780,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/hypercore-factory.ts":{"bytes":5214,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/random-access-storage","kind":"import-statement","external":true},{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/iterator.ts":{"bytes":3956,"imports":[{"path":"readable-stream","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1172,"imports":[{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"src/crypto.ts","kind":"import-statement","original":"./crypto"},{"path":"src/defaults.ts","kind":"import-statement","original":"./defaults"},{"path":"src/hypercore-factory.ts","kind":"import-statement","original":"./hypercore-factory"},{"path":"src/iterator.ts","kind":"import-statement","original":"./iterator"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9473},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/random-access-storage","kind":"import-statement","external":true},{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"readable-stream","kind":"import-statement","external":true}],"exports":["HypercoreFactory","createAsyncIterator","createCodecEncoding","createCrypto","createReadable","defaultFeedOptions","defaultReadStreamOptions","defaultReplicateOptions","defaultWriteStreamOptions","hypercore"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":72},"src/crypto.ts":{"bytesInOutput":1121},"src/defaults.ts":{"bytesInOutput":426},"src/hypercore-factory.ts":{"bytesInOutput":1329},"src/util.ts":{"bytesInOutput":96},"src/iterator.ts":{"bytesInOutput":230}},"bytes":3699}}}
|
|
@@ -81,25 +81,29 @@ import { StorageType, createStorage } from "@dxos/random-access-storage";
|
|
|
81
81
|
import hypercore from "@dxos/vendor-hypercore/hypercore";
|
|
82
82
|
|
|
83
83
|
// src/util.ts
|
|
84
|
-
import
|
|
85
|
-
var py = (obj, fn) =>
|
|
84
|
+
import { promisify } from "node:util";
|
|
85
|
+
var py = (obj, fn) => promisify(fn.bind(obj));
|
|
86
86
|
|
|
87
87
|
// src/hypercore-factory.ts
|
|
88
|
-
function _define_property(obj, key, value) {
|
|
89
|
-
if (key in obj) {
|
|
90
|
-
Object.defineProperty(obj, key, {
|
|
91
|
-
value,
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true,
|
|
94
|
-
writable: true
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
obj[key] = value;
|
|
98
|
-
}
|
|
99
|
-
return obj;
|
|
100
|
-
}
|
|
101
88
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/hypercore/src/hypercore-factory.ts";
|
|
102
89
|
var HypercoreFactory = class {
|
|
90
|
+
_root;
|
|
91
|
+
_options;
|
|
92
|
+
constructor(_root = createStorage({
|
|
93
|
+
type: StorageType.RAM
|
|
94
|
+
}).createDirectory(), _options) {
|
|
95
|
+
this._root = _root;
|
|
96
|
+
this._options = _options;
|
|
97
|
+
invariant2(this._root, void 0, {
|
|
98
|
+
F: __dxlog_file2,
|
|
99
|
+
L: 20,
|
|
100
|
+
S: this,
|
|
101
|
+
A: [
|
|
102
|
+
"this._root",
|
|
103
|
+
""
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
103
107
|
/**
|
|
104
108
|
* Creates a feed using a storage factory prefixed with the feed's key.
|
|
105
109
|
* NOTE: We have to use our `random-access-storage` implementation since the native ones
|
|
@@ -118,23 +122,6 @@ var HypercoreFactory = class {
|
|
|
118
122
|
await py(feed, feed.open)();
|
|
119
123
|
return feed;
|
|
120
124
|
}
|
|
121
|
-
constructor(_root = createStorage({
|
|
122
|
-
type: StorageType.RAM
|
|
123
|
-
}).createDirectory(), _options) {
|
|
124
|
-
_define_property(this, "_root", void 0);
|
|
125
|
-
_define_property(this, "_options", void 0);
|
|
126
|
-
this._root = _root;
|
|
127
|
-
this._options = _options;
|
|
128
|
-
invariant2(this._root, void 0, {
|
|
129
|
-
F: __dxlog_file2,
|
|
130
|
-
L: 20,
|
|
131
|
-
S: this,
|
|
132
|
-
A: [
|
|
133
|
-
"this._root",
|
|
134
|
-
""
|
|
135
|
-
]
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
125
|
};
|
|
139
126
|
|
|
140
127
|
// src/iterator.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/crypto.ts", "../../../src/defaults.ts", "../../../src/hypercore-factory.ts", "../../../src/util.ts", "../../../src/iterator.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nexport { default as hypercore } from '@dxos/vendor-hypercore/hypercore';\nexport type {\n Hypercore,\n HypercoreOptions,\n HypercoreProperties,\n ReadStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\nexport * from './crypto';\nexport * from './defaults';\nexport * from './hypercore-factory';\nexport * from './iterator';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { callbackify } from 'node:util';\n\nimport { type Codec, type EncodingOptions } from '@dxos/codec-protobuf';\nimport { type Signer, verifySignature } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { type PublicKey } from '@dxos/keys';\nimport { arrayToBuffer } from '@dxos/util';\nimport { type AbstractValueEncoding, type Crypto } from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * Create encoding (e.g., from protobuf codec).\n */\nexport const createCodecEncoding = <T>(codec: Codec<T>, opts?: EncodingOptions): AbstractValueEncoding<T> => ({\n encode: (obj: T) => arrayToBuffer(codec.encode(obj, opts)),\n decode: (buffer: Buffer) => codec.decode(buffer, opts),\n});\n\n/**\n * Create a custom hypercore crypto signer.\n */\n// TODO(burdon): Create test without adding deps.\nexport const createCrypto = (signer: Signer, publicKey: PublicKey): Crypto => {\n invariant(signer);\n invariant(publicKey);\n\n return {\n sign: (message, secretKey, cb) => {\n callbackify(signer.sign.bind(signer!))(publicKey, message, (err, result) => {\n if (err) {\n cb(err, null);\n return;\n }\n\n cb(null, arrayToBuffer(result));\n });\n },\n\n verify: async (message, signature, key, cb) => {\n // NOTE: Uses the public key passed into function.\n callbackify(verifySignature)(publicKey, message, signature, cb);\n },\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type {\n HypercoreOptions,\n ReadStreamOptions,\n ReplicationOptions,\n WriteStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-feed--hypercorestorage-key-options\n */\nexport const defaultFeedOptions: HypercoreOptions = {\n createIfMissing: true,\n valueEncoding: 'binary',\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatereadstreamoptions\n */\nexport const defaultReadStreamOptions: ReadStreamOptions = {\n start: 0,\n end: Infinity,\n snapshot: true,\n tail: false,\n live: false,\n timeout: 0,\n wait: true,\n batch: 1,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatewritestreamopts\n */\nexport const defaultWriteStreamOptions: WriteStreamOptions = {\n maxBlockSize: Infinity,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedreplicateisinitiator-options\n */\nexport const defaultReplicateOptions: ReplicationOptions = {\n live: false,\n ack: false,\n download: true,\n upload: true,\n encrypted: true,\n noise: true,\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport { type Directory, StorageType, createStorage } from '@dxos/random-access-storage';\nimport hypercore from '@dxos/vendor-hypercore/hypercore';\nimport type { Hypercore, HypercoreOptions } from '@dxos/vendor-hypercore/hypercore';\n\nimport { py } from './util';\n\n/**\n * Creates feeds with default properties.\n */\nexport class HypercoreFactory<T> {\n constructor(\n private readonly _root: Directory = createStorage({ type: StorageType.RAM }).createDirectory(),\n private readonly _options?: HypercoreOptions,\n ) {\n invariant(this._root);\n }\n\n /**\n * Creates a feed using a storage factory prefixed with the feed's key.\n * NOTE: We have to use our `random-access-storage` implementation since the native ones\n * do not behave uniformly across platforms.\n */\n createFeed(publicKey: Buffer, options?: HypercoreOptions): Hypercore<T> {\n const directory = this._root.createDirectory(publicKey.toString('hex'));\n const storage = (filename: string) => directory.getOrCreateFile(filename).native;\n return hypercore(storage, publicKey, Object.assign({}, this._options, options));\n }\n\n /**\n * Creates and opens a feed.\n */\n async openFeed(publicKey: Buffer, options?: HypercoreOptions): Promise<Hypercore<T>> {\n const feed = this.createFeed(publicKey, options);\n await py(feed, feed.open)(); // TODO(burdon): Sometimes strange bug if done inside function.\n return feed;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";;;AAIA,SAAoBA,WAAXC,gBAA4B;;;ACArC,SAASC,mBAAmB;AAG5B,SAAsBC,uBAAuB;AAC7C,SAASC,iBAAiB;AAE1B,SAASC,qBAAqB;;AAMvB,IAAMC,sBAAsB,CAAIC,OAAiBC,UAAsD;EAC5GC,QAAQ,CAACC,QAAWL,cAAcE,MAAME,OAAOC,KAAKF,IAAAA,CAAAA;EACpDG,QAAQ,CAACC,WAAmBL,MAAMI,OAAOC,QAAQJ,IAAAA;AACnD;AAMO,IAAMK,eAAe,CAACC,QAAgBC,cAAAA;AAC3CX,YAAUU,QAAAA,QAAAA;;;;;;;;;AACVV,YAAUW,WAAAA,QAAAA;;;;;;;;;AAEV,SAAO;IACLC,MAAM,CAACC,SAASC,WAAWC,OAAAA;AACzBjB,kBAAYY,OAAOE,KAAKI,KAAKN,MAAAA,CAAAA,EAAUC,WAAWE,SAAS,CAACI,KAAKC,WAAAA;AAC/D,YAAID,KAAK;AACPF,aAAGE,KAAK,IAAA;AACR;QACF;AAEAF,WAAG,MAAMd,cAAciB,MAAAA,CAAAA;MACzB,CAAA;IACF;IAEAC,QAAQ,OAAON,SAASO,WAAWC,KAAKN,OAAAA;AAEtCjB,kBAAYC,eAAAA,EAAiBY,WAAWE,SAASO,WAAWL,EAAAA;IAC9D;EACF;AACF;;;AChCO,IAAMO,qBAAuC;EAClDC,iBAAiB;EACjBC,eAAe;AACjB;AAKO,IAAMC,2BAA8C;EACzDC,OAAO;EACPC,KAAKC;EACLC,UAAU;EACVC,MAAM;EACNC,MAAM;EACNC,SAAS;EACTC,MAAM;EACNC,OAAO;AACT;AAKO,IAAMC,4BAAgD;EAC3DC,cAAcR;AAChB;AAKO,IAAMS,0BAA8C;EACzDN,MAAM;EACNO,KAAK;EACLC,UAAU;EACVC,QAAQ;EACRC,WAAW;EACXC,OAAO;AACT;;;AC9CA,SAASC,aAAAA,kBAAiB;AAC1B,SAAyBC,aAAaC,qBAAqB;AAC3D,OAAOC,eAAe;;;ACFtB,
|
|
6
|
-
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "createCodecEncoding", "codec", "opts", "encode", "obj", "decode", "buffer", "createCrypto", "signer", "publicKey", "sign", "message", "secretKey", "cb", "bind", "err", "result", "verify", "signature", "key", "defaultFeedOptions", "createIfMissing", "valueEncoding", "defaultReadStreamOptions", "start", "end", "Infinity", "snapshot", "tail", "live", "timeout", "wait", "batch", "defaultWriteStreamOptions", "maxBlockSize", "defaultReplicateOptions", "ack", "download", "upload", "encrypted", "noise", "invariant", "StorageType", "createStorage", "hypercore", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nexport { default as hypercore } from '@dxos/vendor-hypercore/hypercore';\nexport type {\n Hypercore,\n HypercoreOptions,\n HypercoreProperties,\n ReadStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\nexport * from './crypto';\nexport * from './defaults';\nexport * from './hypercore-factory';\nexport * from './iterator';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { callbackify } from 'node:util';\n\nimport { type Codec, type EncodingOptions } from '@dxos/codec-protobuf';\nimport { type Signer, verifySignature } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { type PublicKey } from '@dxos/keys';\nimport { arrayToBuffer } from '@dxos/util';\nimport { type AbstractValueEncoding, type Crypto } from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * Create encoding (e.g., from protobuf codec).\n */\nexport const createCodecEncoding = <T>(codec: Codec<T>, opts?: EncodingOptions): AbstractValueEncoding<T> => ({\n encode: (obj: T) => arrayToBuffer(codec.encode(obj, opts)),\n decode: (buffer: Buffer) => codec.decode(buffer, opts),\n});\n\n/**\n * Create a custom hypercore crypto signer.\n */\n// TODO(burdon): Create test without adding deps.\nexport const createCrypto = (signer: Signer, publicKey: PublicKey): Crypto => {\n invariant(signer);\n invariant(publicKey);\n\n return {\n sign: (message, secretKey, cb) => {\n callbackify(signer.sign.bind(signer!))(publicKey, message, (err, result) => {\n if (err) {\n cb(err, null);\n return;\n }\n\n cb(null, arrayToBuffer(result));\n });\n },\n\n verify: async (message, signature, key, cb) => {\n // NOTE: Uses the public key passed into function.\n callbackify(verifySignature)(publicKey, message, signature, cb);\n },\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type {\n HypercoreOptions,\n ReadStreamOptions,\n ReplicationOptions,\n WriteStreamOptions,\n} from '@dxos/vendor-hypercore/hypercore';\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-feed--hypercorestorage-key-options\n */\nexport const defaultFeedOptions: HypercoreOptions = {\n createIfMissing: true,\n valueEncoding: 'binary',\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatereadstreamoptions\n */\nexport const defaultReadStreamOptions: ReadStreamOptions = {\n start: 0,\n end: Infinity,\n snapshot: true,\n tail: false,\n live: false,\n timeout: 0,\n wait: true,\n batch: 1,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedcreatewritestreamopts\n */\nexport const defaultWriteStreamOptions: WriteStreamOptions = {\n maxBlockSize: Infinity,\n};\n\n/**\n * https://github.com/hypercore-protocol/hypercore/tree/v9.12.0#var-stream--feedreplicateisinitiator-options\n */\nexport const defaultReplicateOptions: ReplicationOptions = {\n live: false,\n ack: false,\n download: true,\n upload: true,\n encrypted: true,\n noise: true,\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport { type Directory, StorageType, createStorage } from '@dxos/random-access-storage';\nimport hypercore from '@dxos/vendor-hypercore/hypercore';\nimport type { Hypercore, HypercoreOptions } from '@dxos/vendor-hypercore/hypercore';\n\nimport { py } from './util';\n\n/**\n * Creates feeds with default properties.\n */\nexport class HypercoreFactory<T> {\n constructor(\n private readonly _root: Directory = createStorage({ type: StorageType.RAM }).createDirectory(),\n private readonly _options?: HypercoreOptions,\n ) {\n invariant(this._root);\n }\n\n /**\n * Creates a feed using a storage factory prefixed with the feed's key.\n * NOTE: We have to use our `random-access-storage` implementation since the native ones\n * do not behave uniformly across platforms.\n */\n createFeed(publicKey: Buffer, options?: HypercoreOptions): Hypercore<T> {\n const directory = this._root.createDirectory(publicKey.toString('hex'));\n const storage = (filename: string) => directory.getOrCreateFile(filename).native;\n return hypercore(storage, publicKey, Object.assign({}, this._options, options));\n }\n\n /**\n * Creates and opens a feed.\n */\n async openFeed(publicKey: Buffer, options?: HypercoreOptions): Promise<Hypercore<T>> {\n const feed = this.createFeed(publicKey, options);\n await py(feed, feed.open)(); // TODO(burdon): Sometimes strange bug if done inside function.\n return feed;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { promisify } from 'node:util';\n\nexport const py = (obj: any, fn: Function) => promisify(fn.bind(obj));\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { Readable } from 'readable-stream';\nimport { type Readable as StreamXReadable } from 'streamx';\n\n/**\n * Wraps streamx.Readable (hypercore.createReadStream) to a standard Readable stream.\n *\n * The read-stream package is mirror of the streams implementations in Node.js 18.9.0.\n * This function is here to standardize the cast in case there are incompatibilities\n * across different platforms.\n *\n * Hypercore createReadStream returns a `streamx` Readable, which does not close properly on destroy.\n *\n * https://github.com/nodejs/readable-stream\n * https://nodejs.org/api/stream.html#readable-streams\n * https://nodejs.org/dist/v18.9.0/docs/api/stream.html#readablewrapstream\n */\nexport const createReadable = (stream: StreamXReadable): Readable => {\n return new Readable({ objectMode: true }).wrap(stream as any);\n};\n\n/**\n * Converts streamx.Readable (hypercore.createReadStream) to an async iterator.\n *\n * https://github.com/tc39/proposal-async-iteration\n * https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#async-iteration\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols\n */\nexport const createAsyncIterator = (stream: Readable): AsyncIterator<any> => {\n return stream[Symbol.asyncIterator]();\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAAoBA,WAAXC,gBAA4B;;;ACArC,SAASC,mBAAmB;AAG5B,SAAsBC,uBAAuB;AAC7C,SAASC,iBAAiB;AAE1B,SAASC,qBAAqB;;AAMvB,IAAMC,sBAAsB,CAAIC,OAAiBC,UAAsD;EAC5GC,QAAQ,CAACC,QAAWL,cAAcE,MAAME,OAAOC,KAAKF,IAAAA,CAAAA;EACpDG,QAAQ,CAACC,WAAmBL,MAAMI,OAAOC,QAAQJ,IAAAA;AACnD;AAMO,IAAMK,eAAe,CAACC,QAAgBC,cAAAA;AAC3CX,YAAUU,QAAAA,QAAAA;;;;;;;;;AACVV,YAAUW,WAAAA,QAAAA;;;;;;;;;AAEV,SAAO;IACLC,MAAM,CAACC,SAASC,WAAWC,OAAAA;AACzBjB,kBAAYY,OAAOE,KAAKI,KAAKN,MAAAA,CAAAA,EAAUC,WAAWE,SAAS,CAACI,KAAKC,WAAAA;AAC/D,YAAID,KAAK;AACPF,aAAGE,KAAK,IAAA;AACR;QACF;AAEAF,WAAG,MAAMd,cAAciB,MAAAA,CAAAA;MACzB,CAAA;IACF;IAEAC,QAAQ,OAAON,SAASO,WAAWC,KAAKN,OAAAA;AAEtCjB,kBAAYC,eAAAA,EAAiBY,WAAWE,SAASO,WAAWL,EAAAA;IAC9D;EACF;AACF;;;AChCO,IAAMO,qBAAuC;EAClDC,iBAAiB;EACjBC,eAAe;AACjB;AAKO,IAAMC,2BAA8C;EACzDC,OAAO;EACPC,KAAKC;EACLC,UAAU;EACVC,MAAM;EACNC,MAAM;EACNC,SAAS;EACTC,MAAM;EACNC,OAAO;AACT;AAKO,IAAMC,4BAAgD;EAC3DC,cAAcR;AAChB;AAKO,IAAMS,0BAA8C;EACzDN,MAAM;EACNO,KAAK;EACLC,UAAU;EACVC,QAAQ;EACRC,WAAW;EACXC,OAAO;AACT;;;AC9CA,SAASC,aAAAA,kBAAiB;AAC1B,SAAyBC,aAAaC,qBAAqB;AAC3D,OAAOC,eAAe;;;ACFtB,SAASC,iBAAiB;AAEnB,IAAMC,KAAK,CAACC,KAAUC,OAAiBC,UAAUD,GAAGE,KAAKH,GAAAA,CAAAA;;;;ADQzD,IAAMI,mBAAN,MAAMA;;;EACX,YACmBC,QAAmBC,cAAc;IAAEC,MAAMC,YAAYC;EAAI,CAAA,EAAGC,gBAAe,GAC3EC,UACjB;SAFiBN,QAAAA;SACAM,WAAAA;AAEjBC,IAAAA,WAAU,KAAKP,OAAK,QAAA;;;;;;;;;EACtB;;;;;;EAOAQ,WAAWC,WAAmBC,SAA0C;AACtE,UAAMC,YAAY,KAAKX,MAAMK,gBAAgBI,UAAUG,SAAS,KAAA,CAAA;AAChE,UAAMC,UAAU,CAACC,aAAqBH,UAAUI,gBAAgBD,QAAAA,EAAUE;AAC1E,WAAOC,UAAUJ,SAASJ,WAAWS,OAAOC,OAAO,CAAC,GAAG,KAAKb,UAAUI,OAAAA,CAAAA;EACxE;;;;EAKA,MAAMU,SAASX,WAAmBC,SAAmD;AACnF,UAAMW,OAAO,KAAKb,WAAWC,WAAWC,OAAAA;AACxC,UAAMY,GAAGD,MAAMA,KAAKE,IAAI,EAAA;AACxB,WAAOF;EACT;AACF;;;AErCA,SAASG,gBAAgB;AAgBlB,IAAMC,iBAAiB,CAACC,WAAAA;AAC7B,SAAO,IAAIC,SAAS;IAAEC,YAAY;EAAK,CAAA,EAAGC,KAAKH,MAAAA;AACjD;AAUO,IAAMI,sBAAsB,CAACJ,WAAAA;AAClC,SAAOA,OAAOK,OAAOC,aAAa,EAAC;AACrC;",
|
|
6
|
+
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "createCodecEncoding", "codec", "opts", "encode", "obj", "decode", "buffer", "createCrypto", "signer", "publicKey", "sign", "message", "secretKey", "cb", "bind", "err", "result", "verify", "signature", "key", "defaultFeedOptions", "createIfMissing", "valueEncoding", "defaultReadStreamOptions", "start", "end", "Infinity", "snapshot", "tail", "live", "timeout", "wait", "batch", "defaultWriteStreamOptions", "maxBlockSize", "defaultReplicateOptions", "ack", "download", "upload", "encrypted", "noise", "invariant", "StorageType", "createStorage", "hypercore", "promisify", "py", "obj", "fn", "promisify", "bind", "HypercoreFactory", "_root", "createStorage", "type", "StorageType", "RAM", "createDirectory", "_options", "invariant", "createFeed", "publicKey", "options", "directory", "toString", "storage", "filename", "getOrCreateFile", "native", "hypercore", "Object", "assign", "openFeed", "feed", "py", "open", "Readable", "createReadable", "stream", "Readable", "objectMode", "wrap", "createAsyncIterator", "Symbol", "asyncIterator"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/crypto.ts":{"bytes":4950,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/defaults.ts":{"bytes":3761,"imports":[],"format":"esm"},"src/util.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/crypto.ts":{"bytes":4950,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/defaults.ts":{"bytes":3761,"imports":[],"format":"esm"},"src/util.ts":{"bytes":780,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/hypercore-factory.ts":{"bytes":5214,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/random-access-storage","kind":"import-statement","external":true},{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/iterator.ts":{"bytes":3956,"imports":[{"path":"readable-stream","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1172,"imports":[{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"src/crypto.ts","kind":"import-statement","original":"./crypto"},{"path":"src/defaults.ts","kind":"import-statement","original":"./defaults"},{"path":"src/hypercore-factory.ts","kind":"import-statement","original":"./hypercore-factory"},{"path":"src/iterator.ts","kind":"import-statement","original":"./iterator"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9475},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/random-access-storage","kind":"import-statement","external":true},{"path":"@dxos/vendor-hypercore/hypercore","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"readable-stream","kind":"import-statement","external":true}],"exports":["HypercoreFactory","createAsyncIterator","createCodecEncoding","createCrypto","createReadable","defaultFeedOptions","defaultReadStreamOptions","defaultReplicateOptions","defaultWriteStreamOptions","hypercore"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":72},"src/crypto.ts":{"bytesInOutput":1111},"src/defaults.ts":{"bytesInOutput":426},"src/hypercore-factory.ts":{"bytesInOutput":1329},"src/util.ts":{"bytesInOutput":86},"src/iterator.ts":{"bytesInOutput":230}},"bytes":3772}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,GAAI,KAAK,GAAG,EAAE,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,GAAI,KAAK,GAAG,EAAE,IAAI,QAAQ,aAA4B,CAAC"}
|