@dxos/feed-store 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8

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.
@@ -2,19 +2,27 @@ import "@dxos/node-std/globals";
2
2
  import {
3
3
  FeedFactory,
4
4
  FeedStore
5
- } from "../chunk-YBS47XQD.mjs";
5
+ } from "../chunk-HBSCNY5U.mjs";
6
6
 
7
7
  // src/testing/mocks.ts
8
8
  import { Event, scheduleTask } from "@dxos/async";
9
9
  import { Context } from "@dxos/context";
10
10
  import { PublicKey } from "@dxos/keys";
11
+ function _define_property(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
18
+ });
19
+ } else {
20
+ obj[key] = value;
21
+ }
22
+ return obj;
23
+ }
11
24
  var __dxlog_file = "/__w/dxos/dxos/packages/common/feed-store/src/testing/mocks.ts";
12
25
  var MockFeedWriter = class {
13
- constructor(feedKey = PublicKey.random()) {
14
- this.feedKey = feedKey;
15
- this.written = new Event();
16
- this.messages = [];
17
- }
18
26
  async write(data, { afterWrite } = {}) {
19
27
  this.messages.push(data);
20
28
  const receipt = {
@@ -33,16 +41,37 @@ var MockFeedWriter = class {
33
41
  });
34
42
  return receipt;
35
43
  }
44
+ constructor(feedKey = PublicKey.random()) {
45
+ _define_property(this, "feedKey", void 0);
46
+ _define_property(this, "written", void 0);
47
+ _define_property(this, "messages", void 0);
48
+ this.feedKey = feedKey;
49
+ this.written = new Event();
50
+ this.messages = [];
51
+ }
36
52
  };
37
53
 
38
54
  // src/testing/test-builder.ts
39
55
  import { Keyring } from "@dxos/keyring";
40
- import { createStorage, StorageType } from "@dxos/random-access-storage";
56
+ import { StorageType, createStorage } from "@dxos/random-access-storage";
41
57
 
42
58
  // src/testing/test-generator.ts
43
59
  import { sleep } from "@dxos/async";
44
60
  import { createCodecEncoding } from "@dxos/hypercore";
45
61
  import { faker } from "@dxos/random";
