@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
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/data.ts
|
|
4
4
|
import { next as A } from "@automerge/automerge";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import { Ref, Type } from "@dxos/echo";
|
|
7
|
+
import { createDocAccessor } from "@dxos/echo-db";
|
|
8
8
|
import { faker as faker2 } from "@dxos/random";
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// src/generator.ts
|
|
11
11
|
import { Filter } from "@dxos/client/echo";
|
|
12
|
-
import {
|
|
12
|
+
import { Obj } from "@dxos/echo";
|
|
13
|
+
import { EchoSchema, getTypeAnnotation } from "@dxos/echo/internal";
|
|
14
|
+
import { isProxy } from "@dxos/echo/internal";
|
|
13
15
|
import { invariant } from "@dxos/invariant";
|
|
14
|
-
import { live, isLiveObject } from "@dxos/live-object";
|
|
15
16
|
import { faker } from "@dxos/random";
|
|
16
17
|
import { entries, range } from "@dxos/util";
|
|
17
|
-
var __dxlog_file = "/
|
|
18
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo-generator/src/generator.ts";
|
|
18
19
|
var TestObjectGenerator = class {
|
|
20
|
+
_schemas;
|
|
21
|
+
_generators;
|
|
22
|
+
_provider;
|
|
19
23
|
// prettier-ignore
|
|
20
24
|
constructor(_schemas, _generators, _provider) {
|
|
21
25
|
this._schemas = _schemas;
|
|
@@ -34,11 +38,20 @@ var TestObjectGenerator = class {
|
|
|
34
38
|
async createObject({ types } = {}) {
|
|
35
39
|
const type = faker.helpers.arrayElement(types ?? Object.keys(this._schemas));
|
|
36
40
|
const data = await this._generators[type](this._provider);
|
|
37
|
-
if (
|
|
41
|
+
if (isProxy(data)) {
|
|
38
42
|
return data;
|
|
39
43
|
}
|
|
40
44
|
const schema = this.getSchema(type);
|
|
41
|
-
|
|
45
|
+
invariant(schema, `Schema is required for type: ${type}. Register a schema for this type.`, {
|
|
46
|
+
F: __dxlog_file,
|
|
47
|
+
L: 54,
|
|
48
|
+
S: this,
|
|
49
|
+
A: [
|
|
50
|
+
"schema",
|
|
51
|
+
"`Schema is required for type: ${type}. Register a schema for this type.`"
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
return Obj.make(schema, data);
|
|
42
55
|
}
|
|
43
56
|
// TODO(burdon): Based on dependencies (e.g., organization before contact).
|
|
44
57
|
async createObjects(map) {
|
|
@@ -61,10 +74,12 @@ var TestObjectGenerator = class {
|
|
|
61
74
|
}
|
|
62
75
|
};
|
|
63
76
|
var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
77
|
+
_space;
|
|
78
|
+
_mutations;
|
|
64
79
|
constructor(_space, schemaMap, generators, _mutations) {
|
|
65
80
|
super(schemaMap, generators, async (type) => {
|
|
66
81
|
const schema = this.getSchema(type);
|
|
67
|
-
const
|
|
82
|
+
const objects = await this._space.db.query(schema ? Filter.type(schema) : Filter.nothing()).run();
|
|
68
83
|
return objects;
|
|
69
84
|
}), this._space = _space, this._mutations = _mutations;
|
|
70
85
|
}
|
|
@@ -84,20 +99,20 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
84
99
|
}
|
|
85
100
|
async _maybeRegisterSchema(typename, schema) {
|
|
86
101
|
if (schema instanceof EchoSchema) {
|
|
87
|
-
const existingSchema = this._space.db.schemaRegistry.getSchema(typename);
|
|
102
|
+
const existingSchema = this._space.internal.db.schemaRegistry.getSchema(typename);
|
|
88
103
|
if (existingSchema != null) {
|
|
89
104
|
return existingSchema;
|
|
90
105
|
}
|
|
91
|
-
const [registeredSchema] = await this._space.db.schemaRegistry.register([
|
|
106
|
+
const [registeredSchema] = await this._space.internal.db.schemaRegistry.register([
|
|
92
107
|
schema
|
|
93
108
|
]);
|
|
94
109
|
return registeredSchema;
|
|
95
110
|
} else {
|
|
96
|
-
const existingSchema = this._space.db.graph.schemaRegistry.getSchema(typename);
|
|
111
|
+
const existingSchema = this._space.internal.db.graph.schemaRegistry.getSchema(typename);
|
|
97
112
|
if (existingSchema != null) {
|
|
98
113
|
return existingSchema;
|
|
99
114
|
}
|
|
100
|
-
this._space.db.graph.schemaRegistry.
|
|
115
|
+
await this._space.internal.db.graph.schemaRegistry.register([
|
|
101
116
|
schema
|
|
102
117
|
]);
|
|
103
118
|
return schema;
|
|
@@ -113,7 +128,7 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
113
128
|
"'Mutations not defined.'"
|
|
114
129
|
]
|
|
115
130
|
});
|
|
116
|
-
const type = getTypeAnnotation(getSchema(object)).typename;
|
|
131
|
+
const type = getTypeAnnotation(Obj.getSchema(object)).typename;
|
|
117
132
|
invariant(type && this._mutations?.[type], "Invalid object type.", {
|
|
118
133
|
F: __dxlog_file,
|
|
119
134
|
L: 132,
|
|
@@ -132,7 +147,7 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
132
147
|
}
|
|
133
148
|
};
|
|
134
149
|
|
|
135
|
-
//
|
|
150
|
+
// src/util.ts
|
|
136
151
|
var randomText = (length) => {
|
|
137
152
|
let result = "";
|
|
138
153
|
const characters = "abcdefghijklmnopqrstuvwxyz";
|
|
@@ -143,7 +158,7 @@ var randomText = (length) => {
|
|
|
143
158
|
return result;
|
|
144
159
|
};
|
|
145
160
|
|
|
146
|
-
//
|
|
161
|
+
// src/data.ts
|
|
147
162
|
var Status = [
|
|
148
163
|
"pending",
|
|
149
164
|
"active",
|
|
@@ -156,20 +171,20 @@ var Priority = [
|
|
|
156
171
|
4,
|
|
157
172
|
5
|
|
158
173
|
];
|
|
159
|
-
var TestSchemaType = /* @__PURE__ */ function(TestSchemaType2) {
|
|
174
|
+
var TestSchemaType = /* @__PURE__ */ (function(TestSchemaType2) {
|
|
160
175
|
TestSchemaType2["document"] = "example.com/type/Document";
|
|
161
176
|
TestSchemaType2["organization"] = "example.com/type/Organization";
|
|
162
|
-
TestSchemaType2["contact"] = "example.com/type/
|
|
177
|
+
TestSchemaType2["contact"] = "example.com/type/Person";
|
|
163
178
|
TestSchemaType2["project"] = "example.com/type/Project";
|
|
164
179
|
return TestSchemaType2;
|
|
165
|
-
}({});
|
|
180
|
+
})({});
|
|
166
181
|
var testSchemas = () => {
|
|
167
182
|
const document = Schema.Struct({
|
|
168
183
|
title: Schema.String.annotations({
|
|
169
184
|
description: "title of the document"
|
|
170
185
|
}),
|
|
171
186
|
content: Schema.String
|
|
172
|
-
}).pipe(
|
|
187
|
+
}).pipe(Type.object({
|
|
173
188
|
typename: "example.com/type/Document",
|
|
174
189
|
version: "0.1.0"
|
|
175
190
|
}));
|
|
@@ -183,7 +198,7 @@ var testSchemas = () => {
|
|
|
183
198
|
description: Schema.String.annotations({
|
|
184
199
|
description: "short summary of the company"
|
|
185
200
|
})
|
|
186
|
-
}).pipe(
|
|
201
|
+
}).pipe(Type.object({
|
|
187
202
|
typename: "example.com/type/Organization",
|
|
188
203
|
version: "0.1.0"
|
|
189
204
|
}));
|
|
@@ -192,11 +207,11 @@ var testSchemas = () => {
|
|
|
192
207
|
description: "name of the person"
|
|
193
208
|
}),
|
|
194
209
|
email: Schema.optional(Schema.String),
|
|
195
|
-
org: Schema.optional(Ref(organization)),
|
|
210
|
+
org: Schema.optional(Type.Ref(organization)),
|
|
196
211
|
lat: Schema.optional(Schema.Number),
|
|
197
212
|
lng: Schema.optional(Schema.Number)
|
|
198
|
-
}).pipe(
|
|
199
|
-
typename: "example.com/type/
|
|
213
|
+
}).pipe(Type.object({
|
|
214
|
+
typename: "example.com/type/Person",
|
|
200
215
|
version: "0.1.0"
|
|
201
216
|
}));
|
|
202
217
|
const project = Schema.Struct({
|
|
@@ -209,15 +224,15 @@ var testSchemas = () => {
|
|
|
209
224
|
status: Schema.String,
|
|
210
225
|
priority: Schema.Number,
|
|
211
226
|
active: Schema.Boolean,
|
|
212
|
-
org: Schema.optional(Ref(organization))
|
|
213
|
-
}).pipe(
|
|
227
|
+
org: Schema.optional(Type.Ref(organization))
|
|
228
|
+
}).pipe(Type.object({
|
|
214
229
|
typename: "example.com/type/Project",
|
|
215
230
|
version: "0.1.0"
|
|
216
231
|
}));
|
|
217
232
|
return {
|
|
218
233
|
["example.com/type/Document"]: document,
|
|
219
234
|
["example.com/type/Organization"]: organization,
|
|
220
|
-
["example.com/type/
|
|
235
|
+
["example.com/type/Person"]: contact,
|
|
221
236
|
["example.com/type/Project"]: project
|
|
222
237
|
};
|
|
223
238
|
};
|
|
@@ -239,7 +254,7 @@ var testObjectGenerators = {
|
|
|
239
254
|
}) ? faker2.internet.url() : void 0,
|
|
240
255
|
description: faker2.lorem.sentences()
|
|
241
256
|
}),
|
|
242
|
-
["example.com/type/
|
|
257
|
+
["example.com/type/Person"]: async (provider) => {
|
|
243
258
|
const organizations = await provider?.("example.com/type/Organization");
|
|
244
259
|
const location = faker2.datatype.boolean() ? faker2.geo.airport() : {};
|
|
245
260
|
return {
|
|
@@ -278,7 +293,7 @@ var testObjectMutators = {
|
|
|
278
293
|
["example.com/type/Organization"]: async () => {
|
|
279
294
|
throw new Error("Method not implemented.");
|
|
280
295
|
},
|
|
281
|
-
["example.com/type/
|
|
296
|
+
["example.com/type/Person"]: async () => {
|
|
282
297
|
throw new Error("Method not implemented.");
|
|
283
298
|
},
|
|
284
299
|
["example.com/type/Project"]: async () => {
|
|
@@ -0,0 +1,7 @@
|
|
|
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 * as Schema from 'effect/Schema';\n\nimport { type Space } from '@dxos/client/echo';\nimport { Ref, Type } from '@dxos/echo';\nimport { createDocAccessor } from '@dxos/echo-db';\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/Person',\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(Type.object({ 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(Type.object({ 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(Type.Ref(organization)),\n lat: Schema.optional(Schema.Number),\n lng: Schema.optional(Schema.Number),\n }).pipe(Type.object({ 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(Type.Ref(organization)),\n }).pipe(Type.object({ 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 { Filter, type Space } from '@dxos/client/echo';\nimport { Obj, type Type } from '@dxos/echo';\nimport { EchoSchema, getTypeAnnotation } from '@dxos/echo/internal';\nimport { isProxy } from '@dxos/echo/internal';\nimport { invariant } from '@dxos/invariant';\nimport { faker } from '@dxos/random';\nimport { entries, range } from '@dxos/util';\n\nimport { type TestSchemaType } from './data';\nimport {\n type MutationsProviderProps,\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\t\tprotected readonly _schemas: TestSchemaMap<T>,\n\t\tprivate readonly _generators: TestGeneratorMap<T>,\n\t\tprivate readonly _provider?: TestObjectProvider<T>,\n\t) {}\n\n get schemas(): Type.Obj.Any[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T): Type.Obj.Any | undefined {\n return this.schemas.find((schema) => getTypeAnnotation(schema)!.typename === type);\n }\n\n protected setSchema(type: T, schema: Type.Obj.Any): void {\n this._schemas[type] = schema;\n }\n\n async createObject({ types }: { types?: T[] } = {}): Promise<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 (isProxy(data)) {\n return data;\n }\n\n const schema = this.getSchema(type);\n invariant(schema, `Schema is required for type: ${type}. Register a schema for this type.`);\n return Obj.make(schema, 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: 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: Type.Obj.Any[] = [];\n for (const [typename, schema] of Object.entries(this._schemas)) {\n const echoSchema = await this._maybeRegisterSchema(typename, schema as Type.Obj.Any);\n this.setSchema(typename as T, echoSchema);\n result.push(echoSchema);\n }\n\n return result;\n }\n\n override async createObject({\n types,\n }: {\n types?: T[];\n } = {}): Promise<Obj.Any> {\n return this._space.db.add(await super.createObject({ types }));\n }\n\n private async _maybeRegisterSchema(typename: string, schema: Type.Obj.Any): Promise<Type.Obj.Any> {\n if (schema instanceof EchoSchema) {\n const existingSchema = this._space.internal.db.schemaRegistry.getSchema(typename);\n if (existingSchema != null) {\n return existingSchema;\n }\n const [registeredSchema] = await this._space.internal.db.schemaRegistry.register([schema]);\n return registeredSchema;\n } else {\n const existingSchema = this._space.internal.db.graph.schemaRegistry.getSchema(typename);\n if (existingSchema != null) {\n return existingSchema;\n }\n await this._space.internal.db.graph.schemaRegistry.register([schema]);\n return schema;\n }\n }\n\n async mutateObject(object: Obj.Any, params: MutationsProviderProps): Promise<void> {\n invariant(this._mutations, 'Mutations not defined.');\n const type = getTypeAnnotation(Obj.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: Obj.Any[], params: MutationsProviderProps): 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,YAAYC,YAAY;AAGxB,SAASC,KAAKC,YAAY;AAC1B,SAASC,yBAAyB;AAClC,SAASC,SAAAA,cAAa;;;ACNtB,SAASC,cAA0B;AACnC,SAASC,WAAsB;AAC/B,SAASC,YAAYC,yBAAyB;AAC9C,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,aAAa;AACtB,SAASC,SAASC,aAAa;;AAexB,IAAMC,sBAAN,MAAMA;;;;;EAEX,YACmBC,UACFC,aACAC,WAChB;SA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,eAASI,OAAOC,OAAO,CAACC,QAAAA;AACtBC,UAAEC,OACAF,KACAN,SAASS,KAAKC,MAAK,GACnB,GACAX,OAAOY,oBAAoBnB,SAAS,IAAIO,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,yBAAA,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,oBAAoB7E,YAAAA,GAAe8B,oBAAAA;AAK/E,IAAMgD,6BAA6B,CAACC,UACzC,IAAIC,qBAAqBD,OAAO/E,YAAAA,GAAe8B,sBAAsB6B,kBAAAA;",
|
|
6
|
+
"names": ["next", "A", "Schema", "Ref", "Type", "createDocAccessor", "faker", "Filter", "Obj", "EchoSchema", "getTypeAnnotation", "isProxy", "invariant", "faker", "entries", "range", "TestObjectGenerator", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "getSchema", "type", "find", "schema", "typename", "setSchema", "createObject", "types", "helpers", "arrayElement", "keys", "data", "make", "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", "internal", "schemaRegistry", "registeredSchema", "register", "graph", "mutateObject", "object", "params", "mutateObjects", "randomText", "length", "result", "characters", "charactersLength", "index", "charAt", "Math", "floor", "random", "Status", "Priority", "TestSchemaType", "testSchemas", "document", "Struct", "title", "String", "annotations", "description", "content", "pipe", "Type", "object", "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", "params", "accessor", "createDocAccessor", "i", "count", "handle", "change", "doc", "A", "splice", "path", "slice", "maxContentLength", "mutationSize", "randomText", "Error", "createTestObjectGenerator", "TestObjectGenerator", "createSpaceObjectGenerator", "space", "SpaceObjectGenerator"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/generator.ts":{"bytes":16828,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/util.ts":{"bytes":1567,"imports":[],"format":"esm"},"src/data.ts":{"bytes":19599,"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"src/generator.ts","kind":"import-statement","original":"./generator"},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/index.ts":{"bytes":661,"imports":[{"path":"src/data.ts","kind":"import-statement","original":"./data"},{"path":"src/generator.ts","kind":"import-statement","original":"./generator"},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18711},"dist/lib/neutral/index.mjs":{"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","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","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/invariant","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":"src/index.ts","inputs":{"src/data.ts":{"bytesInOutput":4813},"src/generator.ts":{"bytesInOutput":4322},"src/util.ts":{"bytesInOutput":299},"src/index.ts":{"bytesInOutput":0}},"bytes":9742}}}
|
package/dist/types/src/data.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const Priority: number[];
|
|
|
8
8
|
export declare enum TestSchemaType {
|
|
9
9
|
document = "example.com/type/Document",
|
|
10
10
|
organization = "example.com/type/Organization",
|
|
11
|
-
contact = "example.com/type/
|
|
11
|
+
contact = "example.com/type/Person",
|
|
12
12
|
project = "example.com/type/Project"
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/data.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/data.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQxE,eAAO,MAAM,MAAM,UAAgC,CAAC;AACpD,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAExC;;GAEG;AACH,oBAAY,cAAc;IACxB,QAAQ,8BAA8B;IACtC,YAAY,kCAAkC;IAC9C,OAAO,4BAA4B;IACnC,OAAO,6BAA6B;CACrC;AA6GD;;GAEG;AACH,eAAO,MAAM,yBAAyB,2CAAqE,CAAC;AAE5G;;GAEG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,KAAK,yCACmC,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { type Schema } from 'effect';
|
|
2
1
|
import { type Space } from '@dxos/client/echo';
|
|
3
|
-
import { type
|
|
4
|
-
import { EchoSchema } from '@dxos/echo-schema';
|
|
5
|
-
import { type Live } from '@dxos/live-object';
|
|
2
|
+
import { Obj, type Type } from '@dxos/echo';
|
|
6
3
|
import { type TestSchemaType } from './data';
|
|
7
|
-
import { type
|
|
4
|
+
import { type MutationsProviderProps, type TestGeneratorMap, type TestMutationsMap, type TestObjectProvider, type TestSchemaMap } from './types';
|
|
8
5
|
/**
|
|
9
6
|
* Typed object generator.
|
|
10
7
|
* @deprecated
|
|
@@ -14,12 +11,12 @@ export declare class TestObjectGenerator<T extends string = TestSchemaType> {
|
|
|
14
11
|
private readonly _generators;
|
|
15
12
|
private readonly _provider?;
|
|
16
13
|
constructor(_schemas: TestSchemaMap<T>, _generators: TestGeneratorMap<T>, _provider?: TestObjectProvider<T> | undefined);
|
|
17
|
-
get schemas():
|
|
18
|
-
getSchema(type: T):
|
|
19
|
-
protected setSchema(type: T, schema:
|
|
14
|
+
get schemas(): Type.Obj.Any[];
|
|
15
|
+
getSchema(type: T): Type.Obj.Any | undefined;
|
|
16
|
+
protected setSchema(type: T, schema: Type.Obj.Any): void;
|
|
20
17
|
createObject({ types }?: {
|
|
21
18
|
types?: T[];
|
|
22
|
-
}): Promise<
|
|
19
|
+
}): Promise<any>;
|
|
23
20
|
createObjects(map: Partial<Record<T, number>>): Promise<any[]>;
|
|
24
21
|
}
|
|
25
22
|
/**
|
|
@@ -29,12 +26,15 @@ export declare class SpaceObjectGenerator<T extends string> extends TestObjectGe
|
|
|
29
26
|
private readonly _space;
|
|
30
27
|
private readonly _mutations?;
|
|
31
28
|
constructor(_space: Space, schemaMap: TestSchemaMap<T>, generators: TestGeneratorMap<T>, _mutations?: TestMutationsMap<T> | undefined);
|
|
32
|
-
addSchemas(): Promise<(Schema.Schema.AnyNoContext
|
|
33
|
-
|
|
29
|
+
addSchemas(): Promise<(import("effect/Schema").Schema.AnyNoContext & {
|
|
30
|
+
readonly typename: string;
|
|
31
|
+
readonly version: string;
|
|
32
|
+
})[]>;
|
|
33
|
+
createObject({ types, }?: {
|
|
34
34
|
types?: T[];
|
|
35
|
-
}): Promise<
|
|
35
|
+
}): Promise<Obj.Any>;
|
|
36
36
|
private _maybeRegisterSchema;
|
|
37
|
-
mutateObject(object:
|
|
38
|
-
mutateObjects(objects:
|
|
37
|
+
mutateObject(object: Obj.Any, params: MutationsProviderProps): Promise<void>;
|
|
38
|
+
mutateObjects(objects: Obj.Any[], params: MutationsProviderProps): Promise<void>;
|
|
39
39
|
}
|
|
40
40
|
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generator.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAO5C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG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ACR,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAIX,oBAAoB;IAkB5B,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5E,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,mBAAmB,SAAS,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type AnyLiveObject } from '@dxos/echo-db';
|
|
3
|
-
import { type EchoSchema } from '@dxos/echo-schema';
|
|
4
|
-
import { type Live } from '@dxos/live-object';
|
|
1
|
+
import { type Obj, type Type } from '@dxos/echo';
|
|
5
2
|
export type TestObject = {
|
|
6
3
|
id: string;
|
|
7
4
|
} & Record<string, any>;
|
|
8
|
-
export type TestSchemaMap<T extends string = string> = Record<T,
|
|
9
|
-
export type TestObjectProvider<T extends string = string> = (type: T) => Promise<
|
|
5
|
+
export type TestSchemaMap<T extends string = string> = Record<T, Type.Obj.Any>;
|
|
6
|
+
export type TestObjectProvider<T extends string = string> = (type: T) => Promise<any[]>;
|
|
10
7
|
export type TestGeneratorMap<T extends string = string> = Record<T, (provider: TestObjectProvider<T> | undefined) => any>;
|
|
11
8
|
export type TestMutationsMap<T extends string = string> = Record<T, TestObjectMutators>;
|
|
12
|
-
export type
|
|
9
|
+
export type MutationsProviderProps = {
|
|
13
10
|
count: number;
|
|
14
11
|
mutationSize: number;
|
|
15
12
|
maxContentLength: number;
|
|
16
13
|
};
|
|
17
|
-
export type TestObjectMutators = (object:
|
|
14
|
+
export type TestObjectMutators = (object: Obj.Any, params: MutationsProviderProps) => Promise<void>;
|
|
18
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE9D,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE/E,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAExF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAC9D,CAAC,EACD,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,GAAG,CACrD,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAExF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|