@dxos/hypercore 0.8.4-main.ead640a → 0.8.4-main.f466a3d56e

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/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -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
- F: __dxlog_file,
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 util from "@dxos/node-std/util";
83
- var py = (obj, fn) => util.promisify(fn.bind(obj));
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 util from 'node:util';\n\nexport const py = (obj: any, fn: Function) => util.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,KAAK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xC,UAAMe,GAAGD,MAAMA,KAAKE,IAAI,EAAA;AACxB,WAAOF;EACT;EAzBA,YACmBZ,QAAmBe,cAAc;IAAEC,MAAMC,YAAYC;EAAI,CAAA,EAAGjB,gBAAe,GAC3ES,UACjB;;;SAFiBV,QAAAA;SACAU,WAAAA;AAEjBS,IAAAA,WAAU,KAAKnB,OAAK,QAAA;;;;;;;;;EACtB;AAqBF;;;AErCA,SAASoB,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", "util", "py", "obj", "fn", "util", "promisify", "bind", "HypercoreFactory", "createFeed", "publicKey", "options", "directory", "_root", "createDirectory", "toString", "storage", "filename", "getOrCreateFile", "native", "hypercore", "Object", "assign", "_options", "openFeed", "feed", "py", "open", "createStorage", "type", "StorageType", "RAM", "invariant", "Readable", "createReadable", "stream", "Readable", "objectMode", "wrap", "createAsyncIterator", "Symbol", "asyncIterator"]
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,YAAA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AkBC,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":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":788,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/hypercore-factory.ts":{"bytes":5613,"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":9494},"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":1649},"src/util.ts":{"bytesInOutput":92},"src/iterator.ts":{"bytesInOutput":230}},"bytes":4015}}}
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
- F: __dxlog_file,
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 util from "node:util";
85
- var py = (obj, fn) => util.promisify(fn.bind(obj));
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 util from 'node:util';\n\nexport const py = (obj: any, fn: Function) => util.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,YA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Z,QAAmBe,cAAc;IAAEC,MAAMC,YAAYC;EAAI,CAAA,EAAGjB,gBAAe,GAC3ES,UACjB;;;SAFiBV,QAAAA;SACAU,WAAAA;AAEjBS,IAAAA,WAAU,KAAKnB,OAAK,QAAA;;;;;;;;;EACtB;AAqBF;;;AErCA,SAASoB,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", "util", "py", "obj", "fn", "util", "promisify", "bind", "HypercoreFactory", "createFeed", "publicKey", "options", "directory", "_root", "createDirectory", "toString", "storage", "filename", "getOrCreateFile", "native", "hypercore", "Object", "assign", "_options", "openFeed", "feed", "py", "open", "createStorage", "type", "StorageType", "RAM", "invariant", "Readable", "createReadable", "stream", "Readable", "objectMode", "wrap", "createAsyncIterator", "Symbol", "asyncIterator"]
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,EAAA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AAA,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":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":788,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/hypercore-factory.ts":{"bytes":5613,"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":9496},"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":1649},"src/util.ts":{"bytesInOutput":82},"src/iterator.ts":{"bytesInOutput":230}},"bytes":4088}}}
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,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,eAAe,KAAG,qBAAqB,CAAC,CAAC,CAGtG,CAAC;AAEH;;GAEG;AAEH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,WAAW,SAAS,KAAG,MAqBnE,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;gBADT,KAAK,GAAE,SAAsE,EAC7E,QAAQ,CAAC,EAAE,gBAAgB,YAAA;IAK9C;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC;IAMvE;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAKrF"}
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,GAAI,QAAQ,eAAe,KAAG,QAExD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,QAAQ,KAAG,aAAa,CAAC,GAAG,CAEvE,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,GAAI,GAAG,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,GAAI,IAAI,aAAa,EAAE,OAAO,MAAM,SAiBrD,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,GAAI,KAAK,GAAG,EAAE,IAAI,QAAQ,aAAiC,CAAC"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,QAAS,GAAG,MAAM,QAAQ,aAA4B,CAAC"}