@dxos/graph 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0

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.
@@ -1,12 +1,12 @@
1
- import { S } from '@dxos/echo-schema';
1
+ import { Schema } from 'effect';
2
2
  import { type Specialize } from '@dxos/util';
3
- export declare const BaseGraphNode: S.Struct<{
4
- id: typeof S.String;
5
- type: S.optional<typeof S.String>;
6
- data: S.optional<typeof S.Any>;
3
+ export declare const BaseGraphNode: Schema.Struct<{
4
+ id: typeof Schema.String;
5
+ type: Schema.optional<typeof Schema.String>;
6
+ data: Schema.optional<typeof Schema.Any>;
7
7
  }>;
8
8
  /** Raw base type. */
9
- export type BaseGraphNode = S.Schema.Type<typeof BaseGraphNode>;
9
+ export type BaseGraphNode = Schema.Schema.Type<typeof BaseGraphNode>;
10
10
  /** Typed node data. */
11
11
  export type GraphNode<Data = any, Optional extends boolean = false> = Specialize<BaseGraphNode, Optional extends true ? {
12
12
  data?: Data;
@@ -16,15 +16,15 @@ export type GraphNode<Data = any, Optional extends boolean = false> = Specialize
16
16
  export declare namespace GraphNode {
17
17
  type Optional<T = any> = GraphNode<T, true>;
18
18
  }
19
- export declare const BaseGraphEdge: S.Struct<{
20
- id: typeof S.String;
21
- type: S.optional<typeof S.String>;
22
- data: S.optional<typeof S.Any>;
23
- source: typeof S.String;
24
- target: typeof S.String;
19
+ export declare const BaseGraphEdge: Schema.Struct<{
20
+ id: typeof Schema.String;
21
+ type: Schema.optional<typeof Schema.String>;
22
+ data: Schema.optional<typeof Schema.Any>;
23
+ source: typeof Schema.String;
24
+ target: typeof Schema.String;
25
25
  }>;
26
26
  /** Raw base type. */
27
- export type BaseGraphEdge = S.Schema.Type<typeof BaseGraphEdge>;
27
+ export type BaseGraphEdge = Schema.Schema.Type<typeof BaseGraphEdge>;
28
28
  /** Typed edge data. */
29
29
  export type GraphEdge<Data = any, Optional extends boolean = false> = Specialize<BaseGraphEdge, Optional extends true ? {
30
30
  data?: Data;
@@ -37,23 +37,23 @@ export declare namespace GraphEdge {
37
37
  /**
38
38
  * Generic graph.
39
39
  */
40
- export declare const Graph: S.Struct<{
41
- id: S.optional<typeof S.String>;
42
- nodes: S.mutable<S.Array$<S.extend<S.Struct<{
43
- id: typeof S.String;
44
- type: S.optional<typeof S.String>;
45
- data: S.optional<typeof S.Any>;
46
- }>, S.TypeLiteral<{}, readonly [{
47
- readonly key: typeof S.String;
48
- readonly value: typeof S.Any;
40
+ export declare const Graph: Schema.Struct<{
41
+ id: Schema.optional<typeof Schema.String>;
42
+ nodes: Schema.mutable<Schema.Array$<Schema.extend<Schema.Struct<{
43
+ id: typeof Schema.String;
44
+ type: Schema.optional<typeof Schema.String>;
45
+ data: Schema.optional<typeof Schema.Any>;
46
+ }>, Schema.TypeLiteral<{}, readonly [{
47
+ readonly key: typeof Schema.String;
48
+ readonly value: typeof Schema.Any;
49
49
  }]>>>>;
50
- edges: S.mutable<S.Array$<S.Struct<{
51
- id: typeof S.String;
52
- type: S.optional<typeof S.String>;
53
- data: S.optional<typeof S.Any>;
54
- source: typeof S.String;
55
- target: typeof S.String;
50
+ edges: Schema.mutable<Schema.Array$<Schema.Struct<{
51
+ id: typeof Schema.String;
52
+ type: Schema.optional<typeof Schema.String>;
53
+ data: Schema.optional<typeof Schema.Any>;
54
+ source: typeof Schema.String;
55
+ target: typeof Schema.String;
56
56
  }>>>;
57
57
  }>;
58
- export type Graph = S.Schema.Type<typeof Graph>;
58
+ export type Graph = Schema.Schema.Type<typeof Graph>;
59
59
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,aAAa;;;;EAIxB,CAAC;AAEH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MAAM,KAAK;;;;;;;;;;;;;;;;;EAIhB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -1,6 +1,3 @@
1
- import { type ReactiveEchoObject } from '@dxos/echo-db';
2
- import { GraphModel } from './model';
3
- import { type GraphNode } from './types';
4
1
  type EdgeMeta = {
5
2
  source: string;
6
3
  target: string;
@@ -8,10 +5,5 @@ type EdgeMeta = {
8
5
  };
9
6
  export declare const createEdgeId: ({ source, target, relation }: EdgeMeta) => string;
10
7
  export declare const parseEdgeId: (id: string) => EdgeMeta;
11
- /**
12
- * Creates a new reactive graph from a set of ECHO objects.
13
- * References are mapped onto graph edges.
14
- */
15
- export declare const createGraph: (objects: ReactiveEchoObject<any>[]) => GraphModel<GraphNode<ReactiveEchoObject<any>>>;
16
8
  export {};
17
9
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAOxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAKhD,KAAK,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,eAAO,MAAM,YAAY,iCAAkC,QAAQ,WAIlE,CAAC;AAEF,eAAO,MAAM,WAAW,OAAQ,MAAM,KAAG,QAIxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,YAAa,kBAAkB,CAAC,GAAG,CAAC,EAAE,KAAG,UAAU,CAAC,SAAS,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAiC7G,CAAC"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AASA,KAAK,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,eAAO,MAAM,YAAY,GAAI,8BAA8B,QAAQ,WAIlE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,QAIxC,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.3"}
1
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/graph",
3
- "version": "0.8.2-main.f11618f",
3
+ "version": "0.8.2-main.fbd8ed0",
4
4
  "description": "Low-level graph API",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -32,24 +32,28 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@preact/signals-core": "^1.6.0",
35
+ "effect": "3.14.21",
35
36
  "lodash.defaultsdeep": "^4.6.1",
36
- "@dxos/async": "0.8.2-main.f11618f",
37
- "@dxos/echo-db": "0.8.2-main.f11618f",
38
- "@dxos/debug": "0.8.2-main.f11618f",
39
- "@dxos/echo-schema": "0.8.2-main.f11618f",
40
- "@dxos/live-object": "0.8.2-main.f11618f",
41
- "@dxos/schema": "0.8.2-main.f11618f",
42
- "@dxos/log": "0.8.2-main.f11618f",
43
- "@dxos/util": "0.8.2-main.f11618f",
44
- "@dxos/invariant": "0.8.2-main.f11618f"
37
+ "@dxos/async": "0.8.2-main.fbd8ed0",
38
+ "@dxos/debug": "0.8.2-main.fbd8ed0",
39
+ "@dxos/echo-db": "0.8.2-main.fbd8ed0",
40
+ "@dxos/invariant": "0.8.2-main.fbd8ed0",
41
+ "@dxos/log": "0.8.2-main.fbd8ed0",
42
+ "@dxos/echo-schema": "0.8.2-main.fbd8ed0",
43
+ "@dxos/live-object": "0.8.2-main.fbd8ed0",
44
+ "@dxos/schema": "0.8.2-main.fbd8ed0",
45
+ "@dxos/util": "0.8.2-main.fbd8ed0"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@antv/graphlib": "^2.0.4",
48
49
  "@antv/layout": "^1.2.13",
49
50
  "@types/lodash.defaultsdeep": "^4.6.6",
50
- "@dxos/echo-db": "0.8.2-main.f11618f",
51
- "@dxos/random": "0.8.2-main.f11618f",
52
- "@dxos/echo-schema": "0.8.2-main.f11618f"
51
+ "@dxos/echo-schema": "0.8.2-main.fbd8ed0",
52
+ "@dxos/random": "0.8.2-main.fbd8ed0",
53
+ "@dxos/echo-db": "0.8.2-main.fbd8ed0"
54
+ },
55
+ "peerDependencies": {
56
+ "effect": "^3.13.3"
53
57
  },
54
58
  "publishConfig": {
55
59
  "access": "public"
package/src/create.ts ADDED
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type AnyLiveObject } from '@dxos/echo-db';
6
+ import { FormatEnum, getSchema } from '@dxos/echo-schema';
7
+ import { live } from '@dxos/live-object';
8
+ import { log } from '@dxos/log';
9
+ import { getSchemaProperties } from '@dxos/schema';
10
+
11
+ import { GraphModel } from './model';
12
+ import { Graph, type GraphNode } from './types';
13
+ import { createEdgeId } from './util';
14
+
15
+ /**
16
+ * Creates a new reactive graph from a set of ECHO objects.
17
+ * References are mapped onto graph edges.
18
+ */
19
+ export const createGraph = (objects: AnyLiveObject<any>[]): GraphModel<GraphNode<AnyLiveObject<any>>> => {
20
+ const graph = new GraphModel<GraphNode<AnyLiveObject<any>>>(live(Graph, { nodes: [], edges: [] }));
21
+
22
+ // Map objects.
23
+ objects.forEach((object) => {
24
+ graph.addNode({ id: object.id, type: object.typename, data: object });
25
+ });
26
+
27
+ // Find references.
28
+ objects.forEach((object) => {
29
+ const schema = getSchema(object);
30
+ if (!schema) {
31
+ log.info('no schema for object', { id: object.id.slice(0, 8) });
32
+ return;
33
+ }
34
+
35
+ // Parse schema to follow referenced objects.
36
+ for (const prop of getSchemaProperties(schema.ast, object)) {
37
+ if (prop.format === FormatEnum.Ref) {
38
+ const source = object;
39
+ const target = object[prop.name]?.target;
40
+ if (target) {
41
+ graph.addEdge({
42
+ id: createEdgeId({ source: source.id, target: target.id, relation: String(prop.name) }),
43
+ source: source.id,
44
+ target: target.id,
45
+ });
46
+ }
47
+ }
48
+ }
49
+ });
50
+
51
+ return graph;
52
+ };
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './create';
5
6
  export * from './model';
6
7
  export * from './types';
7
8
  export * from './util';
package/src/model.test.ts CHANGED
@@ -2,21 +2,20 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { Schema } from 'effect';
5
6
  import { describe, test } from 'vitest';
6
7
 
7
- import { S } from '@dxos/echo-schema';
8
-
9
8
  import { GraphModel } from './model';
10
9
  import { BaseGraphNode, type GraphNode } from './types';
11
10
 
12
- const TestNode = S.extend(
11
+ const TestNode = Schema.extend(
13
12
  BaseGraphNode,
14
- S.Struct({
15
- value: S.String,
13
+ Schema.Struct({
14
+ value: Schema.String,
16
15
  }),
17
16
  );
18
17
 
19
- type TestNode = S.Schema.Type<typeof TestNode>;
18
+ type TestNode = Schema.Schema.Type<typeof TestNode>;
20
19
 
21
20
  type TestData = { value: string };
22
21
 
package/src/model.ts CHANGED
@@ -7,7 +7,7 @@ import { failedInvariant, invariant } from '@dxos/invariant';
7
7
  import { getSnapshot } from '@dxos/live-object';
8
8
  import { type MakeOptional, isNotFalsy, removeBy, stripUndefined } from '@dxos/util';
9
9
 
10
- import { type Graph, type GraphNode, type GraphEdge, type BaseGraphNode, type BaseGraphEdge } from './types';
10
+ import { type BaseGraphEdge, type BaseGraphNode, type Graph, type GraphEdge, type GraphNode } from './types';
11
11
  import { createEdgeId } from './util';
12
12
 
13
13
  /**
package/src/types.ts CHANGED
@@ -2,17 +2,18 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { S } from '@dxos/echo-schema';
5
+ import { Schema } from 'effect';
6
+
6
7
  import { type Specialize } from '@dxos/util';
7
8
 
8
- export const BaseGraphNode = S.Struct({
9
- id: S.String,
10
- type: S.optional(S.String),
11
- data: S.optional(S.Any),
9
+ export const BaseGraphNode = Schema.Struct({
10
+ id: Schema.String,
11
+ type: Schema.optional(Schema.String),
12
+ data: Schema.optional(Schema.Any),
12
13
  });
13
14
 
14
15
  /** Raw base type. */
15
- export type BaseGraphNode = S.Schema.Type<typeof BaseGraphNode>;
16
+ export type BaseGraphNode = Schema.Schema.Type<typeof BaseGraphNode>;
16
17
 
17
18
  /** Typed node data. */
18
19
  export type GraphNode<Data = any, Optional extends boolean = false> = Specialize<
@@ -24,16 +25,16 @@ export declare namespace GraphNode {
24
25
  export type Optional<T = any> = GraphNode<T, true>;
25
26
  }
26
27
 
27
- export const BaseGraphEdge = S.Struct({
28
- id: S.String,
29
- type: S.optional(S.String),
30
- data: S.optional(S.Any),
31
- source: S.String,
32
- target: S.String,
28
+ export const BaseGraphEdge = Schema.Struct({
29
+ id: Schema.String,
30
+ type: Schema.optional(Schema.String),
31
+ data: Schema.optional(Schema.Any),
32
+ source: Schema.String,
33
+ target: Schema.String,
33
34
  });
34
35
 
35
36
  /** Raw base type. */
36
- export type BaseGraphEdge = S.Schema.Type<typeof BaseGraphEdge>;
37
+ export type BaseGraphEdge = Schema.Schema.Type<typeof BaseGraphEdge>;
37
38
 
38
39
  /** Typed edge data. */
39
40
  export type GraphEdge<Data = any, Optional extends boolean = false> = Specialize<
@@ -48,15 +49,18 @@ export declare namespace GraphEdge {
48
49
  /**
49
50
  * Allows any additional properties on graph nodes.
50
51
  */
51
- const ExtendableBaseGraphNode = S.extend(BaseGraphNode, S.Struct({}, { key: S.String, value: S.Any }));
52
+ const ExtendableBaseGraphNode = Schema.extend(
53
+ BaseGraphNode,
54
+ Schema.Struct({}, { key: Schema.String, value: Schema.Any }),
55
+ );
52
56
 
53
57
  /**
54
58
  * Generic graph.
55
59
  */
56
- export const Graph = S.Struct({
57
- id: S.optional(S.String),
58
- nodes: S.mutable(S.Array(ExtendableBaseGraphNode)),
59
- edges: S.mutable(S.Array(BaseGraphEdge)),
60
+ export const Graph = Schema.Struct({
61
+ id: Schema.optional(Schema.String),
62
+ nodes: Schema.mutable(Schema.Array(ExtendableBaseGraphNode)),
63
+ edges: Schema.mutable(Schema.Array(BaseGraphEdge)),
60
64
  });
61
65
 
62
- export type Graph = S.Schema.Type<typeof Graph>;
66
+ export type Graph = Schema.Schema.Type<typeof Graph>;
package/src/util.ts CHANGED
@@ -2,15 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type ReactiveEchoObject } from '@dxos/echo-db';
6
- import { FormatEnum, getSchema } from '@dxos/echo-schema';
7
5
  import { invariant } from '@dxos/invariant';
8
- import { live } from '@dxos/live-object';
9
- import { log } from '@dxos/log';
10
- import { getSchemaProperties } from '@dxos/schema';
11
-
12
- import { GraphModel } from './model';
13
- import { Graph, type GraphNode } from './types';
14
6
 
15
7
  const KEY_REGEX = /\w+/;
16
8
 
@@ -28,42 +20,3 @@ export const parseEdgeId = (id: string): EdgeMeta => {
28
20
  invariant(source.length && target.length);
29
21
  return { source, relation: relation.length ? relation : undefined, target };
30
22
  };
31
-
32
- /**
33
- * Creates a new reactive graph from a set of ECHO objects.
34
- * References are mapped onto graph edges.
35
- */
36
- export const createGraph = (objects: ReactiveEchoObject<any>[]): GraphModel<GraphNode<ReactiveEchoObject<any>>> => {
37
- const graph = new GraphModel<GraphNode<ReactiveEchoObject<any>>>(live(Graph, { nodes: [], edges: [] }));
38
-
39
- // Map objects.
40
- objects.forEach((object) => {
41
- graph.addNode({ id: object.id, type: object.typename, data: object });
42
- });
43
-
44
- // Find references.
45
- objects.forEach((object) => {
46
- const schema = getSchema(object);
47
- if (!schema) {
48
- log.info('no schema for object', { id: object.id.slice(0, 8) });
49
- return;
50
- }
51
-
52
- // Parse schema to follow referenced objects.
53
- for (const prop of getSchemaProperties(schema.ast, object)) {
54
- if (prop.format === FormatEnum.Ref) {
55
- const source = object;
56
- const target = object[prop.name]?.target;
57
- if (target) {
58
- graph.addEdge({
59
- id: createEdgeId({ source: source.id, target: target.id, relation: String(prop.name) }),
60
- source: source.id,
61
- target: target.id,
62
- });
63
- }
64
- }
65
- }
66
- });
67
-
68
- return graph;
69
- };