@dxos/echo-generator 0.8.1 → 0.8.2-main.10c050d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +83 -76
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +81 -74
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +83 -76
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/data.d.ts +13 -4
- package/dist/types/src/data.d.ts.map +1 -1
- package/dist/types/src/generator.d.ts +14 -12
- package/dist/types/src/generator.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +7 -6
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
- package/src/data.ts +56 -64
- package/src/generator.test.ts +35 -7
- package/src/generator.ts +27 -18
- package/src/types.ts +8 -6
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,15 +28,15 @@ __export(node_exports, {
|
|
|
28
28
|
randomText: () => randomText
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(node_exports);
|
|
31
|
-
var import_automerge = require("@
|
|
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
38
|
var import_invariant = require("@dxos/invariant");
|
|
39
|
-
var
|
|
39
|
+
var import_live_object = require("@dxos/live-object");
|
|
40
40
|
var import_random2 = require("@dxos/random");
|
|
41
41
|
var import_util = require("@dxos/util");
|
|
42
42
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-generator/src/generator.ts";
|
|
@@ -59,14 +59,22 @@ var TestObjectGenerator = class {
|
|
|
59
59
|
async createObject({ types } = {}) {
|
|
60
60
|
const type = import_random2.faker.helpers.arrayElement(types ?? Object.keys(this._schemas));
|
|
61
61
|
const data = await this._generators[type](this._provider);
|
|
62
|
-
if ((0,
|
|
62
|
+
if ((0, import_live_object.isLiveObject)(data)) {
|
|
63
63
|
return data;
|
|
64
64
|
}
|
|
65
65
|
const schema = this.getSchema(type);
|
|
66
|
-
return schema ? (0,
|
|
66
|
+
return schema ? (0, import_live_object.live)(schema, data) : (0, import_live_object.live)(data);
|
|
67
67
|
}
|
|
68
68
|
// TODO(burdon): Based on dependencies (e.g., organization before contact).
|
|
69
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
|
+
}
|
|
70
78
|
const tasks = Object.entries(map).map(([type, count]) => {
|
|
71
79
|
return (0, import_util.range)(count, () => this.createObject({
|
|
72
80
|
types: [
|
|
@@ -81,10 +89,9 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
81
89
|
constructor(_space, schemaMap, generators, _mutations) {
|
|
82
90
|
super(schemaMap, generators, async (type) => {
|
|
83
91
|
const schema = this.getSchema(type);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this._space = _space;
|
|
87
|
-
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;
|
|
88
95
|
}
|
|
89
96
|
async addSchemas() {
|
|
90
97
|
const result = [];
|
|
@@ -124,17 +131,17 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
124
131
|
async mutateObject(object, params) {
|
|
125
132
|
(0, import_invariant.invariant)(this._mutations, "Mutations not defined.", {
|
|
126
133
|
F: __dxlog_file,
|
|
127
|
-
L:
|
|
134
|
+
L: 130,
|
|
128
135
|
S: this,
|
|
129
136
|
A: [
|
|
130
137
|
"this._mutations",
|
|
131
138
|
"'Mutations not defined.'"
|
|
132
139
|
]
|
|
133
140
|
});
|
|
134
|
-
const type = (0, import_echo_schema2.getTypeAnnotation)((0,
|
|
141
|
+
const type = (0, import_echo_schema2.getTypeAnnotation)((0, import_echo_schema2.getSchema)(object)).typename;
|
|
135
142
|
(0, import_invariant.invariant)(type && this._mutations?.[type], "Invalid object type.", {
|
|
136
143
|
F: __dxlog_file,
|
|
137
|
-
L:
|
|
144
|
+
L: 132,
|
|
138
145
|
S: this,
|
|
139
146
|
A: [
|
|
140
147
|
"type && this._mutations?.[type]",
|
|
@@ -170,73 +177,73 @@ var Priority = [
|
|
|
170
177
|
4,
|
|
171
178
|
5
|
|
172
179
|
];
|
|
173
|
-
var TestSchemaType
|
|
174
|
-
|
|
175
|
-
TestSchemaType2["
|
|
176
|
-
TestSchemaType2["
|
|
177
|
-
TestSchemaType2["
|
|
178
|
-
TestSchemaType2
|
|
179
|
-
}
|
|
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
|
+
}({});
|
|
180
187
|
var testSchemas = () => {
|
|
181
|
-
const document =
|
|
182
|
-
|
|
183
|
-
version: "0.1.0"
|
|
184
|
-
}, {
|
|
185
|
-
title: import_echo_schema.S.String.annotations({
|
|
188
|
+
const document = import_effect.Schema.Struct({
|
|
189
|
+
title: import_effect.Schema.String.annotations({
|
|
186
190
|
description: "title of the document"
|
|
187
191
|
}),
|
|
188
|
-
content:
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
typename: "example.com/type/organization",
|
|
192
|
+
content: import_effect.Schema.String
|
|
193
|
+
}).pipe((0, import_echo_schema.EchoObject)({
|
|
194
|
+
typename: "example.com/type/Document",
|
|
192
195
|
version: "0.1.0"
|
|
193
|
-
}
|
|
194
|
-
|
|
196
|
+
}));
|
|
197
|
+
const organization = import_effect.Schema.Struct({
|
|
198
|
+
name: import_effect.Schema.String.annotations({
|
|
195
199
|
description: "name of the company or organization"
|
|
196
200
|
}),
|
|
197
|
-
website:
|
|
201
|
+
website: import_effect.Schema.optional(import_effect.Schema.String.annotations({
|
|
198
202
|
description: "public website URL"
|
|
199
|
-
}),
|
|
200
|
-
description:
|
|
203
|
+
})),
|
|
204
|
+
description: import_effect.Schema.String.annotations({
|
|
201
205
|
description: "short summary of the company"
|
|
202
206
|
})
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
typename: "example.com/type/contact",
|
|
207
|
+
}).pipe((0, import_echo_schema.EchoObject)({
|
|
208
|
+
typename: "example.com/type/Organization",
|
|
206
209
|
version: "0.1.0"
|
|
207
|
-
}
|
|
208
|
-
|
|
210
|
+
}));
|
|
211
|
+
const contact = import_effect.Schema.Struct({
|
|
212
|
+
name: import_effect.Schema.String.annotations({
|
|
209
213
|
description: "name of the person"
|
|
210
214
|
}),
|
|
211
|
-
email:
|
|
212
|
-
org: (0, import_echo_schema.Ref)(organization),
|
|
213
|
-
lat:
|
|
214
|
-
lng:
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
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",
|
|
218
221
|
version: "0.1.0"
|
|
219
|
-
}
|
|
220
|
-
|
|
222
|
+
}));
|
|
223
|
+
const project = import_effect.Schema.Struct({
|
|
224
|
+
name: import_effect.Schema.String.annotations({
|
|
221
225
|
description: "name of the project"
|
|
222
226
|
}),
|
|
223
|
-
description:
|
|
224
|
-
website:
|
|
225
|
-
repo:
|
|
226
|
-
status:
|
|
227
|
-
priority:
|
|
228
|
-
active:
|
|
229
|
-
org: (0, import_echo_schema.Ref)(organization)
|
|
230
|
-
})
|
|
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
|
+
}));
|
|
231
238
|
return {
|
|
232
|
-
["example.com/type/
|
|
233
|
-
["example.com/type/
|
|
234
|
-
["example.com/type/
|
|
235
|
-
["example.com/type/
|
|
239
|
+
["example.com/type/Document"]: document,
|
|
240
|
+
["example.com/type/Organization"]: organization,
|
|
241
|
+
["example.com/type/Contact"]: contact,
|
|
242
|
+
["example.com/type/Project"]: project
|
|
236
243
|
};
|
|
237
244
|
};
|
|
238
245
|
var testObjectGenerators = {
|
|
239
|
-
["example.com/type/
|
|
246
|
+
["example.com/type/Document"]: async () => ({
|
|
240
247
|
title: import_random.faker.lorem.sentence(3),
|
|
241
248
|
content: import_random.faker.lorem.sentences({
|
|
242
249
|
min: 1,
|
|
@@ -246,39 +253,39 @@ var testObjectGenerators = {
|
|
|
246
253
|
})
|
|
247
254
|
})
|
|
248
255
|
}),
|
|
249
|
-
["example.com/type/
|
|
256
|
+
["example.com/type/Organization"]: async () => ({
|
|
250
257
|
name: import_random.faker.company.name(),
|
|
251
258
|
website: import_random.faker.datatype.boolean({
|
|
252
259
|
probability: 0.3
|
|
253
260
|
}) ? import_random.faker.internet.url() : void 0,
|
|
254
261
|
description: import_random.faker.lorem.sentences()
|
|
255
262
|
}),
|
|
256
|
-
["example.com/type/
|
|
257
|
-
const organizations = await provider?.("example.com/type/
|
|
258
|
-
const
|
|
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() : {};
|
|
259
266
|
return {
|
|
260
267
|
name: import_random.faker.person.fullName(),
|
|
261
268
|
email: import_random.faker.datatype.boolean({
|
|
262
269
|
probability: 0.5
|
|
263
270
|
}) ? import_random.faker.internet.email() : void 0,
|
|
264
271
|
org: organizations?.length && import_random.faker.datatype.boolean({
|
|
265
|
-
probability: 0.
|
|
266
|
-
}) ?
|
|
272
|
+
probability: 0.8
|
|
273
|
+
}) ? import_echo_schema.Ref.make(import_random.faker.helpers.arrayElement(organizations)) : void 0,
|
|
267
274
|
...location
|
|
268
275
|
};
|
|
269
276
|
},
|
|
270
|
-
["example.com/type/
|
|
277
|
+
["example.com/type/Project"]: async () => ({
|
|
271
278
|
name: import_random.faker.commerce.productName(),
|
|
272
|
-
repo: import_random.faker.
|
|
273
|
-
probability: 0.3
|
|
274
|
-
}) ? import_random.faker.internet.url() : void 0,
|
|
279
|
+
repo: import_random.faker.internet.url(),
|
|
275
280
|
status: import_random.faker.helpers.arrayElement(Status),
|
|
281
|
+
description: import_random.faker.lorem.sentences(),
|
|
282
|
+
website: import_random.faker.internet.url(),
|
|
276
283
|
priority: import_random.faker.helpers.arrayElement(Priority),
|
|
277
284
|
active: import_random.faker.datatype.boolean()
|
|
278
285
|
})
|
|
279
286
|
};
|
|
280
287
|
var testObjectMutators = {
|
|
281
|
-
["example.com/type/
|
|
288
|
+
["example.com/type/Document"]: async (object, params) => {
|
|
282
289
|
const accessor = (0, import_echo.createDocAccessor)(object, [
|
|
283
290
|
"content"
|
|
284
291
|
]);
|
|
@@ -289,13 +296,13 @@ var testObjectMutators = {
|
|
|
289
296
|
});
|
|
290
297
|
}
|
|
291
298
|
},
|
|
292
|
-
["example.com/type/
|
|
299
|
+
["example.com/type/Organization"]: async () => {
|
|
293
300
|
throw new Error("Method not implemented.");
|
|
294
301
|
},
|
|
295
|
-
["example.com/type/
|
|
302
|
+
["example.com/type/Contact"]: async () => {
|
|
296
303
|
throw new Error("Method not implemented.");
|
|
297
304
|
},
|
|
298
|
-
["example.com/type/
|
|
305
|
+
["example.com/type/Project"]: async () => {
|
|
299
306
|
throw new Error("Method not implemented.");
|
|
300
307
|
}
|
|
301
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 { invariant } from '@dxos/invariant';\nimport { create, getSchema, isReactiveObject, type ReactiveObject } 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<ReactiveObject<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 (isReactiveObject(data)) {\n return data;\n }\n\n const schema = this.getSchema(type);\n return schema ? create(schema, data) : create(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;\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,
|
|
6
|
-
"names": ["import_echo", "import_echo_schema", "
|
|
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;\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,uBAA0B;AAC1B,oBAAuB;AAEvB,kBAA8C;AAC9C,yBAAgC;AAChC,oBAAsB;ACHtB,IAAAA,eAAmC;AAEnC,IAAAC,sBAAyD;AACzD,uBAA0B;AAC1B,yBAA8C;AAC9C,IAAAC,iBAAsB;AACtB,kBAA+B;;AAexB,IAAMC,sBAAN,MAAMA;;EAEX,YACqBC,UACFC,aACAC,WACjB;SAHmBF,WAAAA;SACFC,cAAAA;SACAC,YAAAA;EAChB;EAEH,IAAIC,UAAuD;AACzD,WAAOC,OAAOC,OAAO,KAAKL,QAAQ;EACpC;EAEAM,UAAUC,MAA8D;AACtE,WAAO,KAAKJ,QAAQK,KAAK,CAACC,eAAWC,uCAAkBD,MAAAA,EAASE,aAAaJ,IAAAA;EAC/E;EAEUK,UAAUL,MAASE,QAAuD;AAClF,SAAKT,SAASO,IAAAA,IAAQE;EACxB;EAEA,MAAMI,aAAa,EAAEC,MAAK,IAAsB,CAAC,GAAuB;AACtE,UAAMP,OAAOQ,qBAAMC,QAAQC,aAAaH,SAAUV,OAAOc,KAAK,KAAKlB,QAAQ,CAAA;AAC3E,UAAMmB,OAAO,MAAM,KAAKlB,YAAYM,IAAAA,EAAM,KAAKL,SAAS;AACxD,YAAIkB,iCAAaD,IAAAA,GAAO;AACtB,aAAOA;IACT;AAEA,UAAMV,SAAS,KAAKH,UAAUC,IAAAA;AAC9B,WAAOE,aAASY,yBAAKZ,QAAQU,IAAAA,QAAQE,yBAAKF,IAAAA;EAC5C;;EAGA,MAAMG,cAAcC,KAAiC;AACnD,UAAMC,UAAuB,CAAA;AAC7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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
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/echo/echo-generator/src/generator.ts":{"bytes":
|
|
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}}}
|