@dxos/echo 0.8.2-main.5885341 → 0.8.2-main.600d381

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.
Files changed (56) hide show
  1. package/dist/lib/browser/index.mjs +48 -33
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +48 -29
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +48 -33
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/{Database.d.ts → experimental/database.d.ts} +1 -1
  11. package/dist/types/src/experimental/database.d.ts.map +1 -0
  12. package/dist/types/src/experimental/index.d.ts +1 -0
  13. package/dist/types/src/experimental/index.d.ts.map +1 -0
  14. package/dist/types/src/{Queue.d.ts → experimental/queue.d.ts} +1 -1
  15. package/dist/types/src/experimental/queue.d.ts.map +1 -0
  16. package/dist/types/src/{Space.d.ts → experimental/space.d.ts} +1 -1
  17. package/dist/types/src/experimental/space.d.ts.map +1 -0
  18. package/dist/types/src/index.d.ts +3 -6
  19. package/dist/types/src/index.d.ts.map +1 -1
  20. package/dist/types/src/query/api.d.ts +183 -0
  21. package/dist/types/src/query/api.d.ts.map +1 -0
  22. package/dist/types/src/query/ast.d.ts +146 -0
  23. package/dist/types/src/query/ast.d.ts.map +1 -0
  24. package/dist/types/src/query/query.test.d.ts +2 -0
  25. package/dist/types/src/query/query.test.d.ts.map +1 -0
  26. package/dist/types/src/type/Relation.d.ts +16 -0
  27. package/dist/types/src/type/Relation.d.ts.map +1 -0
  28. package/dist/types/src/type/Type.d.ts +80 -0
  29. package/dist/types/src/type/Type.d.ts.map +1 -0
  30. package/dist/types/src/type/Type.test.d.ts +2 -0
  31. package/dist/types/src/type/Type.test.d.ts.map +1 -0
  32. package/dist/types/src/type/index.d.ts +3 -0
  33. package/dist/types/src/type/index.d.ts.map +1 -0
  34. package/dist/types/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +13 -13
  36. package/src/{Database.ts → experimental/database.ts} +1 -1
  37. package/src/experimental/index.ts +7 -0
  38. package/src/{Queue.ts → experimental/queue.ts} +1 -1
  39. package/src/index.ts +3 -7
  40. package/src/query/api.ts +498 -0
  41. package/src/query/ast.ts +179 -0
  42. package/src/query/query.test.ts +146 -0
  43. package/src/type/Relation.ts +17 -0
  44. package/src/type/Type.test.ts +125 -0
  45. package/src/type/Type.ts +143 -0
  46. package/src/type/index.ts +6 -0
  47. package/dist/types/src/Database.d.ts.map +0 -1
  48. package/dist/types/src/Queue.d.ts.map +0 -1
  49. package/dist/types/src/Space.d.ts.map +0 -1
  50. package/dist/types/src/Type.d.ts +0 -49
  51. package/dist/types/src/Type.d.ts.map +0 -1
  52. package/dist/types/src/api.test.d.ts +0 -2
  53. package/dist/types/src/api.test.d.ts.map +0 -1
  54. package/src/Type.ts +0 -99
  55. package/src/api.test.ts +0 -92
  56. /package/src/{Space.ts → experimental/space.ts} +0 -0
@@ -6,44 +6,59 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // packages/core/echo/echo/src/index.ts
9
+ import { Format, FormatEnum } from "@dxos/echo-schema";
9
10
  import { DXN } from "@dxos/keys";
10
11
 
11
- // packages/core/echo/echo/src/Database.ts
12
- var Database_exports = {};
12
+ // packages/core/echo/echo/src/type/Type.ts
13
+ import { EchoObject, EntityKind, Expando as Expando$, ObjectId as ObjectId$, Ref as Ref$, SpaceIdSchema as SpaceIdSchema$, getTypeAnnotation, getSchema as getSchema$, getSchemaDXN, getSchemaTypename, getSchemaVersion, isInstanceOf, toJsonSchema as toJsonSchema$ } from "@dxos/echo-schema";
14
+ import { invariant } from "@dxos/invariant";
15
+ import { SpaceId as SpaceId$ } from "@dxos/keys";
16
+ import { live as live$ } from "@dxos/live-object";
17
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo/src/type/Type.ts";
18
+ var Type;
19
+ (function(Type2) {
20
+ Type2.SpaceIdSchema = SpaceIdSchema$;
21
+ Type2.SpaceId = SpaceId$;
22
+ Type2.ObjectId = ObjectId$;
23
+ Type2.Kind = EntityKind;
24
+ Type2.Expando = Expando$;
25
+ Type2.create = live$;
26
+ Type2.def = (meta) => EchoObject(meta);
27
+ Type2.Ref = (self) => Ref$(self);
28
+ Type2.ref = Ref$.make;
29
+ Type2.getMeta = getTypeAnnotation;
30
+ Type2.getSchema = getSchema$;
31
+ Type2.instanceOf = isInstanceOf;
32
+ Type2.getDXN = getSchemaDXN;
33
+ Type2.getTypename = (schema) => {
34
+ const typename = getSchemaTypename(schema);
35
+ invariant(typename, "Invalid object", {
36
+ F: __dxlog_file,
37
+ L: 138,
38
+ S: this,
39
+ A: [
40
+ "typename",
41
+ "'Invalid object'"
42
+ ]
43
+ });
44
+ return typename;
45
+ };
46
+ Type2.getVersion = getSchemaVersion;
47
+ Type2.toJsonSchema = toJsonSchema$;
48
+ })(Type || (Type = {}));
13
49
 
