@dxos/echo-generator 0.3.3-main.1817c8a → 0.3.3-main.22971a3

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.
@@ -1,20 +1,65 @@
1
1
  import "@dxos/node-std/globals";
2
2
 
3
+ // packages/core/echo/echo-generator/src/data.ts
4
+ import { faker as faker2 } from "@faker-js/faker";
5
+ import { Schema, Text } from "@dxos/client/echo";
6
+
3
7
  // packages/core/echo/echo-generator/src/generator.ts
4
8
  import { faker } from "@faker-js/faker";
5
- import { Expando, Schema as SchemaType } from "@dxos/client/echo";
9
+ import { Expando } from "@dxos/client/echo";
10
+
11
+ // packages/core/echo/echo-generator/src/util.ts
6
12
  var range = (fn, length) => Array.from({
7
13
  length
8
14
  }).map((_, i) => fn(i)).filter(Boolean);
9
- var createFactory = ({ createSchema, createData }) => {
10
- const schema = createSchema?.();
11
- return {
12
- schema,
13
- createObject: () => new Expando(createData(), {
14
- schema
15
- })
16
- };
15
+
16
+ // packages/core/echo/echo-generator/src/generator.ts
17
+ var TestObjectGenerator = class {
18
+ // prettier-ignore
19
+ constructor(schema, _generators, _provider) {
20
+ this.schema = schema;
21
+ this._generators = _generators;
22
+ this._provider = _provider;
23
+ }
24
+ get schemas() {
25
+ return Object.values(this.schema);
26
+ }
27
+ createObject({ types } = {}) {
28
+ const type = faker.helpers.arrayElement(types ?? Object.keys(this.schema));
29
+ const factory = this._generators[type];
30
+ const data = factory(this._provider);
31
+ return new Expando(data, {
32
+ schema: this.schema[type]
33
+ });
34
+ }
35
+ // TODO(burdon): Create batch.
36
+ createObjects({ types, count }) {
37
+ return range(() => this.createObject({
38
+ types
39
+ }), count);
40
+ }
41
+ };
42
+ var SpaceObjectGenerator = class extends TestObjectGenerator {
43
+ constructor(_space, schema, generators) {
44
+ super(schema, generators, (type) => {
45
+ const { objects } = this._space.db.query((object) => {
46
+ return object.__schema === schema[type];
47
+ });
48
+ return objects;
49
+ });
50
+ this._space = _space;
51
+ }
52
+ addSchemas() {
53
+ this.schemas.forEach((schema) => this._space.db.add(schema));
54
+ }
55
+ createObject({ types } = {}) {
56
+ return this._space.db.add(super.createObject({
57
+ types
58
+ }));
59
+ }
17
60
  };
61
+
62
+ // packages/core/echo/echo-generator/src/data.ts
18
63
  var Status = [
19
64
  "pending",
20
65
  "active",
@@ -27,107 +72,130 @@ var Priority = [
27
72
  4,
28
73
  5
29
74
  ];
30
- var defaultGenerators = {
31
- document: {
32
- createSchema: () => new SchemaType({
33
- props: [
34
- {
35
- id: "title",
36
- type: SchemaType.PropType.STRING
37
- },
38
- {
39
- id: "body",
40
- type: SchemaType.PropType.STRING
41
- }
42
- ]
43
- }),
44
- createData: () => ({
45
- title: faker.lorem.sentence(3),
46
- body: faker.lorem.sentences({
75
+ var testSchemas = () => {
76
+ const document = new Schema({
77
+ props: [
78
+ {
79
+ id: "name",
80
+ type: Schema.PropType.STRING
81
+ },
82
+ {
83
+ id: "content",
84
+ type: Schema.PropType.STRING
85
+ }
86
+ ]
87
+ });
88
+ const organization = new Schema({
89
+ props: [
90
+ // TODO(burdon): Add metadata for default label.
91
+ {
92
+ id: "name",
93
+ type: Schema.PropType.STRING
94
+ },
95
+ {
96
+ id: "website",
97
+ type: Schema.PropType.STRING
98
+ },
99
+ {
100
+ id: "active",
101
+ type: Schema.PropType.BOOLEAN
102
+ }
103
+ ]
104
+ });
105
+ const person = new Schema({
106
+ props: [
107
+ {
108
+ id: "name",
109
+ type: Schema.PropType.STRING
110
+ },
111
+ {
112
+ id: "email",
113
+ type: Schema.PropType.STRING
114
+ },
115
+ {
116
+ id: "org",
117
+ type: Schema.PropType.REF,
118
+ ref: organization
119
+ }
120
+ ]
121
+ });
122
+ const project = new Schema({
123
+ props: [
124
+ {
125
+ id: "title",
126
+ type: Schema.PropType.STRING
127
+ },
128
+ {
129
+ id: "repo",
130
+ type: Schema.PropType.STRING
131
+ },
132
+ {
133
+ id: "status",
134
+ type: Schema.PropType.STRING
135
+ },
136
+ {
137
+ id: "priority",
138
+ type: Schema.PropType.NUMBER
139
+ }
140
+ ]
141
+ });
142
+ return {
143
+ document,
144
+ organization,
145
+ person,
146
+ project
147
+ };
148
+ };
149
+ var testObjectGenerators = {
150
+ document: () => ({
151
+ title: faker2.lorem.sentence(3),
152
+ content: faker2.lorem.sentences({
153
+ min: 1,
154
+ max: faker2.number.int({
47
155
  min: 1,
48
- max: faker.number.int({
49
- min: 1,
50
- max: 3
51
- })
156
+ max: 3
52
157
  })
53
158
  })
54
- },
55
- // TODO(burdon): Configure images.
56
- image: {
57
- createSchema: () => new SchemaType({
58
- props: [
59
- {
60
- id: "title",
61
- type: SchemaType.PropType.STRING
62
- },
63
- {
64
- id: "body",
65
- type: SchemaType.PropType.STRING
66
- }
67
- ]
68
- }),
69
- createData: () => ({
70
- title: faker.lorem.sentence(3),
71
- body: faker.datatype.boolean() ? faker.lorem.sentences() : void 0
72
- })
73
- },
74
- project: {
75
- createSchema: () => new SchemaType({
76
- props: [
77
- {
78
- id: "title",
79
- type: SchemaType.PropType.STRING
80
- },
81
- {
82
- id: "repo",
83
- type: SchemaType.PropType.STRING
84
- },
85
- {
86
- id: "status",
87
- type: SchemaType.PropType.STRING
88
- },
89
- {
90
- id: "priority",
91
- type: SchemaType.PropType.NUMBER
92
- }
93
- ]
94
- }),
95
- createData: () => ({
96
- title: faker.commerce.productName(),
97
- repo: faker.datatype.boolean({
159
+ }),
160
+ organization: () => ({
161
+ name: faker2.company.name(),
162
+ website: faker2.datatype.boolean({
163
+ probability: 0.3
164
+ }) ? faker2.internet.url() : void 0,
165
+ description: new Text(faker2.lorem.sentences())
166
+ }),
167
+ person: (provider) => {
168
+ const organizations = provider?.("organization");
169
+ return {
170
+ name: faker2.person.fullName(),
171
+ email: faker2.datatype.boolean({
172
+ probability: 0.5
173
+ }) ? faker2.internet.email() : void 0,
174
+ org: organizations?.length && faker2.datatype.boolean({
98
175
  probability: 0.3
99
- }) ? faker.internet.url() : void 0,
100
- status: faker.helpers.arrayElement(Status),
101
- priority: faker.helpers.arrayElement(Priority)
102
- })
103
- }
104
- };
105
- var TestObjectGenerator = class {
106
- constructor({ types, factories } = {}) {
107
- this.factories = factories ?? (types ?? Object.keys(defaultGenerators)).reduce((acc, type) => {
108
- acc[type] = createFactory(defaultGenerators[type]);
109
- return acc;
110
- }, {});
111
- }
112
- get schema() {
113
- return Object.values(this.factories).map((f) => f.schema);
114
- }
115
- createObject({ types } = {}) {
116
- const type = faker.helpers.arrayElement(types ?? Object.keys(this.factories));
117
- const factory = this.factories[type];
118
- return factory?.createObject();
119
- }
120
- createObjects({ types, length }) {
121
- return range(() => this.createObject({
122
- types
123
- }), length);
124
- }
176
+ }) ? faker2.helpers.arrayElement(organizations) : void 0
177
+ };
178
+ },
179
+ project: () => ({
180
+ title: faker2.commerce.productName(),
181
+ repo: faker2.datatype.boolean({
182
+ probability: 0.3
183
+ }) ? faker2.internet.url() : void 0,
184
+ status: faker2.helpers.arrayElement(Status),
185
+ priority: faker2.helpers.arrayElement(Priority)
186
+ })
125
187
  };
188
+ var createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);
189
+ var createSpaceObjectGenerator = (space) => new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators);
126
190
  export {
127
191
  Priority,
192
+ SpaceObjectGenerator,
128
193
  Status,
129
194
  TestObjectGenerator,
130
- defaultGenerators,
131
- range
195
+ createSpaceObjectGenerator,
196
+ createTestObjectGenerator,
197
+ range,
198
+ testObjectGenerators,
199
+ testSchemas
132
200
  };
133
201
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/generator.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\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\nimport { faker } from '@faker-js/faker';\n\nimport { Expando, type TypedObject, Schema as SchemaType } from '@dxos/client/echo';\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter(Boolean) as T[];\n\n// TODO(burdon): Commit to using ECHO to generate all test data? Or convert from raw data?\nexport type TestItem = { id: string; type: string } & Record<string, any>;\n\ntype ObjectDataGenerator = {\n createSchema?: () => SchemaType;\n createData: () => any;\n};\n\ntype ObjectFactory<T extends TypedObject> = {\n schema?: SchemaType; // TODO(burdon): Support both typed and expando schema.\n createObject: () => T;\n};\n\ntype ObjectFactoryMap = { [type: string]: ObjectFactory<any> };\n\nconst createFactory = ({ createSchema, createData }: ObjectDataGenerator) => {\n const schema = createSchema?.();\n return {\n schema,\n createObject: () => new Expando(createData(), { schema }),\n };\n};\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport const defaultGenerators: { [type: string]: ObjectDataGenerator } = {\n document: {\n createSchema: () =>\n new SchemaType({\n props: [\n {\n id: 'title',\n type: SchemaType.PropType.STRING,\n },\n {\n id: 'body',\n type: SchemaType.PropType.STRING,\n },\n ],\n }),\n createData: () => ({\n title: faker.lorem.sentence(3),\n body: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n },\n\n // TODO(burdon): Configure images.\n image: {\n createSchema: () =>\n new SchemaType({\n props: [\n {\n id: 'title',\n type: SchemaType.PropType.STRING,\n },\n {\n id: 'body',\n type: SchemaType.PropType.STRING,\n },\n ],\n }),\n createData: () => ({\n title: faker.lorem.sentence(3),\n body: faker.datatype.boolean() ? faker.lorem.sentences() : undefined,\n }),\n },\n\n project: {\n createSchema: () =>\n new SchemaType({\n props: [\n {\n id: 'title',\n type: SchemaType.PropType.STRING,\n },\n {\n id: 'repo',\n type: SchemaType.PropType.STRING,\n },\n {\n id: 'status',\n type: SchemaType.PropType.STRING,\n },\n {\n id: 'priority',\n type: SchemaType.PropType.NUMBER,\n },\n ],\n }),\n createData: () => ({\n title: 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 }),\n },\n};\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator {\n public readonly factories: ObjectFactoryMap;\n\n constructor({ types, factories }: { types?: string[]; factories?: ObjectFactoryMap } = {}) {\n this.factories =\n factories ??\n (types ?? Object.keys(defaultGenerators)).reduce<ObjectFactoryMap>((acc, type) => {\n acc[type] = createFactory(defaultGenerators[type]);\n return acc;\n }, {});\n }\n\n get schema(): SchemaType[] {\n return Object.values(this.factories).map((f) => f.schema!);\n }\n\n createObject({ types }: { types?: string[] } = {}) {\n const type = faker.helpers.arrayElement(types ?? Object.keys(this.factories));\n const factory = this.factories[type];\n return factory?.createObject();\n }\n\n createObjects({ types, length }: { types?: string[]; length: number }) {\n return range(() => this.createObject({ types }), length);\n }\n}\n"],
5
- "mappings": ";;;AAOA,SAASA,aAAa;AAEtB,SAASC,SAA2BC,UAAUC,kBAAkB;AAGzD,IAAMC,QAAQ,CAAIC,IAAkCC,WACzDC,MAAMC,KAAK;EAAEF;AAAO,CAAA,EACjBG,IAAI,CAACC,GAAGC,MAAMN,GAAGM,CAAAA,CAAAA,EACjBC,OAAOC,OAAAA;AAiBZ,IAAMC,gBAAgB,CAAC,EAAEC,cAAcC,WAAU,MAAuB;AACtE,QAAMC,SAASF,eAAAA;AACf,SAAO;IACLE;IACAC,cAAc,MAAM,IAAIC,QAAQH,WAAAA,GAAc;MAAEC;IAAO,CAAA;EACzD;AACF;AAGO,IAAMG,SAAS;EAAC;EAAW;EAAU;;AACrC,IAAMC,WAAW;EAAC;EAAG;EAAG;EAAG;EAAG;;AAE9B,IAAMC,oBAA6D;EACxEC,UAAU;IACRR,cAAc,MACZ,IAAIS,WAAW;MACbC,OAAO;QACL;UACEC,IAAI;UACJC,MA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F,SAAKA,YACHA,cACCD,SAASE,OAAOC,KAAKvC,iBAAAA,GAAoBwC,OAAyB,CAACC,KAAKpC,SAAAA;AACvEoC,UAAIpC,IAAAA,IAAQb,cAAcQ,kBAAkBK,IAAAA,CAAK;AACjD,aAAOoC;IACT,GAAG,CAAC,CAAA;EACR;EAEA,IAAI9C,SAAuB;AACzB,WAAO2C,OAAOI,OAAO,KAAKL,SAAS,EAAElD,IAAI,CAACwD,MAAMA,EAAEhD,MAAM;EAC1D;EAEAC,aAAa,EAAEwC,MAAK,IAA2B,CAAC,GAAG;AACjD,UAAM/B,OAAOI,MAAMsB,QAAQC,aAAaI,SAASE,OAAOC,KAAK,KAAKF,SAAS,CAAA;AAC3E,UAAMO,UAAU,KAAKP,UAAUhC,IAAAA;AAC/B,WAAOuC,SAAShD,aAAAA;EAClB;EAEAiD,cAAc,EAAET,OAAOpD,OAAM,GAA0C;AACrE,WAAOF,MAAM,MAAM,KAAKc,aAAa;MAAEwC;IAAM,CAAA,GAAIpD,MAAAA;EACnD;AACF;",
6
- "names": ["faker", "Expando", "Schema", "SchemaType", "range", "fn", "length", "Array", "from", "map", "_", "i", "filter", "Boolean", "createFactory", "createSchema", "createData", "schema", "createObject", "Expando", "Status", "Priority", "defaultGenerators", "document", "SchemaType", "props", "id", "type", "PropType", "STRING", "title", "faker", "lorem", "sentence", "body", "sentences", "min", "max", "number", "int", "image", "datatype", "boolean", "undefined", "project", "NUMBER", "commerce", "productName", "repo", "probability", "internet", "url", "status", "helpers", "arrayElement", "priority", "TestObjectGenerator", "constructor", "types", "factories", "Object", "keys", "reduce", "acc", "values", "f", "factory", "createObjects"]
3
+ "sources": ["../../../src/data.ts", "../../../src/generator.ts", "../../../src/util.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\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\nimport { faker } from '@faker-js/faker';\n\nimport { Schema, type Space, Text } from '@dxos/client/echo';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestSchemaMap } from './types';\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport type TestSchemaType = 'document' | 'organization' | 'person' | 'project';\n\nexport const testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = new Schema({\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'content',\n type: Schema.PropType.STRING, // TODO(burdon): Rich text.\n },\n ],\n });\n\n const organization = new Schema({\n props: [\n // TODO(burdon): Add metadata for default label.\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'active',\n type: Schema.PropType.BOOLEAN,\n },\n ],\n });\n\n const person = new Schema({\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'email',\n type: Schema.PropType.STRING,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n ],\n });\n\n const project = new Schema({\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'repo',\n type: Schema.PropType.STRING,\n },\n {\n id: 'status',\n type: Schema.PropType.STRING,\n },\n {\n id: 'priority',\n type: Schema.PropType.NUMBER,\n },\n ],\n });\n\n return { document, organization, person, project };\n};\n\nexport const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n document: () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n organization: () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: new Text(faker.lorem.sentences()),\n }),\n\n person: (provider) => {\n const organizations = provider?.('organization');\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 ? faker.helpers.arrayElement(organizations)\n : undefined,\n };\n },\n\n project: () => ({\n title: 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 }),\n};\n\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators);\n", "//\n// Copyright 2023 DXOS.org\n//\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\nimport { faker } from '@faker-js/faker';\n\nimport { Expando, type Schema, type Space } from '@dxos/client/echo';\n\nimport { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';\nimport { range } from './util';\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator<T extends string> {\n // prettier-ignore\n constructor(\n public readonly schema: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>\n ) {}\n\n get schemas(): Schema[] {\n return Object.values(this.schema);\n }\n\n createObject({ types }: { types?: T[] } = {}): Expando {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this.schema) as T[]));\n const factory = this._generators[type];\n const data = factory(this._provider);\n return new Expando(data, { schema: this.schema[type] });\n }\n\n // TODO(burdon): Create batch.\n createObjects({ types, count }: { types?: T[]; count: number }): Expando[] {\n return range(() => this.createObject({ types }), count);\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(private readonly _space: Space, schema: TestSchemaMap<T>, generators: TestGeneratorMap<T>) {\n super(schema, generators, (type: T) => {\n // TODO(burdon): Query by schema.\n const { objects } = this._space.db.query((object) => {\n return object.__schema === schema[type];\n });\n\n return objects;\n });\n }\n\n addSchemas() {\n this.schemas.forEach((schema) => this._space.db.add(schema));\n }\n\n override createObject({ types }: { types?: T[] } = {}): Expando {\n return this._space.db.add(super.createObject({ types }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter(Boolean) as T[];\n"],
5
+ "mappings": ";;;AAOA,SAASA,SAAAA,cAAa;AAEtB,SAASC,QAAoBC,YAAY;;;ACFzC,SAASC,aAAa;AAEtB,SAASC,eAAwC;;;ACJ1C,IAAMC,QAAQ,CAAIC,IAAkCC,WACzDC,MAAMC,KAAK;EAAEF;AAAO,CAAA,EACjBG,IAAI,CAACC,GAAGC,MAAMN,GAAGM,CAAAA,CAAAA,EACjBC,OAAOC,OAAAA;;;ADSL,IAAMC,sBAAN,MAAMA;;EAEXC,YACkBC,QACCC,aACAC,WACjB;kBAHgBF;uBACCC;qBACAC;EAChB;EAEH,IAAIC,UAAoB;AACtB,WAAOC,OAAOC,OAAO,KAAKL,MAAM;EAClC;EAEAM,aAAa,EAAEC,MAAK,IAAsB,CAAC,GAAY;AACrD,UAAMC,OAAOC,MAAMC,QAAQC,aAAaJ,SAAUH,OAAOQ,KAAK,KAAKZ,MAAM,CAAA;AACzE,UAAMa,UAAU,KAAKZ,YAAYO,IAAAA;AACjC,UAAMM,OAAOD,QAAQ,KAAKX,SAAS;AACnC,WAAO,IAAIa,QAAQD,MAAM;MAAEd,QAAQ,KAAKA,OAAOQ,IAAAA;IAAM,CAAA;EACvD;;EAGAQ,cAAc,EAAET,OAAOU,MAAK,GAA+C;AACzE,WAAOC,MAAM,MAAM,KAAKZ,aAAa;MAAEC;IAAM,CAAA,GAAIU,KAAAA;EACnD;AACF;AAKO,IAAME,uBAAN,cAAqDrB,oBAAAA;EAC1DC,YAA6BqB,QAA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AAa9C,MAAAA;IACnCmD,UAAUhC,OAAM0B,QAAQC,aAAa7C,QAAAA;EACvC;AACF;AAEO,IAAMmD,4BAA4B,MAAM,IAAIC,oBAAoBnD,YAAAA,GAAee,oBAAAA;AAE/E,IAAMqC,6BAA6B,CAACC,UACzC,IAAIC,qBAAqBD,OAAOrD,YAAAA,GAAee,oBAAAA;",
6
+ "names": ["faker", "Schema", "Text", "faker", "Expando", "range", "fn", "length", "Array", "from", "map", "_", "i", "filter", "Boolean", "TestObjectGenerator", "constructor", "schema", "_generators", "_provider", "schemas", "Object", "values", "createObject", "types", "type", "faker", "helpers", "arrayElement", "keys", "factory", "data", "Expando", "createObjects", "count", "range", "SpaceObjectGenerator", "_space", "generators", "objects", "db", "query", "object", "__schema", "addSchemas", "forEach", "add", "Status", "Priority", "testSchemas", "document", "Schema", "props", "id", "type", "PropType", "STRING", "organization", "BOOLEAN", "person", "REF", "ref", "project", "NUMBER", "testObjectGenerators", "title", "faker", "lorem", "sentence", "content", "sentences", "min", "max", "number", "int", "name", "company", "website", "datatype", "boolean", "probability", "internet", "url", "undefined", "description", "Text", "provider", "organizations", "fullName", "email", "org", "length", "helpers", "arrayElement", "commerce", "productName", "repo", "status", "priority", "createTestObjectGenerator", "TestObjectGenerator", "createSpaceObjectGenerator", "space", "SpaceObjectGenerator"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/core/echo/echo-generator/src/generator.ts":{"bytes":14286,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo-generator/src/index.ts":{"bytes":478,"imports":[{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"}],"format":"esm"}},"outputs":{"packages/core/echo/echo-generator/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7186},"packages/core/echo/echo-generator/dist/lib/browser/index.mjs":{"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true}],"exports":["Priority","Status","TestObjectGenerator","defaultGenerators","range"],"entryPoint":"packages/core/echo/echo-generator/src/index.ts","inputs":{"packages/core/echo/echo-generator/src/generator.ts":{"bytesInOutput":2817},"packages/core/echo/echo-generator/src/index.ts":{"bytesInOutput":0}},"bytes":3026}}}
1
+ {"inputs":{"packages/core/echo/echo-generator/src/util.ts":{"bytes":1057,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/generator.ts":{"bytes":7133,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/core/echo/echo-generator/src/data.ts":{"bytes":12963,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"}],"format":"esm"},"packages/core/echo/echo-generator/src/index.ts":{"bytes":634,"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/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"packages/core/echo/echo-generator/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10324},"packages/core/echo/echo-generator/dist/lib/browser/index.mjs":{"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true}],"exports":["Priority","SpaceObjectGenerator","Status","TestObjectGenerator","createSpaceObjectGenerator","createTestObjectGenerator","range","testObjectGenerators","testSchemas"],"entryPoint":"packages/core/echo/echo-generator/src/index.ts","inputs":{"packages/core/echo/echo-generator/src/data.ts":{"bytesInOutput":2835},"packages/core/echo/echo-generator/src/generator.ts":{"bytesInOutput":1297},"packages/core/echo/echo-generator/src/util.ts":{"bytesInOutput":91},"packages/core/echo/echo-generator/src/index.ts":{"bytesInOutput":0}},"bytes":4738}}}