@dxos/hypercore 0.8.4-main.dedc0f3 → 0.8.4-main.e00bdcdb52
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 +13 -50
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +13 -50
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/crypto.d.ts.map +1 -1
- package/dist/types/src/hypercore-factory.d.ts.map +1 -1
- package/dist/types/src/iterator.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -25
- package/src/hypercore-factory.test.ts +3 -3
- package/src/hypercore-protocol.test.ts +2 -2
- package/src/hypercore.test.ts +8 -9
- package/src/iterator.test.ts +3 -4
- package/src/replicate.test.ts +4 -4
- package/src/streams.test.ts +3 -4
- package/src/testing.ts +2 -2
- package/src/util.ts +2 -2
|
@@ -12,24 +12,8 @@ var createCodecEncoding = (codec, opts) => ({
|
|
|
12
12
|
decode: (buffer) => codec.decode(buffer, opts)
|
|
13
13
|
});
|
|
14
14
|
var createCrypto = (signer, publicKey) => {
|
|
15
|
-
invariant(signer, void 0, {
|
|
16
|
-
|
|
17
|
-
L: 27,
|
|
18
|
-
S: void 0,
|
|
19
|
-
A: [
|
|
20
|
-
"signer",
|
|
21
|
-
""
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
invariant(publicKey, void 0, {
|
|
25
|
-
F: __dxlog_file,
|
|
26
|
-
L: 28,
|
|
27
|
-
S: void 0,
|
|
28
|
-
A: [
|
|
29
|
-
"publicKey",
|
|
30
|
-
""
|
|
31
|
-
]
|
|
32
|
-
});
|
|
15
|
+
invariant(signer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 18, S: void 0, A: ["signer", ""] });
|
|
16
|
+
invariant(publicKey, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 19, S: void 0, A: ["publicKey", ""] });
|
|
33
17
|
return {
|
|
34
18
|
sign: (message, secretKey, cb) => {
|
|
35
19
|
callbackify(signer.sign.bind(signer))(publicKey, message, (err, result) => {
|
|
@@ -79,25 +63,21 @@ import { StorageType, createStorage } from "@dxos/random-access-storage";
|
|
|
79
63
|
import hypercore from "@dxos/vendor-hypercore/hypercore";
|
|
80
64
|
|
|
81
65
|
// src/util.ts
|
|
82
|
-
import
|
|
83
|
-
var py = (obj, fn) =>
|
|
66
|
+
import { promisify } from "@dxos/node-std/util";
|
|
67
|
+
var py = (obj, fn) => promisify(fn.bind(obj));
|
|
84
68
|
|
|
85
69
|
// 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
70
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/hypercore/src/hypercore-factory.ts";
|
|
100
71
|
var HypercoreFactory = class {
|
|
72
|
+
_root;
|
|
73
|
+
_options;
|
|
74
|
+
constructor(_root = createStorage({
|
|
75
|
+
type: StorageType.RAM
|
|
76
|
+
}).createDirectory(), _options) {
|
|
77
|
+
this._root = _root;
|
|
78
|
+
this._options = _options;
|
|
79
|
+
invariant2(this._root, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 18, S: this, A: ["this._root", ""] });
|
|
80
|
+
}
|
|
101
81
|
/**
|
|
102
82
|
* Creates a feed using a storage factory prefixed with the feed's key.
|
|
103
83
|
* NOTE: We have to use our `random-access-storage` implementation since the native ones
|
|
@@ -116,23 +96,6 @@ var HypercoreFactory = class {
|
|
|
116
96
|
await py(feed, feed.open)();
|
|
117
97
|
return feed;
|
|
118
98
|
}
|
|
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
99
|
};
|
|
137
100
|
|
|
138
101
|
// 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
|
|
6
|
-
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "
|
|
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;AAG9B,IAAA,eAAA;AAKEC,IAASC,sBAAgCA,CAAAA,OAAQC,UAAAA;EAChD,QAAA,CAAA,QAAA,cAAA,MAAA,OAAA,KAAA,IAAA,CAAA;EAEH,QAAA,CAAA,WAAA,MAAA,OAAA,QAAA,IAAA;;AAMEJ,IAAAA,eAAUK,CAAAA,QAAAA,cAAAA;AAEV,YAAO,QAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,QAAA,GAAA,CAAA,UAAA,EAAA,EAAA,CAAA;YACC,WAAUC,QAAAA,EAAAA,YAAWC,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,QAAAA,GAAAA,CAAAA,aAAAA,EAAAA,EAAAA,CAAAA;;oBAEnBC,WAAK,OAAA;kBACJA,OAAK,KAAA,KAAA,MAAA,CAAA,EAAA,WAAA,SAAA,CAAA,KAAA,WAAA;YACR,KAAA;AACF,aAAA,KAAA,IAAA;AAEG;QACL;AACF,WAAA,MAAA,cAAA,MAAA,CAAA;MAEAC,CAAAA;;YAEEX,OAAAA,SAAYC,WAAiBM,KAAAA,OAAWK;AAE5C,kBAAA,eAAA,EAAA,WAAA,SAAA,WAAA,EAAA;IACA;;;;;AChCK,IAAMC,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,OAAiBH,UAAUG,GAAGC,KAAKF,GAAAA,CAAAA;;;ADKhE,IAAAG,gBAAA;;EAIE;;EAC4E,YAAGC,QAAiB,cAE9F;UAFiBC,YAAAA;qBACAC,GAAAA,UAAAA;AAEjBC,SAAAA,QAAU;AACZ,SAAA,WAAA;AAEA,IAAAA,WAAA,KAAA,OAAA,QAAA,EAAA,YAAA,YAAA,GAAAJ,eAAA,GAAA,IAAA,GAAA,MAAA,GAAA,CAAA,cAAA,EAAA,EAAA,CAAA;;;;;;;aAOQK,WAAWC,SAAqBC;AACtC,UAAA,YAAiBF,KAAAA,MAASG,gBAAkBC,UAAW,SAAKN,KAAQ,CAAEO;AACxE,UAAA,UAAA,CAAA,aAAA,UAAA,gBAAA,QAAA,EAAA;AAEA,WAAA,UAAA,SAAA,WAAA,OAAA,OAAA,CAAA,GAAA,KAAA,UAAA,OAAA,CAAA;;;;;QAKE,SAASC,WAAe,SAAK;AAC7B,UAAA,OAAOA,KAAAA,WAAAA,WAAAA,OAAAA;AACT,UAAA,GAAA,MAAA,KAAA,IAAA,EAAA;AACF,WAAA;;;;;AErCA,SAASC,gBAAgB;AAgBlB,IAAMC,iBAAiB,CAACC,WAAAA;AAC7B,SAAO,IAAIF,SAAS;IAAEG,YAAY;EAAK,CAAA,EAAGC,KAAKF,MAAAA;AACjD;AAUO,IAAMG,sBAAsB,CAACH,WAAAA;AAClC,SAAOA,OAAOI,OAAOC,aAAa,EAAC;AACrC;",
|
|
6
|
+
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "decode", "buffer", "opts", "publicKey", "secretKey", "cb", "err", "verify", "message", "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", "bind", "__dxlog_file", "createDirectory", "_root", "_options", "invariant", "storage", "filename", "directory", "publicKey", "assign", "options", "feed", "Readable", "createReadable", "stream", "objectMode", "wrap", "createAsyncIterator", "Symbol", "asyncIterator"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/crypto.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/crypto.ts":{"bytes":4805,"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":3682,"imports":[],"format":"esm"},"src/util.ts":{"bytes":705,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/hypercore-factory.ts":{"bytes":5109,"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":3877,"imports":[{"path":"readable-stream","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1096,"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":9210},"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":1097},"src/defaults.ts":{"bytesInOutput":426},"src/hypercore-factory.ts":{"bytesInOutput":1301},"src/util.ts":{"bytesInOutput":96},"src/iterator.ts":{"bytesInOutput":230}},"bytes":3647}}}
|
|
@@ -14,24 +14,8 @@ var createCodecEncoding = (codec, opts) => ({
|
|
|
14
14
|
decode: (buffer) => codec.decode(buffer, opts)
|
|
15
15
|
});
|
|
16
16
|
var createCrypto = (signer, publicKey) => {
|
|
17
|
-
invariant(signer, void 0, {
|
|
18
|
-
|
|
19
|
-
L: 27,
|
|
20
|
-
S: void 0,
|
|
21
|
-
A: [
|
|
22
|
-
"signer",
|
|
23
|
-
""
|
|
24
|
-
]
|
|
25
|
-
});
|
|
26
|
-
invariant(publicKey, void 0, {
|
|
27
|
-
F: __dxlog_file,
|
|
28
|
-
L: 28,
|
|
29
|
-
S: void 0,
|
|
30
|
-
A: [
|
|
31
|
-
"publicKey",
|
|
32
|
-
""
|
|
33
|
-
]
|
|
34
|
-
});
|
|
17
|
+
invariant(signer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 18, S: void 0, A: ["signer", ""] });
|
|
18
|
+
invariant(publicKey, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 19, S: void 0, A: ["publicKey", ""] });
|
|
35
19
|
return {
|
|
36
20
|
sign: (message, secretKey, cb) => {
|
|
37
21
|
callbackify(signer.sign.bind(signer))(publicKey, message, (err, result) => {
|
|
@@ -81,25 +65,21 @@ import { StorageType, createStorage } from "@dxos/random-access-storage";
|
|
|
81
65
|
import hypercore from "@dxos/vendor-hypercore/hypercore";
|
|
82
66
|
|
|
83
67
|
// src/util.ts
|
|
84
|
-
import
|
|
85
|
-
var py = (obj, fn) =>
|
|
68
|
+
import { promisify } from "node:util";
|
|
69
|
+
var py = (obj, fn) => promisify(fn.bind(obj));
|
|
86
70
|
|
|
87
71
|
// 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
72
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/hypercore/src/hypercore-factory.ts";
|
|
102
73
|
var HypercoreFactory = class {
|
|
74
|
+
_root;
|
|
75
|
+
_options;
|
|
76
|
+
constructor(_root = createStorage({
|
|
77
|
+
type: StorageType.RAM
|
|
78
|
+
}).createDirectory(), _options) {
|
|
79
|
+
this._root = _root;
|
|
80
|
+
this._options = _options;
|
|
81
|
+
invariant2(this._root, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 18, S: this, A: ["this._root", ""] });
|
|
82
|
+
}
|
|
103
83
|
/**
|
|
104
84
|
* Creates a feed using a storage factory prefixed with the feed's key.
|
|
105
85
|
* NOTE: We have to use our `random-access-storage` implementation since the native ones
|
|
@@ -118,23 +98,6 @@ var HypercoreFactory = class {
|
|
|
118
98
|
await py(feed, feed.open)();
|
|
119
99
|
return feed;
|
|
120
100
|
}
|
|
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
101
|
};
|
|
139
102
|
|
|
140
103
|
// 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
|
|
6
|
-
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "
|
|
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;AAG9B,IAAA,eAAA;AAKEC,IAASC,sBAAgCA,CAAAA,OAAQC,UAAAA;EAChD,QAAA,CAAA,QAAA,cAAA,MAAA,OAAA,KAAA,IAAA,CAAA;EAEH,QAAA,CAAA,WAAA,MAAA,OAAA,QAAA,IAAA;;AAMEJ,IAAAA,eAAUK,CAAAA,QAAAA,cAAAA;AAEV,YAAO,QAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,QAAA,GAAA,CAAA,UAAA,EAAA,EAAA,CAAA;YACC,WAAUC,QAAAA,EAAAA,YAAWC,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,QAAAA,GAAAA,CAAAA,aAAAA,EAAAA,EAAAA,CAAAA;;oBAEnBC,WAAK,OAAA;kBACJA,OAAK,KAAA,KAAA,MAAA,CAAA,EAAA,WAAA,SAAA,CAAA,KAAA,WAAA;YACR,KAAA;AACF,aAAA,KAAA,IAAA;AAEG;QACL;AACF,WAAA,MAAA,cAAA,MAAA,CAAA;MAEAC,CAAAA;;YAEEX,OAAAA,SAAYC,WAAiBM,KAAAA,OAAWK;AAE5C,kBAAA,eAAA,EAAA,WAAA,SAAA,WAAA,EAAA;IACA;;;;;AChCK,IAAMC,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,OAAiBH,UAAUG,GAAGC,KAAKF,GAAAA,CAAAA;;;ADKhE,IAAAG,gBAAA;;EAIE;;EAC4E,YAAGC,QAAiB,cAE9F;UAFiBC,YAAAA;qBACAC,GAAAA,UAAAA;AAEjBC,SAAAA,QAAU;AACZ,SAAA,WAAA;AAEA,IAAAA,WAAA,KAAA,OAAA,QAAA,EAAA,YAAA,YAAA,GAAAJ,eAAA,GAAA,IAAA,GAAA,MAAA,GAAA,CAAA,cAAA,EAAA,EAAA,CAAA;;;;;;;aAOQK,WAAWC,SAAqBC;AACtC,UAAA,YAAiBF,KAAAA,MAASG,gBAAkBC,UAAW,SAAKN,KAAQ,CAAEO;AACxE,UAAA,UAAA,CAAA,aAAA,UAAA,gBAAA,QAAA,EAAA;AAEA,WAAA,UAAA,SAAA,WAAA,OAAA,OAAA,CAAA,GAAA,KAAA,UAAA,OAAA,CAAA;;;;;QAKE,SAASC,WAAe,SAAK;AAC7B,UAAA,OAAOA,KAAAA,WAAAA,WAAAA,OAAAA;AACT,UAAA,GAAA,MAAA,KAAA,IAAA,EAAA;AACF,WAAA;;;;;AErCA,SAASC,gBAAgB;AAgBlB,IAAMC,iBAAiB,CAACC,WAAAA;AAC7B,SAAO,IAAIF,SAAS;IAAEG,YAAY;EAAK,CAAA,EAAGC,KAAKF,MAAAA;AACjD;AAUO,IAAMG,sBAAsB,CAACH,WAAAA;AAClC,SAAOA,OAAOI,OAAOC,aAAa,EAAC;AACrC;",
|
|
6
|
+
"names": ["hypercore", "default", "callbackify", "verifySignature", "invariant", "arrayToBuffer", "decode", "buffer", "opts", "publicKey", "secretKey", "cb", "err", "verify", "message", "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", "bind", "__dxlog_file", "createDirectory", "_root", "_options", "invariant", "storage", "filename", "directory", "publicKey", "assign", "options", "feed", "Readable", "createReadable", "stream", "objectMode", "wrap", "createAsyncIterator", "Symbol", "asyncIterator"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/crypto.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/crypto.ts":{"bytes":4805,"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":3682,"imports":[],"format":"esm"},"src/util.ts":{"bytes":705,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/hypercore-factory.ts":{"bytes":5109,"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":3877,"imports":[{"path":"readable-stream","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1096,"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":9212},"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":1087},"src/defaults.ts":{"bytesInOutput":426},"src/hypercore-factory.ts":{"bytesInOutput":1301},"src/util.ts":{"bytesInOutput":86},"src/iterator.ts":{"bytesInOutput":230}},"bytes":3720}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/crypto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE3F;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/crypto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE3F;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,SAAS,eAAe,KAAG,qBAAqB,CAAC,CAAC,CAGtG,CAAC;AAEH;;GAEG;AAEH,eAAO,MAAM,YAAY,WAAY,MAAM,aAAa,SAAS,KAAG,MAqBnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hypercore-factory.d.ts","sourceRoot":"","sources":["../../../src/hypercore-factory.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA8B,MAAM,6BAA6B,CAAC;AAEzF,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpF;;GAEG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"hypercore-factory.d.ts","sourceRoot":"","sources":["../../../src/hypercore-factory.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA8B,MAAM,6BAA6B,CAAC;AAEzF,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpF;;GAEG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAF5B,YACmB,KAAK,GAAE,SAAsE,EAC7E,QAAQ,CAAC,EAAE,gBAAgB,YAAA,EAG7C;IAED;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAItE;IAED;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAInF;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["../../../src/iterator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,KAAK,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["../../../src/iterator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,KAAK,QAAQ,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,QAExD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,WAAY,QAAQ,KAAG,aAAa,CAAC,GAAG,CAEvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,YAAW,CAAC;AAG7B,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,YAAW,CAAC;AAG7B,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,eAAO,MAAM,cAAc,MAAO,MAAM,KAAG,YAGzC,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;AAG7F,eAAO,MAAM,KAAK,OAAQ,aAAa,SAAS,MAAM,SAiBrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,QAAS,GAAG,MAAM,QAAQ,aAA4B,CAAC"}
|