14
- // packages/core/echo/echo/src/Queue.ts
15
- var Queue_exports = {};
16
-
17
- // packages/core/echo/echo/src/Space.ts
18
- var Space_exports = {};
19
-
20
- // packages/core/echo/echo/src/Type.ts
21
- var Type_exports = {};
22
- __export(Type_exports, {
23
- Kind: () => EntityKind,
24
- ObjectId: () => ObjectId,
25
- Ref: () => Ref,
26
- create: () => create,
27
- def: () => def,
28
- getDXN: () => getSchemaDXN,
29
- getMeta: () => getTypeAnnotation,
30
- getSchema: () => getSchema,
31
- getTypename: () => getSchemaTypename,
32
- getVersion: () => getSchemaVersion,
33
- instanceOf: () => isInstanceOf,
34
- ref: () => ref
50
+ // packages/core/echo/echo/src/type/Relation.ts
51
+ var Relation_exports = {};
52
+ __export(Relation_exports, {
53
+ def: () => def
35
54
  });
36
- import { EchoObject, EntityKind, ObjectId, Ref as Ref$, getTypeAnnotation, getSchema, getSchemaDXN, getSchemaTypename, getSchemaVersion, isInstanceOf } from "@dxos/echo-schema";
37
- import { live as create$ } from "@dxos/live-object";
38
- var ref = Ref$.make;
39
- var create = create$;
40
- var def = (meta) => EchoObject(meta);
41
- var Ref = (self) => Ref$(self);
55
+ import { EchoRelation } from "@dxos/echo-schema";
56
+ var def = EchoRelation;
42
57
  export {
43
58
  DXN,
44
- Database_exports as Database,
45
- Queue_exports as Queue,
46
- Space_exports as Space,
47
- Type_exports as Type
59
+ Format,
60
+ FormatEnum,
61
+ Relation_exports as Relation,
62
+ Type
48
63
  };
49
64
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/Database.ts", "../../../src/Queue.ts", "../../../src/Space.ts", "../../../src/Type.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { DXN } from '@dxos/keys';\n\nexport { DXN };\n\nexport * as Database from './Database';\nexport * as Queue from './Queue';\nexport * as Space from './Space';\nexport * as Type from './Type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Database API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Database {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Queue API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Queue {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Space API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Space {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport {\n type BaseSchema,\n type EchoSchema,\n type Expando as Expando$,\n type ImmutableSchema,\n type JsonSchemaType,\n type TypeMeta,\n EchoObject,\n EntityKind,\n ObjectId,\n Ref as Ref$,\n getTypeAnnotation,\n getSchema,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n isInstanceOf,\n} from '@dxos/echo-schema';\nimport { live as create$ } from '@dxos/live-object';\n\n// NOTES:\n// - New Echo package and namespaces allow for incremental migration; vastly simplifies imports.\n// - Split into separate ECHO namespaces: Database, Space, Type, Query, Queue.\n// - Example; import { Database, Type, Query, Queue } from '@dxos/echo';\n// - Use `declare namespace` for types (no code is generated). See Effect pattern, where Schema is a namespace, interface, and function.\n// - Test with @dxos/schema/testing types.\n// - Define user (Composer) types in namespace (e.g., of plugin) and drop Type suffix; remove all deprecated Braneframe types.\n\nexport type { TypeMeta as Meta, JsonSchemaType as JsonSchema };\nexport {\n EntityKind as Kind,\n ObjectId,\n getTypeAnnotation as getMeta,\n getSchema,\n getSchemaDXN as getDXN,\n getSchemaTypename as getTypename,\n getSchemaVersion as getVersion,\n isInstanceOf as instanceOf,\n};\n\n/**\n * Type API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Type {\n /**\n * A schema that can be extended with arbitrary properties.\n */\n export type Expando = Expando$;\n\n export type Abstract<T = any> = BaseSchema<T>;\n export type ImmutableType<T> = ImmutableSchema<T>;\n export type MutableType<T> = EchoSchema<T>;\n}\n\n//\n// Constructors\n//\n\nexport const ref = Ref$.make;\nexport const create = create$;\n\n//\n// Combinators\n//\n\n/**\n * Defines an ECHO type.\n *\n * @example\n * ```ts\n * const Organization = S.Struct({\n * name: S.String,\n * }).pipe(Type.def({ typename: 'example.com/type/Organization', version: '1.0.0' }));\n * ```\n */\nexport const def = (meta: TypeMeta) => EchoObject(meta);\n\n/**\n * Defines a reference to an ECHO object.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Contact = S.Struct({\n * name: S.String,\n * organization: Type.Ref(Organization),\n * }).pipe(Type.def({ typename: 'example.com/type/Contact', version: '1.0.0' }));\n * ```\n */\nexport const Ref = <S extends Schema.Schema.AnyNoContext>(self: S) => Ref$<Schema.Schema.Type<S>>(self);\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,WAAW;;;ACJpB;;;ACAA;;;ACAA;;;ACAA;;;;;;;;;;;;;;;AAMA,SAOEC,YACAC,YACAC,UACAC,OAAOC,MACPC,mBACAC,WACAC,cACAC,mBACAC,kBACAC,oBACK;AACP,SAASC,QAAQC,eAAe;AA2CzB,IAAMC,MAAMC,KAAKC;AACjB,IAAMC,SAASC;AAgBf,IAAMC,MAAM,CAACC,SAAmBC,WAAWD,IAAAA;AAc3C,IAAME,MAAM,CAAuCC,SAAYR,KAA4BQ,IAAAA;",
6
- "names": ["DXN", "EchoObject", "EntityKind", "ObjectId", "Ref", "Ref$", "getTypeAnnotation", "getSchema", "getSchemaDXN", "getSchemaTypename", "getSchemaVersion", "isInstanceOf", "live", "create$", "ref", "Ref$", "make", "create", "create$", "def", "meta", "EchoObject", "Ref", "self"]
3
+ "sources": ["../../../src/index.ts", "../../../src/type/Type.ts", "../../../src/type/Relation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport { Format, FormatEnum } from '@dxos/echo-schema';\nexport { DXN } from '@dxos/keys';\n\nexport * from './type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { type AnyLiveObject as AnyLiveObject$ } from '@dxos/echo-db';\nimport {\n type BaseEchoObject,\n type BaseObject,\n type BaseSchema,\n type EchoSchema,\n EchoObject,\n EntityKind,\n Expando as Expando$,\n type ImmutableSchema,\n type JsonSchemaType,\n ObjectId as ObjectId$,\n Ref as Ref$,\n SpaceIdSchema as SpaceIdSchema$,\n type StoredSchema,\n type TypeMeta,\n getTypeAnnotation,\n getSchema as getSchema$,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n isInstanceOf,\n toJsonSchema as toJsonSchema$,\n} from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId as SpaceId$ } from '@dxos/keys';\nimport { live as live$ } from '@dxos/live-object';\n\n// TODO(burdon): Type vs. Ref vs. Relation vs. Object.\n\n/**\n * Type System API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport namespace Type {\n //\n // Keys\n //\n\n export const SpaceIdSchema = SpaceIdSchema$; // TODO(burdon): Reconcile with SpaceId as with ObjectId.\n export const SpaceId = SpaceId$;\n export type SpaceId = SpaceId$;\n\n export const ObjectId = ObjectId$;\n export type ObjectId = ObjectId$;\n\n //\n // Objects\n //\n\n export const Kind = EntityKind;\n export type AnyObject = BaseEchoObject;\n export type AnyLiveObject<T extends BaseObject> = AnyLiveObject$<T>;\n\n //\n // Schema\n //\n\n export type JsonSchema = JsonSchemaType;\n\n /**\n * A schema that can be extended with arbitrary properties.\n */\n export const Expando = Expando$;\n export type Expando = Expando$;\n\n // TODO(burdon): Review/remove.\n export type Abstract<T = any> = BaseSchema<T>;\n export type ImmutableType<T> = ImmutableSchema<T>;\n export type MutableType<T> = EchoSchema<T>;\n export type StoredType = StoredSchema;\n\n export const create = live$;\n\n /**\n * Defines an ECHO type.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Organization = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.def({\n * typename: 'example.com/type/Organization',\n * version: '0.1.0',\n * }));\n * ```\n */\n export const def = (meta: TypeMeta) => EchoObject(meta);\n\n //\n // Refs\n //\n\n /**\n * Defines a reference to an ECHO object.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Person = Schema.Struct({\n * name: Schema.String,\n * organization: Type.Ref(Organization),\n * }).pipe(Type.def({\n * typename: 'example.com/type/Person',\n * version: '0.1.0',\n * }));\n * ```\n */\n export const Ref = <S extends Schema.Schema.AnyNoContext>(self: S) => Ref$<Schema.Schema.Type<S>>(self);\n\n export const ref = Ref$.make;\n\n //\n // Object utils\n //\n\n export const getMeta = getTypeAnnotation;\n export const getSchema = getSchema$;\n export const instanceOf = isInstanceOf;\n\n //\n // Type utils\n //\n\n // TODO(burdon): Reconcile getDXN and getTypename.\n export const getDXN = getSchemaDXN;\n export const getTypename = (schema: Schema.Schema.AnyNoContext): string => {\n const typename = getSchemaTypename(schema);\n invariant(typename, 'Invalid object');\n return typename;\n };\n export const getVersion = getSchemaVersion;\n export const toJsonSchema = toJsonSchema$;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoRelation, type RelationSourceTargetRefs } from '@dxos/echo-schema';\n\nexport const def = EchoRelation;\n\n/**\n * Get relation target type.\n */\nexport type Target<A> = A extends RelationSourceTargetRefs<infer T, infer _S> ? T : never;\n\n/**\n * Get relation source type.\n */\nexport type Source<A> = A extends RelationSourceTargetRefs<infer _T, infer S> ? S : never;\n"],
5
+ "mappings": ";;;;;;;;AAIA,SAASA,QAAQC,kBAAkB;AACnC,SAASC,WAAW;;;ACEpB,SAKEC,YACAC,YACAC,WAAWC,UAGXC,YAAYC,WACZC,OAAOC,MACPC,iBAAiBC,gBAGjBC,mBACAC,aAAaC,YACbC,cACAC,mBACAC,kBACAC,cACAC,gBAAgBC,qBACX;AACP,SAASC,iBAAiB;AAC1B,SAASC,WAAWC,gBAAgB;AACpC,SAASC,QAAQC,aAAa;;;UAUbC,OAAAA;QAKFhB,gBAAgBC;QAChBW,UAAUC;QAGVjB,WAAWC;QAOXoB,OAAOxB;AAYnB,EAAAuB,MACYtB,UAAUC;QASVuB,SAASH;AAerB,EAAAC,MACYG,MAAM,CAACC,SAAmB5B,WAAW4B,IAAAA;AAoBjD,EAAAJ,MACYlB,MAAM,CAAuCuB,SAAYtB,KAA4BsB,IAAAA;QAErFC,MAAMvB,KAAKwB;QAMXC,UAAUtB;QACVC,YAAYC;QACZqB,aAAajB;QAObkB,SAASrB;QACTsB,cAAc,CAACC,WAAAA;AAC1B,UAAMC,WAAWvB,kBAAkBsB,MAAAA;AACnCjB,cAAUkB,UAAU,kBAAA;;;;;;;;;AACpB,WAAOA;EACT;QACaC,aAAavB;QACbE,eAAeC;AAC9B,GApGiBM,SAAAA,OAAAA,CAAAA,EAAAA;;;AC1CjB;;;;AAIA,SAASe,oBAAmD;AAErD,IAAMC,MAAMC;",
6
+ "names": ["Format", "FormatEnum", "DXN", "EchoObject", "EntityKind", "Expando", "Expando$", "ObjectId", "ObjectId$", "Ref", "Ref$", "SpaceIdSchema", "SpaceIdSchema$", "getTypeAnnotation", "getSchema", "getSchema$", "getSchemaDXN", "getSchemaTypename", "getSchemaVersion", "isInstanceOf", "toJsonSchema", "toJsonSchema$", "invariant", "SpaceId", "SpaceId$", "live", "live$", "Type", "Kind", "create", "def", "meta", "self", "ref", "make", "getMeta", "instanceOf", "getDXN", "getTypename", "schema", "typename", "getVersion", "EchoRelation", "def", "EchoRelation"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/core/echo/echo/src/Database.ts":{"bytes":689,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Queue.ts":{"bytes":671,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Space.ts":{"bytes":671,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Type.ts":{"bytes":6059,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/index.ts":{"bytes":1157,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo/src/Database.ts","kind":"import-statement","original":"./Database"},{"path":"packages/core/echo/echo/src/Queue.ts","kind":"import-statement","original":"./Queue"},{"path":"packages/core/echo/echo/src/Space.ts","kind":"import-statement","original":"./Space"},{"path":"packages/core/echo/echo/src/Type.ts","kind":"import-statement","original":"./Type"}],"format":"esm"}},"outputs":{"packages/core/echo/echo/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4028},"packages/core/echo/echo/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["DXN","Database","Queue","Space","Type"],"entryPoint":"packages/core/echo/echo/src/index.ts","inputs":{"packages/core/echo/echo/src/index.ts":{"bytesInOutput":34},"packages/core/echo/echo/src/Database.ts":{"bytesInOutput":27},"packages/core/echo/echo/src/Queue.ts":{"bytesInOutput":24},"packages/core/echo/echo/src/Space.ts":{"bytesInOutput":24},"packages/core/echo/echo/src/Type.ts":{"bytesInOutput":735}},"bytes":1412}}}
1
+ {"inputs":{"packages/core/echo/echo/src/type/Type.ts":{"bytes":9137,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/type/Relation.ts":{"bytes":1122,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/type/index.ts":{"bytes":683,"imports":[{"path":"packages/core/echo/echo/src/type/Type.ts","kind":"import-statement","original":"./Type"},{"path":"packages/core/echo/echo/src/type/Relation.ts","kind":"import-statement","original":"./Relation"}],"format":"esm"},"packages/core/echo/echo/src/index.ts":{"bytes":829,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo/src/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"}},"outputs":{"packages/core/echo/echo/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5484},"packages/core/echo/echo/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["DXN","Format","FormatEnum","Relation","Type"],"entryPoint":"packages/core/echo/echo/src/index.ts","inputs":{"packages/core/echo/echo/src/index.ts":{"bytesInOutput":90},"packages/core/echo/echo/src/type/Type.ts":{"bytesInOutput":1353},"packages/core/echo/echo/src/type/index.ts":{"bytesInOutput":0},"packages/core/echo/echo/src/type/Relation.ts":{"bytesInOutput":151}},"bytes":2046}}}
@@ -19,48 +19,67 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
21
  DXN: () => import_keys.DXN,
22
- Database: () => Database_exports,
23
- Queue: () => Queue_exports,
24
- Space: () => Space_exports,
25
- Type: () => Type_exports
22
+ Format: () => import_echo_schema.Format,
23
+ FormatEnum: () => import_echo_schema.FormatEnum,
24
+ Relation: () => Relation_exports,
25
+ Type: () => Type
26
26
  });
27
27
  module.exports = __toCommonJS(node_exports);
28
- var import_keys = require("@dxos/keys");
29
28
  var import_echo_schema = require("@dxos/echo-schema");
29
+ var import_keys = require("@dxos/keys");
30
+ var import_echo_schema2 = require("@dxos/echo-schema");
31
+ var import_invariant = require("@dxos/invariant");
32
+ var import_keys2 = require("@dxos/keys");
30
33
  var import_live_object = require("@dxos/live-object");
34
+ var import_echo_schema3 = require("@dxos/echo-schema");
31
35
  var __defProp2 = Object.defineProperty;
32
36
  var __export2 = (target, all) => {
33
37
  for (var name in all)
34
38
  __defProp2(target, name, { get: all[name], enumerable: true });
35
39
  };
36
- var Database_exports = {};
37
- var Queue_exports = {};
38
- var Space_exports = {};
39
- var Type_exports = {};
40
- __export2(Type_exports, {
41
- Kind: () => import_echo_schema.EntityKind,
42
- ObjectId: () => import_echo_schema.ObjectId,
43
- Ref: () => Ref,
44
- create: () => create,
45
- def: () => def,
46
- getDXN: () => import_echo_schema.getSchemaDXN,
47
- getMeta: () => import_echo_schema.getTypeAnnotation,
48
- getSchema: () => import_echo_schema.getSchema,
49
- getTypename: () => import_echo_schema.getSchemaTypename,
50
- getVersion: () => import_echo_schema.getSchemaVersion,
51
- instanceOf: () => import_echo_schema.isInstanceOf,
52
- ref: () => ref
40
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo/src/type/Type.ts";
41
+ var Type;
42
+ (function(Type2) {
43
+ Type2.SpaceIdSchema = import_echo_schema2.SpaceIdSchema;
44
+ Type2.SpaceId = import_keys2.SpaceId;
45
+ Type2.ObjectId = import_echo_schema2.ObjectId;
46
+ Type2.Kind = import_echo_schema2.EntityKind;
47
+ Type2.Expando = import_echo_schema2.Expando;
48
+ Type2.create = import_live_object.live;
49
+ Type2.def = (meta) => (0, import_echo_schema2.EchoObject)(meta);
50
+ Type2.Ref = (self) => (0, import_echo_schema2.Ref)(self);
51
+ Type2.ref = import_echo_schema2.Ref.make;
52
+ Type2.getMeta = import_echo_schema2.getTypeAnnotation;
53
+ Type2.getSchema = import_echo_schema2.getSchema;
54
+ Type2.instanceOf = import_echo_schema2.isInstanceOf;
55
+ Type2.getDXN = import_echo_schema2.getSchemaDXN;
56
+ Type2.getTypename = (schema) => {
57
+ const typename = (0, import_echo_schema2.getSchemaTypename)(schema);
58
+ (0, import_invariant.invariant)(typename, "Invalid object", {
59
+ F: __dxlog_file,
60
+ L: 138,
61
+ S: this,
62
+ A: [
63
+ "typename",
64
+ "'Invalid object'"
65
+ ]
66
+ });
67
+ return typename;
68
+ };
69
+ Type2.getVersion = import_echo_schema2.getSchemaVersion;
70
+ Type2.toJsonSchema = import_echo_schema2.toJsonSchema;
71
+ })(Type || (Type = {}));
72
+ var Relation_exports = {};
73
+ __export2(Relation_exports, {
74
+ def: () => def
53
75
  });
54
- var ref = import_echo_schema.Ref.make;
55
- var create = import_live_object.live;
56
- var def = (meta) => (0, import_echo_schema.EchoObject)(meta);
57
- var Ref = (self) => (0, import_echo_schema.Ref)(self);
76
+ var def = import_echo_schema3.EchoRelation;
58
77
  // Annotate the CommonJS export names for ESM import in node:
59
78
  0 && (module.exports = {
60
79
  DXN,
61
- Database,
62
- Queue,
63
- Space,
80
+ Format,
81
+ FormatEnum,
82
+ Relation,
64
83
  Type
65
84
  });
66
85
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/Database.ts", "../../../src/Queue.ts", "../../../src/Space.ts", "../../../src/Type.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { DXN } from '@dxos/keys';\n\nexport { DXN };\n\nexport * as Database from './Database';\nexport * as Queue from './Queue';\nexport * as Space from './Space';\nexport * as Type from './Type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Database API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Database {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Queue API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Queue {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Space API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Space {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport {\n type BaseSchema,\n type EchoSchema,\n type Expando as Expando$,\n type ImmutableSchema,\n type JsonSchemaType,\n type TypeMeta,\n EchoObject,\n EntityKind,\n ObjectId,\n Ref as Ref$,\n getTypeAnnotation,\n getSchema,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n isInstanceOf,\n} from '@dxos/echo-schema';\nimport { live as create$ } from '@dxos/live-object';\n\n// NOTES:\n// - New Echo package and namespaces allow for incremental migration; vastly simplifies imports.\n// - Split into separate ECHO namespaces: Database, Space, Type, Query, Queue.\n// - Example; import { Database, Type, Query, Queue } from '@dxos/echo';\n// - Use `declare namespace` for types (no code is generated). See Effect pattern, where Schema is a namespace, interface, and function.\n// - Test with @dxos/schema/testing types.\n// - Define user (Composer) types in namespace (e.g., of plugin) and drop Type suffix; remove all deprecated Braneframe types.\n\nexport type { TypeMeta as Meta, JsonSchemaType as JsonSchema };\nexport {\n EntityKind as Kind,\n ObjectId,\n getTypeAnnotation as getMeta,\n getSchema,\n getSchemaDXN as getDXN,\n getSchemaTypename as getTypename,\n getSchemaVersion as getVersion,\n isInstanceOf as instanceOf,\n};\n\n/**\n * Type API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Type {\n /**\n * A schema that can be extended with arbitrary properties.\n */\n export type Expando = Expando$;\n\n export type Abstract<T = any> = BaseSchema<T>;\n export type ImmutableType<T> = ImmutableSchema<T>;\n export type MutableType<T> = EchoSchema<T>;\n}\n\n//\n// Constructors\n//\n\nexport const ref = Ref$.make;\nexport const create = create$;\n\n//\n// Combinators\n//\n\n/**\n * Defines an ECHO type.\n *\n * @example\n * ```ts\n * const Organization = S.Struct({\n * name: S.String,\n * }).pipe(Type.def({ typename: 'example.com/type/Organization', version: '1.0.0' }));\n * ```\n */\nexport const def = (meta: TypeMeta) => EchoObject(meta);\n\n/**\n * Defines a reference to an ECHO object.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Contact = S.Struct({\n * name: S.String,\n * organization: Type.Ref(Organization),\n * }).pipe(Type.def({ typename: 'example.com/type/Contact', version: '1.0.0' }));\n * ```\n */\nexport const Ref = <S extends Schema.Schema.AnyNoContext>(self: S) => Ref$<Schema.Schema.Type<S>>(self);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,kBAAoB;AIEpB,yBAiBO;AACP,yBAAgC;;;;;;AHxBhC,IAAA,mBAAA,CAAA;ACAA,IAAA,gBAAA,CAAA;ACAA,IAAA,gBAAA,CAAA;ACAA,IAAA,eAAA,CAAA;;;;;;;;;;;;;;;AAmEO,IAAMA,MAAMC,mBAAAA,IAAKC;AACjB,IAAMC,SAASC,mBAAAA;AAgBf,IAAMC,MAAM,CAACC,aAAmBC,+BAAWD,IAAAA;AAc3C,IAAME,MAAM,CAAuCC,aAAYR,mBAAAA,KAA4BQ,IAAAA;",
6
- "names": ["ref", "Ref$", "make", "create", "create$", "def", "meta", "EchoObject", "Ref", "self"]
3
+ "sources": ["../../../src/index.ts", "../../../src/type/Type.ts", "../../../src/type/Relation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport { Format, FormatEnum } from '@dxos/echo-schema';\nexport { DXN } from '@dxos/keys';\n\nexport * from './type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { type AnyLiveObject as AnyLiveObject$ } from '@dxos/echo-db';\nimport {\n type BaseEchoObject,\n type BaseObject,\n type BaseSchema,\n type EchoSchema,\n EchoObject,\n EntityKind,\n Expando as Expando$,\n type ImmutableSchema,\n type JsonSchemaType,\n ObjectId as ObjectId$,\n Ref as Ref$,\n SpaceIdSchema as SpaceIdSchema$,\n type StoredSchema,\n type TypeMeta,\n getTypeAnnotation,\n getSchema as getSchema$,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n isInstanceOf,\n toJsonSchema as toJsonSchema$,\n} from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId as SpaceId$ } from '@dxos/keys';\nimport { live as live$ } from '@dxos/live-object';\n\n// TODO(burdon): Type vs. Ref vs. Relation vs. Object.\n\n/**\n * Type System API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport namespace Type {\n //\n // Keys\n //\n\n export const SpaceIdSchema = SpaceIdSchema$; // TODO(burdon): Reconcile with SpaceId as with ObjectId.\n export const SpaceId = SpaceId$;\n export type SpaceId = SpaceId$;\n\n export const ObjectId = ObjectId$;\n export type ObjectId = ObjectId$;\n\n //\n // Objects\n //\n\n export const Kind = EntityKind;\n export type AnyObject = BaseEchoObject;\n export type AnyLiveObject<T extends BaseObject> = AnyLiveObject$<T>;\n\n //\n // Schema\n //\n\n export type JsonSchema = JsonSchemaType;\n\n /**\n * A schema that can be extended with arbitrary properties.\n */\n export const Expando = Expando$;\n export type Expando = Expando$;\n\n // TODO(burdon): Review/remove.\n export type Abstract<T = any> = BaseSchema<T>;\n export type ImmutableType<T> = ImmutableSchema<T>;\n export type MutableType<T> = EchoSchema<T>;\n export type StoredType = StoredSchema;\n\n export const create = live$;\n\n /**\n * Defines an ECHO type.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Organization = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.def({\n * typename: 'example.com/type/Organization',\n * version: '0.1.0',\n * }));\n * ```\n */\n export const def = (meta: TypeMeta) => EchoObject(meta);\n\n //\n // Refs\n //\n\n /**\n * Defines a reference to an ECHO object.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Person = Schema.Struct({\n * name: Schema.String,\n * organization: Type.Ref(Organization),\n * }).pipe(Type.def({\n * typename: 'example.com/type/Person',\n * version: '0.1.0',\n * }));\n * ```\n */\n export const Ref = <S extends Schema.Schema.AnyNoContext>(self: S) => Ref$<Schema.Schema.Type<S>>(self);\n\n export const ref = Ref$.make;\n\n //\n // Object utils\n //\n\n export const getMeta = getTypeAnnotation;\n export const getSchema = getSchema$;\n export const instanceOf = isInstanceOf;\n\n //\n // Type utils\n //\n\n // TODO(burdon): Reconcile getDXN and getTypename.\n export const getDXN = getSchemaDXN;\n export const getTypename = (schema: Schema.Schema.AnyNoContext): string => {\n const typename = getSchemaTypename(schema);\n invariant(typename, 'Invalid object');\n return typename;\n };\n export const getVersion = getSchemaVersion;\n export const toJsonSchema = toJsonSchema$;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoRelation, type RelationSourceTargetRefs } from '@dxos/echo-schema';\n\nexport const def = EchoRelation;\n\n/**\n * Get relation target type.\n */\nexport type Target<A> = A extends RelationSourceTargetRefs<infer T, infer _S> ? T : never;\n\n/**\n * Get relation source type.\n */\nexport type Source<A> = A extends RelationSourceTargetRefs<infer _T, infer S> ? S : never;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAmC;AACnC,kBAAoB;ACEpB,IAAAA,sBAsBO;AACP,uBAA0B;AAC1B,IAAAC,eAAoC;AACpC,yBAA8B;AC5B9B,IAAAD,sBAA4D;;;;;;;;UDsC3CE,OAAAA;QAKFC,gBAAgBC,oBAAAA;QAChBC,UAAUC,aAAAA;QAGVC,WAAWC,oBAAAA;QAOXC,OAAOC;AAYnBR,QACYS,UAAUC,oBAAAA;QASVC,SAASC,mBAAAA;AAerBZ,QACYa,MAAM,CAACC,aAAmBC,gCAAWD,IAAAA;AAoBjDd,QACYgB,MAAM,CAAuCC,aAAYC,oBAAAA,KAA4BD,IAAAA;QAErFE,MAAMD,oBAAAA,IAAKE;QAMXC,UAAUC;QACVC,YAAYC,oBAAAA;QACZC,aAAaC;QAObC,SAASC;QACTC,cAAc,CAACC,WAAAA;AAC1B,UAAMC,eAAWC,uCAAkBF,MAAAA;AACnCG,oCAAUF,UAAU,kBAAA;;;;;;;;;AACpB,WAAOA;EACT;QACaG,aAAaC;QACbC,eAAeC,oBAAAA;AAC9B,GApGiBrC,SAAAA,OAAAA,CAAAA,EAAAA;AC1CjB,IAAA,mBAAA,CAAA;;;;AAMO,IAAMa,MAAMyB;",
6
+ "names": ["import_echo_schema", "import_keys", "Type", "SpaceIdSchema", "SpaceIdSchema$", "SpaceId", "SpaceId$", "ObjectId", "ObjectId$", "Kind", "EntityKind", "Expando", "Expando$", "create", "live$", "def", "meta", "EchoObject", "Ref", "self", "Ref$", "ref", "make", "getMeta", "getTypeAnnotation", "getSchema", "getSchema$", "instanceOf", "isInstanceOf", "getDXN", "getSchemaDXN", "getTypename", "schema", "typename", "getSchemaTypename", "invariant", "getVersion", "getSchemaVersion", "toJsonSchema", "toJsonSchema$", "EchoRelation"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/core/echo/echo/src/Database.ts":{"bytes":689,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Queue.ts":{"bytes":671,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Space.ts":{"bytes":671,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Type.ts":{"bytes":6059,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/index.ts":{"bytes":1157,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo/src/Database.ts","kind":"import-statement","original":"./Database"},{"path":"packages/core/echo/echo/src/Queue.ts","kind":"import-statement","original":"./Queue"},{"path":"packages/core/echo/echo/src/Space.ts","kind":"import-statement","original":"./Space"},{"path":"packages/core/echo/echo/src/Type.ts","kind":"import-statement","original":"./Type"}],"format":"esm"}},"outputs":{"packages/core/echo/echo/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4027},"packages/core/echo/echo/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["DXN","Database","Queue","Space","Type"],"entryPoint":"packages/core/echo/echo/src/index.ts","inputs":{"packages/core/echo/echo/src/index.ts":{"bytesInOutput":34},"packages/core/echo/echo/src/Database.ts":{"bytesInOutput":27},"packages/core/echo/echo/src/Queue.ts":{"bytesInOutput":24},"packages/core/echo/echo/src/Space.ts":{"bytesInOutput":24},"packages/core/echo/echo/src/Type.ts":{"bytesInOutput":735}},"bytes":1379}}}
1
+ {"inputs":{"packages/core/echo/echo/src/type/Type.ts":{"bytes":9137,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/type/Relation.ts":{"bytes":1122,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/type/index.ts":{"bytes":683,"imports":[{"path":"packages/core/echo/echo/src/type/Type.ts","kind":"import-statement","original":"./Type"},{"path":"packages/core/echo/echo/src/type/Relation.ts","kind":"import-statement","original":"./Relation"}],"format":"esm"},"packages/core/echo/echo/src/index.ts":{"bytes":829,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo/src/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"}},"outputs":{"packages/core/echo/echo/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5483},"packages/core/echo/echo/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["DXN","Format","FormatEnum","Relation","Type"],"entryPoint":"packages/core/echo/echo/src/index.ts","inputs":{"packages/core/echo/echo/src/index.ts":{"bytesInOutput":90},"packages/core/echo/echo/src/type/Type.ts":{"bytesInOutput":1353},"packages/core/echo/echo/src/type/index.ts":{"bytesInOutput":0},"packages/core/echo/echo/src/type/Relation.ts":{"bytesInOutput":151}},"bytes":2013}}}
@@ -6,44 +6,59 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // packages/core/echo/echo/src/index.ts
9
+ import { Format, FormatEnum } from "@dxos/echo-schema";
9
10
  import { DXN } from "@dxos/keys";
10
11
 
11
- // packages/core/echo/echo/src/Database.ts
12
- var Database_exports = {};
12
+ // packages/core/echo/echo/src/type/Type.ts
13
+ import { EchoObject, EntityKind, Expando as Expando$, ObjectId as ObjectId$, Ref as Ref$, SpaceIdSchema as SpaceIdSchema$, getTypeAnnotation, getSchema as getSchema$, getSchemaDXN, getSchemaTypename, getSchemaVersion, isInstanceOf, toJsonSchema as toJsonSchema$ } from "@dxos/echo-schema";
14
+ import { invariant } from "@dxos/invariant";
15
+ import { SpaceId as SpaceId$ } from "@dxos/keys";
16
+ import { live as live$ } from "@dxos/live-object";
17
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo/src/type/Type.ts";
18
+ var Type;
19
+ (function(Type2) {
20
+ Type2.SpaceIdSchema = SpaceIdSchema$;
21
+ Type2.SpaceId = SpaceId$;
22
+ Type2.ObjectId = ObjectId$;
23
+ Type2.Kind = EntityKind;
24
+ Type2.Expando = Expando$;
25
+ Type2.create = live$;
26
+ Type2.def = (meta) => EchoObject(meta);
27
+ Type2.Ref = (self) => Ref$(self);
28
+ Type2.ref = Ref$.make;
29
+ Type2.getMeta = getTypeAnnotation;
30
+ Type2.getSchema = getSchema$;
31
+ Type2.instanceOf = isInstanceOf;
32
+ Type2.getDXN = getSchemaDXN;
33
+ Type2.getTypename = (schema) => {
34
+ const typename = getSchemaTypename(schema);
35
+ invariant(typename, "Invalid object", {
36
+ F: __dxlog_file,
37
+ L: 138,
38
+ S: this,
39
+ A: [
40
+ "typename",
41
+ "'Invalid object'"
42
+ ]
43
+ });
44
+ return typename;
45
+ };
46
+ Type2.getVersion = getSchemaVersion;
47
+ Type2.toJsonSchema = toJsonSchema$;
48
+ })(Type || (Type = {}));
13
49
 
14
- // packages/core/echo/echo/src/Queue.ts
15
- var Queue_exports = {};
16
-
17
- // packages/core/echo/echo/src/Space.ts
18
- var Space_exports = {};
19
-
20
- // packages/core/echo/echo/src/Type.ts
21
- var Type_exports = {};
22
- __export(Type_exports, {
23
- Kind: () => EntityKind,
24
- ObjectId: () => ObjectId,
25
- Ref: () => Ref,
26
- create: () => create,
27
- def: () => def,
28
- getDXN: () => getSchemaDXN,
29
- getMeta: () => getTypeAnnotation,
30
- getSchema: () => getSchema,
31
- getTypename: () => getSchemaTypename,
32
- getVersion: () => getSchemaVersion,
33
- instanceOf: () => isInstanceOf,
34
- ref: () => ref
50
+ // packages/core/echo/echo/src/type/Relation.ts
51
+ var Relation_exports = {};
52
+ __export(Relation_exports, {
53
+ def: () => def
35
54
  });
36
- import { EchoObject, EntityKind, ObjectId, Ref as Ref$, getTypeAnnotation, getSchema, getSchemaDXN, getSchemaTypename, getSchemaVersion, isInstanceOf } from "@dxos/echo-schema";
37
- import { live as create$ } from "@dxos/live-object";
38
- var ref = Ref$.make;
39
- var create = create$;
40
- var def = (meta) => EchoObject(meta);
41
- var Ref = (self) => Ref$(self);
55
+ import { EchoRelation } from "@dxos/echo-schema";
56
+ var def = EchoRelation;
42
57
  export {
43
58
  DXN,
44
- Database_exports as Database,
45
- Queue_exports as Queue,
46
- Space_exports as Space,
47
- Type_exports as Type
59
+ Format,
60
+ FormatEnum,
61
+ Relation_exports as Relation,
62
+ Type
48
63
  };
49
64
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/Database.ts", "../../../src/Queue.ts", "../../../src/Space.ts", "../../../src/Type.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { DXN } from '@dxos/keys';\n\nexport { DXN };\n\nexport * as Database from './Database';\nexport * as Queue from './Queue';\nexport * as Space from './Space';\nexport * as Type from './Type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Database API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Database {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Queue API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Queue {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Space API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Space {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport {\n type BaseSchema,\n type EchoSchema,\n type Expando as Expando$,\n type ImmutableSchema,\n type JsonSchemaType,\n type TypeMeta,\n EchoObject,\n EntityKind,\n ObjectId,\n Ref as Ref$,\n getTypeAnnotation,\n getSchema,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n isInstanceOf,\n} from '@dxos/echo-schema';\nimport { live as create$ } from '@dxos/live-object';\n\n// NOTES:\n// - New Echo package and namespaces allow for incremental migration; vastly simplifies imports.\n// - Split into separate ECHO namespaces: Database, Space, Type, Query, Queue.\n// - Example; import { Database, Type, Query, Queue } from '@dxos/echo';\n// - Use `declare namespace` for types (no code is generated). See Effect pattern, where Schema is a namespace, interface, and function.\n// - Test with @dxos/schema/testing types.\n// - Define user (Composer) types in namespace (e.g., of plugin) and drop Type suffix; remove all deprecated Braneframe types.\n\nexport type { TypeMeta as Meta, JsonSchemaType as JsonSchema };\nexport {\n EntityKind as Kind,\n ObjectId,\n getTypeAnnotation as getMeta,\n getSchema,\n getSchemaDXN as getDXN,\n getSchemaTypename as getTypename,\n getSchemaVersion as getVersion,\n isInstanceOf as instanceOf,\n};\n\n/**\n * Type API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport declare namespace Type {\n /**\n * A schema that can be extended with arbitrary properties.\n */\n export type Expando = Expando$;\n\n export type Abstract<T = any> = BaseSchema<T>;\n export type ImmutableType<T> = ImmutableSchema<T>;\n export type MutableType<T> = EchoSchema<T>;\n}\n\n//\n// Constructors\n//\n\nexport const ref = Ref$.make;\nexport const create = create$;\n\n//\n// Combinators\n//\n\n/**\n * Defines an ECHO type.\n *\n * @example\n * ```ts\n * const Organization = S.Struct({\n * name: S.String,\n * }).pipe(Type.def({ typename: 'example.com/type/Organization', version: '1.0.0' }));\n * ```\n */\nexport const def = (meta: TypeMeta) => EchoObject(meta);\n\n/**\n * Defines a reference to an ECHO object.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Contact = S.Struct({\n * name: S.String,\n * organization: Type.Ref(Organization),\n * }).pipe(Type.def({ typename: 'example.com/type/Contact', version: '1.0.0' }));\n * ```\n */\nexport const Ref = <S extends Schema.Schema.AnyNoContext>(self: S) => Ref$<Schema.Schema.Type<S>>(self);\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,WAAW;;;ACJpB;;;ACAA;;;ACAA;;;ACAA;;;;;;;;;;;;;;;AAMA,SAOEC,YACAC,YACAC,UACAC,OAAOC,MACPC,mBACAC,WACAC,cACAC,mBACAC,kBACAC,oBACK;AACP,SAASC,QAAQC,eAAe;AA2CzB,IAAMC,MAAMC,KAAKC;AACjB,IAAMC,SAASC;AAgBf,IAAMC,MAAM,CAACC,SAAmBC,WAAWD,IAAAA;AAc3C,IAAME,MAAM,CAAuCC,SAAYR,KAA4BQ,IAAAA;",
6
- "names": ["DXN", "EchoObject", "EntityKind", "ObjectId", "Ref", "Ref$", "getTypeAnnotation", "getSchema", "getSchemaDXN", "getSchemaTypename", "getSchemaVersion", "isInstanceOf", "live", "create$", "ref", "Ref$", "make", "create", "create$", "def", "meta", "EchoObject", "Ref", "self"]
3
+ "sources": ["../../../src/index.ts", "../../../src/type/Type.ts", "../../../src/type/Relation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nexport { Format, FormatEnum } from '@dxos/echo-schema';\nexport { DXN } from '@dxos/keys';\n\nexport * from './type';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { type AnyLiveObject as AnyLiveObject$ } from '@dxos/echo-db';\nimport {\n type BaseEchoObject,\n type BaseObject,\n type BaseSchema,\n type EchoSchema,\n EchoObject,\n EntityKind,\n Expando as Expando$,\n type ImmutableSchema,\n type JsonSchemaType,\n ObjectId as ObjectId$,\n Ref as Ref$,\n SpaceIdSchema as SpaceIdSchema$,\n type StoredSchema,\n type TypeMeta,\n getTypeAnnotation,\n getSchema as getSchema$,\n getSchemaDXN,\n getSchemaTypename,\n getSchemaVersion,\n isInstanceOf,\n toJsonSchema as toJsonSchema$,\n} from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceId as SpaceId$ } from '@dxos/keys';\nimport { live as live$ } from '@dxos/live-object';\n\n// TODO(burdon): Type vs. Ref vs. Relation vs. Object.\n\n/**\n * Type System API.\n *\n * @category api namespace\n * @since 0.9.0\n */\nexport namespace Type {\n //\n // Keys\n //\n\n export const SpaceIdSchema = SpaceIdSchema$; // TODO(burdon): Reconcile with SpaceId as with ObjectId.\n export const SpaceId = SpaceId$;\n export type SpaceId = SpaceId$;\n\n export const ObjectId = ObjectId$;\n export type ObjectId = ObjectId$;\n\n //\n // Objects\n //\n\n export const Kind = EntityKind;\n export type AnyObject = BaseEchoObject;\n export type AnyLiveObject<T extends BaseObject> = AnyLiveObject$<T>;\n\n //\n // Schema\n //\n\n export type JsonSchema = JsonSchemaType;\n\n /**\n * A schema that can be extended with arbitrary properties.\n */\n export const Expando = Expando$;\n export type Expando = Expando$;\n\n // TODO(burdon): Review/remove.\n export type Abstract<T = any> = BaseSchema<T>;\n export type ImmutableType<T> = ImmutableSchema<T>;\n export type MutableType<T> = EchoSchema<T>;\n export type StoredType = StoredSchema;\n\n export const create = live$;\n\n /**\n * Defines an ECHO type.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Organization = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.def({\n * typename: 'example.com/type/Organization',\n * version: '0.1.0',\n * }));\n * ```\n */\n export const def = (meta: TypeMeta) => EchoObject(meta);\n\n //\n // Refs\n //\n\n /**\n * Defines a reference to an ECHO object.\n *\n * @example\n * ```ts\n * import { Type } from '@dxos/echo';\n * const Person = Schema.Struct({\n * name: Schema.String,\n * organization: Type.Ref(Organization),\n * }).pipe(Type.def({\n * typename: 'example.com/type/Person',\n * version: '0.1.0',\n * }));\n * ```\n */\n export const Ref = <S extends Schema.Schema.AnyNoContext>(self: S) => Ref$<Schema.Schema.Type<S>>(self);\n\n export const ref = Ref$.make;\n\n //\n // Object utils\n //\n\n export const getMeta = getTypeAnnotation;\n export const getSchema = getSchema$;\n export const instanceOf = isInstanceOf;\n\n //\n // Type utils\n //\n\n // TODO(burdon): Reconcile getDXN and getTypename.\n export const getDXN = getSchemaDXN;\n export const getTypename = (schema: Schema.Schema.AnyNoContext): string => {\n const typename = getSchemaTypename(schema);\n invariant(typename, 'Invalid object');\n return typename;\n };\n export const getVersion = getSchemaVersion;\n export const toJsonSchema = toJsonSchema$;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoRelation, type RelationSourceTargetRefs } from '@dxos/echo-schema';\n\nexport const def = EchoRelation;\n\n/**\n * Get relation target type.\n */\nexport type Target<A> = A extends RelationSourceTargetRefs<infer T, infer _S> ? T : never;\n\n/**\n * Get relation source type.\n */\nexport type Source<A> = A extends RelationSourceTargetRefs<infer _T, infer S> ? S : never;\n"],
5
+ "mappings": ";;;;;;;;AAIA,SAASA,QAAQC,kBAAkB;AACnC,SAASC,WAAW;;;ACEpB,SAKEC,YACAC,YACAC,WAAWC,UAGXC,YAAYC,WACZC,OAAOC,MACPC,iBAAiBC,gBAGjBC,mBACAC,aAAaC,YACbC,cACAC,mBACAC,kBACAC,cACAC,gBAAgBC,qBACX;AACP,SAASC,iBAAiB;AAC1B,SAASC,WAAWC,gBAAgB;AACpC,SAASC,QAAQC,aAAa;;;UAUbC,OAAAA;QAKFhB,gBAAgBC;QAChBW,UAAUC;QAGVjB,WAAWC;QAOXoB,OAAOxB;AAYnB,EAAAuB,MACYtB,UAAUC;QASVuB,SAASH;AAerB,EAAAC,MACYG,MAAM,CAACC,SAAmB5B,WAAW4B,IAAAA;AAoBjD,EAAAJ,MACYlB,MAAM,CAAuCuB,SAAYtB,KAA4BsB,IAAAA;QAErFC,MAAMvB,KAAKwB;QAMXC,UAAUtB;QACVC,YAAYC;QACZqB,aAAajB;QAObkB,SAASrB;QACTsB,cAAc,CAACC,WAAAA;AAC1B,UAAMC,WAAWvB,kBAAkBsB,MAAAA;AACnCjB,cAAUkB,UAAU,kBAAA;;;;;;;;;AACpB,WAAOA;EACT;QACaC,aAAavB;QACbE,eAAeC;AAC9B,GApGiBM,SAAAA,OAAAA,CAAAA,EAAAA;;;AC1CjB;;;;AAIA,SAASe,oBAAmD;AAErD,IAAMC,MAAMC;",
6
+ "names": ["Format", "FormatEnum", "DXN", "EchoObject", "EntityKind", "Expando", "Expando$", "ObjectId", "ObjectId$", "Ref", "Ref$", "SpaceIdSchema", "SpaceIdSchema$", "getTypeAnnotation", "getSchema", "getSchema$", "getSchemaDXN", "getSchemaTypename", "getSchemaVersion", "isInstanceOf", "toJsonSchema", "toJsonSchema$", "invariant", "SpaceId", "SpaceId$", "live", "live$", "Type", "Kind", "create", "def", "meta", "self", "ref", "make", "getMeta", "instanceOf", "getDXN", "getTypename", "schema", "typename", "getVersion", "EchoRelation", "def", "EchoRelation"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/core/echo/echo/src/Database.ts":{"bytes":689,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Queue.ts":{"bytes":671,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Space.ts":{"bytes":671,"imports":[],"format":"esm"},"packages/core/echo/echo/src/Type.ts":{"bytes":6059,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/index.ts":{"bytes":1157,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo/src/Database.ts","kind":"import-statement","original":"./Database"},{"path":"packages/core/echo/echo/src/Queue.ts","kind":"import-statement","original":"./Queue"},{"path":"packages/core/echo/echo/src/Space.ts","kind":"import-statement","original":"./Space"},{"path":"packages/core/echo/echo/src/Type.ts","kind":"import-statement","original":"./Type"}],"format":"esm"}},"outputs":{"packages/core/echo/echo/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4028},"packages/core/echo/echo/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["DXN","Database","Queue","Space","Type"],"entryPoint":"packages/core/echo/echo/src/index.ts","inputs":{"packages/core/echo/echo/src/index.ts":{"bytesInOutput":34},"packages/core/echo/echo/src/Database.ts":{"bytesInOutput":27},"packages/core/echo/echo/src/Queue.ts":{"bytesInOutput":24},"packages/core/echo/echo/src/Space.ts":{"bytesInOutput":24},"packages/core/echo/echo/src/Type.ts":{"bytesInOutput":735}},"bytes":1471}}}
1
+ {"inputs":{"packages/core/echo/echo/src/type/Type.ts":{"bytes":9137,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/type/Relation.ts":{"bytes":1122,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/echo/echo/src/type/index.ts":{"bytes":683,"imports":[{"path":"packages/core/echo/echo/src/type/Type.ts","kind":"import-statement","original":"./Type"},{"path":"packages/core/echo/echo/src/type/Relation.ts","kind":"import-statement","original":"./Relation"}],"format":"esm"},"packages/core/echo/echo/src/index.ts":{"bytes":829,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/echo/echo/src/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"}},"outputs":{"packages/core/echo/echo/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5484},"packages/core/echo/echo/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["DXN","Format","FormatEnum","Relation","Type"],"entryPoint":"packages/core/echo/echo/src/index.ts","inputs":{"packages/core/echo/echo/src/index.ts":{"bytesInOutput":90},"packages/core/echo/echo/src/type/Type.ts":{"bytesInOutput":1353},"packages/core/echo/echo/src/type/index.ts":{"bytesInOutput":0},"packages/core/echo/echo/src/type/Relation.ts":{"bytesInOutput":151}},"bytes":2105}}}
@@ -5,4 +5,4 @@
5
5
  * @since 0.9.0
6
6
  */
7
7
  export declare namespace Database { }
8
- //# sourceMappingURL=Database.d.ts.map
8
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/experimental/database.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,yBAAiB,QAAQ,CAAC,GAAE"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/index.ts"],"names":[],"mappings":""}
@@ -5,4 +5,4 @@
5
5
  * @since 0.9.0
6
6
  */
7
7
  export declare namespace Queue { }
8
- //# sourceMappingURL=Queue.d.ts.map
8
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../../src/experimental/queue.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,yBAAiB,KAAK,CAAC,GAAE"}
@@ -5,4 +5,4 @@
5
5
  * @since 0.9.0
6
6
  */
7
7
  export declare namespace Space { }
8
- //# sourceMappingURL=Space.d.ts.map
8
+ //# sourceMappingURL=space.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../src/experimental/space.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC,GAAE"}
@@ -1,7 +1,4 @@
1
- import { DXN } from '@dxos/keys';
2
- export { DXN };
3
- export * as Database from './Database';
4
- export * as Queue from './Queue';
5
- export * as Space from './Space';
6
- export * as Type from './Type';
1
+ export { Format, FormatEnum } from '@dxos/echo-schema';
2
+ export { DXN } from '@dxos/keys';
3
+ export * from './type';
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAE,CAAC;AAEf,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,cAAc,QAAQ,CAAC"}