62
+ function _define_property2(obj, key, value) {
63
+ if (key in obj) {
64
+ Object.defineProperty(obj, key, {
65
+ value,
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true
69
+ });
70
+ } else {
71
+ obj[key] = value;
72
+ }
73
+ return obj;
74
+ }
46
75
  var defaultCodec = {
47
76
  encode: (obj) => Buffer.from(JSON.stringify(obj)),
48
77
  decode: (buffer) => JSON.parse(buffer.toString())
@@ -54,10 +83,6 @@ var defaultTestBlockGenerator = (i) => ({
54
83
  value: faker.lorem.sentence()
55
84
  });
56
85
  var TestGenerator = class {
57
- constructor(_generate) {
58
- this._generate = _generate;
59
- this._count = 0;
60
- }
61
86
  async writeBlocks(writer, { count = 1, delay } = {}) {
62
87
  return await Promise.all(Array.from(Array(count)).map(async () => {
63
88
  const data = this._generate(this._count++);
@@ -68,18 +93,31 @@ var TestGenerator = class {
68
93
  return receipt;
69
94
  }));
70
95
  }
96
+ constructor(_generate) {
97
+ _define_property2(this, "_generate", void 0);
98
+ _define_property2(this, "_count", void 0);
99
+ this._generate = _generate;
100
+ this._count = 0;
101
+ }
71
102
  };
72
103
  var defaultTestGenerator = new TestGenerator(defaultTestBlockGenerator);
73
104
 
74
105
  // src/testing/test-builder.ts
106
+ function _define_property3(obj, key, value) {
107
+ if (key in obj) {
108
+ Object.defineProperty(obj, key, {
109
+ value,
110
+ enumerable: true,
111
+ configurable: true,
112
+ writable: true
113
+ });
114
+ } else {
115
+ obj[key] = value;
116
+ }
117
+ return obj;
118
+ }
75
119
  var evaluate = (builder, arg) => arg === "function" ? arg(builder) : arg;
76
120
  var TestBuilder = class _TestBuilder {
77
- static {
78
- this.ROOT_DIR = "feeds";
79
- }
80
- constructor(_properties = {}) {
81
- this._properties = _properties;
82
- }
83
121
  /**
84
122
  * Creates a new builder with the current builder's properties.
85
123
  */
@@ -87,15 +125,18 @@ var TestBuilder = class _TestBuilder {
87
125
  return new _TestBuilder(Object.assign({}, this._properties));
88
126
  }
89
127
  get keyring() {
90
- return this._properties.keyring ??= new Keyring();
128
+ var _this__properties;
129
+ return (_this__properties = this._properties).keyring ?? (_this__properties.keyring = new Keyring());
91
130
  }
92
131
  get storage() {
93
- return this._properties.storage ??= createStorage({
132
+ var _this__properties;
133
+ return (_this__properties = this._properties).storage ?? (_this__properties.storage = createStorage({
94
134
  type: StorageType.RAM
95
- });
135
+ }));
96
136
  }
97
137
  get root() {
98
- return this._properties.root ??= this.storage.createDirectory(_TestBuilder.ROOT_DIR);
138
+ var _this__properties;
139
+ return (_this__properties = this._properties).root ?? (_this__properties.root = this.storage.createDirectory(_TestBuilder.ROOT_DIR));
99
140
  }
100
141
  setKeyring(keyring) {
101
142
  this._properties.keyring = evaluate(this, keyring);
@@ -126,20 +167,25 @@ var TestBuilder = class _TestBuilder {
126
167
  factory: this.createFeedFactory()
127
168
  });
128
169
  }
170
+ constructor(_properties = {}) {
171
+ _define_property3(this, "_properties", void 0);
172
+ this._properties = _properties;
173
+ }
129
174
  };
175
+ _define_property3(TestBuilder, "ROOT_DIR", "feeds");
130
176
  var TestItemBuilder = class extends TestBuilder {
131
- constructor() {
132
- super({
133
- valueEncoding: defaultValueEncoding,
134
- generator: defaultTestGenerator
135
- });
136
- }
137
177
  get valueEncoding() {
138
178
  return this._properties.valueEncoding;
139
179
  }
140
180
  get generator() {
141
181
  return this._properties.generator;
142
182
  }
183
+ constructor() {
184
+ super({
185
+ valueEncoding: defaultValueEncoding,
186
+ generator: defaultTestGenerator
187
+ });
188
+ }
143
189
  };
144
190
  export {
145
191
  MockFeedWriter,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/testing/mocks.ts", "../../../../src/testing/test-builder.ts", "../../../../src/testing/test-generator.ts"],
4
- "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { Event, scheduleTask } from '@dxos/async';\nimport { Context } from '@dxos/context';\nimport { PublicKey } from '@dxos/keys';\n\nimport type { FeedWriter, WriteOptions, WriteReceipt } from '../feed-writer';\n\n/**\n * Mock writer collects and emits messages.\n */\nexport class MockFeedWriter<T extends {}> implements FeedWriter<T> {\n public readonly written = new Event<[T, WriteReceipt]>();\n public readonly messages: T[] = [];\n\n constructor(readonly feedKey = PublicKey.random()) {}\n\n async write(data: T, { afterWrite }: WriteOptions = {}): Promise<WriteReceipt> {\n this.messages.push(data);\n\n const receipt: WriteReceipt = {\n feedKey: this.feedKey,\n seq: this.messages.length - 1,\n };\n\n await afterWrite?.(receipt);\n\n scheduleTask(new Context(), () => {\n this.written.emit([data, receipt]);\n });\n\n return receipt;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type { ValueEncoding } from 'hypercore';\n\nimport { Keyring } from '@dxos/keyring';\nimport { createStorage, type Directory, type Storage, StorageType } from '@dxos/random-access-storage';\n\nimport { defaultTestGenerator, defaultValueEncoding, type TestGenerator, type TestItem } from './test-generator';\nimport { FeedFactory } from '../feed-factory';\nimport { FeedStore } from '../feed-store';\n\nexport type TestBuilderOptions<T extends {}> = {\n storage?: Storage;\n root?: Directory;\n keyring?: Keyring;\n valueEncoding?: ValueEncoding<T>;\n generator?: TestGenerator<T>;\n};\n\ntype PropertyProvider<T extends {}, P> = (cb: TestBuilder<T>) => P;\n\nconst evaluate = <T extends {}, P>(builder: TestBuilder<T>, arg: P | PropertyProvider<T, P>) =>\n arg === 'function' ? (arg as Function)(builder) : arg;\n\n/**\n * The builder provides building blocks for tests with sensible defaults.\n * - Factory methods trigger the automatic generation of unset required properties.\n * - Avoids explosion of overly specific test functions that require and return large bags of properties.\n */\nexport class TestBuilder<T extends {}> {\n static readonly ROOT_DIR = 'feeds';\n\n constructor(public readonly _properties: TestBuilderOptions<T> = {}) {}\n\n /**\n * Creates a new builder with the current builder's properties.\n */\n clone(): TestBuilder<T> {\n return new TestBuilder<T>(Object.assign({}, this._properties));\n }\n\n get keyring(): Keyring {\n return (this._properties.keyring ??= new Keyring());\n }\n\n get storage(): Storage {\n return (this._properties.storage ??= createStorage({ type: StorageType.RAM }));\n }\n\n get root(): Directory {\n return (this._properties.root ??= this.storage.createDirectory(TestBuilder.ROOT_DIR));\n }\n\n setKeyring(keyring: Keyring | PropertyProvider<T, Keyring>): this {\n this._properties.keyring = evaluate(this, keyring);\n return this;\n }\n\n setStorage(storage: Storage, root?: string): this {\n this._properties.storage = evaluate(this, storage);\n if (root) {\n this._properties.root = this.storage.createDirectory(root);\n }\n\n return this;\n }\n\n setRoot(root: Directory): this {\n this._properties.root = evaluate(this, root);\n return this;\n }\n\n createFeedFactory(): FeedFactory<T> {\n return new FeedFactory<T>({\n root: this.root,\n signer: this.keyring,\n hypercore: {\n valueEncoding: this._properties.valueEncoding,\n },\n });\n }\n\n createFeedStore(): FeedStore<T> {\n return new FeedStore<T>({\n factory: this.createFeedFactory(),\n });\n }\n}\n\n/**\n * Builder with default encoder and generator.\n */\nexport class TestItemBuilder extends TestBuilder<TestItem> {\n constructor() {\n super({\n valueEncoding: defaultValueEncoding,\n generator: defaultTestGenerator,\n });\n }\n\n get valueEncoding() {\n return this._properties.valueEncoding!;\n }\n\n get generator() {\n return this._properties.generator!;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type { AbstractValueEncoding } from 'hypercore';\n\nimport { sleep } from '@dxos/async';\nimport { type Codec } from '@dxos/codec-protobuf';\nimport { createCodecEncoding } from '@dxos/hypercore';\nimport { faker } from '@dxos/random';\n\nimport { type FeedWriter } from '../feed-writer';\n\nexport type TestItem = {\n id: string;\n index: number;\n value: string;\n};\n\nexport const defaultCodec: Codec<any> = {\n encode: (obj: any) => Buffer.from(JSON.stringify(obj)),\n decode: (buffer: Uint8Array) => JSON.parse(buffer.toString()),\n};\n\nexport const defaultValueEncoding: AbstractValueEncoding<any> = createCodecEncoding(defaultCodec);\n\nexport type TestBlockGenerator<T> = (i: number) => T;\n\nexport const defaultTestBlockGenerator: TestBlockGenerator<TestItem> = (i) => ({\n id: faker.string.uuid(),\n index: i,\n value: faker.lorem.sentence(),\n});\n\n/**\n * Writes data to feeds.\n */\nexport class TestGenerator<T extends {}> {\n _count = 0;\n\n constructor(private readonly _generate: TestBlockGenerator<T>) {}\n\n async writeBlocks(\n writer: FeedWriter<T>,\n {\n count = 1,\n delay,\n }: {\n count?: number;\n delay?: {\n min: number;\n max: number;\n };\n } = {},\n ) {\n return await Promise.all(\n Array.from(Array(count)).map(async () => {\n const data = this._generate(this._count++);\n const receipt = await writer.write(data);\n if (delay) {\n await sleep(faker.number.int(delay));\n }\n\n return receipt;\n }),\n );\n }\n}\n\nexport const defaultTestGenerator = new TestGenerator<TestItem>(defaultTestBlockGenerator);\n"],
5
- "mappings": ";;;;;;;AAIA,SAASA,OAAOC,oBAAoB;AACpC,SAASC,eAAe;AACxB,SAASC,iBAAiB;;AAOnB,IAAMC,iBAAN,MAAMA;EAIX,YAAqBC,UAAUF,UAAUG,OAAM,GAAI;SAA9BD,UAAAA;SAHLE,UAAU,IAAIP,MAAAA;SACdQ,WAAgB,CAAA;EAEoB;EAEpD,MAAMC,MAAMC,MAAS,EAAEC,WAAU,IAAmB,CAAC,GAA0B;AAC7E,SAAKH,SAASI,KAAKF,IAAAA;AAEnB,UAAMG,UAAwB;MAC5BR,SAAS,KAAKA;MACdS,KAAK,KAAKN,SAASO,SAAS;IAC9B;AAEA,UAAMJ,aAAaE,OAAAA;AAEnBZ,iBAAa,IAAIC,QAAAA,QAAAA;;;QAAW,MAAA;AAC1B,WAAKK,QAAQS,KAAK;QAACN;QAAMG;OAAQ;IACnC,CAAA;AAEA,WAAOA;EACT;AACF;;;AC7BA,SAASI,eAAe;AACxB,SAASC,eAA6CC,mBAAmB;;;ACDzE,SAASC,aAAa;AAEtB,SAASC,2BAA2B;AACpC,SAASC,aAAa;AAUf,IAAMC,eAA2B;EACtCC,QAAQ,CAACC,QAAaC,OAAOC,KAAKC,KAAKC,UAAUJ,GAAAA,CAAAA;EACjDK,QAAQ,CAACC,WAAuBH,KAAKI,MAAMD,OAAOE,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AS,KAAKL,QAAQM,gBAAgBd,aAAYC,QAAQ;EACrF;EAEAc,WAAWT,SAAuD;AAChE,SAAKJ,YAAYI,UAAUT,SAAS,MAAMS,OAAAA;AAC1C,WAAO;EACT;EAEAU,WAAWR,SAAkBK,MAAqB;AAChD,SAAKX,YAAYM,UAAUX,SAAS,MAAMW,OAAAA;AAC1C,QAAIK,MAAM;AACR,WAAKX,YAAYW,OAAO,KAAKL,QAAQM,gBAAgBD,IAAAA;IACvD;AAEA,WAAO;EACT;EAEAI,QAAQJ,MAAuB;AAC7B,SAAKX,YAAYW,OAAOhB,SAAS,MAAMgB,IAAAA;AACvC,WAAO;EACT;EAEAK,oBAAoC;AAClC,WAAO,IAAIC,YAAe;MACxBN,MAAM,KAAKA;MACXO,QAAQ,KAAKd;MACbe,WAAW;QACTC,eAAe,KAAKpB,YAAYoB;MAClC;IACF,CAAA;EACF;EAEAC,kBAAgC;AAC9B,WAAO,IAAIC,UAAa;MACtBC,SAAS,KAAKP,kBAAiB;IACjC,CAAA;EACF;AACF;AAKO,IAAMQ,kBAAN,cAA8B1B,YAAAA;EACnC,cAAc;AACZ,UAAM;MACJsB,eAAeK;MACfC,WAAWC;IACb,CAAA;EACF;EAEA,IAAIP,gBAAgB;AAClB,WAAO,KAAKpB,YAAYoB;EAC1B;EAEA,IAAIM,YAAY;AACd,WAAO,KAAK1B,YAAY0B;EAC1B;AACF;",
6
- "names": ["Event", "scheduleTask", "Context", "PublicKey", "MockFeedWriter", "feedKey", "random", "written", "messages", "write", "data", "afterWrite", "push", "receipt", "seq", "length", "emit", "Keyring", "createStorage", "StorageType", "sleep", "createCodecEncoding", "faker", "defaultCodec", "encode", "obj", "Buffer", "from", "JSON", "stringify", "decode", "buffer", "parse", "toString", "defaultValueEncoding", "createCodecEncoding", "defaultTestBlockGenerator", "i", "id", "faker", "string", "uuid", "index", "value", "lorem", "sentence", "TestGenerator", "_generate", "_count", "writeBlocks", "writer", "count", "delay", "Promise", "all", "Array", "map", "data", "receipt", "write", "sleep", "number", "int", "defaultTestGenerator", "evaluate", "builder", "arg", "TestBuilder", "ROOT_DIR", "_properties", "clone", "Object", "assign", "keyring", "Keyring", "storage", "createStorage", "type", "StorageType", "RAM", "root", "createDirectory", "setKeyring", "setStorage", "setRoot", "createFeedFactory", "FeedFactory", "signer", "hypercore", "valueEncoding", "createFeedStore", "FeedStore", "factory", "TestItemBuilder", "defaultValueEncoding", "generator", "defaultTestGenerator"]
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { Event, scheduleTask } from '@dxos/async';\nimport { Context } from '@dxos/context';\nimport { PublicKey } from '@dxos/keys';\n\nimport type { FeedWriter, WriteOptions, WriteReceipt } from '../feed-writer';\n\n/**\n * Mock writer collects and emits messages.\n */\nexport class MockFeedWriter<T extends {}> implements FeedWriter<T> {\n public readonly written = new Event<[T, WriteReceipt]>();\n public readonly messages: T[] = [];\n\n constructor(readonly feedKey = PublicKey.random()) {}\n\n async write(data: T, { afterWrite }: WriteOptions = {}): Promise<WriteReceipt> {\n this.messages.push(data);\n\n const receipt: WriteReceipt = {\n feedKey: this.feedKey,\n seq: this.messages.length - 1,\n };\n\n await afterWrite?.(receipt);\n\n scheduleTask(new Context(), () => {\n this.written.emit([data, receipt]);\n });\n\n return receipt;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type { ValueEncoding } from 'hypercore';\n\nimport { Keyring } from '@dxos/keyring';\nimport { type Directory, type Storage, StorageType, createStorage } from '@dxos/random-access-storage';\n\nimport { FeedFactory } from '../feed-factory';\nimport { FeedStore } from '../feed-store';\n\nimport { type TestGenerator, type TestItem, defaultTestGenerator, defaultValueEncoding } from './test-generator';\n\nexport type TestBuilderOptions<T extends {}> = {\n storage?: Storage;\n root?: Directory;\n keyring?: Keyring;\n valueEncoding?: ValueEncoding<T>;\n generator?: TestGenerator<T>;\n};\n\ntype PropertyProvider<T extends {}, P> = (cb: TestBuilder<T>) => P;\n\nconst evaluate = <T extends {}, P>(builder: TestBuilder<T>, arg: P | PropertyProvider<T, P>) =>\n arg === 'function' ? (arg as Function)(builder) : arg;\n\n/**\n * The builder provides building blocks for tests with sensible defaults.\n * - Factory methods trigger the automatic generation of unset required properties.\n * - Avoids explosion of overly specific test functions that require and return large bags of properties.\n */\nexport class TestBuilder<T extends {}> {\n static readonly ROOT_DIR = 'feeds';\n\n constructor(public readonly _properties: TestBuilderOptions<T> = {}) {}\n\n /**\n * Creates a new builder with the current builder's properties.\n */\n clone(): TestBuilder<T> {\n return new TestBuilder<T>(Object.assign({}, this._properties));\n }\n\n get keyring(): Keyring {\n return (this._properties.keyring ??= new Keyring());\n }\n\n get storage(): Storage {\n return (this._properties.storage ??= createStorage({ type: StorageType.RAM }));\n }\n\n get root(): Directory {\n return (this._properties.root ??= this.storage.createDirectory(TestBuilder.ROOT_DIR));\n }\n\n setKeyring(keyring: Keyring | PropertyProvider<T, Keyring>): this {\n this._properties.keyring = evaluate(this, keyring);\n return this;\n }\n\n setStorage(storage: Storage, root?: string): this {\n this._properties.storage = evaluate(this, storage);\n if (root) {\n this._properties.root = this.storage.createDirectory(root);\n }\n\n return this;\n }\n\n setRoot(root: Directory): this {\n this._properties.root = evaluate(this, root);\n return this;\n }\n\n createFeedFactory(): FeedFactory<T> {\n return new FeedFactory<T>({\n root: this.root,\n signer: this.keyring,\n hypercore: {\n valueEncoding: this._properties.valueEncoding,\n },\n });\n }\n\n createFeedStore(): FeedStore<T> {\n return new FeedStore<T>({\n factory: this.createFeedFactory(),\n });\n }\n}\n\n/**\n * Builder with default encoder and generator.\n */\nexport class TestItemBuilder extends TestBuilder<TestItem> {\n constructor() {\n super({\n valueEncoding: defaultValueEncoding,\n generator: defaultTestGenerator,\n });\n }\n\n get valueEncoding() {\n return this._properties.valueEncoding!;\n }\n\n get generator() {\n return this._properties.generator!;\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport type { AbstractValueEncoding } from 'hypercore';\n\nimport { sleep } from '@dxos/async';\nimport { type Codec } from '@dxos/codec-protobuf';\nimport { createCodecEncoding } from '@dxos/hypercore';\nimport { faker } from '@dxos/random';\n\nimport { type FeedWriter } from '../feed-writer';\n\nexport type TestItem = {\n id: string;\n index: number;\n value: string;\n};\n\nexport const defaultCodec: Codec<any> = {\n encode: (obj: any) => Buffer.from(JSON.stringify(obj)),\n decode: (buffer: Uint8Array) => JSON.parse(buffer.toString()),\n};\n\nexport const defaultValueEncoding: AbstractValueEncoding<any> = createCodecEncoding(defaultCodec);\n\nexport type TestBlockGenerator<T> = (i: number) => T;\n\nexport const defaultTestBlockGenerator: TestBlockGenerator<TestItem> = (i) => ({\n id: faker.string.uuid(),\n index: i,\n value: faker.lorem.sentence(),\n});\n\n/**\n * Writes data to feeds.\n */\nexport class TestGenerator<T extends {}> {\n _count = 0;\n\n constructor(private readonly _generate: TestBlockGenerator<T>) {}\n\n async writeBlocks(\n writer: FeedWriter<T>,\n {\n count = 1,\n delay,\n }: {\n count?: number;\n delay?: {\n min: number;\n max: number;\n };\n } = {},\n ) {\n return await Promise.all(\n Array.from(Array(count)).map(async () => {\n const data = this._generate(this._count++);\n const receipt = await writer.write(data);\n if (delay) {\n await sleep(faker.number.int(delay));\n }\n\n return receipt;\n }),\n );\n }\n}\n\nexport const defaultTestGenerator = new TestGenerator<TestItem>(defaultTestBlockGenerator);\n"],
5
+ "mappings": ";;;;;;;AAIA,SAASA,OAAOC,oBAAoB;AACpC,SAASC,eAAe;AACxB,SAASC,iBAAiB;;;;;;;;;;;;;;;AAOnB,IAAMC,iBAAN,MAAMA;EAMX,MAAMC,MAAMC,MAAS,EAAEC,WAAU,IAAmB,CAAC,GAA0B;AAC7E,SAAKC,SAASC,KAAKH,IAAAA;AAEnB,UAAMI,UAAwB;MAC5BC,SAAS,KAAKA;MACdC,KAAK,KAAKJ,SAASK,SAAS;IAC9B;AAEA,UAAMN,aAAaG,OAAAA;AAEnBT,iBAAa,IAAIC,QAAAA,QAAAA;;;QAAW,MAAA;AAC1B,WAA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IACjC,CAAA;EACF;EAtDA,YAA4Bd,cAAqC,CAAC,GAAG;;SAAzCA,cAAAA;EAA0C;AAuDxE;AAzDEsB,kBADW1B,aACKc,YAAW,OAAA;AA8DtB,IAAMa,kBAAN,cAA8B3B,YAAAA;EAQnC,IAAIsB,gBAAgB;AAClB,WAAO,KAAKlB,YAAYkB;EAC1B;EAEA,IAAIM,YAAY;AACd,WAAO,KAAKxB,YAAYwB;EAC1B;EAbA,cAAc;AACZ,UAAM;MACJN,eAAeO;MACfD,WAAWE;IACb,CAAA;EACF;AASF;",
6
+ "names": ["Event", "scheduleTask", "Context", "PublicKey", "MockFeedWriter", "write", "data", "afterWrite", "messages", "push", "receipt", "feedKey", "seq", "length", "written", "emit", "random", "Keyring", "StorageType", "createStorage", "sleep", "createCodecEncoding", "faker", "defaultCodec", "encode", "obj", "Buffer", "from", "JSON", "stringify", "decode", "buffer", "parse", "toString", "defaultValueEncoding", "createCodecEncoding", "defaultTestBlockGenerator", "i", "id", "faker", "string", "uuid", "index", "value", "lorem", "sentence", "TestGenerator", "writeBlocks", "writer", "count", "delay", "Promise", "all", "Array", "map", "data", "_generate", "_count", "receipt", "write", "sleep", "number", "int", "defaultTestGenerator", "evaluate", "builder", "arg", "TestBuilder", "clone", "Object", "assign", "_properties", "keyring", "Keyring", "storage", "createStorage", "type", "StorageType", "RAM", "root", "createDirectory", "ROOT_DIR", "setKeyring", "setStorage", "setRoot", "createFeedFactory", "FeedFactory", "signer", "hypercore", "valueEncoding", "createFeedStore", "FeedStore", "factory", "_define_property", "TestItemBuilder", "generator", "defaultValueEncoding", "defaultTestGenerator"]
7
7
  }
@@ -4,73 +4,27 @@ import { createRequire } from 'node:module';const require = createRequire(import
4
4
  import { inspect } from "node:util";
5
5
  import { Readable, Transform } from "streamx";
6
6
  import { Trigger } from "@dxos/async";
7
- import { inspectObject, StackTrace } from "@dxos/debug";
7
+ import { StackTrace, inspectObject } from "@dxos/debug";
8
8
  import { invariant } from "@dxos/invariant";
9
9
  import { log } from "@dxos/log";
10
10
  import { arrayToBuffer, createBinder, rangeFromTo } from "@dxos/util";
11
- var __dxlog_file = "/__w/dxos/dxos/packages/common/feed-store/src/feed-wrapper.ts";
12
- var FeedWrapper = class {
13
- constructor(_hypercore, _key, _storageDirectory) {
14
- this._hypercore = _hypercore;
15
- this._key = _key;
16
- this._storageDirectory = _storageDirectory;
17
- this._pendingWrites = /* @__PURE__ */ new Set();
18
- this._binder = createBinder(this._hypercore);
19
- this._writeLock = new Trigger();
20
- this._closed = false;
21
- this.on = this._binder.fn(this._hypercore.on);
22
- this.off = this._binder.fn(this._hypercore.off);
23
- this.open = this._binder.async(this._hypercore.open);
24
- this._close = this._binder.async(this._hypercore.close);
25
- this.close = async () => {
26
- if (this._pendingWrites.size) {
27
- log.warn("Closing feed with pending writes", {
28
- feed: this._key,
29
- count: this._pendingWrites.size,
30
- pendingWrites: Array.from(this._pendingWrites.values()).map((stack) => stack.getStack())
31
- }, {
32
- F: __dxlog_file,
33
- L: 173,
34
- S: this,
35
- C: (f, a) => f(...a)
36
- });
37
- }
38
- this._closed = true;
39
- await this.flushToDisk();
40
- await this._close();
41
- };
42
- this.has = this._binder.fn(this._hypercore.has);
43
- this.get = this._binder.async(this._hypercore.get);
44
- this.append = this._binder.async(this._hypercore.append);
45
- this.download = this._binder.fn(this._hypercore.download);
46
- this.undownload = this._binder.fn(this._hypercore.undownload);
47
- this.setDownloading = this._binder.fn(this._hypercore.setDownloading);
48
- this.replicate = this._binder.fn(this._hypercore.replicate);
49
- this.clear = this._binder.async(this._hypercore.clear);
50
- this.proof = this._binder.async(this._hypercore.proof);
51
- this.put = this._binder.async(this._hypercore.put);
52
- this.putBuffer = this._binder.async(this._hypercore._putBuffer);
53
- invariant(this._hypercore, void 0, {
54
- F: __dxlog_file,
55
- L: 37,
56
- S: this,
57
- A: [
58
- "this._hypercore",
59
- ""
60
- ]
61
- });
62
- invariant(this._key, void 0, {
63
- F: __dxlog_file,
64
- L: 38,
65
- S: this,
66
- A: [
67
- "this._key",
68
- ""
69
- ]
11
+ function _define_property(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
70
18
  });
71
- this._writeLock.wake();
19
+ } else {
20
+ obj[key] = value;
72
21
  }
73
- [inspect.custom]() {
22
+ return obj;
23
+ }
24
+ var __dxlog_file = "/__w/dxos/dxos/packages/common/feed-store/src/feed-wrapper.ts";
25
+ var _inspect_custom = inspect.custom;
26
+ var FeedWrapper = class {
27
+ [_inspect_custom]() {
74
28
  return inspectObject(this);
75
29
  }
76
30
  toJSON() {
@@ -114,13 +68,13 @@ var FeedWrapper = class {
114
68
  seq: this._hypercore.length
115
69
  }, {
116
70
  F: __dxlog_file,
117
- L: 97,
71
+ L: 98,
118
72
  S: this,
119
73
  C: (f, a) => f(...a)
120
74
  });
121
75
  invariant(!this._closed, "Feed closed", {
122
76
  F: __dxlog_file,
123
- L: 98,
77
+ L: 99,
124
78
  S: this,
125
79
  A: [
126
80
  "!this._closed",
@@ -150,7 +104,7 @@ var FeedWrapper = class {
150
104
  const seq = await this.append(data);
151
105
  invariant(seq < this.length, "Invalid seq after write", {
152
106
  F: __dxlog_file,
153
- L: 129,
107
+ L: 130,
154
108
  S: this,
155
109
  A: [
156
110
  "seq < this.length",
@@ -162,7 +116,7 @@ var FeedWrapper = class {
162
116
  seq
163
117
  }, {
164
118
  F: __dxlog_file,
165
- L: 130,
119
+ L: 131,
166
120
  S: this,
167
121
  C: (f, a) => f(...a)
168
122
  });
@@ -200,7 +154,7 @@ var FeedWrapper = class {
200
154
  async safeClear(from, to) {
201
155
  invariant(from >= 0 && from < to && to <= this.length, "Invalid range", {
202
156
  F: __dxlog_file,
203
- L: 210,
157
+ L: 211,
204
158
  S: this,
205
159
  A: [
206
160
  "from >= 0 && from < to && to <= this.length",
@@ -229,35 +183,91 @@ var FeedWrapper = class {
229
183
  }
230
184
  }
231
185
  }
232
- };
233
- var BatchedReadStream = class extends Readable {
234
- constructor(feed, opts = {}) {
235
- super({
236
- objectMode: true
237
- });
238
- this._reading = false;
239
- invariant(opts.live === true, "Only live mode supported", {
186
+ constructor(_hypercore, _key, _storageDirectory) {
187
+ _define_property(this, "_hypercore", void 0);
188
+ _define_property(this, "_key", void 0);
189
+ _define_property(this, "_storageDirectory", void 0);
190
+ _define_property(this, "_pendingWrites", void 0);
191
+ _define_property(this, "_binder", void 0);
192
+ _define_property(this, "_writeLock", void 0);
193
+ _define_property(this, "_closed", void 0);
194
+ _define_property(this, "on", void 0);
195
+ _define_property(this, "off", void 0);
196
+ _define_property(this, "open", void 0);
197
+ _define_property(this, "_close", void 0);
198
+ _define_property(this, "close", void 0);
199
+ _define_property(this, "has", void 0);
200
+ _define_property(this, "get", void 0);
201
+ _define_property(this, "append", void 0);
202
+ _define_property(this, "download", void 0);
203
+ _define_property(this, "undownload", void 0);
204
+ _define_property(this, "setDownloading", void 0);
205
+ _define_property(this, "replicate", void 0);
206
+ _define_property(this, "clear", void 0);
207
+ _define_property(this, "proof", void 0);
208
+ _define_property(this, "put", void 0);
209
+ _define_property(this, "putBuffer", void 0);
210
+ this._hypercore = _hypercore;
211
+ this._key = _key;
212
+ this._storageDirectory = _storageDirectory;
213
+ this._pendingWrites = /* @__PURE__ */ new Set();
214
+ this._binder = createBinder(this._hypercore);
215
+ this._writeLock = new Trigger();
216
+ this._closed = false;
217
+ this.on = this._binder.fn(this._hypercore.on);
218
+ this.off = this._binder.fn(this._hypercore.off);
219
+ this.open = this._binder.async(this._hypercore.open);
220
+ this._close = this._binder.async(this._hypercore.close);
221
+ this.close = async () => {
222
+ if (this._pendingWrites.size) {
223
+ log.warn("Closing feed with pending writes", {
224
+ feed: this._key,
225
+ count: this._pendingWrites.size,
226
+ pendingWrites: Array.from(this._pendingWrites.values()).map((stack) => stack.getStack())
227
+ }, {
228
+ F: __dxlog_file,
229
+ L: 174,
230
+ S: this,
231
+ C: (f, a) => f(...a)
232
+ });
233
+ }
234
+ this._closed = true;
235
+ await this.flushToDisk();
236
+ await this._close();
237
+ };
238
+ this.has = this._binder.fn(this._hypercore.has);
239
+ this.get = this._binder.async(this._hypercore.get);
240
+ this.append = this._binder.async(this._hypercore.append);
241
+ this.download = this._binder.fn(this._hypercore.download);
242
+ this.undownload = this._binder.fn(this._hypercore.undownload);
243
+ this.setDownloading = this._binder.fn(this._hypercore.setDownloading);
244
+ this.replicate = this._binder.fn(this._hypercore.replicate);
245
+ this.clear = this._binder.async(this._hypercore.clear);
246
+ this.proof = this._binder.async(this._hypercore.proof);
247
+ this.put = this._binder.async(this._hypercore.put);
248
+ this.putBuffer = this._binder.async(this._hypercore._putBuffer);
249
+ invariant(this._hypercore, void 0, {
240
250
  F: __dxlog_file,
241
- L: 252,
251
+ L: 38,
242
252
  S: this,
243
253
  A: [
244
- "opts.live === true",
245
- "'Only live mode supported'"
254
+ "this._hypercore",
255
+ ""
246
256
  ]
247
257
  });
248
- invariant(opts.batch !== void 0 && opts.batch > 1, void 0, {
258
+ invariant(this._key, void 0, {
249
259
  F: __dxlog_file,
250
- L: 253,
260
+ L: 39,
251
261
  S: this,
252
262
  A: [
253
- "opts.batch !== undefined && opts.batch > 1",
263
+ "this._key",
254
264
  ""
255
265
  ]
256
266
  });
257
- this._feed = feed;
258
- this._batch = opts.batch;
259
- this._cursor = opts.start ?? 0;
267
+ this._writeLock.wake();
260
268
  }
269
+ };
270
+ var BatchedReadStream = class extends Readable {
261
271
  _open(cb) {
262
272
  this._feed.ready(cb);
263
273
  }
@@ -301,6 +311,32 @@ var BatchedReadStream = class extends Readable {
301
311
  }
302
312
  });
303
313
  }
314
+ constructor(feed, opts = {}) {
315
+ super({
316
+ objectMode: true
317
+ }), _define_property(this, "_feed", void 0), _define_property(this, "_batch", void 0), _define_property(this, "_cursor", void 0), _define_property(this, "_reading", false);
318
+ invariant(opts.live === true, "Only live mode supported", {
319
+ F: __dxlog_file,
320
+ L: 253,
321
+ S: this,
322
+ A: [
323
+ "opts.live === true",
324
+ "'Only live mode supported'"
325
+ ]
326
+ });
327
+ invariant(opts.batch !== void 0 && opts.batch > 1, void 0, {
328
+ F: __dxlog_file,
329
+ L: 254,
330
+ S: this,
331
+ A: [
332
+ "opts.batch !== undefined && opts.batch > 1",
333
+ ""
334
+ ]
335
+ });
336
+ this._feed = feed;
337
+ this._batch = opts.batch;
338
+ this._cursor = opts.start ?? 0;
339
+ }
304
340
  };
305
341
 
306
342
  // src/feed-factory.ts
@@ -309,21 +345,21 @@ import { subtleCrypto } from "@dxos/crypto";
309
345
  import { failUndefined } from "@dxos/debug";
310
346
  import { createCrypto, hypercore } from "@dxos/hypercore";
311
347
  import { log as log2 } from "@dxos/log";
312
- var __dxlog_file2 = "/__w/dxos/dxos/packages/common/feed-store/src/feed-factory.ts";
313
- var FeedFactory = class {
314
- constructor({ root, signer, hypercore: hypercore2 }) {
315
- log2("FeedFactory", {
316
- options: hypercore2
317
- }, {
318
- F: __dxlog_file2,
319
- L: 43,
320
- S: this,
321
- C: (f, a) => f(...a)
348
+ function _define_property2(obj, key, value) {
349
+ if (key in obj) {
350
+ Object.defineProperty(obj, key, {
351
+ value,
352
+ enumerable: true,
353
+ configurable: true,
354
+ writable: true
322
355
  });
323
- this._root = root ?? failUndefined();
324
- this._signer = signer;
325
- this._hypercoreOptions = hypercore2;
356
+ } else {
357
+ obj[key] = value;
326
358
  }
359
+ return obj;
360
+ }
361
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/common/feed-store/src/feed-factory.ts";
362
+ var FeedFactory = class {
327
363
  get storageRoot() {
328
364
  return this._root;
329
365
  }
@@ -362,6 +398,22 @@ var FeedFactory = class {
362
398
  const core = hypercore(makeStorage, Buffer.from(key), opts);
363
399
  return new FeedWrapper(core, publicKey, storageDir);
364
400
  }
401
+ constructor({ root, signer, hypercore: hypercore2 }) {
402
+ _define_property2(this, "_root", void 0);
403
+ _define_property2(this, "_signer", void 0);
404
+ _define_property2(this, "_hypercoreOptions", void 0);
405
+ log2("FeedFactory", {
406
+ options: hypercore2
407
+ }, {
408
+ F: __dxlog_file2,
409
+ L: 43,
410
+ S: this,
411
+ C: (f, a) => f(...a)
412
+ });
413
+ this._root = root ?? failUndefined();
414
+ this._signer = signer;
415
+ this._hypercoreOptions = hypercore2;
416
+ }
365
417
  };
366
418
 
367
419
  // src/feed-store.ts
@@ -371,15 +423,21 @@ import { invariant as invariant2 } from "@dxos/invariant";
371
423
  import { PublicKey } from "@dxos/keys";
372
424
  import { log as log3 } from "@dxos/log";
373
425
  import { ComplexMap, defaultMap } from "@dxos/util";
426
+ function _define_property3(obj, key, value) {
427
+ if (key in obj) {
428
+ Object.defineProperty(obj, key, {
429
+ value,
430
+ enumerable: true,
431
+ configurable: true,
432
+ writable: true
433
+ });
434
+ } else {
435
+ obj[key] = value;
436
+ }
437
+ return obj;
438
+ }
374
439
  var __dxlog_file3 = "/__w/dxos/dxos/packages/common/feed-store/src/feed-store.ts";
375
440
  var FeedStore = class {
376
- constructor({ factory }) {
377
- this._feeds = new ComplexMap(PublicKey.hash);
378
- this._mutexes = new ComplexMap(PublicKey.hash);
379
- this._closed = false;
380
- this.feedOpened = new Event();
381
- this._factory = factory ?? failUndefined2();
382
- }
383
441
  get size() {
384
442
  return this._feeds.size;
385
443
  }
@@ -485,6 +543,14 @@ var FeedStore = class {
485
543
  C: (f, a) => f(...a)
486
544
  });
487
545
  }
546
+ constructor({ factory }) {
547
+ _define_property3(this, "_feeds", new ComplexMap(PublicKey.hash));
548
+ _define_property3(this, "_mutexes", new ComplexMap(PublicKey.hash));
549
+ _define_property3(this, "_factory", void 0);
550
+ _define_property3(this, "_closed", false);
551
+ _define_property3(this, "feedOpened", new Event());
552
+ this._factory = factory ?? failUndefined2();
553
+ }
488
554
  };
489
555
 
490
556
  export {
@@ -492,4 +558,4 @@ export {
492
558
  FeedFactory,
493
559
  FeedStore
494
560
  };
495
- //# sourceMappingURL=chunk-3SO44TKS.mjs.map
561
+ //# sourceMappingURL=chunk-NKF34XAW.mjs.map