@dxos/echo-generator 0.8.3 → 0.8.4-main.1068cf700f
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 → neutral}/index.mjs +46 -31
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/types/src/data.d.ts +1 -1
- package/dist/types/src/data.d.ts.map +1 -1
- package/dist/types/src/generator.d.ts +14 -14
- package/dist/types/src/generator.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -8
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -18
- package/src/data.ts +11 -10
- package/src/generator.test.ts +19 -16
- package/src/generator.ts +32 -32
- package/src/index.ts +1 -1
- package/src/types.ts +5 -9
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node/index.cjs +0 -322
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -300
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-generator",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.1068cf700f",
|
|
4
4
|
"description": "ECHO data generator for testing.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "info@dxos.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
13
18
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"
|
|
15
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
19
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -24,24 +28,22 @@
|
|
|
24
28
|
"src"
|
|
25
29
|
],
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"@automerge/automerge": "3.
|
|
28
|
-
"effect": "3.
|
|
29
|
-
"@dxos/client": "0.8.
|
|
30
|
-
"@dxos/echo
|
|
31
|
-
"@dxos/echo-
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/util": "0.8.3",
|
|
37
|
-
"@dxos/invariant": "0.8.3"
|
|
31
|
+
"@automerge/automerge": "3.2.3",
|
|
32
|
+
"effect": "3.19.16",
|
|
33
|
+
"@dxos/client": "0.8.4-main.1068cf700f",
|
|
34
|
+
"@dxos/echo": "0.8.4-main.1068cf700f",
|
|
35
|
+
"@dxos/echo-db": "0.8.4-main.1068cf700f",
|
|
36
|
+
"@dxos/invariant": "0.8.4-main.1068cf700f",
|
|
37
|
+
"@dxos/util": "0.8.4-main.1068cf700f",
|
|
38
|
+
"@dxos/log": "0.8.4-main.1068cf700f",
|
|
39
|
+
"@dxos/node-std": "0.8.4-main.1068cf700f"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
|
-
"@dxos/random": "0.8.
|
|
42
|
+
"@dxos/random": "0.8.4-main.1068cf700f"
|
|
41
43
|
},
|
|
42
44
|
"peerDependencies": {
|
|
43
|
-
"effect": "
|
|
44
|
-
"@dxos/random": "0.8.
|
|
45
|
+
"effect": "3.19.16",
|
|
46
|
+
"@dxos/random": "0.8.4-main.1068cf700f"
|
|
45
47
|
},
|
|
46
48
|
"publishConfig": {
|
|
47
49
|
"access": "public"
|
package/src/data.ts
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { next as A } from '@automerge/automerge';
|
|
6
|
-
import
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { type Space } from '@dxos/client/echo';
|
|
9
|
+
import { Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
10
11
|
import { faker } from '@dxos/random';
|
|
11
12
|
|
|
12
13
|
import { SpaceObjectGenerator, TestObjectGenerator } from './generator';
|
|
@@ -26,7 +27,7 @@ export const Priority = [1, 2, 3, 4, 5];
|
|
|
26
27
|
export enum TestSchemaType {
|
|
27
28
|
document = 'example.com/type/Document',
|
|
28
29
|
organization = 'example.com/type/Organization',
|
|
29
|
-
contact = 'example.com/type/
|
|
30
|
+
contact = 'example.com/type/Person',
|
|
30
31
|
project = 'example.com/type/Project',
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -37,21 +38,21 @@ const testSchemas = (): TestSchemaMap<TestSchemaType> => {
|
|
|
37
38
|
const document = Schema.Struct({
|
|
38
39
|
title: Schema.String.annotations({ description: 'title of the document' }),
|
|
39
40
|
content: Schema.String,
|
|
40
|
-
}).pipe(
|
|
41
|
+
}).pipe(Type.object({ typename: TestSchemaType.document, version: '0.1.0' }));
|
|
41
42
|
|
|
42
43
|
const organization = Schema.Struct({
|
|
43
44
|
name: Schema.String.annotations({ description: 'name of the company or organization' }),
|
|
44
45
|
website: Schema.optional(Schema.String.annotations({ description: 'public website URL' })),
|
|
45
46
|
description: Schema.String.annotations({ description: 'short summary of the company' }),
|
|
46
|
-
}).pipe(
|
|
47
|
+
}).pipe(Type.object({ typename: TestSchemaType.organization, version: '0.1.0' }));
|
|
47
48
|
|
|
48
49
|
const contact = Schema.Struct({
|
|
49
50
|
name: Schema.String.annotations({ description: 'name of the person' }),
|
|
50
51
|
email: Schema.optional(Schema.String),
|
|
51
|
-
org: Schema.optional(Ref(organization)),
|
|
52
|
+
org: Schema.optional(Type.Ref(organization)),
|
|
52
53
|
lat: Schema.optional(Schema.Number),
|
|
53
54
|
lng: Schema.optional(Schema.Number),
|
|
54
|
-
}).pipe(
|
|
55
|
+
}).pipe(Type.object({ typename: TestSchemaType.contact, version: '0.1.0' }));
|
|
55
56
|
|
|
56
57
|
const project = Schema.Struct({
|
|
57
58
|
name: Schema.String.annotations({ description: 'name of the project' }),
|
|
@@ -61,8 +62,8 @@ const testSchemas = (): TestSchemaMap<TestSchemaType> => {
|
|
|
61
62
|
status: Schema.String,
|
|
62
63
|
priority: Schema.Number,
|
|
63
64
|
active: Schema.Boolean,
|
|
64
|
-
org: Schema.optional(Ref(organization)),
|
|
65
|
-
}).pipe(
|
|
65
|
+
org: Schema.optional(Type.Ref(organization)),
|
|
66
|
+
}).pipe(Type.object({ typename: TestSchemaType.project, version: '0.1.0' }));
|
|
66
67
|
|
|
67
68
|
return {
|
|
68
69
|
[TestSchemaType.document]: document,
|
package/src/generator.test.ts
CHANGED
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { next as A } from '@automerge/automerge';
|
|
6
|
-
import
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
7
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
8
8
|
|
|
9
9
|
import { Client } from '@dxos/client';
|
|
10
|
+
import { Obj, Type } from '@dxos/echo';
|
|
10
11
|
import { getObjectCore } from '@dxos/echo-db';
|
|
11
|
-
import { TypedObject } from '@dxos/echo-schema';
|
|
12
|
-
import { getType } from '@dxos/live-object';
|
|
13
12
|
import { faker } from '@dxos/random';
|
|
14
13
|
|
|
15
|
-
import { createSpaceObjectGenerator, createTestObjectGenerator
|
|
14
|
+
import { TestSchemaType, createSpaceObjectGenerator, createTestObjectGenerator } from './data';
|
|
16
15
|
import { SpaceObjectGenerator } from './generator';
|
|
17
16
|
|
|
18
17
|
faker.seed(3);
|
|
@@ -44,7 +43,7 @@ describe('TestObjectGenerator', () => {
|
|
|
44
43
|
|
|
45
44
|
// Create org object.
|
|
46
45
|
const organization = await generator.createObject({ types: [TestSchemaType.organization] });
|
|
47
|
-
expect(
|
|
46
|
+
expect(Obj.getTypeDXN(organization)).to.exist;
|
|
48
47
|
|
|
49
48
|
// Expect at least one person object with a linked org reference.
|
|
50
49
|
const objects = await generator.createObjects({ [TestSchemaType.contact]: 10 });
|
|
@@ -60,14 +59,14 @@ describe('TestObjectGenerator', () => {
|
|
|
60
59
|
const generator = createSpaceObjectGenerator(space);
|
|
61
60
|
await generator.addSchemas();
|
|
62
61
|
const organization = await generator.createObject({ types: [TestSchemaType.organization] });
|
|
63
|
-
schemaId.push(
|
|
62
|
+
schemaId.push(Obj.getTypeDXN(organization)!.toString());
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
{
|
|
67
66
|
const generator = createSpaceObjectGenerator(space);
|
|
68
67
|
await generator.addSchemas();
|
|
69
68
|
const organization = await generator.createObject({ types: [TestSchemaType.organization] });
|
|
70
|
-
schemaId.push(
|
|
69
|
+
schemaId.push(Obj.getTypeDXN(organization)!.toString());
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
expect(schemaId[0]).not.to.be.undefined;
|
|
@@ -79,7 +78,7 @@ describe('TestObjectGenerator', () => {
|
|
|
79
78
|
const generator = createSpaceObjectGenerator(space);
|
|
80
79
|
await generator.addSchemas();
|
|
81
80
|
const document = await generator.createObject({ types: [TestSchemaType.document] });
|
|
82
|
-
expect(
|
|
81
|
+
expect(Obj.getTypeDXN(document)).to.exist;
|
|
83
82
|
|
|
84
83
|
const beforeChangesCount = A.getAllChanges(getObjectCore(document).docHandle!.doc()).length;
|
|
85
84
|
|
|
@@ -93,12 +92,14 @@ describe('TestObjectGenerator', () => {
|
|
|
93
92
|
});
|
|
94
93
|
|
|
95
94
|
test('create object with in memory schema', async () => {
|
|
96
|
-
|
|
97
|
-
typename: 'example.org/type/Task',
|
|
98
|
-
version: '0.1.0',
|
|
99
|
-
})({
|
|
95
|
+
const Task = Schema.Struct({
|
|
100
96
|
name: Schema.optional(Schema.String),
|
|
101
|
-
})
|
|
97
|
+
}).pipe(
|
|
98
|
+
Type.object({
|
|
99
|
+
typename: 'example.org/type/Task',
|
|
100
|
+
version: '0.1.0',
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
102
103
|
|
|
103
104
|
enum Types {
|
|
104
105
|
task = 'example.org/type/Task',
|
|
@@ -107,7 +108,9 @@ describe('TestObjectGenerator', () => {
|
|
|
107
108
|
const { space } = await setupTest();
|
|
108
109
|
const generator = new SpaceObjectGenerator<Types>(
|
|
109
110
|
space,
|
|
110
|
-
{
|
|
111
|
+
{
|
|
112
|
+
[Types.task]: Task,
|
|
113
|
+
},
|
|
111
114
|
{
|
|
112
115
|
[Types.task]: () => ({ name: 'Default' }),
|
|
113
116
|
},
|
|
@@ -122,7 +125,7 @@ describe('TestObjectGenerator', () => {
|
|
|
122
125
|
await generator.addSchemas();
|
|
123
126
|
|
|
124
127
|
const todo = await generator.createObject({ types: [Types.task] });
|
|
125
|
-
expect(
|
|
128
|
+
expect(Obj.getTypeDXN(todo)).to.exist;
|
|
126
129
|
});
|
|
127
130
|
|
|
128
131
|
test('references', async () => {
|
|
@@ -142,7 +145,7 @@ describe('TestObjectGenerator', () => {
|
|
|
142
145
|
test('create project', async () => {
|
|
143
146
|
const generator = createTestObjectGenerator();
|
|
144
147
|
const project = await generator.createObject({ types: [TestSchemaType.project] });
|
|
145
|
-
expect(
|
|
148
|
+
expect(Obj.getTypeDXN(project)).to.exist;
|
|
146
149
|
});
|
|
147
150
|
|
|
148
151
|
test('create object with not type', async () => {
|
package/src/generator.ts
CHANGED
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Schema } from 'effect';
|
|
6
|
-
|
|
7
5
|
import { Filter, type Space } from '@dxos/client/echo';
|
|
8
|
-
import { type
|
|
9
|
-
import {
|
|
6
|
+
import { Obj, type Type } from '@dxos/echo';
|
|
7
|
+
import { EchoSchema, getTypeAnnotation } from '@dxos/echo/internal';
|
|
8
|
+
import { isProxy } from '@dxos/echo/internal';
|
|
10
9
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { live, isLiveObject, type Live } from '@dxos/live-object';
|
|
12
10
|
import { faker } from '@dxos/random';
|
|
13
11
|
import { entries, range } from '@dxos/util';
|
|
14
12
|
|
|
15
13
|
import { type TestSchemaType } from './data';
|
|
16
14
|
import {
|
|
17
|
-
type
|
|
15
|
+
type MutationsProviderProps,
|
|
18
16
|
type TestGeneratorMap,
|
|
19
17
|
type TestMutationsMap,
|
|
20
18
|
type TestObjectProvider,
|
|
@@ -28,37 +26,38 @@ import {
|
|
|
28
26
|
export class TestObjectGenerator<T extends string = TestSchemaType> {
|
|
29
27
|
// prettier-ignore
|
|
30
28
|
constructor(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
protected readonly _schemas: TestSchemaMap<T>,
|
|
30
|
+
private readonly _generators: TestGeneratorMap<T>,
|
|
31
|
+
private readonly _provider?: TestObjectProvider<T>,
|
|
32
|
+
) {}
|
|
35
33
|
|
|
36
|
-
get schemas():
|
|
34
|
+
get schemas(): Type.Obj.Any[] {
|
|
37
35
|
return Object.values(this._schemas);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
getSchema(type: T):
|
|
38
|
+
getSchema(type: T): Type.Obj.Any | undefined {
|
|
41
39
|
return this.schemas.find((schema) => getTypeAnnotation(schema)!.typename === type);
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
protected setSchema(type: T, schema:
|
|
42
|
+
protected setSchema(type: T, schema: Type.Obj.Any): void {
|
|
45
43
|
this._schemas[type] = schema;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
async createObject({ types }: { types?: T[] } = {}): Promise<
|
|
46
|
+
async createObject({ types }: { types?: T[] } = {}): Promise<any> {
|
|
49
47
|
const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));
|
|
50
48
|
const data = await this._generators[type](this._provider);
|
|
51
|
-
if (
|
|
49
|
+
if (isProxy(data)) {
|
|
52
50
|
return data;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
const schema = this.getSchema(type);
|
|
56
|
-
|
|
54
|
+
invariant(schema, `Schema is required for type: ${type}. Register a schema for this type.`);
|
|
55
|
+
return Obj.make(schema, data);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
// TODO(burdon): Based on dependencies (e.g., organization before contact).
|
|
60
59
|
async createObjects(map: Partial<Record<T, number>>) {
|
|
61
|
-
const results:
|
|
60
|
+
const results: any[] = [];
|
|
62
61
|
for (const [type, count] of entries(map)) {
|
|
63
62
|
results.push(...(await Promise.all(range(count ?? 0, () => this.createObject({ types: [type as T] })))));
|
|
64
63
|
}
|
|
@@ -85,15 +84,15 @@ export class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<
|
|
|
85
84
|
) {
|
|
86
85
|
super(schemaMap, generators, async (type: T) => {
|
|
87
86
|
const schema = this.getSchema(type);
|
|
88
|
-
const
|
|
87
|
+
const objects = await this._space.db.query(schema ? Filter.type(schema) : Filter.nothing()).run();
|
|
89
88
|
return objects;
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
async addSchemas() {
|
|
94
|
-
const result:
|
|
93
|
+
const result: Type.Obj.Any[] = [];
|
|
95
94
|
for (const [typename, schema] of Object.entries(this._schemas)) {
|
|
96
|
-
const echoSchema = await this._maybeRegisterSchema(typename, schema as
|
|
95
|
+
const echoSchema = await this._maybeRegisterSchema(typename, schema as Type.Obj.Any);
|
|
97
96
|
this.setSchema(typename as T, echoSchema);
|
|
98
97
|
result.push(echoSchema);
|
|
99
98
|
}
|
|
@@ -101,40 +100,41 @@ export class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<
|
|
|
101
100
|
return result;
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
override async createObject({
|
|
103
|
+
override async createObject({
|
|
104
|
+
types,
|
|
105
|
+
}: {
|
|
106
|
+
types?: T[];
|
|
107
|
+
} = {}): Promise<Obj.Any> {
|
|
105
108
|
return this._space.db.add(await super.createObject({ types }));
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
private async _maybeRegisterSchema(
|
|
109
|
-
typename: string,
|
|
110
|
-
schema: EchoSchema | Schema.Schema.AnyNoContext,
|
|
111
|
-
): Promise<EchoSchema | Schema.Schema.AnyNoContext> {
|
|
111
|
+
private async _maybeRegisterSchema(typename: string, schema: Type.Obj.Any): Promise<Type.Obj.Any> {
|
|
112
112
|
if (schema instanceof EchoSchema) {
|
|
113
|
-
const existingSchema = this._space.db.schemaRegistry.getSchema(typename);
|
|
113
|
+
const existingSchema = this._space.internal.db.schemaRegistry.getSchema(typename);
|
|
114
114
|
if (existingSchema != null) {
|
|
115
115
|
return existingSchema;
|
|
116
116
|
}
|
|
117
|
-
const [registeredSchema] = await this._space.db.schemaRegistry.register([schema]);
|
|
117
|
+
const [registeredSchema] = await this._space.internal.db.schemaRegistry.register([schema]);
|
|
118
118
|
return registeredSchema;
|
|
119
119
|
} else {
|
|
120
|
-
const existingSchema = this._space.db.graph.schemaRegistry.getSchema(typename);
|
|
120
|
+
const existingSchema = this._space.internal.db.graph.schemaRegistry.getSchema(typename);
|
|
121
121
|
if (existingSchema != null) {
|
|
122
122
|
return existingSchema;
|
|
123
123
|
}
|
|
124
|
-
this._space.db.graph.schemaRegistry.
|
|
124
|
+
await this._space.internal.db.graph.schemaRegistry.register([schema]);
|
|
125
125
|
return schema;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
async mutateObject(object:
|
|
129
|
+
async mutateObject(object: Obj.Any, params: MutationsProviderProps): Promise<void> {
|
|
130
130
|
invariant(this._mutations, 'Mutations not defined.');
|
|
131
|
-
const type = getTypeAnnotation(getSchema(object)!)!.typename as T;
|
|
131
|
+
const type = getTypeAnnotation(Obj.getSchema(object)!)!.typename as T;
|
|
132
132
|
invariant(type && this._mutations?.[type], 'Invalid object type.');
|
|
133
133
|
|
|
134
134
|
await this._mutations;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
async mutateObjects(objects:
|
|
137
|
+
async mutateObjects(objects: Obj.Any[], params: MutationsProviderProps): Promise<void> {
|
|
138
138
|
for (const object of objects) {
|
|
139
139
|
await this.mutateObject(object, params);
|
|
140
140
|
}
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
6
|
-
|
|
7
|
-
import { type AnyLiveObject } from '@dxos/echo-db';
|
|
8
|
-
import { type EchoSchema } from '@dxos/echo-schema';
|
|
9
|
-
import { type Live } from '@dxos/live-object';
|
|
5
|
+
import { type Obj, type Type } from '@dxos/echo';
|
|
10
6
|
|
|
11
7
|
// TODO(burdon): Use echo-schema types.
|
|
12
8
|
export type TestObject = { id: string } & Record<string, any>;
|
|
13
9
|
|
|
14
|
-
export type TestSchemaMap<T extends string = string> = Record<T,
|
|
10
|
+
export type TestSchemaMap<T extends string = string> = Record<T, Type.Obj.Any>;
|
|
15
11
|
|
|
16
|
-
export type TestObjectProvider<T extends string = string> = (type: T) => Promise<
|
|
12
|
+
export type TestObjectProvider<T extends string = string> = (type: T) => Promise<any[]>;
|
|
17
13
|
|
|
18
14
|
export type TestGeneratorMap<T extends string = string> = Record<
|
|
19
15
|
T,
|
|
@@ -22,10 +18,10 @@ export type TestGeneratorMap<T extends string = string> = Record<
|
|
|
22
18
|
|
|
23
19
|
export type TestMutationsMap<T extends string = string> = Record<T, TestObjectMutators>;
|
|
24
20
|
|
|
25
|
-
export type
|
|
21
|
+
export type MutationsProviderProps = {
|
|
26
22
|
count: number;
|
|
27
23
|
mutationSize: number;
|
|
28
24
|
maxContentLength: number;
|
|
29
25
|
};
|
|
30
26
|
|
|
31
|
-
export type TestObjectMutators = (object:
|
|
27
|
+
export type TestObjectMutators = (object: Obj.Any, params: MutationsProviderProps) => Promise<void>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 '@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,SAASA,QAAQC,SAAS;AAC1B,SAASC,cAAc;AAEvB,SAASC,yBAAqC;AAC9C,SAASC,YAAYC,WAAW;AAChC,SAASC,SAAAA,cAAa;;;ACHtB,SAASC,cAA0B;AAEnC,SAASC,mBAAmBC,YAAYC,iBAAiB;AACzD,SAASC,iBAAiB;AAC1B,SAASC,MAAMC,oBAA+B;AAC9C,SAASC,aAAa;AACtB,SAASC,SAASC,aAAa;;AAexB,IAAMC,sBAAN,MAAMA;;EAEX,YACqBC,UACFC,aACAC,WACjB;SAHmBF,WAAAA;SACFC,cAAAA;SACAC,YAAAA;EAChB;EAEH,IAAIC,UAAuD;AAC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AOC,OAAO,CAACC,QAAAA;AACtBC,UAAEC,OACAF,KACAN,SAASS,KAAKC,MAAK,GACnB,GACAX,OAAOY,oBAAoBpB,SAAS,IAAIQ,OAAOa,cAC/CC,WAAWd,OAAOa,YAAY,CAAA;MAElC,CAAA;IACF;EACF;EACA,CAAA,+BAAA,GAA+B,YAAA;AAC7B,UAAM,IAAIE,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,IAAIC,oBAAoB9E,YAAAA,GAAe8B,oBAAAA;AAK/E,IAAMiD,6BAA6B,CAACC,UACzC,IAAIC,qBAAqBD,OAAOhF,YAAAA,GAAe8B,sBAAsB6B,kBAAAA;",
|
|
6
|
-
"names": ["next", "A", "Schema", "createDocAccessor", "EchoObject", "Ref", "faker", "Filter", "getTypeAnnotation", "EchoSchema", "getSchema", "invariant", "live", "isLiveObject", "faker", "entries", "range", "TestObjectGenerator", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "type", "find", "schema", "typename", "setSchema", "createObject", "types", "helpers", "arrayElement", "keys", "data", "createObjects", "map", "results", "count", "push", "Promise", "all", "tasks", "flatMap", "t", "SpaceObjectGenerator", "_space", "schemaMap", "generators", "_mutations", "objects", "db", "query", "nothing", "run", "addSchemas", "result", "echoSchema", "_maybeRegisterSchema", "add", "existingSchema", "schemaRegistry", "registeredSchema", "register", "graph", "addSchema", "mutateObject", "object", "params", "mutateObjects", "randomText", "length", "result", "characters", "charactersLength", "index", "charAt", "Math", "floor", "random", "Status", "Priority", "TestSchemaType", "testSchemas", "document", "Schema", "Struct", "title", "String", "annotations", "description", "content", "pipe", "EchoObject", "typename", "version", "organization", "name", "website", "optional", "contact", "email", "org", "Ref", "lat", "Number", "lng", "project", "repo", "status", "priority", "active", "Boolean", "testObjectGenerators", "faker", "lorem", "sentence", "sentences", "min", "max", "number", "int", "company", "datatype", "boolean", "probability", "internet", "url", "undefined", "provider", "organizations", "location", "geo", "airport", "person", "fullName", "length", "make", "helpers", "arrayElement", "commerce", "productName", "testObjectMutators", "object", "params", "accessor", "createDocAccessor", "i", "count", "handle", "change", "doc", "A", "splice", "path", "slice", "maxContentLength", "mutationSize", "randomText", "Error", "createTestObjectGenerator", "TestObjectGenerator", "createSpaceObjectGenerator", "space", "SpaceObjectGenerator"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18940},"packages/core/echo/echo-generator/dist/lib/browser/index.mjs":{"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":9514}}}
|