@dxos/echo-generator 0.8.2-main.f11618f → 0.8.2-staging.42af850

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.
@@ -28,16 +28,15 @@ __export(node_exports, {
28
28
  randomText: () => randomText
29
29
  });
30
30
  module.exports = __toCommonJS(node_exports);
31
- var import_automerge = require("@dxos/automerge/automerge");
31
+ var import_automerge = require("@automerge/automerge");
32
+ var import_effect = require("effect");
32
33
  var import_echo = require("@dxos/client/echo");
33
34
  var import_echo_schema = require("@dxos/echo-schema");
34
- var import_live_object = require("@dxos/live-object");
35
35
  var import_random = require("@dxos/random");
36
36
  var import_echo2 = require("@dxos/client/echo");
37
37
  var import_echo_schema2 = require("@dxos/echo-schema");
38
- var import_echo_schema3 = require("@dxos/echo-schema");
39
38
  var import_invariant = require("@dxos/invariant");
40
- var import_live_object2 = require("@dxos/live-object");
39
+ var import_live_object = require("@dxos/live-object");
41
40
  var import_random2 = require("@dxos/random");
42
41
  var import_util = require("@dxos/util");
43
42
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-generator/src/generator.ts";
@@ -60,14 +59,22 @@ var TestObjectGenerator = class {
60
59
  async createObject({ types } = {}) {
61
60
  const type = import_random2.faker.helpers.arrayElement(types ?? Object.keys(this._schemas));
62
61
  const data = await this._generators[type](this._provider);
63
- if ((0, import_live_object2.isLiveObject)(data)) {
62
+ if ((0, import_live_object.isLiveObject)(data)) {
64
63
  return data;
65
64
  }
66
65
  const schema = this.getSchema(type);
67
- return schema ? (0, import_live_object2.live)(schema, data) : (0, import_live_object2.live)(data);
66
+ return schema ? (0, import_live_object.live)(schema, data) : (0, import_live_object.live)(data);
68
67
  }
69
68
  // TODO(burdon): Based on dependencies (e.g., organization before contact).
70
69
  async createObjects(map) {
70
+ const results = [];
71
+ for (const [type, count] of (0, import_util.entries)(map)) {
72
+ results.push(...await Promise.all((0, import_util.range)(count ?? 0, () => this.createObject({
73
+ types: [
74
+ type
75
+ ]
76
+ }))));
77
+ }
71
78
  const tasks = Object.entries(map).map(([type, count]) => {
72
79
  return (0, import_util.range)(count, () => this.createObject({
73
80
  types: [
@@ -82,10 +89,9 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
82
89
  constructor(_space, schemaMap, generators, _mutations) {
83
90
  super(schemaMap, generators, async (type) => {
84
91
  const schema = this.getSchema(type);
85
- return (schema && (await this._space.db.query(import_echo2.Filter.schema(schema)).run()).objects) ?? [];
86
- });
87
- this._space = _space;
88
- this._mutations = _mutations;
92
+ const { objects } = await this._space.db.query(schema ? import_echo2.Filter.type(schema) : import_echo2.Filter.nothing()).run();
93
+ return objects;
94
+ }), this._space = _space, this._mutations = _mutations;
89
95
  }
90
96
  async addSchemas() {
91
97
  const result = [];
@@ -125,17 +131,17 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
125
131
  async mutateObject(object, params) {
126
132
  (0, import_invariant.invariant)(this._mutations, "Mutations not defined.", {
127
133
  F: __dxlog_file,
128
- L: 122,
134
+ L: 130,
129
135
  S: this,
130
136
  A: [
131
137
  "this._mutations",
132
138
  "'Mutations not defined.'"
133
139
  ]
134
140
  });
135
- const type = (0, import_echo_schema2.getTypeAnnotation)((0, import_echo_schema3.getSchema)(object)).typename;
141
+ const type = (0, import_echo_schema2.getTypeAnnotation)((0, import_echo_schema2.getSchema)(object)).typename;
136
142
  (0, import_invariant.invariant)(type && this._mutations?.[type], "Invalid object type.", {
137
143
  F: __dxlog_file,
138
- L: 124,
144
+ L: 132,
139
145
  S: this,
140
146
  A: [
141
147
  "type && this._mutations?.[type]",
@@ -171,73 +177,73 @@ var Priority = [
171
177
  4,
172
178
  5
173
179
  ];
174
- var TestSchemaType;
175
- (function(TestSchemaType2) {
176
- TestSchemaType2["document"] = "example.com/type/document";
177
- TestSchemaType2["organization"] = "example.com/type/organization";
178
- TestSchemaType2["contact"] = "example.com/type/contact";
179
- TestSchemaType2["project"] = "example.com/type/project";
180
- })(TestSchemaType || (TestSchemaType = {}));
180
+ var TestSchemaType = /* @__PURE__ */ function(TestSchemaType2) {
181
+ TestSchemaType2["document"] = "example.com/type/Document";
182
+ TestSchemaType2["organization"] = "example.com/type/Organization";
183
+ TestSchemaType2["contact"] = "example.com/type/Contact";
184
+ TestSchemaType2["project"] = "example.com/type/Project";
185
+ return TestSchemaType2;
186
+ }({});
181
187
  var testSchemas = () => {
182
- const document = (0, import_live_object.createEchoSchema)({
183
- typename: "example.com/type/document",
184
- version: "0.1.0"
185
- }, {
186
- title: import_echo_schema.S.String.annotations({
188
+ const document = import_effect.Schema.Struct({
189
+ title: import_effect.Schema.String.annotations({
187
190
  description: "title of the document"
188
191
  }),
189
- content: import_echo_schema.S.String
190
- });
191
- const organization = (0, import_live_object.createEchoSchema)({
192
- typename: "example.com/type/organization",
192
+ content: import_effect.Schema.String
193
+ }).pipe((0, import_echo_schema.EchoObject)({
194
+ typename: "example.com/type/Document",
193
195
  version: "0.1.0"
194
- }, {
195
- name: import_echo_schema.S.String.annotations({
196
+ }));
197
+ const organization = import_effect.Schema.Struct({
198
+ name: import_effect.Schema.String.annotations({
196
199
  description: "name of the company or organization"
197
200
  }),
198
- website: import_echo_schema.S.String.annotations({
201
+ website: import_effect.Schema.optional(import_effect.Schema.String.annotations({
199
202
  description: "public website URL"
200
- }),
201
- description: import_echo_schema.S.String.annotations({
203
+ })),
204
+ description: import_effect.Schema.String.annotations({
202
205
  description: "short summary of the company"
203
206
  })
204
- });
205
- const contact = (0, import_live_object.createEchoSchema)({
206
- typename: "example.com/type/contact",
207
+ }).pipe((0, import_echo_schema.EchoObject)({
208
+ typename: "example.com/type/Organization",
207
209
  version: "0.1.0"
208
- }, {
209
- name: import_echo_schema.S.String.annotations({
210
+ }));
211
+ const contact = import_effect.Schema.Struct({
212
+ name: import_effect.Schema.String.annotations({
210
213
  description: "name of the person"
211
214
  }),
212
- email: import_echo_schema.S.String,
213
- org: (0, import_echo_schema.Ref)(organization),
214
- lat: import_echo_schema.S.Number,
215
- lng: import_echo_schema.S.Number
216
- });
217
- const project = (0, import_live_object.createEchoSchema)({
218
- typename: "example.com/type/project",
215
+ email: import_effect.Schema.optional(import_effect.Schema.String),
216
+ org: import_effect.Schema.optional((0, import_echo_schema.Ref)(organization)),
217
+ lat: import_effect.Schema.optional(import_effect.Schema.Number),
218
+ lng: import_effect.Schema.optional(import_effect.Schema.Number)
219
+ }).pipe((0, import_echo_schema.EchoObject)({
220
+ typename: "example.com/type/Contact",
219
221
  version: "0.1.0"
220
- }, {
221
- name: import_echo_schema.S.String.annotations({
222
+ }));
223
+ const project = import_effect.Schema.Struct({
224
+ name: import_effect.Schema.String.annotations({
222
225
  description: "name of the project"
223
226
  }),
224
- description: import_echo_schema.S.String,
225
- website: import_echo_schema.S.String,
226
- repo: import_echo_schema.S.String,
227
- status: import_echo_schema.S.String,
228
- priority: import_echo_schema.S.Number,
229
- active: import_echo_schema.S.Boolean,
230
- org: (0, import_echo_schema.Ref)(organization)
231
- });
227
+ description: import_effect.Schema.String,
228
+ website: import_effect.Schema.String,
229
+ repo: import_effect.Schema.String,
230
+ status: import_effect.Schema.String,
231
+ priority: import_effect.Schema.Number,
232
+ active: import_effect.Schema.Boolean,
233
+ org: import_effect.Schema.optional((0, import_echo_schema.Ref)(organization))
234
+ }).pipe((0, import_echo_schema.EchoObject)({
235
+ typename: "example.com/type/Project",
236
+ version: "0.1.0"
237
+ }));
232
238
  return {
233
- ["example.com/type/document"]: document,
234
- ["example.com/type/organization"]: organization,
235
- ["example.com/type/contact"]: contact,
236
- ["example.com/type/project"]: project
239
+ ["example.com/type/Document"]: document,
240
+ ["example.com/type/Organization"]: organization,
241
+ ["example.com/type/Contact"]: contact,
242
+ ["example.com/type/Project"]: project
237
243
  };
238
244
  };
239
245
  var testObjectGenerators = {
240
- ["example.com/type/document"]: async () => ({
246
+ ["example.com/type/Document"]: async () => ({
241
247
  title: import_random.faker.lorem.sentence(3),
242
248
  content: import_random.faker.lorem.sentences({
243
249
  min: 1,
@@ -247,39 +253,39 @@ var testObjectGenerators = {
247
253
  })
248
254
  })
249
255
  }),
250
- ["example.com/type/organization"]: async () => ({
256
+ ["example.com/type/Organization"]: async () => ({
251
257
  name: import_random.faker.company.name(),
252
258
  website: import_random.faker.datatype.boolean({
253
259
  probability: 0.3
254
260
  }) ? import_random.faker.internet.url() : void 0,
255
261
  description: import_random.faker.lorem.sentences()
256
262
  }),
257
- ["example.com/type/contact"]: async (provider) => {
258
- const organizations = await provider?.("example.com/type/organization");
259
- const { location } = import_random.faker.datatype.boolean() ? import_random.faker.geo.airport() : {};
263
+ ["example.com/type/Contact"]: async (provider) => {
264
+ const organizations = await provider?.("example.com/type/Organization");
265
+ const location = import_random.faker.datatype.boolean() ? import_random.faker.geo.airport() : {};
260
266
  return {
261
267
  name: import_random.faker.person.fullName(),
262
268
  email: import_random.faker.datatype.boolean({
263
269
  probability: 0.5
264
270
  }) ? import_random.faker.internet.email() : void 0,
265
271
  org: organizations?.length && import_random.faker.datatype.boolean({
266
- probability: 0.3
267
- }) ? (0, import_live_object.makeRef)(import_random.faker.helpers.arrayElement(organizations)) : void 0,
272
+ probability: 0.8
273
+ }) ? import_echo_schema.Ref.make(import_random.faker.helpers.arrayElement(organizations)) : void 0,
268
274
  ...location
269
275
  };
270
276
  },
271
- ["example.com/type/project"]: async () => ({
277
+ ["example.com/type/Project"]: async () => ({
272
278
  name: import_random.faker.commerce.productName(),
273
- repo: import_random.faker.datatype.boolean({
274
- probability: 0.3
275
- }) ? import_random.faker.internet.url() : void 0,
279
+ repo: import_random.faker.internet.url(),
276
280
  status: import_random.faker.helpers.arrayElement(Status),
281
+ description: import_random.faker.lorem.sentences(),
282
+ website: import_random.faker.internet.url(),
277
283
  priority: import_random.faker.helpers.arrayElement(Priority),
278
284
  active: import_random.faker.datatype.boolean()
279
285
  })
280
286
  };
281
287
  var testObjectMutators = {
282
- ["example.com/type/document"]: async (object, params) => {
288
+ ["example.com/type/Document"]: async (object, params) => {
283
289
  const accessor = (0, import_echo.createDocAccessor)(object, [
284
290
  "content"
285
291
  ]);
@@ -290,13 +296,13 @@ var testObjectMutators = {
290
296
  });
291
297
  }
292
298
  },
293
- ["example.com/type/organization"]: async () => {
299
+ ["example.com/type/Organization"]: async () => {
294
300
  throw new Error("Method not implemented.");
295
301
  },
296
- ["example.com/type/contact"]: async () => {
302
+ ["example.com/type/Contact"]: async () => {
297
303
  throw new Error("Method not implemented.");
298
304
  },
299
- ["example.com/type/project"]: async () => {
305
+ ["example.com/type/Project"]: async () => {
300
306
  throw new Error("Method not implemented.");
301
307
  }
302
308
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/data.ts", "../../../src/generator.ts", "../../../src/util.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { next as A } from '@dxos/automerge/automerge';\nimport { createDocAccessor, type Space } from '@dxos/client/echo';\nimport { Ref, S } from '@dxos/echo-schema';\nimport { createEchoSchema, makeRef } from '@dxos/live-object';\nimport { faker } from '@dxos/random';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestMutationsMap, type TestSchemaMap } from './types';\nimport { randomText } from './util';\n\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/aurora/testing.\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport enum TestSchemaType {\n document = 'example.com/type/document',\n organization = 'example.com/type/organization',\n contact = 'example.com/type/contact',\n project = 'example.com/type/project',\n}\n\nconst testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = createEchoSchema(\n {\n typename: TestSchemaType.document,\n version: '0.1.0',\n },\n {\n title: S.String.annotations({ description: 'title of the document' }),\n content: S.String,\n },\n );\n\n const organization = createEchoSchema(\n {\n typename: TestSchemaType.organization,\n version: '0.1.0',\n },\n {\n name: S.String.annotations({ description: 'name of the company or organization' }),\n website: S.String.annotations({ description: 'public website URL' }),\n description: S.String.annotations({ description: 'short summary of the company' }),\n },\n );\n\n const contact = createEchoSchema(\n {\n typename: TestSchemaType.contact,\n version: '0.1.0',\n },\n {\n name: S.String.annotations({ description: 'name of the person' }),\n email: S.String,\n org: Ref(organization),\n lat: S.Number,\n lng: S.Number,\n },\n );\n\n const project = createEchoSchema(\n {\n typename: TestSchemaType.project,\n version: '0.1.0',\n },\n {\n name: S.String.annotations({ description: 'name of the project' }),\n description: S.String,\n website: S.String,\n repo: S.String,\n status: S.String,\n priority: S.Number,\n active: S.Boolean,\n org: Ref(organization),\n },\n );\n\n return {\n [TestSchemaType.document]: document,\n [TestSchemaType.organization]: organization,\n [TestSchemaType.contact]: contact,\n [TestSchemaType.project]: project,\n };\n};\n\nconst testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n [TestSchemaType.document]: async () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n [TestSchemaType.organization]: async () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: faker.lorem.sentences(),\n }),\n\n [TestSchemaType.contact]: async (provider) => {\n const organizations = await provider?.(TestSchemaType.organization);\n const { location } = faker.datatype.boolean() ? faker.geo.airport() : {};\n return {\n name: faker.person.fullName(),\n email: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.email() : undefined,\n org:\n organizations?.length && faker.datatype.boolean({ probability: 0.3 })\n ? makeRef(faker.helpers.arrayElement(organizations))\n : undefined,\n ...location,\n };\n },\n\n [TestSchemaType.project]: async () => ({\n name: faker.commerce.productName(),\n repo: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n status: faker.helpers.arrayElement(Status),\n priority: faker.helpers.arrayElement(Priority),\n active: faker.datatype.boolean(),\n }),\n};\n\nconst testObjectMutators: TestMutationsMap<TestSchemaType> = {\n [TestSchemaType.document]: async (object, params) => {\n const accessor = createDocAccessor(object, ['content']);\n for (let i = 0; i < params.count; i++) {\n const length = object.content?.content?.length ?? 0;\n accessor.handle.change((doc) => {\n A.splice(\n doc,\n accessor.path.slice(),\n 0,\n params.maxContentLength >= length ? 0 : params.mutationSize,\n randomText(params.mutationSize),\n );\n });\n }\n },\n [TestSchemaType.organization]: async () => {\n throw new Error('Method not implemented.');\n },\n [TestSchemaType.contact]: async () => {\n throw new Error('Method not implemented.');\n },\n [TestSchemaType.project]: async () => {\n throw new Error('Method not implemented.');\n },\n};\n\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators, testObjectMutators);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Filter, type Space } from '@dxos/client/echo';\nimport { type ReactiveEchoObject } from '@dxos/echo-db';\nimport { getTypeAnnotation, EchoSchema, type S } from '@dxos/echo-schema';\nimport { getSchema } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { live, isLiveObject, type Live } from '@dxos/live-object';\nimport { faker } from '@dxos/random';\nimport { range } from '@dxos/util';\n\nimport { type TestSchemaType } from './data';\nimport {\n type MutationsProviderParams,\n type TestGeneratorMap,\n type TestMutationsMap,\n type TestObjectProvider,\n type TestSchemaMap,\n} from './types';\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator<T extends string = TestSchemaType> {\n // prettier-ignore\n constructor(\n protected readonly _schemas: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>,\n ) {}\n\n get schemas(): (EchoSchema | S.Schema.AnyNoContext)[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T): EchoSchema | S.Schema.AnyNoContext | undefined {\n return this.schemas.find((schema) => getTypeAnnotation(schema)!.typename === type);\n }\n\n protected setSchema(type: T, schema: EchoSchema | S.Schema.AnyNoContext) {\n this._schemas[type] = schema;\n }\n\n async createObject({ types }: { types?: T[] } = {}): Promise<Live<any>> {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));\n const data = await this._generators[type](this._provider);\n if (isLiveObject(data)) {\n return data;\n }\n\n const schema = this.getSchema(type);\n return schema ? live(schema, data) : live(data);\n }\n\n // TODO(burdon): Based on dependencies (e.g., organization before contact).\n async createObjects(map: Partial<Record<T, number>>) {\n const tasks = Object.entries<number>(map as any)\n .map(([type, count]) => {\n return range(count, () => this.createObject({ types: [type as T] }));\n })\n .flatMap((t) => t);\n\n return Promise.all(tasks);\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(\n private readonly _space: Space,\n schemaMap: TestSchemaMap<T>,\n generators: TestGeneratorMap<T>,\n private readonly _mutations?: TestMutationsMap<T>,\n ) {\n super(schemaMap, generators, async (type: T) => {\n const schema = this.getSchema(type);\n return (schema && (await this._space.db.query(Filter.schema(schema)).run()).objects) ?? [];\n });\n }\n\n async addSchemas() {\n const result: (EchoSchema | S.Schema.AnyNoContext)[] = [];\n for (const [typename, schema] of Object.entries(this._schemas)) {\n const echoSchema = await this._maybeRegisterSchema(typename, schema as EchoSchema | S.Schema.AnyNoContext);\n this.setSchema(typename as T, echoSchema);\n result.push(echoSchema);\n }\n\n return result;\n }\n\n override async createObject({ types }: { types?: T[] } = {}): Promise<ReactiveEchoObject<any>> {\n return this._space.db.add(await super.createObject({ types }));\n }\n\n private async _maybeRegisterSchema(\n typename: string,\n schema: EchoSchema | S.Schema.AnyNoContext,\n ): Promise<EchoSchema | S.Schema.AnyNoContext> {\n if (schema instanceof EchoSchema) {\n const existingSchema = this._space.db.schemaRegistry.getSchema(typename);\n if (existingSchema != null) {\n return existingSchema;\n }\n const [registeredSchema] = await this._space.db.schemaRegistry.register([schema]);\n return registeredSchema;\n } else {\n const existingSchema = this._space.db.graph.schemaRegistry.getSchema(typename);\n if (existingSchema != null) {\n return existingSchema;\n }\n this._space.db.graph.schemaRegistry.addSchema([schema]);\n return schema;\n }\n }\n\n async mutateObject(object: ReactiveEchoObject<any>, params: MutationsProviderParams) {\n invariant(this._mutations, 'Mutations not defined.');\n const type = getTypeAnnotation(getSchema(object)!)!.typename as T;\n invariant(type && this._mutations?.[type], 'Invalid object type.');\n\n await this._mutations![type](object, params);\n }\n\n async mutateObjects(objects: ReactiveEchoObject<any>[], params: MutationsProviderParams) {\n for (const object of objects) {\n await this.mutateObject(object, params);\n }\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const randomText = (length: number) => {\n let result = '';\n const characters = 'abcdefghijklmnopqrstuvwxyz';\n const charactersLength = characters.length;\n for (let index = 0; index < length; index++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n\n return result;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,uBAA0B;AAC1B,kBAA8C;AAC9C,yBAAuB;AACvB,yBAA0C;AAC1C,oBAAsB;ACJtB,IAAAA,eAAmC;AAEnC,IAAAC,sBAAsD;AACtD,IAAAA,sBAA0B;AAC1B,uBAA0B;AAC1B,IAAAC,sBAA8C;AAC9C,IAAAC,iBAAsB;AACtB,kBAAsB;;AAcf,IAAMC,sBAAN,MAAMA;;EAEXC,YACqBC,UACFC,aACAC,WACjB;SAHmBF,WAAAA;SACFC,cAAAA;SACAC,YAAAA;EAChB;EAEH,IAAIC,UAAkD;AACpD,WAAOC,OAAOC,OAAO,KAAKL,QAAQ;EACpC;EAEAM,UAAUC,MAAyD;AACjE,WAAO,KAAKJ,QAAQK,KAAK,CAACC,eAAWC,uCAAkBD,MAAAA,EAASE,aAAaJ,IAAAA;EAC/E;EAEUK,UAAUL,MAASE,QAA4C;AACvE,SAAKT,SAASO,IAAAA,IAAQE;EACxB;EAEA,MAAMI,aAAa,EAAEC,MAAK,IAAs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0BAAA,GAA0B,aAAa;IACrChC,MAAMpE,cAAAA,MAAM0G,SAASC,YAAW;IAChC7B,MAAM9E,cAAAA,MAAM4F,SAASC,QAAQ;MAAEC,aAAa;IAAI,CAAA,IAAK9F,cAAAA,MAAM+F,SAASC,IAAG,IAAKC;IAC5ElB,QAAQ/E,cAAAA,MAAMC,QAAQC,aAAaoD,MAAAA;IACnC0B,UAAUhF,cAAAA,MAAMC,QAAQC,aAAaqD,QAAAA;IACrC0B,QAAQjF,cAAAA,MAAM4F,SAASC,QAAO;EAChC;AACF;AAEA,IAAMe,qBAAuD;EAC3D,CAAA,2BAAA,GAA2B,OAAOnE,QAAQC,WAAAA;AACxC,UAAMmE,eAAWC,+BAAkBrE,QAAQ;MAAC;KAAU;AACtD,aAASsE,IAAI,GAAGA,IAAIrE,OAAO/B,OAAOoG,KAAK;AACrC,YAAMjE,SAASL,OAAOyB,SAASA,SAASpB,UAAU;AAClD+D,eAASG,OAAOC,OAAO,CAACC,QAAAA;AACtBC,yBAAAA,KAAEC,OACAF,KACAL,SAASQ,KAAKC,MAAK,GACnB,GACA5E,OAAO6E,oBAAoBzE,SAAS,IAAIJ,OAAO8E,cAC/C3E,WAAWH,OAAO8E,YAAY,CAAA;MAElC,CAAA;IACF;EACF;EACA,CAAA,+BAAA,GAA+B,YAAA;AAC7B,UAAM,IAAIC,MAAM,yBAAA;EAClB;EACA,CAAA,0BAAA,GAA0B,YAAA;AACxB,UAAM,IAAIA,MAAM,yBAAA;EAClB;EACA,CAAA,0BAAA,GAA0B,YAAA;AACxB,UAAM,IAAIA,MAAM,yBAAA;EAClB;AACF;AAEO,IAAMC,4BAA4B,MAAM,IAAI3I,oBAAoB0E,YAAAA,GAAe0B,oBAAAA;AAE/E,IAAMwC,6BAA6B,CAACC,UACzC,IAAI3G,qBAAqB2G,OAAOnE,YAAAA,GAAe0B,sBAAsByB,kBAAAA;",
6
- "names": ["import_echo", "import_echo_schema", "import_live_object", "import_random", "TestObjectGenerator", "constructor", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "getSchema", "type", "find", "schema", "getTypeAnnotation", "typename", "setSchema", "createObject", "types", "faker", "helpers", "arrayElement", "keys", "data", "isLiveObject", "live", "createObjects", "map", "tasks", "entries", "count", "range", "flatMap", "t", "Promise", "all", "SpaceObjectGenerator", "_space", "schemaMap", "generators", "_mutations", "db", "query", "Filter", "run", "objects", "addSchemas", "result", "echoSchema", "_maybeRegisterSchema", "push", "add", "EchoSchema", "existingSchema", "schemaRegistry", "registeredSchema", "register", "graph", "addSchema", "mutateObject", "object", "params", "invariant", "mutateObjects", "randomText", "length", "characters", "charactersLength", "index", "charAt", "Math", "floor", "random", "Status", "Priority", "TestSchemaType", "testSchemas", "document", "createEchoSchema", "version", "title", "S", "String", "annotations", "description", "content", "organization", "name", "website", "contact", "email", "org", "Ref", "lat", "Number", "lng", "project", "repo", "status", "priority", "active", "Boolean", "testObjectGenerators", "lorem", "sentence", "sentences", "min", "max", "number", "int", "company", "datatype", "boolean", "probability", "internet", "url", "undefined", "provider", "organizations", "location", "geo", "airport", "person", "fullName", "makeRef", "commerce", "productName", "testObjectMutators", "accessor", "createDocAccessor", "i", "handle", "change", "doc", "A", "splice", "path", "slice", "maxContentLength", "mutationSize", "Error", "createTestObjectGenerator", "createSpaceObjectGenerator", "space"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { next as A } from '@automerge/automerge';\nimport { Schema } from 'effect';\n\nimport { createDocAccessor, type Space } from '@dxos/client/echo';\nimport { EchoObject, Ref } from '@dxos/echo-schema';\nimport { faker } from '@dxos/random';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestMutationsMap, type TestSchemaMap } from './types';\nimport { randomText } from './util';\n\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/aurora/testing.\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\n/**\n * @deprecated\n */\nexport enum TestSchemaType {\n document = 'example.com/type/Document',\n organization = 'example.com/type/Organization',\n contact = 'example.com/type/Contact',\n project = 'example.com/type/Project',\n}\n\n/**\n * @deprecated\n */\nconst testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = Schema.Struct({\n title: Schema.String.annotations({ description: 'title of the document' }),\n content: Schema.String,\n }).pipe(EchoObject({ typename: TestSchemaType.document, version: '0.1.0' }));\n\n const organization = Schema.Struct({\n name: Schema.String.annotations({ description: 'name of the company or organization' }),\n website: Schema.optional(Schema.String.annotations({ description: 'public website URL' })),\n description: Schema.String.annotations({ description: 'short summary of the company' }),\n }).pipe(EchoObject({ typename: TestSchemaType.organization, version: '0.1.0' }));\n\n const contact = Schema.Struct({\n name: Schema.String.annotations({ description: 'name of the person' }),\n email: Schema.optional(Schema.String),\n org: Schema.optional(Ref(organization)),\n lat: Schema.optional(Schema.Number),\n lng: Schema.optional(Schema.Number),\n }).pipe(EchoObject({ typename: TestSchemaType.contact, version: '0.1.0' }));\n\n const project = Schema.Struct({\n name: Schema.String.annotations({ description: 'name of the project' }),\n description: Schema.String,\n website: Schema.String,\n repo: Schema.String,\n status: Schema.String,\n priority: Schema.Number,\n active: Schema.Boolean,\n org: Schema.optional(Ref(organization)),\n }).pipe(EchoObject({ typename: TestSchemaType.project, version: '0.1.0' }));\n\n return {\n [TestSchemaType.document]: document,\n [TestSchemaType.organization]: organization,\n [TestSchemaType.contact]: contact,\n [TestSchemaType.project]: project,\n };\n};\n\nconst testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n [TestSchemaType.document]: async () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n [TestSchemaType.organization]: async () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: faker.lorem.sentences(),\n }),\n\n [TestSchemaType.contact]: async (provider) => {\n const organizations = await provider?.(TestSchemaType.organization);\n const location = faker.datatype.boolean() ? faker.geo.airport() : {};\n\n return {\n name: faker.person.fullName(),\n email: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.email() : undefined,\n org:\n organizations?.length && faker.datatype.boolean({ probability: 0.8 })\n ? Ref.make(faker.helpers.arrayElement(organizations))\n : undefined,\n ...location,\n };\n },\n\n [TestSchemaType.project]: async () => ({\n name: faker.commerce.productName(),\n repo: faker.internet.url(),\n status: faker.helpers.arrayElement(Status),\n description: faker.lorem.sentences(),\n website: faker.internet.url(),\n priority: faker.helpers.arrayElement(Priority),\n active: faker.datatype.boolean(),\n }),\n};\n\nconst testObjectMutators: TestMutationsMap<TestSchemaType> = {\n [TestSchemaType.document]: async (object, params) => {\n const accessor = createDocAccessor(object, ['content']);\n for (let i = 0; i < params.count; i++) {\n const length = object.content?.content?.length ?? 0;\n accessor.handle.change((doc) => {\n A.splice(\n doc,\n accessor.path.slice(),\n 0,\n params.maxContentLength >= length ? 0 : params.mutationSize,\n randomText(params.mutationSize),\n );\n });\n }\n },\n [TestSchemaType.organization]: async () => {\n throw new Error('Method not implemented.');\n },\n [TestSchemaType.contact]: async () => {\n throw new Error('Method not implemented.');\n },\n [TestSchemaType.project]: async () => {\n throw new Error('Method not implemented.');\n },\n};\n\n/**\n * @deprecated Use generators in schema package.\n */\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\n/**\n * @deprecated Use generators in schema package.\n */\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators, testObjectMutators);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { Filter, type Space } from '@dxos/client/echo';\nimport { type AnyLiveObject } from '@dxos/echo-db';\nimport { getTypeAnnotation, EchoSchema, getSchema } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { live, isLiveObject, type Live } from '@dxos/live-object';\nimport { faker } from '@dxos/random';\nimport { entries, range } from '@dxos/util';\n\nimport { type TestSchemaType } from './data';\nimport {\n type MutationsProviderParams,\n type TestGeneratorMap,\n type TestMutationsMap,\n type TestObjectProvider,\n type TestSchemaMap,\n} from './types';\n\n/**\n * Typed object generator.\n * @deprecated\n */\nexport class TestObjectGenerator<T extends string = TestSchemaType> {\n // prettier-ignore\n constructor(\n protected readonly _schemas: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>,\n ) {}\n\n get schemas(): (EchoSchema | Schema.Schema.AnyNoContext)[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T): EchoSchema | Schema.Schema.AnyNoContext | undefined {\n return this.schemas.find((schema) => getTypeAnnotation(schema)!.typename === type);\n }\n\n protected setSchema(type: T, schema: EchoSchema | Schema.Schema.AnyNoContext): void {\n this._schemas[type] = schema;\n }\n\n async createObject({ types }: { types?: T[] } = {}): Promise<Live<any>> {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));\n const data = await this._generators[type](this._provider);\n if (isLiveObject(data)) {\n return data;\n }\n\n const schema = this.getSchema(type);\n return schema ? live(schema, data) : live(data);\n }\n\n // TODO(burdon): Based on dependencies (e.g., organization before contact).\n async createObjects(map: Partial<Record<T, number>>) {\n const results: Live<any>[] = [];\n for (const [type, count] of entries(map)) {\n results.push(...(await Promise.all(range(count ?? 0, () => this.createObject({ types: [type as T] })))));\n }\n\n const tasks = Object.entries<number>(map as any)\n .map(([type, count]) => {\n return range(count, () => this.createObject({ types: [type as T] }));\n })\n .flatMap((t) => t);\n\n return Promise.all(tasks);\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(\n private readonly _space: Space,\n schemaMap: TestSchemaMap<T>,\n generators: TestGeneratorMap<T>,\n private readonly _mutations?: TestMutationsMap<T>,\n ) {\n super(schemaMap, generators, async (type: T) => {\n const schema = this.getSchema(type);\n const { objects } = await this._space.db.query(schema ? Filter.type(schema) : Filter.nothing()).run();\n return objects;\n });\n }\n\n async addSchemas() {\n const result: (EchoSchema | Schema.Schema.AnyNoContext)[] = [];\n for (const [typename, schema] of Object.entries(this._schemas)) {\n const echoSchema = await this._maybeRegisterSchema(typename, schema as EchoSchema | Schema.Schema.AnyNoContext);\n this.setSchema(typename as T, echoSchema);\n result.push(echoSchema);\n }\n\n return result;\n }\n\n override async createObject({ types }: { types?: T[] } = {}): Promise<AnyLiveObject<any>> {\n return this._space.db.add(await super.createObject({ types }));\n }\n\n private async _maybeRegisterSchema(\n typename: string,\n schema: EchoSchema | Schema.Schema.AnyNoContext,\n ): Promise<EchoSchema | Schema.Schema.AnyNoContext> {\n if (schema instanceof EchoSchema) {\n const existingSchema = this._space.db.schemaRegistry.getSchema(typename);\n if (existingSchema != null) {\n return existingSchema;\n }\n const [registeredSchema] = await this._space.db.schemaRegistry.register([schema]);\n return registeredSchema;\n } else {\n const existingSchema = this._space.db.graph.schemaRegistry.getSchema(typename);\n if (existingSchema != null) {\n return existingSchema;\n }\n this._space.db.graph.schemaRegistry.addSchema([schema]);\n return schema;\n }\n }\n\n async mutateObject(object: AnyLiveObject<any>, params: MutationsProviderParams): Promise<void> {\n invariant(this._mutations, 'Mutations not defined.');\n const type = getTypeAnnotation(getSchema(object)!)!.typename as T;\n invariant(type && this._mutations?.[type], 'Invalid object type.');\n\n await this._mutations![type](object, params);\n }\n\n async mutateObjects(objects: AnyLiveObject<any>[], params: MutationsProviderParams): Promise<void> {\n for (const object of objects) {\n await this.mutateObject(object, params);\n }\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const randomText = (length: number) => {\n let result = '';\n const characters = 'abcdefghijklmnopqrstuvwxyz';\n const charactersLength = characters.length;\n for (let index = 0; index < length; index++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n\n return result;\n};\n"],
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,GAA0B,aAAa;IACrCjC,MAAMxE,cAAAA,MAAM+G,SAASC,YAAW;IAChC7B,MAAMnF,cAAAA,MAAMoG,SAASC,IAAG;IACxBjB,QAAQpF,cAAAA,MAAMC,QAAQC,aAAasD,MAAAA;IACnCU,aAAalE,cAAAA,MAAMyF,MAAME,UAAS;IAClClB,SAASzE,cAAAA,MAAMoG,SAASC,IAAG;IAC3BhB,UAAUrF,cAAAA,MAAMC,QAAQC,aAAauD,QAAAA;IACrC6B,QAAQtF,cAAAA,MAAMiG,SAASC,QAAO;EAChC;AACF;AAEA,IAAMe,qBAAuD;EAC3D,CAAA,2BAAA,GAA2B,OAAOtE,QAAQC,WAAAA;AACxC,UAAMsE,eAAWC,+BAAkBxE,QAAQ;MAAC;KAAU;AACtD,aAASyE,IAAI,GAAGA,IAAIxE,OAAOlC,OAAO0G,KAAK;AACrC,YAAMpE,SAASL,OAAOwB,SAASA,SAASnB,UAAU;AAClDkE,eAASG,OAAOC,OAAO,CAACC,QAAAA;AACtBC,yBAAAA,KAAEC,OACAF,KACAL,SAASQ,KAAKC,MAAK,GACnB,GACA/E,OAAOgF,oBAAoB5E,SAAS,IAAIJ,OAAOiF,cAC/C9E,WAAWH,OAAOiF,YAAY,CAAA;MAElC,CAAA;IACF;EACF;EACA,CAAA,+BAAA,GAA+B,YAAA;AAC7B,UAAM,IAAIC,MAAM,yBAAA;EAClB;EACA,CAAA,0BAAA,GAA0B,YAAA;AACxB,UAAM,IAAIA,MAAM,yBAAA;EAClB;EACA,CAAA,0BAAA,GAA0B,YAAA;AACxB,UAAM,IAAIA,MAAM,yBAAA;EAClB;AACF;AAKO,IAAMC,4BAA4B,MAAM,IAAI/I,oBAAoB2E,YAAAA,GAAe6B,oBAAAA;AAK/E,IAAMwC,6BAA6B,CAACC,UACzC,IAAI9G,qBAAqB8G,OAAOtE,YAAAA,GAAe6B,sBAAsByB,kBAAAA;",
6
+ "names": ["import_echo", "import_echo_schema", "import_random", "TestObjectGenerator", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "getSchema", "type", "find", "schema", "getTypeAnnotation", "typename", "setSchema", "createObject", "types", "faker", "helpers", "arrayElement", "keys", "data", "isLiveObject", "live", "createObjects", "map", "results", "count", "entries", "push", "Promise", "all", "range", "tasks", "flatMap", "t", "SpaceObjectGenerator", "_space", "schemaMap", "generators", "_mutations", "objects", "db", "query", "Filter", "nothing", "run", "addSchemas", "result", "echoSchema", "_maybeRegisterSchema", "add", "EchoSchema", "existingSchema", "schemaRegistry", "registeredSchema", "register", "graph", "addSchema", "mutateObject", "object", "params", "invariant", "mutateObjects", "randomText", "length", "characters", "charactersLength", "index", "charAt", "Math", "floor", "random", "Status", "Priority", "TestSchemaType", "testSchemas", "document", "Schema", "Struct", "title", "String", "annotations", "description", "content", "pipe", "EchoObject", "version", "organization", "name", "website", "optional", "contact", "email", "org", "Ref", "lat", "Number", "lng", "project", "repo", "status", "priority", "active", "Boolean", "testObjectGenerators", "lorem", "sentence", "sentences", "min", "max", "number", "int", "company", "datatype", "boolean", "probability", "internet", "url", "undefined", "provider", "organizations", "location", "geo", "airport", "person", "fullName", "make", "commerce", "productName", "testObjectMutators", "accessor", "createDocAccessor", "i", "handle", "change", "doc", "A", "splice", "path", "slice", "maxContentLength", "mutationSize", "Error", "createTestObjectGenerator", "createSpaceObjectGenerator", "space"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/core/echo/echo-generator/src/generator.ts":{"bytes":15821,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo-generator/src/util.ts":{"bytes":1624,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/data.ts":{"bytes":18602,"imports":[{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/core/echo/echo-generator/src/types.ts":{"bytes":1705,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/index.ts":{"bytes":751,"imports":[{"path":"packages/core/echo/echo-generator/src/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"},{"path":"packages/core/echo/echo-generator/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"packages/core/echo/echo-generator/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17909},"packages/core/echo/echo-generator/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Priority","SpaceObjectGenerator","Status","TestObjectGenerator","TestSchemaType","createSpaceObjectGenerator","createTestObjectGenerator","randomText"],"entryPoint":"packages/core/echo/echo-generator/src/index.ts","inputs":{"packages/core/echo/echo-generator/src/data.ts":{"bytesInOutput":4586},"packages/core/echo/echo-generator/src/generator.ts":{"bytesInOutput":3745},"packages/core/echo/echo-generator/src/util.ts":{"bytesInOutput":299},"packages/core/echo/echo-generator/src/index.ts":{"bytesInOutput":0}},"bytes":9040}}}
1
+ {"inputs":{"packages/core/echo/echo-generator/src/generator.ts":{"bytes":16612,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo-generator/src/util.ts":{"bytes":1580,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/data.ts":{"bytes":19484,"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/core/echo/echo-generator/src/types.ts":{"bytes":1713,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/index.ts":{"bytes":715,"imports":[{"path":"packages/core/echo/echo-generator/src/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"},{"path":"packages/core/echo/echo-generator/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"packages/core/echo/echo-generator/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18938},"packages/core/echo/echo-generator/dist/lib/node/index.cjs":{"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Priority","SpaceObjectGenerator","Status","TestObjectGenerator","TestSchemaType","createSpaceObjectGenerator","createTestObjectGenerator","randomText"],"entryPoint":"packages/core/echo/echo-generator/src/index.ts","inputs":{"packages/core/echo/echo-generator/src/data.ts":{"bytesInOutput":4811},"packages/core/echo/echo-generator/src/generator.ts":{"bytesInOutput":3960},"packages/core/echo/echo-generator/src/util.ts":{"bytesInOutput":299},"packages/core/echo/echo-generator/src/index.ts":{"bytesInOutput":0}},"bytes":9480}}}