@dxos/echo-generator 0.3.8-next.f4e0086 → 0.3.9-main.27aafd0
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 +6 -1
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +55 -62
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/data.d.ts.map +1 -1
- package/dist/types/src/generator.d.ts +2 -1
- package/dist/types/src/generator.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/data.ts +6 -1
- package/src/generator.ts +2 -1
- package/src/index.ts +1 -0
|
@@ -111,7 +111,7 @@ var testSchemas = () => {
|
|
|
111
111
|
typename: TestSchemaType.document,
|
|
112
112
|
props: [
|
|
113
113
|
{
|
|
114
|
-
id: "
|
|
114
|
+
id: "title",
|
|
115
115
|
type: Schema2.PropType.STRING
|
|
116
116
|
},
|
|
117
117
|
{
|
|
@@ -194,6 +194,11 @@ var testSchemas = () => {
|
|
|
194
194
|
{
|
|
195
195
|
id: "active",
|
|
196
196
|
type: Schema2.PropType.BOOLEAN
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: "org",
|
|
200
|
+
type: Schema2.PropType.REF,
|
|
201
|
+
ref: organization
|
|
197
202
|
}
|
|
198
203
|
]
|
|
199
204
|
});
|
|
@@ -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\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/aurora/testing.\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\nimport { faker } from '@faker-js/faker';\n\nimport { Schema, type Space, TextObject } from '@dxos/client/echo';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestSchemaMap } from './types';\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport enum TestSchemaType {\n document = 'example.com/schema/document',\n organization = 'example.com/schema/organization',\n contact = 'example.com/schema/contact',\n project = 'example.com/schema/project',\n}\n\nexport const testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = new Schema({\n typename: TestSchemaType.document,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'content',\n type: Schema.PropType.STRING, // TODO(burdon): Rich text.\n },\n ],\n });\n\n const organization = new Schema({\n typename: TestSchemaType.organization,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING,\n },\n ],\n });\n\n const contact = new Schema({\n typename: TestSchemaType.contact,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'email',\n type: Schema.PropType.STRING,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n // TODO(burdon): Convert to object with nested props.\n {\n id: 'lat',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'lng',\n type: Schema.PropType.NUMBER,\n },\n ],\n });\n\n const project = new Schema({\n typename: TestSchemaType.project,\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING, // TODO(burdon): Text.\n },\n {\n id: 'repo',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'status',\n type: Schema.PropType.STRING,\n },\n {\n id: 'priority',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'active',\n type: Schema.PropType.BOOLEAN,\n },\n ],\n });\n\n return {\n [TestSchemaType.document]: document,\n [TestSchemaType.organization]: organization,\n [TestSchemaType.contact]: contact,\n [TestSchemaType.project]: project,\n };\n};\n\nexport const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n [TestSchemaType.document]: () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n [TestSchemaType.organization]: () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: new TextObject(faker.lorem.sentences()),\n }),\n\n [TestSchemaType.contact]: (provider) => {\n const organizations = provider?.(TestSchemaType.organization);\n const location = faker.datatype.boolean() ? faker.helpers.arrayElement(locations) : undefined;\n return {\n name: faker.person.fullName(),\n email: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.email() : undefined,\n org:\n organizations?.length && faker.datatype.boolean({ probability: 0.3 })\n ? faker.helpers.arrayElement(organizations)\n : undefined,\n ...location,\n };\n },\n\n [TestSchemaType.project]: () => ({\n title: faker.commerce.productName(),\n repo: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n status: faker.helpers.arrayElement(Status),\n priority: faker.helpers.arrayElement(Priority),\n active: faker.datatype.boolean(),\n }),\n};\n\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators);\n\nconst locations = [\n { lat: 139.74946157054467, lng: 35.686962764371174 },\n { lat: -73.98196278740681, lng: 40.75192492259464 },\n { lat: -99.1329340602939, lng: 19.444388301415472 },\n { lat: 72.85504343876647, lng: 19.0189362343566 },\n { lat: -46.62696583905523, lng: -23.55673372837896 },\n { lat: 77.22805816860182, lng: 28.671938757181522 },\n { lat: 121.43455881982015, lng: 31.218398311228327 },\n { lat: 88.32272979950551, lng: 22.49691515689642 },\n { lat: 90.40663360810754, lng: 23.725005570312817 },\n { lat: -58.399477232331435, lng: -34.600555749907414 },\n { lat: -118.18192636994041, lng: 33.99192410876543 },\n { lat: 66.98806305137339, lng: 24.87193814681484 },\n { lat: 31.248022361126118, lng: 30.051906205103705 },\n { lat: -43.22696665284366, lng: -22.923077315615956 },\n { lat: 135.4581989565952, lng: 34.75198107491417 },\n { lat: 116.38633982565943, lng: 39.93083808990906 },\n { lat: 120.9802713035424, lng: 14.606104813440538 },\n { lat: 37.6135769672714, lng: 55.75410998124818 },\n { lat: 29.008055727002613, lng: 41.10694201243979 },\n { lat: 2.33138946713035, lng: 48.86863878981461 },\n { lat: 126.99778513820195, lng: 37.56829495838895 },\n { lat: 3.3895852125984334, lng: 6.445207512093191 },\n { lat: 106.82749176247012, lng: -6.172471846798885 },\n { lat: -87.75200083270931, lng: 41.83193651927843 },\n { lat: 113.32306427226172, lng: 23.14692716047989 },\n { lat: -0.11866770247593195, lng: 51.5019405883275 },\n { lat: -77.05200795343472, lng: -12.04606681752557 },\n { lat: 51.42239817500899, lng: 35.673888627001304 },\n { lat: 15.313026023171744, lng: -4.327778243275986 },\n { lat: -74.08528981377441, lng: 4.598369421147822 },\n { lat: 114.1201772298325, lng: 22.554316369677963 },\n { lat: 114.26807118958311, lng: 30.581977209337822 },\n { lat: 114.18306345846304, lng: 22.30692675357551 },\n { lat: 117.19807322410043, lng: 39.13197212310894 },\n { lat: 80.27805287890033, lng: 13.091933670856292 },\n { lat: 121.568333333333, lng: 25.0358333333333 },\n { lat: 77.55806386521755, lng: 12.97194099507442 },\n { lat: 100.51469879369489, lng: 13.751945064087977 },\n { lat: 74.34807892054346, lng: 31.56191739488844 },\n { lat: 106.59303578916195, lng: 29.566922888044644 },\n { lat: 78.47800771287751, lng: 17.401928991511454 },\n { lat: -70.66898671317483, lng: -33.448067956934096 },\n { lat: -80.22605193945003, lng: 25.789556555021534 },\n { lat: -43.916950376804834, lng: -19.91308016391116 },\n { lat: -3.6852975446125242, lng: 40.40197212311381 },\n { lat: -75.17194183200792, lng: 40.001919022526465 },\n { lat: 72.57805776168215, lng: 23.031998775062675 },\n { lat: 106.69308136207889, lng: 10.781971309193409 },\n { lat: -79.42196665298843, lng: 43.70192573640844 },\n { lat: 103.85387481909902, lng: 1.2949793251059418 },\n { lat: 13.23248118266855, lng: -8.836340255012658 },\n { lat: 44.391922914564134, lng: 33.34059435615865 },\n { lat: 2.181424460619155, lng: 41.385245438547486 },\n { lat: 88.32994665421205, lng: 22.580390440861947 },\n { lat: -96.84196278749818, lng: 32.82196968167733 },\n { lat: 123.44802765120869, lng: 41.80692512604918 },\n { lat: 32.532233380011576, lng: 15.590024084277673 },\n { lat: 73.84805776168719, lng: 18.531963374654026 },\n { lat: 151.1832339501475, lng: -33.91806510862875 },\n { lat: 30.314074200315076, lng: 59.94096036375191 },\n { lat: 91.79802154756635, lng: 22.33193814680459 },\n { lat: 113.74277634138707, lng: 23.050834758613007 },\n { lat: -84.40189524187565, lng: 33.83195971260585 },\n { lat: -71.07195953218684, lng: 42.33190600170229 },\n { lat: 46.770795798688255, lng: 24.642779007816443 },\n { lat: -95.341925149146, lng: 29.821920243188856 },\n { lat: 105.8480683412422, lng: 21.035273107737055 },\n { lat: -77.01136443943716, lng: 38.901495235087054 },\n { lat: -103.33198008081848, lng: 20.671961950508944 },\n { lat: 144.97307037590406, lng: -37.81808545369631 },\n { lat: 29.948050030391755, lng: 31.201965205759393 },\n { lat: 104.06807363094873, lng: 30.671945877957796 },\n { lat: -83.0820016464927, lng: 42.33190600170229 },\n { lat: 96.16473175266185, lng: 16.785299963188777 },\n { lat: 108.89305043760862, lng: 34.27697130928732 },\n { lat: -51.20195790450316, lng: -30.048068770722466 },\n { lat: 121.465, lng: 25.0127777777778 },\n { lat: 72.83809356897484, lng: 21.20192960187819 },\n { lat: 109.60911291406296, lng: 23.09653464659317 },\n { lat: -4.041994118507091, lng: 5.321942826098564 },\n { lat: -47.91799814700306, lng: -15.781394372878992 },\n { lat: 32.862445782356644, lng: 39.929184444075474 },\n { lat: -100.33193064232995, lng: 25.671940995125283 },\n { lat: 139.60202098994017, lng: 35.43065615270891 },\n { lat: 118.77802846499208, lng: 32.05196500231233 },\n { lat: -73.58524281670213, lng: 45.50194506421502 },\n { lat: 106.7180927553083, lng: 26.581988806001448 },\n { lat: -34.91755136960728, lng: -8.073699467249241 },\n { lat: 126.64803904445057, lng: 45.75192980542715 },\n { lat: -38.58192718342411, lng: -3.7480720258257634 },\n { lat: -112.07193755969467, lng: 33.5419257363676 },\n { lat: 117.67001623440774, lng: 24.520375385531167 },\n { lat: -38.48193328693924, lng: -12.968026046044827 },\n { lat: 129.00810170722048, lng: 35.09699877511093 },\n { lat: -122.41716877355225, lng: 37.76919562968743 },\n { lat: 28.028063865019476, lng: -26.16809888138414 },\n { lat: 13.399602764700546, lng: 52.523764522251156 },\n { lat: 3.048606670909237, lng: 36.765010656628135 },\n { lat: 125.75274485499392, lng: 39.02138455800434 },\n { lat: 12.481312562873995, lng: 41.89790148509894 },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { faker } from '@faker-js/faker';\n\nimport { Expando, type TypedObject, Schema, type Space } from '@dxos/client/echo';\n\nimport { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';\nimport { range } from './util';\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator<T extends string> {\n // prettier-ignore\n constructor(\n private readonly _schemas: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>\n ) {}\n\n get schemas(): Schema[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T) {\n return this.schemas.find((schema) => schema.typename === type);\n }\n\n protected setSchema(type: T, schema: Schema) {\n this._schemas[type] = schema;\n }\n\n // TODO(burdon): Runtime type check via: https://github.com/Effect-TS/schema (or zod).\n createObject({ types }: { types?: T[] } = {}): TypedObject {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));\n const data = this._generators[type](this._provider);\n const schema = this.getSchema(type);\n return new Expando(data, { schema });\n }\n\n // TODO(burdon): Create batch.\n // TODO(burdon): Based on dependencies (e.g., organization before contact).\n createObjects(map: Partial<Record<T, number>>): Expando[] {\n const objects: Expando[] = [];\n Object.entries<number>(map as any).forEach(([type, count]) => {\n range(() => objects.push(this.createObject({ types: [type as T] })), count);\n });\n\n return objects;\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(private readonly _space: Space, schemaMap: TestSchemaMap<T>, generators: TestGeneratorMap<T>) {\n super(schemaMap, generators, (type: T) => {\n const { objects } = this._space.db.query((object) => {\n return object.__schema?.id === this.getSchema(type)?.id;\n });\n\n return objects;\n });\n\n // TODO(burdon): Map initially are objects that have not been added to the space.\n // Merge existing schema in space with defaults.\n const { objects } = this._space.db.query(Schema.filter());\n Object.keys(schemaMap).forEach((type) => {\n const schema = objects.find((object) => object.typename === type);\n if (schema) {\n this.setSchema(type as T, schema);\n }\n });\n }\n\n addSchemas() {\n const { objects } = this._space.db.query(Schema.filter());\n this.schemas.forEach((schema) => {\n if (!objects.find((object) => object.typename === schema.typename)) {\n this._space.db.add(schema);\n }\n });\n\n return this.schemas;\n }\n\n override createObject({ types }: { types?: T[] } = {}): Expando {\n return this._space.db.add(super.createObject({ types }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter(Boolean) as T[];\n"],
|
|
5
|
-
"mappings": ";;;AAOA,SAASA,SAAAA,cAAa;AAEtB,SAASC,UAAAA,SAAoBC,kBAAkB;;;ACL/C,SAASC,aAAa;AAEtB,SAASC,SAA2BC,cAA0B;;;ACDvD,IAAMC,QAAQ,CAAIC,IAAkCC,WACzDC,MAAMC,KAAK;EAAEF;AAAO,CAAA,EACjBG,IAAI,CAACC,GAAGC,MAAMN,GAAGM,CAAAA,CAAAA,EACjBC,OAAOC,OAAAA;;;
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/aurora/testing.\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\nimport { faker } from '@faker-js/faker';\n\nimport { Schema, type Space, TextObject } from '@dxos/client/echo';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestSchemaMap } from './types';\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport enum TestSchemaType {\n document = 'example.com/schema/document',\n organization = 'example.com/schema/organization',\n contact = 'example.com/schema/contact',\n project = 'example.com/schema/project',\n}\n\nexport const testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = new Schema({\n typename: TestSchemaType.document,\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'content',\n type: Schema.PropType.STRING, // TODO(burdon): Rich text.\n },\n ],\n });\n\n const organization = new Schema({\n typename: TestSchemaType.organization,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING,\n },\n ],\n });\n\n const contact = new Schema({\n typename: TestSchemaType.contact,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'email',\n type: Schema.PropType.STRING,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n // TODO(burdon): Convert to object with nested props.\n {\n id: 'lat',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'lng',\n type: Schema.PropType.NUMBER,\n },\n ],\n });\n\n const project = new Schema({\n typename: TestSchemaType.project,\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING, // TODO(burdon): Text.\n },\n {\n id: 'repo',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'status',\n type: Schema.PropType.STRING,\n },\n {\n id: 'priority',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'active',\n type: Schema.PropType.BOOLEAN,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n ],\n });\n\n return {\n [TestSchemaType.document]: document,\n [TestSchemaType.organization]: organization,\n [TestSchemaType.contact]: contact,\n [TestSchemaType.project]: project,\n };\n};\n\nexport const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n [TestSchemaType.document]: () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n [TestSchemaType.organization]: () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: new TextObject(faker.lorem.sentences()),\n }),\n\n [TestSchemaType.contact]: (provider) => {\n const organizations = provider?.(TestSchemaType.organization);\n const location = faker.datatype.boolean() ? faker.helpers.arrayElement(locations) : undefined;\n return {\n name: faker.person.fullName(),\n email: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.email() : undefined,\n org:\n organizations?.length && faker.datatype.boolean({ probability: 0.3 })\n ? faker.helpers.arrayElement(organizations)\n : undefined,\n ...location,\n };\n },\n\n [TestSchemaType.project]: () => ({\n title: faker.commerce.productName(),\n repo: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n status: faker.helpers.arrayElement(Status),\n priority: faker.helpers.arrayElement(Priority),\n active: faker.datatype.boolean(),\n }),\n};\n\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators);\n\nconst locations = [\n { lat: 139.74946157054467, lng: 35.686962764371174 },\n { lat: -73.98196278740681, lng: 40.75192492259464 },\n { lat: -99.1329340602939, lng: 19.444388301415472 },\n { lat: 72.85504343876647, lng: 19.0189362343566 },\n { lat: -46.62696583905523, lng: -23.55673372837896 },\n { lat: 77.22805816860182, lng: 28.671938757181522 },\n { lat: 121.43455881982015, lng: 31.218398311228327 },\n { lat: 88.32272979950551, lng: 22.49691515689642 },\n { lat: 90.40663360810754, lng: 23.725005570312817 },\n { lat: -58.399477232331435, lng: -34.600555749907414 },\n { lat: -118.18192636994041, lng: 33.99192410876543 },\n { lat: 66.98806305137339, lng: 24.87193814681484 },\n { lat: 31.248022361126118, lng: 30.051906205103705 },\n { lat: -43.22696665284366, lng: -22.923077315615956 },\n { lat: 135.4581989565952, lng: 34.75198107491417 },\n { lat: 116.38633982565943, lng: 39.93083808990906 },\n { lat: 120.9802713035424, lng: 14.606104813440538 },\n { lat: 37.6135769672714, lng: 55.75410998124818 },\n { lat: 29.008055727002613, lng: 41.10694201243979 },\n { lat: 2.33138946713035, lng: 48.86863878981461 },\n { lat: 126.99778513820195, lng: 37.56829495838895 },\n { lat: 3.3895852125984334, lng: 6.445207512093191 },\n { lat: 106.82749176247012, lng: -6.172471846798885 },\n { lat: -87.75200083270931, lng: 41.83193651927843 },\n { lat: 113.32306427226172, lng: 23.14692716047989 },\n { lat: -0.11866770247593195, lng: 51.5019405883275 },\n { lat: -77.05200795343472, lng: -12.04606681752557 },\n { lat: 51.42239817500899, lng: 35.673888627001304 },\n { lat: 15.313026023171744, lng: -4.327778243275986 },\n { lat: -74.08528981377441, lng: 4.598369421147822 },\n { lat: 114.1201772298325, lng: 22.554316369677963 },\n { lat: 114.26807118958311, lng: 30.581977209337822 },\n { lat: 114.18306345846304, lng: 22.30692675357551 },\n { lat: 117.19807322410043, lng: 39.13197212310894 },\n { lat: 80.27805287890033, lng: 13.091933670856292 },\n { lat: 121.568333333333, lng: 25.0358333333333 },\n { lat: 77.55806386521755, lng: 12.97194099507442 },\n { lat: 100.51469879369489, lng: 13.751945064087977 },\n { lat: 74.34807892054346, lng: 31.56191739488844 },\n { lat: 106.59303578916195, lng: 29.566922888044644 },\n { lat: 78.47800771287751, lng: 17.401928991511454 },\n { lat: -70.66898671317483, lng: -33.448067956934096 },\n { lat: -80.22605193945003, lng: 25.789556555021534 },\n { lat: -43.916950376804834, lng: -19.91308016391116 },\n { lat: -3.6852975446125242, lng: 40.40197212311381 },\n { lat: -75.17194183200792, lng: 40.001919022526465 },\n { lat: 72.57805776168215, lng: 23.031998775062675 },\n { lat: 106.69308136207889, lng: 10.781971309193409 },\n { lat: -79.42196665298843, lng: 43.70192573640844 },\n { lat: 103.85387481909902, lng: 1.2949793251059418 },\n { lat: 13.23248118266855, lng: -8.836340255012658 },\n { lat: 44.391922914564134, lng: 33.34059435615865 },\n { lat: 2.181424460619155, lng: 41.385245438547486 },\n { lat: 88.32994665421205, lng: 22.580390440861947 },\n { lat: -96.84196278749818, lng: 32.82196968167733 },\n { lat: 123.44802765120869, lng: 41.80692512604918 },\n { lat: 32.532233380011576, lng: 15.590024084277673 },\n { lat: 73.84805776168719, lng: 18.531963374654026 },\n { lat: 151.1832339501475, lng: -33.91806510862875 },\n { lat: 30.314074200315076, lng: 59.94096036375191 },\n { lat: 91.79802154756635, lng: 22.33193814680459 },\n { lat: 113.74277634138707, lng: 23.050834758613007 },\n { lat: -84.40189524187565, lng: 33.83195971260585 },\n { lat: -71.07195953218684, lng: 42.33190600170229 },\n { lat: 46.770795798688255, lng: 24.642779007816443 },\n { lat: -95.341925149146, lng: 29.821920243188856 },\n { lat: 105.8480683412422, lng: 21.035273107737055 },\n { lat: -77.01136443943716, lng: 38.901495235087054 },\n { lat: -103.33198008081848, lng: 20.671961950508944 },\n { lat: 144.97307037590406, lng: -37.81808545369631 },\n { lat: 29.948050030391755, lng: 31.201965205759393 },\n { lat: 104.06807363094873, lng: 30.671945877957796 },\n { lat: -83.0820016464927, lng: 42.33190600170229 },\n { lat: 96.16473175266185, lng: 16.785299963188777 },\n { lat: 108.89305043760862, lng: 34.27697130928732 },\n { lat: -51.20195790450316, lng: -30.048068770722466 },\n { lat: 121.465, lng: 25.0127777777778 },\n { lat: 72.83809356897484, lng: 21.20192960187819 },\n { lat: 109.60911291406296, lng: 23.09653464659317 },\n { lat: -4.041994118507091, lng: 5.321942826098564 },\n { lat: -47.91799814700306, lng: -15.781394372878992 },\n { lat: 32.862445782356644, lng: 39.929184444075474 },\n { lat: -100.33193064232995, lng: 25.671940995125283 },\n { lat: 139.60202098994017, lng: 35.43065615270891 },\n { lat: 118.77802846499208, lng: 32.05196500231233 },\n { lat: -73.58524281670213, lng: 45.50194506421502 },\n { lat: 106.7180927553083, lng: 26.581988806001448 },\n { lat: -34.91755136960728, lng: -8.073699467249241 },\n { lat: 126.64803904445057, lng: 45.75192980542715 },\n { lat: -38.58192718342411, lng: -3.7480720258257634 },\n { lat: -112.07193755969467, lng: 33.5419257363676 },\n { lat: 117.67001623440774, lng: 24.520375385531167 },\n { lat: -38.48193328693924, lng: -12.968026046044827 },\n { lat: 129.00810170722048, lng: 35.09699877511093 },\n { lat: -122.41716877355225, lng: 37.76919562968743 },\n { lat: 28.028063865019476, lng: -26.16809888138414 },\n { lat: 13.399602764700546, lng: 52.523764522251156 },\n { lat: 3.048606670909237, lng: 36.765010656628135 },\n { lat: 125.75274485499392, lng: 39.02138455800434 },\n { lat: 12.481312562873995, lng: 41.89790148509894 },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { faker } from '@faker-js/faker';\n\nimport { Expando, type TypedObject, Schema, type Space } from '@dxos/client/echo';\n\nimport { type TestSchemaType } from './data';\nimport { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';\nimport { range } from './util';\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator<T extends string = TestSchemaType> {\n // prettier-ignore\n constructor(\n private readonly _schemas: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>\n ) {}\n\n get schemas(): Schema[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T) {\n return this.schemas.find((schema) => schema.typename === type);\n }\n\n protected setSchema(type: T, schema: Schema) {\n this._schemas[type] = schema;\n }\n\n // TODO(burdon): Runtime type check via: https://github.com/Effect-TS/schema (or zod).\n createObject({ types }: { types?: T[] } = {}): TypedObject {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));\n const data = this._generators[type](this._provider);\n const schema = this.getSchema(type);\n return new Expando(data, { schema });\n }\n\n // TODO(burdon): Create batch.\n // TODO(burdon): Based on dependencies (e.g., organization before contact).\n createObjects(map: Partial<Record<T, number>>): Expando[] {\n const objects: Expando[] = [];\n Object.entries<number>(map as any).forEach(([type, count]) => {\n range(() => objects.push(this.createObject({ types: [type as T] })), count);\n });\n\n return objects;\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(private readonly _space: Space, schemaMap: TestSchemaMap<T>, generators: TestGeneratorMap<T>) {\n super(schemaMap, generators, (type: T) => {\n const { objects } = this._space.db.query((object) => {\n return object.__schema?.id === this.getSchema(type)?.id;\n });\n\n return objects;\n });\n\n // TODO(burdon): Map initially are objects that have not been added to the space.\n // Merge existing schema in space with defaults.\n const { objects } = this._space.db.query(Schema.filter());\n Object.keys(schemaMap).forEach((type) => {\n const schema = objects.find((object) => object.typename === type);\n if (schema) {\n this.setSchema(type as T, schema);\n }\n });\n }\n\n addSchemas() {\n const { objects } = this._space.db.query(Schema.filter());\n this.schemas.forEach((schema) => {\n if (!objects.find((object) => object.typename === schema.typename)) {\n this._space.db.add(schema);\n }\n });\n\n return this.schemas;\n }\n\n override createObject({ types }: { types?: T[] } = {}): Expando {\n return this._space.db.add(super.createObject({ types }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter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AAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAqBC,KAAK;EAAmB;EACpD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAmBC,KAAK;EAAmB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAAqBC,KAAK;EAAiB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAqBC,KAAK;EAAkB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAmBC,KAAK;EAAmB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;;",
|
|
6
6
|
"names": ["faker", "Schema", "TextObject", "faker", "Expando", "Schema", "range", "fn", "length", "Array", "from", "map", "_", "i", "filter", "Boolean", "TestObjectGenerator", "constructor", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "getSchema", "type", "find", "schema", "typename", "setSchema", "createObject", "types", "faker", "helpers", "arrayElement", "keys", "data", "Expando", "createObjects", "map", "objects", "entries", "forEach", "count", "range", "push", "SpaceObjectGenerator", "_space", "schemaMap", "generators", "db", "query", "object", "__schema", "id", "Schema", "filter", "addSchemas", "add", "Status", "Priority", "TestSchemaType", "document", "organization", "contact", "project", "testSchemas", "Schema", "typename", "props", "id", "type", "PropType", "STRING", "REF", "ref", "NUMBER", "BOOLEAN", "testObjectGenerators", "title", "faker", "lorem", "sentence", "content", "sentences", "min", "max", "number", "int", "name", "company", "website", "datatype", "boolean", "probability", "internet", "url", "undefined", "description", "TextObject", "provider", "organizations", "location", "helpers", "arrayElement", "locations", "person", "fullName", "email", "org", "length", "commerce", "productName", "repo", "status", "priority", "active", "createTestObjectGenerator", "TestObjectGenerator", "createSpaceObjectGenerator", "space", "SpaceObjectGenerator", "lat", "lng"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/echo/echo-generator/src/util.ts":{"bytes":1057,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/generator.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/core/echo/echo-generator/src/util.ts":{"bytes":1057,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/generator.ts":{"bytes":10604,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/core/echo/echo-generator/src/data.ts":{"bytes":37836,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"}],"format":"esm"},"packages/core/echo/echo-generator/src/types.ts":{"bytes":937,"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":23446},"packages/core/echo/echo-generator/dist/lib/browser/index.mjs":{"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true}],"exports":["Priority","SpaceObjectGenerator","Status","TestObjectGenerator","TestSchemaType","createSpaceObjectGenerator","createTestObjectGenerator","range","testObjectGenerators","testSchemas"],"entryPoint":"packages/core/echo/echo-generator/src/index.ts","inputs":{"packages/core/echo/echo-generator/src/data.ts":{"bytesInOutput":10767},"packages/core/echo/echo-generator/src/generator.ts":{"bytesInOutput":2245},"packages/core/echo/echo-generator/src/util.ts":{"bytesInOutput":91},"packages/core/echo/echo-generator/src/index.ts":{"bytesInOutput":0}},"bytes":13636}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -16,10 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
19
|
+
var node_exports = {};
|
|
20
|
+
__export(node_exports, {
|
|
23
21
|
Priority: () => Priority,
|
|
24
22
|
SpaceObjectGenerator: () => SpaceObjectGenerator,
|
|
25
23
|
Status: () => Status,
|
|
@@ -31,22 +29,14 @@ __export(src_exports, {
|
|
|
31
29
|
testObjectGenerators: () => testObjectGenerators,
|
|
32
30
|
testSchemas: () => testSchemas
|
|
33
31
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
|
|
36
|
-
// packages/core/echo/echo-generator/src/data.ts
|
|
37
|
-
var import_faker2 = require("@faker-js/faker");
|
|
38
|
-
var import_echo2 = require("@dxos/client/echo");
|
|
39
|
-
|
|
40
|
-
// packages/core/echo/echo-generator/src/generator.ts
|
|
32
|
+
module.exports = __toCommonJS(node_exports);
|
|
41
33
|
var import_faker = require("@faker-js/faker");
|
|
42
34
|
var import_echo = require("@dxos/client/echo");
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
var import_faker2 = require("@faker-js/faker");
|
|
36
|
+
var import_echo2 = require("@dxos/client/echo");
|
|
45
37
|
var range = (fn, length) => Array.from({
|
|
46
38
|
length
|
|
47
39
|
}).map((_, i) => fn(i)).filter(Boolean);
|
|
48
|
-
|
|
49
|
-
// packages/core/echo/echo-generator/src/generator.ts
|
|
50
40
|
var TestObjectGenerator = class {
|
|
51
41
|
// prettier-ignore
|
|
52
42
|
constructor(_schemas, _generators, _provider) {
|
|
@@ -65,10 +55,10 @@ var TestObjectGenerator = class {
|
|
|
65
55
|
}
|
|
66
56
|
// TODO(burdon): Runtime type check via: https://github.com/Effect-TS/schema (or zod).
|
|
67
57
|
createObject({ types } = {}) {
|
|
68
|
-
const type =
|
|
58
|
+
const type = import_faker2.faker.helpers.arrayElement(types ?? Object.keys(this._schemas));
|
|
69
59
|
const data = this._generators[type](this._provider);
|
|
70
60
|
const schema = this.getSchema(type);
|
|
71
|
-
return new
|
|
61
|
+
return new import_echo2.Expando(data, {
|
|
72
62
|
schema
|
|
73
63
|
});
|
|
74
64
|
}
|
|
@@ -95,7 +85,7 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
95
85
|
return objects2;
|
|
96
86
|
});
|
|
97
87
|
this._space = _space;
|
|
98
|
-
const { objects } = this._space.db.query(
|
|
88
|
+
const { objects } = this._space.db.query(import_echo2.Schema.filter());
|
|
99
89
|
Object.keys(schemaMap).forEach((type) => {
|
|
100
90
|
const schema = objects.find((object) => object.typename === type);
|
|
101
91
|
if (schema) {
|
|
@@ -104,7 +94,7 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
104
94
|
});
|
|
105
95
|
}
|
|
106
96
|
addSchemas() {
|
|
107
|
-
const { objects } = this._space.db.query(
|
|
97
|
+
const { objects } = this._space.db.query(import_echo2.Schema.filter());
|
|
108
98
|
this.schemas.forEach((schema) => {
|
|
109
99
|
if (!objects.find((object) => object.typename === schema.typename)) {
|
|
110
100
|
this._space.db.add(schema);
|
|
@@ -118,8 +108,6 @@ var SpaceObjectGenerator = class extends TestObjectGenerator {
|
|
|
118
108
|
}));
|
|
119
109
|
}
|
|
120
110
|
};
|
|
121
|
-
|
|
122
|
-
// packages/core/echo/echo-generator/src/data.ts
|
|
123
111
|
var Status = [
|
|
124
112
|
"pending",
|
|
125
113
|
"active",
|
|
@@ -140,93 +128,98 @@ var TestSchemaType;
|
|
|
140
128
|
TestSchemaType2["project"] = "example.com/schema/project";
|
|
141
129
|
})(TestSchemaType || (TestSchemaType = {}));
|
|
142
130
|
var testSchemas = () => {
|
|
143
|
-
const document = new
|
|
131
|
+
const document = new import_echo.Schema({
|
|
144
132
|
typename: TestSchemaType.document,
|
|
145
133
|
props: [
|
|
146
134
|
{
|
|
147
|
-
id: "
|
|
148
|
-
type:
|
|
135
|
+
id: "title",
|
|
136
|
+
type: import_echo.Schema.PropType.STRING
|
|
149
137
|
},
|
|
150
138
|
{
|
|
151
139
|
id: "content",
|
|
152
|
-
type:
|
|
140
|
+
type: import_echo.Schema.PropType.STRING
|
|
153
141
|
}
|
|
154
142
|
]
|
|
155
143
|
});
|
|
156
|
-
const organization = new
|
|
144
|
+
const organization = new import_echo.Schema({
|
|
157
145
|
typename: TestSchemaType.organization,
|
|
158
146
|
props: [
|
|
159
147
|
{
|
|
160
148
|
id: "name",
|
|
161
|
-
type:
|
|
149
|
+
type: import_echo.Schema.PropType.STRING
|
|
162
150
|
},
|
|
163
151
|
{
|
|
164
152
|
id: "website",
|
|
165
|
-
type:
|
|
153
|
+
type: import_echo.Schema.PropType.STRING
|
|
166
154
|
},
|
|
167
155
|
{
|
|
168
156
|
id: "description",
|
|
169
|
-
type:
|
|
157
|
+
type: import_echo.Schema.PropType.STRING
|
|
170
158
|
}
|
|
171
159
|
]
|
|
172
160
|
});
|
|
173
|
-
const contact = new
|
|
161
|
+
const contact = new import_echo.Schema({
|
|
174
162
|
typename: TestSchemaType.contact,
|
|
175
163
|
props: [
|
|
176
164
|
{
|
|
177
165
|
id: "name",
|
|
178
|
-
type:
|
|
166
|
+
type: import_echo.Schema.PropType.STRING
|
|
179
167
|
},
|
|
180
168
|
{
|
|
181
169
|
id: "email",
|
|
182
|
-
type:
|
|
170
|
+
type: import_echo.Schema.PropType.STRING
|
|
183
171
|
},
|
|
184
172
|
{
|
|
185
173
|
id: "org",
|
|
186
|
-
type:
|
|
174
|
+
type: import_echo.Schema.PropType.REF,
|
|
187
175
|
ref: organization
|
|
188
176
|
},
|
|
189
177
|
// TODO(burdon): Convert to object with nested props.
|
|
190
178
|
{
|
|
191
179
|
id: "lat",
|
|
192
|
-
type:
|
|
180
|
+
type: import_echo.Schema.PropType.NUMBER
|
|
193
181
|
},
|
|
194
182
|
{
|
|
195
183
|
id: "lng",
|
|
196
|
-
type:
|
|
184
|
+
type: import_echo.Schema.PropType.NUMBER
|
|
197
185
|
}
|
|
198
186
|
]
|
|
199
187
|
});
|
|
200
|
-
const project = new
|
|
188
|
+
const project = new import_echo.Schema({
|
|
201
189
|
typename: TestSchemaType.project,
|
|
202
190
|
props: [
|
|
203
191
|
{
|
|
204
192
|
id: "title",
|
|
205
|
-
type:
|
|
193
|
+
type: import_echo.Schema.PropType.STRING
|
|
206
194
|
},
|
|
207
195
|
{
|
|
208
196
|
id: "description",
|
|
209
|
-
type:
|
|
197
|
+
type: import_echo.Schema.PropType.STRING
|
|
210
198
|
},
|
|
211
199
|
{
|
|
212
200
|
id: "repo",
|
|
213
|
-
type:
|
|
201
|
+
type: import_echo.Schema.PropType.STRING
|
|
214
202
|
},
|
|
215
203
|
{
|
|
216
204
|
id: "website",
|
|
217
|
-
type:
|
|
205
|
+
type: import_echo.Schema.PropType.STRING
|
|
218
206
|
},
|
|
219
207
|
{
|
|
220
208
|
id: "status",
|
|
221
|
-
type:
|
|
209
|
+
type: import_echo.Schema.PropType.STRING
|
|
222
210
|
},
|
|
223
211
|
{
|
|
224
212
|
id: "priority",
|
|
225
|
-
type:
|
|
213
|
+
type: import_echo.Schema.PropType.NUMBER
|
|
226
214
|
},
|
|
227
215
|
{
|
|
228
216
|
id: "active",
|
|
229
|
-
type:
|
|
217
|
+
type: import_echo.Schema.PropType.BOOLEAN
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: "org",
|
|
221
|
+
type: import_echo.Schema.PropType.REF,
|
|
222
|
+
ref: organization
|
|
230
223
|
}
|
|
231
224
|
]
|
|
232
225
|
});
|
|
@@ -239,44 +232,44 @@ var testSchemas = () => {
|
|
|
239
232
|
};
|
|
240
233
|
var testObjectGenerators = {
|
|
241
234
|
[TestSchemaType.document]: () => ({
|
|
242
|
-
title:
|
|
243
|
-
content:
|
|
235
|
+
title: import_faker.faker.lorem.sentence(3),
|
|
236
|
+
content: import_faker.faker.lorem.sentences({
|
|
244
237
|
min: 1,
|
|
245
|
-
max:
|
|
238
|
+
max: import_faker.faker.number.int({
|
|
246
239
|
min: 1,
|
|
247
240
|
max: 3
|
|
248
241
|
})
|
|
249
242
|
})
|
|
250
243
|
}),
|
|
251
244
|
[TestSchemaType.organization]: () => ({
|
|
252
|
-
name:
|
|
253
|
-
website:
|
|
245
|
+
name: import_faker.faker.company.name(),
|
|
246
|
+
website: import_faker.faker.datatype.boolean({
|
|
254
247
|
probability: 0.3
|
|
255
|
-
}) ?
|
|
256
|
-
description: new
|
|
248
|
+
}) ? import_faker.faker.internet.url() : void 0,
|
|
249
|
+
description: new import_echo.TextObject(import_faker.faker.lorem.sentences())
|
|
257
250
|
}),
|
|
258
251
|
[TestSchemaType.contact]: (provider) => {
|
|
259
252
|
const organizations = provider?.(TestSchemaType.organization);
|
|
260
|
-
const location =
|
|
253
|
+
const location = import_faker.faker.datatype.boolean() ? import_faker.faker.helpers.arrayElement(locations) : void 0;
|
|
261
254
|
return {
|
|
262
|
-
name:
|
|
263
|
-
email:
|
|
255
|
+
name: import_faker.faker.person.fullName(),
|
|
256
|
+
email: import_faker.faker.datatype.boolean({
|
|
264
257
|
probability: 0.5
|
|
265
|
-
}) ?
|
|
266
|
-
org: organizations?.length &&
|
|
258
|
+
}) ? import_faker.faker.internet.email() : void 0,
|
|
259
|
+
org: organizations?.length && import_faker.faker.datatype.boolean({
|
|
267
260
|
probability: 0.3
|
|
268
|
-
}) ?
|
|
261
|
+
}) ? import_faker.faker.helpers.arrayElement(organizations) : void 0,
|
|
269
262
|
...location
|
|
270
263
|
};
|
|
271
264
|
},
|
|
272
265
|
[TestSchemaType.project]: () => ({
|
|
273
|
-
title:
|
|
274
|
-
repo:
|
|
266
|
+
title: import_faker.faker.commerce.productName(),
|
|
267
|
+
repo: import_faker.faker.datatype.boolean({
|
|
275
268
|
probability: 0.3
|
|
276
|
-
}) ?
|
|
277
|
-
status:
|
|
278
|
-
priority:
|
|
279
|
-
active:
|
|
269
|
+
}) ? import_faker.faker.internet.url() : void 0,
|
|
270
|
+
status: import_faker.faker.helpers.arrayElement(Status),
|
|
271
|
+
priority: import_faker.faker.helpers.arrayElement(Priority),
|
|
272
|
+
active: import_faker.faker.datatype.boolean()
|
|
280
273
|
})
|
|
281
274
|
};
|
|
282
275
|
var createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './data';\nexport * from './generator';\nexport * from './util';\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/aurora/testing.\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\nimport { faker } from '@faker-js/faker';\n\nimport { Schema, type Space, TextObject } from '@dxos/client/echo';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestSchemaMap } from './types';\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport enum TestSchemaType {\n document = 'example.com/schema/document',\n organization = 'example.com/schema/organization',\n contact = 'example.com/schema/contact',\n project = 'example.com/schema/project',\n}\n\nexport const testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = new Schema({\n typename: TestSchemaType.document,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'content',\n type: Schema.PropType.STRING, // TODO(burdon): Rich text.\n },\n ],\n });\n\n const organization = new Schema({\n typename: TestSchemaType.organization,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING,\n },\n ],\n });\n\n const contact = new Schema({\n typename: TestSchemaType.contact,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'email',\n type: Schema.PropType.STRING,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n // TODO(burdon): Convert to object with nested props.\n {\n id: 'lat',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'lng',\n type: Schema.PropType.NUMBER,\n },\n ],\n });\n\n const project = new Schema({\n typename: TestSchemaType.project,\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING, // TODO(burdon): Text.\n },\n {\n id: 'repo',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'status',\n type: Schema.PropType.STRING,\n },\n {\n id: 'priority',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'active',\n type: Schema.PropType.BOOLEAN,\n },\n ],\n });\n\n return {\n [TestSchemaType.document]: document,\n [TestSchemaType.organization]: organization,\n [TestSchemaType.contact]: contact,\n [TestSchemaType.project]: project,\n };\n};\n\nexport const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n [TestSchemaType.document]: () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n [TestSchemaType.organization]: () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: new TextObject(faker.lorem.sentences()),\n }),\n\n [TestSchemaType.contact]: (provider) => {\n const organizations = provider?.(TestSchemaType.organization);\n const location = faker.datatype.boolean() ? faker.helpers.arrayElement(locations) : undefined;\n return {\n name: faker.person.fullName(),\n email: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.email() : undefined,\n org:\n organizations?.length && faker.datatype.boolean({ probability: 0.3 })\n ? faker.helpers.arrayElement(organizations)\n : undefined,\n ...location,\n };\n },\n\n [TestSchemaType.project]: () => ({\n title: faker.commerce.productName(),\n repo: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n status: faker.helpers.arrayElement(Status),\n priority: faker.helpers.arrayElement(Priority),\n active: faker.datatype.boolean(),\n }),\n};\n\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators);\n\nconst locations = [\n { lat: 139.74946157054467, lng: 35.686962764371174 },\n { lat: -73.98196278740681, lng: 40.75192492259464 },\n { lat: -99.1329340602939, lng: 19.444388301415472 },\n { lat: 72.85504343876647, lng: 19.0189362343566 },\n { lat: -46.62696583905523, lng: -23.55673372837896 },\n { lat: 77.22805816860182, lng: 28.671938757181522 },\n { lat: 121.43455881982015, lng: 31.218398311228327 },\n { lat: 88.32272979950551, lng: 22.49691515689642 },\n { lat: 90.40663360810754, lng: 23.725005570312817 },\n { lat: -58.399477232331435, lng: -34.600555749907414 },\n { lat: -118.18192636994041, lng: 33.99192410876543 },\n { lat: 66.98806305137339, lng: 24.87193814681484 },\n { lat: 31.248022361126118, lng: 30.051906205103705 },\n { lat: -43.22696665284366, lng: -22.923077315615956 },\n { lat: 135.4581989565952, lng: 34.75198107491417 },\n { lat: 116.38633982565943, lng: 39.93083808990906 },\n { lat: 120.9802713035424, lng: 14.606104813440538 },\n { lat: 37.6135769672714, lng: 55.75410998124818 },\n { lat: 29.008055727002613, lng: 41.10694201243979 },\n { lat: 2.33138946713035, lng: 48.86863878981461 },\n { lat: 126.99778513820195, lng: 37.56829495838895 },\n { lat: 3.3895852125984334, lng: 6.445207512093191 },\n { lat: 106.82749176247012, lng: -6.172471846798885 },\n { lat: -87.75200083270931, lng: 41.83193651927843 },\n { lat: 113.32306427226172, lng: 23.14692716047989 },\n { lat: -0.11866770247593195, lng: 51.5019405883275 },\n { lat: -77.05200795343472, lng: -12.04606681752557 },\n { lat: 51.42239817500899, lng: 35.673888627001304 },\n { lat: 15.313026023171744, lng: -4.327778243275986 },\n { lat: -74.08528981377441, lng: 4.598369421147822 },\n { lat: 114.1201772298325, lng: 22.554316369677963 },\n { lat: 114.26807118958311, lng: 30.581977209337822 },\n { lat: 114.18306345846304, lng: 22.30692675357551 },\n { lat: 117.19807322410043, lng: 39.13197212310894 },\n { lat: 80.27805287890033, lng: 13.091933670856292 },\n { lat: 121.568333333333, lng: 25.0358333333333 },\n { lat: 77.55806386521755, lng: 12.97194099507442 },\n { lat: 100.51469879369489, lng: 13.751945064087977 },\n { lat: 74.34807892054346, lng: 31.56191739488844 },\n { lat: 106.59303578916195, lng: 29.566922888044644 },\n { lat: 78.47800771287751, lng: 17.401928991511454 },\n { lat: -70.66898671317483, lng: -33.448067956934096 },\n { lat: -80.22605193945003, lng: 25.789556555021534 },\n { lat: -43.916950376804834, lng: -19.91308016391116 },\n { lat: -3.6852975446125242, lng: 40.40197212311381 },\n { lat: -75.17194183200792, lng: 40.001919022526465 },\n { lat: 72.57805776168215, lng: 23.031998775062675 },\n { lat: 106.69308136207889, lng: 10.781971309193409 },\n { lat: -79.42196665298843, lng: 43.70192573640844 },\n { lat: 103.85387481909902, lng: 1.2949793251059418 },\n { lat: 13.23248118266855, lng: -8.836340255012658 },\n { lat: 44.391922914564134, lng: 33.34059435615865 },\n { lat: 2.181424460619155, lng: 41.385245438547486 },\n { lat: 88.32994665421205, lng: 22.580390440861947 },\n { lat: -96.84196278749818, lng: 32.82196968167733 },\n { lat: 123.44802765120869, lng: 41.80692512604918 },\n { lat: 32.532233380011576, lng: 15.590024084277673 },\n { lat: 73.84805776168719, lng: 18.531963374654026 },\n { lat: 151.1832339501475, lng: -33.91806510862875 },\n { lat: 30.314074200315076, lng: 59.94096036375191 },\n { lat: 91.79802154756635, lng: 22.33193814680459 },\n { lat: 113.74277634138707, lng: 23.050834758613007 },\n { lat: -84.40189524187565, lng: 33.83195971260585 },\n { lat: -71.07195953218684, lng: 42.33190600170229 },\n { lat: 46.770795798688255, lng: 24.642779007816443 },\n { lat: -95.341925149146, lng: 29.821920243188856 },\n { lat: 105.8480683412422, lng: 21.035273107737055 },\n { lat: -77.01136443943716, lng: 38.901495235087054 },\n { lat: -103.33198008081848, lng: 20.671961950508944 },\n { lat: 144.97307037590406, lng: -37.81808545369631 },\n { lat: 29.948050030391755, lng: 31.201965205759393 },\n { lat: 104.06807363094873, lng: 30.671945877957796 },\n { lat: -83.0820016464927, lng: 42.33190600170229 },\n { lat: 96.16473175266185, lng: 16.785299963188777 },\n { lat: 108.89305043760862, lng: 34.27697130928732 },\n { lat: -51.20195790450316, lng: -30.048068770722466 },\n { lat: 121.465, lng: 25.0127777777778 },\n { lat: 72.83809356897484, lng: 21.20192960187819 },\n { lat: 109.60911291406296, lng: 23.09653464659317 },\n { lat: -4.041994118507091, lng: 5.321942826098564 },\n { lat: -47.91799814700306, lng: -15.781394372878992 },\n { lat: 32.862445782356644, lng: 39.929184444075474 },\n { lat: -100.33193064232995, lng: 25.671940995125283 },\n { lat: 139.60202098994017, lng: 35.43065615270891 },\n { lat: 118.77802846499208, lng: 32.05196500231233 },\n { lat: -73.58524281670213, lng: 45.50194506421502 },\n { lat: 106.7180927553083, lng: 26.581988806001448 },\n { lat: -34.91755136960728, lng: -8.073699467249241 },\n { lat: 126.64803904445057, lng: 45.75192980542715 },\n { lat: -38.58192718342411, lng: -3.7480720258257634 },\n { lat: -112.07193755969467, lng: 33.5419257363676 },\n { lat: 117.67001623440774, lng: 24.520375385531167 },\n { lat: -38.48193328693924, lng: -12.968026046044827 },\n { lat: 129.00810170722048, lng: 35.09699877511093 },\n { lat: -122.41716877355225, lng: 37.76919562968743 },\n { lat: 28.028063865019476, lng: -26.16809888138414 },\n { lat: 13.399602764700546, lng: 52.523764522251156 },\n { lat: 3.048606670909237, lng: 36.765010656628135 },\n { lat: 125.75274485499392, lng: 39.02138455800434 },\n { lat: 12.481312562873995, lng: 41.89790148509894 },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { faker } from '@faker-js/faker';\n\nimport { Expando, type TypedObject, Schema, type Space } from '@dxos/client/echo';\n\nimport { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';\nimport { range } from './util';\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator<T extends string> {\n // prettier-ignore\n constructor(\n private readonly _schemas: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>\n ) {}\n\n get schemas(): Schema[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T) {\n return this.schemas.find((schema) => schema.typename === type);\n }\n\n protected setSchema(type: T, schema: Schema) {\n this._schemas[type] = schema;\n }\n\n // TODO(burdon): Runtime type check via: https://github.com/Effect-TS/schema (or zod).\n createObject({ types }: { types?: T[] } = {}): TypedObject {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));\n const data = this._generators[type](this._provider);\n const schema = this.getSchema(type);\n return new Expando(data, { schema });\n }\n\n // TODO(burdon): Create batch.\n // TODO(burdon): Based on dependencies (e.g., organization before contact).\n createObjects(map: Partial<Record<T, number>>): Expando[] {\n const objects: Expando[] = [];\n Object.entries<number>(map as any).forEach(([type, count]) => {\n range(() => objects.push(this.createObject({ types: [type as T] })), count);\n });\n\n return objects;\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(private readonly _space: Space, schemaMap: TestSchemaMap<T>, generators: TestGeneratorMap<T>) {\n super(schemaMap, generators, (type: T) => {\n const { objects } = this._space.db.query((object) => {\n return object.__schema?.id === this.getSchema(type)?.id;\n });\n\n return objects;\n });\n\n // TODO(burdon): Map initially are objects that have not been added to the space.\n // Merge existing schema in space with defaults.\n const { objects } = this._space.db.query(Schema.filter());\n Object.keys(schemaMap).forEach((type) => {\n const schema = objects.find((object) => object.typename === type);\n if (schema) {\n this.setSchema(type as T, schema);\n }\n });\n }\n\n addSchemas() {\n const { objects } = this._space.db.query(Schema.filter());\n this.schemas.forEach((schema) => {\n if (!objects.find((object) => object.typename === schema.typename)) {\n this._space.db.add(schema);\n }\n });\n\n return this.schemas;\n }\n\n override createObject({ types }: { types?: T[] } = {}): Expando {\n return this._space.db.add(super.createObject({ types }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter(Boolean) as T[];\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_faker", "import_echo", "range", "fn", "length", "Array", "from", "map", "_", "i", "filter", "Boolean", "TestObjectGenerator", "constructor", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "getSchema", "type", "find", "schema", "typename", "setSchema", "createObject", "types", "faker", "helpers", "arrayElement", "keys", "data", "Expando", "createObjects", "
|
|
3
|
+
"sources": ["../../../src/data.ts", "../../../src/generator.ts", "../../../src/util.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/aurora/testing.\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\nimport { faker } from '@faker-js/faker';\n\nimport { Schema, type Space, TextObject } from '@dxos/client/echo';\n\nimport { SpaceObjectGenerator, TestObjectGenerator } from './generator';\nimport { type TestGeneratorMap, type TestSchemaMap } from './types';\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport enum TestSchemaType {\n document = 'example.com/schema/document',\n organization = 'example.com/schema/organization',\n contact = 'example.com/schema/contact',\n project = 'example.com/schema/project',\n}\n\nexport const testSchemas = (): TestSchemaMap<TestSchemaType> => {\n const document = new Schema({\n typename: TestSchemaType.document,\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'content',\n type: Schema.PropType.STRING, // TODO(burdon): Rich text.\n },\n ],\n });\n\n const organization = new Schema({\n typename: TestSchemaType.organization,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING,\n },\n ],\n });\n\n const contact = new Schema({\n typename: TestSchemaType.contact,\n props: [\n {\n id: 'name',\n type: Schema.PropType.STRING,\n },\n {\n id: 'email',\n type: Schema.PropType.STRING,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n // TODO(burdon): Convert to object with nested props.\n {\n id: 'lat',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'lng',\n type: Schema.PropType.NUMBER,\n },\n ],\n });\n\n const project = new Schema({\n typename: TestSchemaType.project,\n props: [\n {\n id: 'title',\n type: Schema.PropType.STRING,\n },\n {\n id: 'description',\n type: Schema.PropType.STRING, // TODO(burdon): Text.\n },\n {\n id: 'repo',\n type: Schema.PropType.STRING,\n },\n {\n id: 'website',\n type: Schema.PropType.STRING,\n },\n {\n id: 'status',\n type: Schema.PropType.STRING,\n },\n {\n id: 'priority',\n type: Schema.PropType.NUMBER,\n },\n {\n id: 'active',\n type: Schema.PropType.BOOLEAN,\n },\n {\n id: 'org',\n type: Schema.PropType.REF,\n ref: organization,\n },\n ],\n });\n\n return {\n [TestSchemaType.document]: document,\n [TestSchemaType.organization]: organization,\n [TestSchemaType.contact]: contact,\n [TestSchemaType.project]: project,\n };\n};\n\nexport const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {\n [TestSchemaType.document]: () => ({\n title: faker.lorem.sentence(3),\n content: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n\n [TestSchemaType.organization]: () => ({\n name: faker.company.name(),\n website: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n description: new TextObject(faker.lorem.sentences()),\n }),\n\n [TestSchemaType.contact]: (provider) => {\n const organizations = provider?.(TestSchemaType.organization);\n const location = faker.datatype.boolean() ? faker.helpers.arrayElement(locations) : undefined;\n return {\n name: faker.person.fullName(),\n email: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.email() : undefined,\n org:\n organizations?.length && faker.datatype.boolean({ probability: 0.3 })\n ? faker.helpers.arrayElement(organizations)\n : undefined,\n ...location,\n };\n },\n\n [TestSchemaType.project]: () => ({\n title: faker.commerce.productName(),\n repo: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n status: faker.helpers.arrayElement(Status),\n priority: faker.helpers.arrayElement(Priority),\n active: faker.datatype.boolean(),\n }),\n};\n\nexport const createTestObjectGenerator = () => new TestObjectGenerator(testSchemas(), testObjectGenerators);\n\nexport const createSpaceObjectGenerator = (space: Space) =>\n new SpaceObjectGenerator(space, testSchemas(), testObjectGenerators);\n\nconst locations = [\n { lat: 139.74946157054467, lng: 35.686962764371174 },\n { lat: -73.98196278740681, lng: 40.75192492259464 },\n { lat: -99.1329340602939, lng: 19.444388301415472 },\n { lat: 72.85504343876647, lng: 19.0189362343566 },\n { lat: -46.62696583905523, lng: -23.55673372837896 },\n { lat: 77.22805816860182, lng: 28.671938757181522 },\n { lat: 121.43455881982015, lng: 31.218398311228327 },\n { lat: 88.32272979950551, lng: 22.49691515689642 },\n { lat: 90.40663360810754, lng: 23.725005570312817 },\n { lat: -58.399477232331435, lng: -34.600555749907414 },\n { lat: -118.18192636994041, lng: 33.99192410876543 },\n { lat: 66.98806305137339, lng: 24.87193814681484 },\n { lat: 31.248022361126118, lng: 30.051906205103705 },\n { lat: -43.22696665284366, lng: -22.923077315615956 },\n { lat: 135.4581989565952, lng: 34.75198107491417 },\n { lat: 116.38633982565943, lng: 39.93083808990906 },\n { lat: 120.9802713035424, lng: 14.606104813440538 },\n { lat: 37.6135769672714, lng: 55.75410998124818 },\n { lat: 29.008055727002613, lng: 41.10694201243979 },\n { lat: 2.33138946713035, lng: 48.86863878981461 },\n { lat: 126.99778513820195, lng: 37.56829495838895 },\n { lat: 3.3895852125984334, lng: 6.445207512093191 },\n { lat: 106.82749176247012, lng: -6.172471846798885 },\n { lat: -87.75200083270931, lng: 41.83193651927843 },\n { lat: 113.32306427226172, lng: 23.14692716047989 },\n { lat: -0.11866770247593195, lng: 51.5019405883275 },\n { lat: -77.05200795343472, lng: -12.04606681752557 },\n { lat: 51.42239817500899, lng: 35.673888627001304 },\n { lat: 15.313026023171744, lng: -4.327778243275986 },\n { lat: -74.08528981377441, lng: 4.598369421147822 },\n { lat: 114.1201772298325, lng: 22.554316369677963 },\n { lat: 114.26807118958311, lng: 30.581977209337822 },\n { lat: 114.18306345846304, lng: 22.30692675357551 },\n { lat: 117.19807322410043, lng: 39.13197212310894 },\n { lat: 80.27805287890033, lng: 13.091933670856292 },\n { lat: 121.568333333333, lng: 25.0358333333333 },\n { lat: 77.55806386521755, lng: 12.97194099507442 },\n { lat: 100.51469879369489, lng: 13.751945064087977 },\n { lat: 74.34807892054346, lng: 31.56191739488844 },\n { lat: 106.59303578916195, lng: 29.566922888044644 },\n { lat: 78.47800771287751, lng: 17.401928991511454 },\n { lat: -70.66898671317483, lng: -33.448067956934096 },\n { lat: -80.22605193945003, lng: 25.789556555021534 },\n { lat: -43.916950376804834, lng: -19.91308016391116 },\n { lat: -3.6852975446125242, lng: 40.40197212311381 },\n { lat: -75.17194183200792, lng: 40.001919022526465 },\n { lat: 72.57805776168215, lng: 23.031998775062675 },\n { lat: 106.69308136207889, lng: 10.781971309193409 },\n { lat: -79.42196665298843, lng: 43.70192573640844 },\n { lat: 103.85387481909902, lng: 1.2949793251059418 },\n { lat: 13.23248118266855, lng: -8.836340255012658 },\n { lat: 44.391922914564134, lng: 33.34059435615865 },\n { lat: 2.181424460619155, lng: 41.385245438547486 },\n { lat: 88.32994665421205, lng: 22.580390440861947 },\n { lat: -96.84196278749818, lng: 32.82196968167733 },\n { lat: 123.44802765120869, lng: 41.80692512604918 },\n { lat: 32.532233380011576, lng: 15.590024084277673 },\n { lat: 73.84805776168719, lng: 18.531963374654026 },\n { lat: 151.1832339501475, lng: -33.91806510862875 },\n { lat: 30.314074200315076, lng: 59.94096036375191 },\n { lat: 91.79802154756635, lng: 22.33193814680459 },\n { lat: 113.74277634138707, lng: 23.050834758613007 },\n { lat: -84.40189524187565, lng: 33.83195971260585 },\n { lat: -71.07195953218684, lng: 42.33190600170229 },\n { lat: 46.770795798688255, lng: 24.642779007816443 },\n { lat: -95.341925149146, lng: 29.821920243188856 },\n { lat: 105.8480683412422, lng: 21.035273107737055 },\n { lat: -77.01136443943716, lng: 38.901495235087054 },\n { lat: -103.33198008081848, lng: 20.671961950508944 },\n { lat: 144.97307037590406, lng: -37.81808545369631 },\n { lat: 29.948050030391755, lng: 31.201965205759393 },\n { lat: 104.06807363094873, lng: 30.671945877957796 },\n { lat: -83.0820016464927, lng: 42.33190600170229 },\n { lat: 96.16473175266185, lng: 16.785299963188777 },\n { lat: 108.89305043760862, lng: 34.27697130928732 },\n { lat: -51.20195790450316, lng: -30.048068770722466 },\n { lat: 121.465, lng: 25.0127777777778 },\n { lat: 72.83809356897484, lng: 21.20192960187819 },\n { lat: 109.60911291406296, lng: 23.09653464659317 },\n { lat: -4.041994118507091, lng: 5.321942826098564 },\n { lat: -47.91799814700306, lng: -15.781394372878992 },\n { lat: 32.862445782356644, lng: 39.929184444075474 },\n { lat: -100.33193064232995, lng: 25.671940995125283 },\n { lat: 139.60202098994017, lng: 35.43065615270891 },\n { lat: 118.77802846499208, lng: 32.05196500231233 },\n { lat: -73.58524281670213, lng: 45.50194506421502 },\n { lat: 106.7180927553083, lng: 26.581988806001448 },\n { lat: -34.91755136960728, lng: -8.073699467249241 },\n { lat: 126.64803904445057, lng: 45.75192980542715 },\n { lat: -38.58192718342411, lng: -3.7480720258257634 },\n { lat: -112.07193755969467, lng: 33.5419257363676 },\n { lat: 117.67001623440774, lng: 24.520375385531167 },\n { lat: -38.48193328693924, lng: -12.968026046044827 },\n { lat: 129.00810170722048, lng: 35.09699877511093 },\n { lat: -122.41716877355225, lng: 37.76919562968743 },\n { lat: 28.028063865019476, lng: -26.16809888138414 },\n { lat: 13.399602764700546, lng: 52.523764522251156 },\n { lat: 3.048606670909237, lng: 36.765010656628135 },\n { lat: 125.75274485499392, lng: 39.02138455800434 },\n { lat: 12.481312562873995, lng: 41.89790148509894 },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { faker } from '@faker-js/faker';\n\nimport { Expando, type TypedObject, Schema, type Space } from '@dxos/client/echo';\n\nimport { type TestSchemaType } from './data';\nimport { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';\nimport { range } from './util';\n\n/**\n * Typed object generator.\n */\nexport class TestObjectGenerator<T extends string = TestSchemaType> {\n // prettier-ignore\n constructor(\n private readonly _schemas: TestSchemaMap<T>,\n private readonly _generators: TestGeneratorMap<T>,\n private readonly _provider?: TestObjectProvider<T>\n ) {}\n\n get schemas(): Schema[] {\n return Object.values(this._schemas);\n }\n\n getSchema(type: T) {\n return this.schemas.find((schema) => schema.typename === type);\n }\n\n protected setSchema(type: T, schema: Schema) {\n this._schemas[type] = schema;\n }\n\n // TODO(burdon): Runtime type check via: https://github.com/Effect-TS/schema (or zod).\n createObject({ types }: { types?: T[] } = {}): TypedObject {\n const type = faker.helpers.arrayElement(types ?? (Object.keys(this._schemas) as T[]));\n const data = this._generators[type](this._provider);\n const schema = this.getSchema(type);\n return new Expando(data, { schema });\n }\n\n // TODO(burdon): Create batch.\n // TODO(burdon): Based on dependencies (e.g., organization before contact).\n createObjects(map: Partial<Record<T, number>>): Expando[] {\n const objects: Expando[] = [];\n Object.entries<number>(map as any).forEach(([type, count]) => {\n range(() => objects.push(this.createObject({ types: [type as T] })), count);\n });\n\n return objects;\n }\n}\n\n/**\n * Typed object generator for a space.\n */\nexport class SpaceObjectGenerator<T extends string> extends TestObjectGenerator<T> {\n constructor(private readonly _space: Space, schemaMap: TestSchemaMap<T>, generators: TestGeneratorMap<T>) {\n super(schemaMap, generators, (type: T) => {\n const { objects } = this._space.db.query((object) => {\n return object.__schema?.id === this.getSchema(type)?.id;\n });\n\n return objects;\n });\n\n // TODO(burdon): Map initially are objects that have not been added to the space.\n // Merge existing schema in space with defaults.\n const { objects } = this._space.db.query(Schema.filter());\n Object.keys(schemaMap).forEach((type) => {\n const schema = objects.find((object) => object.typename === type);\n if (schema) {\n this.setSchema(type as T, schema);\n }\n });\n }\n\n addSchemas() {\n const { objects } = this._space.db.query(Schema.filter());\n this.schemas.forEach((schema) => {\n if (!objects.find((object) => object.typename === schema.typename)) {\n this._space.db.add(schema);\n }\n });\n\n return this.schemas;\n }\n\n override createObject({ types }: { types?: T[] } = {}): Expando {\n return this._space.db.add(super.createObject({ types }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter(Boolean) as T[];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,mBAAsB;AAEtB,kBAA+C;ACL/C,IA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AED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAASC,KAAK;EAAiB;EACtC;IAAED,KAAK;IAAmBC,KAAK;EAAkB;EACjD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAqBC,KAAK;EAAmB;EACpD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAmBC,KAAK;EAAmB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAAqBC,KAAK;EAAiB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAoB;EACpD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAqBC,KAAK;EAAkB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAoBC,KAAK;EAAmB;EACnD;IAAED,KAAK;IAAmBC,KAAK;EAAmB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;EAClD;IAAED,KAAK;IAAoBC,KAAK;EAAkB;;",
|
|
6
|
+
"names": ["import_faker", "import_echo", "range", "fn", "length", "Array", "from", "map", "_", "i", "filter", "Boolean", "TestObjectGenerator", "constructor", "_schemas", "_generators", "_provider", "schemas", "Object", "values", "getSchema", "type", "find", "schema", "typename", "setSchema", "createObject", "types", "faker", "helpers", "arrayElement", "keys", "data", "Expando", "createObjects", "objects", "entries", "forEach", "count", "push", "SpaceObjectGenerator", "_space", "schemaMap", "generators", "db", "query", "object", "__schema", "id", "Schema", "addSchemas", "add", "Status", "Priority", "TestSchemaType", "document", "organization", "contact", "project", "testSchemas", "props", "PropType", "STRING", "REF", "ref", "NUMBER", "BOOLEAN", "testObjectGenerators", "title", "lorem", "sentence", "content", "sentences", "min", "max", "number", "int", "name", "company", "website", "datatype", "boolean", "probability", "internet", "url", "undefined", "description", "TextObject", "provider", "organizations", "location", "locations", "person", "fullName", "email", "org", "commerce", "productName", "repo", "status", "priority", "active", "createTestObjectGenerator", "createSpaceObjectGenerator", "space", "lat", "lng"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/echo/echo-generator/src/util.ts":{"bytes":1057,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/generator.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/core/echo/echo-generator/src/util.ts":{"bytes":1057,"imports":[],"format":"esm"},"packages/core/echo/echo-generator/src/generator.ts":{"bytes":10604,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/core/echo/echo-generator/src/data.ts":{"bytes":37836,"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"packages/core/echo/echo-generator/src/generator.ts","kind":"import-statement","original":"./generator"}],"format":"esm"},"packages/core/echo/echo-generator/src/types.ts":{"bytes":937,"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":23444},"packages/core/echo/echo-generator/dist/lib/node/index.cjs":{"imports":[{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@faker-js/faker","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true}],"exports":["Priority","SpaceObjectGenerator","Status","TestObjectGenerator","TestSchemaType","createSpaceObjectGenerator","createTestObjectGenerator","range","testObjectGenerators","testSchemas"],"entryPoint":"packages/core/echo/echo-generator/src/index.ts","inputs":{"packages/core/echo/echo-generator/src/data.ts":{"bytesInOutput":10767},"packages/core/echo/echo-generator/src/generator.ts":{"bytesInOutput":2245},"packages/core/echo/echo-generator/src/util.ts":{"bytesInOutput":91},"packages/core/echo/echo-generator/src/index.ts":{"bytesInOutput":0}},"bytes":13602}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/data.ts"],"names":[],"mappings":"AASA,OAAO,EAAU,KAAK,KAAK,EAAc,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpE,eAAO,MAAM,MAAM,UAAgC,CAAC;AACpD,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAExC,oBAAY,cAAc;IACxB,QAAQ,gCAAgC;IACxC,YAAY,oCAAoC;IAChD,OAAO,+BAA+B;IACtC,OAAO,+BAA+B;CACvC;AAED,eAAO,MAAM,WAAW,QAAO,cAAc,cAAc,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/data.ts"],"names":[],"mappings":"AASA,OAAO,EAAU,KAAK,KAAK,EAAc,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpE,eAAO,MAAM,MAAM,UAAgC,CAAC;AACpD,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAExC,oBAAY,cAAc;IACxB,QAAQ,gCAAgC;IACxC,YAAY,oCAAoC;IAChD,OAAO,+BAA+B;IACtC,OAAO,+BAA+B;CACvC;AAED,eAAO,MAAM,WAAW,QAAO,cAAc,cAAc,CA0G1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,cAAc,CAiCjE,CAAC;AAEF,eAAO,MAAM,yBAAyB,2CAAqE,CAAC;AAE5G,eAAO,MAAM,0BAA0B,UAAW,KAAK,yCACe,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Expando, type TypedObject, Schema, type Space } from '@dxos/client/echo';
|
|
2
|
+
import { type TestSchemaType } from './data';
|
|
2
3
|
import { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Typed object generator.
|
|
5
6
|
*/
|
|
6
|
-
export declare class TestObjectGenerator<T extends string> {
|
|
7
|
+
export declare class TestObjectGenerator<T extends string = TestSchemaType> {
|
|
7
8
|
private readonly _schemas;
|
|
8
9
|
private readonly _generators;
|
|
9
10
|
private readonly _provider?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAA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QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAoBxG,UAAU;IAWD,YAAY,CAAC,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;KAAO,GAAG,OAAO;CAGhE"}
|
|
@@ -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,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-generator",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9-main.27aafd0",
|
|
4
4
|
"description": "ECHO data generator for testing.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@faker-js/faker": "^8.0.2",
|
|
20
|
-
"@dxos/client": "0.3.
|
|
21
|
-
"@dxos/node-std": "0.3.
|
|
20
|
+
"@dxos/client": "0.3.9-main.27aafd0",
|
|
21
|
+
"@dxos/node-std": "0.3.9-main.27aafd0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {},
|
|
24
24
|
"publishConfig": {
|
package/src/data.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const testSchemas = (): TestSchemaMap<TestSchemaType> => {
|
|
|
28
28
|
typename: TestSchemaType.document,
|
|
29
29
|
props: [
|
|
30
30
|
{
|
|
31
|
-
id: '
|
|
31
|
+
id: 'title',
|
|
32
32
|
type: Schema.PropType.STRING,
|
|
33
33
|
},
|
|
34
34
|
{
|
|
@@ -115,6 +115,11 @@ export const testSchemas = (): TestSchemaMap<TestSchemaType> => {
|
|
|
115
115
|
id: 'active',
|
|
116
116
|
type: Schema.PropType.BOOLEAN,
|
|
117
117
|
},
|
|
118
|
+
{
|
|
119
|
+
id: 'org',
|
|
120
|
+
type: Schema.PropType.REF,
|
|
121
|
+
ref: organization,
|
|
122
|
+
},
|
|
118
123
|
],
|
|
119
124
|
});
|
|
120
125
|
|
package/src/generator.ts
CHANGED
|
@@ -6,13 +6,14 @@ import { faker } from '@faker-js/faker';
|
|
|
6
6
|
|
|
7
7
|
import { Expando, type TypedObject, Schema, type Space } from '@dxos/client/echo';
|
|
8
8
|
|
|
9
|
+
import { type TestSchemaType } from './data';
|
|
9
10
|
import { type TestGeneratorMap, type TestObjectProvider, type TestSchemaMap } from './types';
|
|
10
11
|
import { range } from './util';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Typed object generator.
|
|
14
15
|
*/
|
|
15
|
-
export class TestObjectGenerator<T extends string> {
|
|
16
|
+
export class TestObjectGenerator<T extends string = TestSchemaType> {
|
|
16
17
|
// prettier-ignore
|
|
17
18
|
constructor(
|
|
18
19
|
private readonly _schemas: TestSchemaMap<T>,
|