@dxos/echo-generator 0.9.1-main.c7dcc2e112 → 0.10.0
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/neutral/index.mjs +5 -4
- package/dist/lib/neutral/index.mjs.map +3 -3
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/data.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -12
- package/src/data.ts +5 -4
- package/src/generator.test.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "ECHO data generator for testing.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -25,21 +25,22 @@
|
|
|
25
25
|
"src"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@automerge/automerge": "3.3.0-fragments.
|
|
29
|
-
"effect": "3.21.
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
28
|
+
"@automerge/automerge": "3.3.0-fragments.2",
|
|
29
|
+
"effect": "3.21.4",
|
|
30
|
+
"@dxos/client": "0.10.0",
|
|
31
|
+
"@dxos/echo": "0.10.0",
|
|
32
|
+
"@dxos/node-std": "0.10.0",
|
|
33
|
+
"@dxos/invariant": "0.10.0",
|
|
34
|
+
"@dxos/echo-doc": "0.10.0",
|
|
35
|
+
"@dxos/echo-client": "0.10.0",
|
|
36
|
+
"@dxos/util": "0.10.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@dxos/random": "0.
|
|
39
|
+
"@dxos/random": "0.10.0"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
|
-
"effect": "3.21.
|
|
42
|
-
"@dxos/random": "0.
|
|
42
|
+
"effect": "3.21.4",
|
|
43
|
+
"@dxos/random": "0.10.0"
|
|
43
44
|
},
|
|
44
45
|
"publishConfig": {
|
|
45
46
|
"access": "public"
|
package/src/data.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
|
|
8
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
9
|
import { DXN, Ref, Type } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Doc } from '@dxos/echo-doc';
|
|
11
11
|
import { random } from '@dxos/random';
|
|
12
12
|
|
|
13
13
|
import { SpaceObjectGenerator, TestObjectGenerator } from './generator';
|
|
@@ -87,7 +87,7 @@ const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {
|
|
|
87
87
|
|
|
88
88
|
[TestSchemaType.contact]: async (provider) => {
|
|
89
89
|
const organizations = await provider?.(TestSchemaType.organization);
|
|
90
|
-
const
|
|
90
|
+
const airport = random.datatype.boolean() ? random.geo.airport() : undefined;
|
|
91
91
|
|
|
92
92
|
return {
|
|
93
93
|
name: random.person.fullName(),
|
|
@@ -96,7 +96,8 @@ const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {
|
|
|
96
96
|
organizations?.length && random.datatype.boolean({ probability: 0.8 })
|
|
97
97
|
? Ref.make(random.helpers.arrayElement(organizations))
|
|
98
98
|
: undefined,
|
|
99
|
-
|
|
99
|
+
lat: airport?.location?.[1],
|
|
100
|
+
lng: airport?.location?.[0],
|
|
100
101
|
};
|
|
101
102
|
},
|
|
102
103
|
|
|
@@ -113,7 +114,7 @@ const testObjectGenerators: TestGeneratorMap<TestSchemaType> = {
|
|
|
113
114
|
|
|
114
115
|
const testObjectMutators: TestMutationsMap<TestSchemaType> = {
|
|
115
116
|
[TestSchemaType.document]: async (object, params) => {
|
|
116
|
-
const accessor =
|
|
117
|
+
const accessor = Doc.createAccessor(object, ['content']);
|
|
117
118
|
for (let i = 0; i < params.count; i++) {
|
|
118
119
|
const length = object.content?.content?.length ?? 0;
|
|
119
120
|
accessor.handle.change((doc) => {
|
package/src/generator.test.ts
CHANGED
|
@@ -93,9 +93,11 @@ describe('TestObjectGenerator', () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
test('create object with in memory schema', async () => {
|
|
96
|
-
const Task =
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const Task = Type.makeObject(DXN.make('com.example.type.task', '0.1.0'))(
|
|
97
|
+
Schema.Struct({
|
|
98
|
+
name: Schema.optional(Schema.String),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
99
101
|
|
|
100
102
|
enum Types {
|
|
101
103
|
task = 'com.example.type.task',
|