@dxos/echo-protocol 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731

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,4 +1,4 @@
1
- import type { DXN, ObjectId } from '@dxos/keys';
1
+ import type { EntityId, URI } from '@dxos/keys';
2
2
  import { type RawString } from './automerge';
3
3
  import type { ForeignKey } from './foreign-key';
4
4
  import { type EncodedReference } from './reference';
@@ -9,8 +9,8 @@ export type SpaceState = {
9
9
  /**
10
10
  * Array indexes get converted to strings.
11
11
  */
12
- export type ObjectProp = string;
13
- export type ObjectPropPath = ObjectProp[];
12
+ export type EntityProp = string;
13
+ export type EntityPropPath = EntityProp[];
14
14
  /**
15
15
  * Link to all documents that hold objects in the space.
16
16
  */
@@ -23,13 +23,13 @@ export interface DatabaseDirectory {
23
23
  * Objects inlined in the current document.
24
24
  */
25
25
  objects?: {
26
- [id: string]: ObjectStructure;
26
+ [id: string]: EntityStructure;
27
27
  };
28
28
  /**
29
29
  * Object id points to an automerge doc url where the object is embedded.
30
30
  */
31
31
  links?: {
32
- [echoId: string]: string | RawString;
32
+ [echoUri: string]: string | RawString;
33
33
  };
34
34
  /**
35
35
  * @deprecated
@@ -42,77 +42,83 @@ export declare const DatabaseDirectory: Readonly<{
42
42
  * @returns Space key in hex of the space that owns the document. In hex format. Without 0x prefix.
43
43
  */
44
44
  getSpaceKey: (doc: DatabaseDirectory) => string | null;
45
- getInlineObject: (doc: DatabaseDirectory, id: ObjectId) => ObjectStructure | undefined;
46
- getLink: (doc: DatabaseDirectory, id: ObjectId) => string | undefined;
45
+ getInlineObject: (doc: DatabaseDirectory, id: EntityId) => EntityStructure | undefined;
46
+ getLink: (doc: DatabaseDirectory, id: EntityId) => string | undefined;
47
47
  make: ({ spaceKey, objects, links, }: {
48
48
  spaceKey: string;
49
- objects?: Record<string, ObjectStructure>;
49
+ objects?: Record<string, EntityStructure>;
50
50
  links?: Record<string, RawString>;
51
51
  }) => DatabaseDirectory;
52
52
  }>;
53
53
  /**
54
54
  * Representation of an ECHO object in an AM document.
55
55
  */
56
- export type ObjectStructure = {
57
- system?: ObjectSystem;
58
- meta: ObjectMeta;
56
+ export type EntityStructure = {
57
+ system?: EntitySystem;
58
+ meta: EntityMeta;
59
59
  /**
60
60
  * User-defined data.
61
61
  * Adheres to schema in `system.type`
62
62
  */
63
63
  data: Record<string, any>;
64
64
  };
65
- export declare const ObjectStructure: Readonly<{
65
+ export declare const EntityStructure: Readonly<{
66
66
  /**
67
67
  * @throws On invalid object structure.
68
68
  */
69
- getTypeReference: (object: ObjectStructure) => EncodedReference | undefined;
69
+ getTypeReference: (object: EntityStructure) => EncodedReference | undefined;
70
70
  /**
71
71
  * @throws On invalid object structure.
72
72
  */
73
- getEntityKind: (object: ObjectStructure) => 'object' | 'relation';
74
- isDeleted: (object: ObjectStructure) => boolean;
75
- getRelationSource: (object: ObjectStructure) => EncodedReference | undefined;
76
- getRelationTarget: (object: ObjectStructure) => EncodedReference | undefined;
77
- getParent: (object: ObjectStructure) => EncodedReference | undefined;
73
+ getEntityKind: (object: EntityStructure) => 'object' | 'relation' | 'type';
74
+ isDeleted: (object: EntityStructure) => boolean;
75
+ getRelationSource: (object: EntityStructure) => EncodedReference | undefined;
76
+ getRelationTarget: (object: EntityStructure) => EncodedReference | undefined;
77
+ getParent: (object: EntityStructure) => EncodedReference | undefined;
78
78
  /**
79
79
  * @returns All references in the data section of the object.
80
80
  */
81
- getAllOutgoingReferences: (object: ObjectStructure) => {
82
- path: ObjectPropPath;
81
+ getAllOutgoingReferences: (object: EntityStructure) => {
82
+ path: EntityPropPath;
83
83
  reference: EncodedReference;
84
84
  }[];
85
- getTags: (object: ObjectStructure) => string[];
85
+ getTags: (object: EntityStructure) => (EncodedReference | string)[];
86
86
  makeObject: ({ type, data, keys, }: {
87
- type: DXN.String;
87
+ type: URI.URI;
88
88
  deleted?: boolean;
89
89
  keys?: ForeignKey[];
90
90
  data?: unknown;
91
- }) => ObjectStructure;
91
+ }) => EntityStructure;
92
92
  makeRelation: ({ type, source, target, deleted, keys, data, }: {
93
- type: DXN.String;
93
+ type: URI.URI;
94
94
  source: EncodedReference;
95
95
  target: EncodedReference;
96
96
  deleted?: boolean;
97
97
  keys?: ForeignKey[];
98
98
  data?: unknown;
99
- }) => ObjectStructure;
99
+ }) => EntityStructure;
100
+ makeType: ({ type, keys, data }: {
101
+ type: URI.URI;
102
+ keys?: ForeignKey[];
103
+ data?: unknown;
104
+ }) => EntityStructure;
100
105
  }>;
101
106
  /**
102
107
  * Echo object metadata.
103
108
  */
104
- export type ObjectMeta = {
109
+ export type EntityMeta = {
105
110
  /**
106
111
  * Foreign keys.
107
112
  */
108
113
  keys: ForeignKey[];
109
114
  /**
110
115
  * Tags.
111
- * An array of DXNs of Tag objects within the space.
116
+ * Encoded references to Tag objects within the space.
112
117
  *
113
- * NOTE: Optional for backwards compatibilty.
118
+ * NOTE: Optional for backwards compatibility; legacy data may store bare DXN strings, which are
119
+ * upgraded to encoded references on read (see `object-core.ts`).
114
120
  */
115
- tags?: string[];
121
+ tags?: (EncodedReference | string)[];
116
122
  /**
117
123
  * Fully-qualified registry key for the object (FQN format, e.g. `org.example.type.foo`).
118
124
  * Identifies the canonical registry entry the object instance was created from.
@@ -123,18 +129,37 @@ export type ObjectMeta = {
123
129
  * Must be a valid semver string (e.g. `1.2.3`).
124
130
  */
125
131
  version?: string;
132
+ /**
133
+ * Dictionary of annotations to this entity.
134
+ *
135
+ * NOTE: Optional for backwards compatibility. Values are arbitrary decoded automerge primitives;
136
+ * typed as `any` so `EntityStructure` stays assignable to `DecodedAutomergePrimaryValue`.
137
+ */
138
+ annotations?: {
139
+ readonly [key: string]: any;
140
+ };
126
141
  };
127
142
  /**
128
143
  * Automerge object system properties.
129
144
  * (Is automerge specific.)
130
145
  */
131
- export type ObjectSystem = {
146
+ export type EntitySystem = {
132
147
  /**
133
- * Entity kind.
148
+ * Entity kind. `'type'` covers persisted ECHO type definitions (instances of
149
+ * the `Type.Type` meta-schema); `'object'` / `'relation'` cover regular ECHO
150
+ * instances.
134
151
  */
135
- kind?: 'object' | 'relation';
152
+ kind?: 'object' | 'relation' | 'type';
136
153
  /**
137
- * Object reference ('protobuf' protocol) type.
154
+ * Object reference ('protobuf' protocol) type — DXN of the schema this
155
+ * entity instantiates.
156
+ *
157
+ * - For `kind === 'object'` / `'relation'` instances, this is the URI of the
158
+ * user-defined schema the entity was created from (e.g. `dxn:type:org.example.Person:1.0.0`).
159
+ * - For `kind === 'type'` entities (persisted Type.Type meta-instances) this
160
+ * is always the URI of the `TypeSchema` meta-schema itself
161
+ * (`dxn:org.dxos.type.schema:0.1.0`). The kind that the meta-instance
162
+ * _describes_ (object/relation/type) lives in `data.jsonSchema.entityKind`.
138
163
  */
139
164
  type?: EncodedReference;
140
165
  /**
@@ -161,7 +186,7 @@ export type ObjectSystem = {
161
186
  export declare const PROPERTY_ID = "id";
162
187
  /**
163
188
  * Data namespace.
164
- * The key on {@link ObjectStructure} that contains the user-defined data.
189
+ * The key on {@link EntityStructure} that contains the user-defined data.
165
190
  */
166
191
  export declare const DATA_NAMESPACE = "data";
167
192
  //# sourceMappingURL=document-structure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-structure.d.ts","sourceRoot":"","sources":["../../../src/document-structure.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,MAAM,UAAU,GAAG;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG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"}
@@ -1,4 +1,5 @@
1
1
  import * as Schema from 'effect/Schema';
2
+ import { EID, URI } from '@dxos/keys';
2
3
  /**
3
4
  * Filter by object type and properties.
4
5
  *
@@ -6,8 +7,8 @@ import * as Schema from 'effect/Schema';
6
7
  */
7
8
  declare const FilterObject_: Schema.Struct<{
8
9
  type: Schema.Literal<["object"]>;
9
- typename: Schema.Union<[Schema.refine<string, typeof Schema.NonEmptyString>, typeof Schema.Null]>;
10
- id: Schema.optional<Schema.Array$<import("@dxos/keys").ObjectIdClass>>;
10
+ typename: Schema.Union<[Schema.Schema<URI.URI, URI.URI, never>, typeof Schema.Null]>;
11
+ id: Schema.optional<Schema.Array$<import("@dxos/keys").EntityIdClass>>;
11
12
  /**
12
13
  * Filter by property.
13
14
  * Must not include object ID.
@@ -153,7 +154,7 @@ export declare const FilterOr: Schema.Schema<FilterOr>;
153
154
  declare const FilterChildOf_: Schema.Struct<{
154
155
  type: Schema.Literal<["child-of"]>;
155
156
  /** Parent DXNs to match children of. */
156
- parents: Schema.Array$<Schema.refine<string, typeof Schema.NonEmptyString>>;
157
+ parents: Schema.Array$<Schema.Schema<EID.EID, EID.EID, never>>;
157
158
  /** Whether to match transitively (grandchildren, etc.). Defaults to true. */
158
159
  transitive: typeof Schema.Boolean;
159
160
  }>;
@@ -208,7 +209,7 @@ declare const QueryIncomingReferencesClause_: Schema.Struct<{
208
209
  * If null, matches references from any property.
209
210
  */
210
211
  property: Schema.NullOr<typeof Schema.String>;
211
- typename: Schema.Union<[Schema.refine<string, typeof Schema.NonEmptyString>, typeof Schema.Null]>;
212
+ typename: Schema.Union<[Schema.Schema<URI.URI, URI.URI, never>, typeof Schema.Null]>;
212
213
  }>;
213
214
  export interface QueryIncomingReferencesClause extends Schema.Schema.Type<typeof QueryIncomingReferencesClause_> {
214
215
  }
@@ -353,15 +354,27 @@ export declare const QueryFromClause_: Schema.Struct<{
353
354
  type: Schema.Literal<["from"]>;
354
355
  query: Schema.suspend<QueryFilterClause | QueryFromClause | QueryHierarchyTraversalClause | QueryIncomingReferencesClause | QueryLimitClause | QueryOptionsClause | QueryOrderClause | QueryReferenceTraversalClause | QueryRelationClause | QueryRelationTraversalClause | QuerySelectClause | QuerySetDifferenceClause | QueryUnionClause, QueryFilterClause | QueryFromClause | QueryHierarchyTraversalClause | QueryIncomingReferencesClause | QueryLimitClause | QueryOptionsClause | QueryOrderClause | QueryReferenceTraversalClause | QueryRelationClause | QueryRelationTraversalClause | QuerySelectClause | QuerySetDifferenceClause | QueryUnionClause, never>;
355
356
  from: Schema.Union<[Schema.TaggedStruct<"scope", {
356
- scope: Schema.suspend<{
357
- readonly spaceIds?: readonly string[] | undefined;
358
- readonly allFeedsFromSpaces?: boolean | undefined;
359
- readonly feeds?: readonly string[] | undefined;
357
+ scopes: Schema.Array$<Schema.suspend<{
358
+ readonly _tag: "space";
359
+ readonly spaceId?: string | undefined;
360
+ readonly includeAllFeeds?: boolean | undefined;
361
+ } | {
362
+ readonly _tag: "feed";
363
+ readonly feedUri: string;
364
+ } | {
365
+ readonly _tag: "registry";
366
+ readonly location: "local" | "remote";
360
367
  }, {
361
- readonly allFeedsFromSpaces?: boolean | undefined;
362
- readonly feeds?: readonly string[] | undefined;
363
- readonly spaceIds?: readonly string[] | undefined;
364
- }, never>;
368
+ readonly _tag: "space";
369
+ readonly includeAllFeeds?: boolean | undefined;
370
+ readonly spaceId?: string | undefined;
371
+ } | {
372
+ readonly _tag: "feed";
373
+ readonly feedUri: string;
374
+ } | {
375
+ readonly _tag: "registry";
376
+ readonly location: "local" | "remote";
377
+ }, never>>;
365
378
  }>, Schema.TaggedStruct<"query", {
366
379
  query: Schema.suspend<QueryFilterClause | QueryFromClause | QueryHierarchyTraversalClause | QueryIncomingReferencesClause | QueryLimitClause | QueryOptionsClause | QueryOrderClause | QueryReferenceTraversalClause | QueryRelationClause | QueryRelationTraversalClause | QuerySelectClause | QuerySetDifferenceClause | QueryUnionClause, QueryFilterClause | QueryFromClause | QueryHierarchyTraversalClause | QueryIncomingReferencesClause | QueryLimitClause | QueryOptionsClause | QueryOrderClause | QueryReferenceTraversalClause | QueryRelationClause | QueryRelationTraversalClause | QuerySelectClause | QuerySetDifferenceClause | QueryUnionClause, never>;
367
380
  }>]>;
@@ -385,28 +398,52 @@ export declare const QueryOptions: Schema.Struct<{
385
398
  export interface QueryOptions extends Schema.Schema.Type<typeof QueryOptions> {
386
399
  }
387
400
  /**
388
- * Specifies the scope of the data to query from.
401
+ * Selects from a space (automerge documents).
402
+ * When `spaceId` is omitted, targets the owning space — i.e. the space of whichever
403
+ * database executes the query. This lets callers reference "this space" without
404
+ * having to look up its id.
405
+ * When `includeAllFeeds` is true, also selects from all feeds belonging to that space.
389
406
  */
390
- export declare const Scope: Schema.Struct<{
391
- /**
392
- * The nested select statemets will select from the given spaces.
393
- *
394
- * NOTE: Spaces and feeds are unioned together if both are specified.
395
- */
396
- spaceIds: Schema.optional<Schema.Array$<typeof Schema.String>>;
397
- /**
398
- * If true, the nested select statements will select from all feeds in the spaces specified by `spaceIds`.
399
- */
400
- allFeedsFromSpaces: Schema.optional<typeof Schema.Boolean>;
401
- /**
402
- * The nested select statemets will select from the given feeds (by underlying queue DXN).
403
- *
404
- * NOTE: Spaces and feeds are unioned together if both are specified.
405
- */
406
- feeds: Schema.optional<Schema.Array$<Schema.refine<string, typeof Schema.NonEmptyString>>>;
407
+ export declare const SpaceScope: Schema.TaggedStruct<"space", {
408
+ spaceId: Schema.optional<typeof Schema.String>;
409
+ includeAllFeeds: Schema.optional<typeof Schema.Boolean>;
410
+ }>;
411
+ export interface SpaceScope extends Schema.Schema.Type<typeof SpaceScope> {
412
+ }
413
+ /**
414
+ * Selects from a specific feed (by its underlying queue DXN).
415
+ */
416
+ export declare const FeedScope: Schema.TaggedStruct<"feed", {
417
+ feedUri: typeof Schema.String;
407
418
  }>;
408
- export interface Scope extends Schema.Schema.Type<typeof Scope> {
419
+ export interface FeedScope extends Schema.Schema.Type<typeof FeedScope> {
409
420
  }
421
+ /**
422
+ * Selects from a code-shipped object registry.
423
+ *
424
+ * - `'local'` — the in-process registry attached to the hypergraph.
425
+ * - `'remote'` — a future remote registry service (not yet implemented).
426
+ *
427
+ * To include both, add two separate `RegistryScope` entries to the `scopes` array.
428
+ */
429
+ export declare const RegistryScope: Schema.TaggedStruct<"registry", {
430
+ location: Schema.Literal<["local", "remote"]>;
431
+ }>;
432
+ export interface RegistryScope extends Schema.Schema.Type<typeof RegistryScope> {
433
+ }
434
+ /**
435
+ * Specifies the scope of the data to query from.
436
+ * A `from` clause may carry multiple scopes; results are unioned across them.
437
+ */
438
+ export declare const Scope: Schema.Union<[Schema.TaggedStruct<"space", {
439
+ spaceId: Schema.optional<typeof Schema.String>;
440
+ includeAllFeeds: Schema.optional<typeof Schema.Boolean>;
441
+ }>, Schema.TaggedStruct<"feed", {
442
+ feedUri: typeof Schema.String;
443
+ }>, Schema.TaggedStruct<"registry", {
444
+ location: Schema.Literal<["local", "remote"]>;
445
+ }>]>;
446
+ export type Scope = Schema.Schema.Type<typeof Scope>;
410
447
  export declare const visit: (query: Query, visitor: (node: Query) => void) => void;
411
448
  /**
412
449
  * Recursively transforms a query tree bottom-up.
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../../src/query/ast.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAYxC;;;;GAIG;AAEH,QAAA,MAAM,aAAa;;;;IAOjB;;;OAGG;;IAMH;;OAEG;;;;;;;;IAGH;;OAEG;;IAGH;;;OAGG;;EAIH,CAAC;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,aAAa,CAAC;CAAG;AACjF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAiB,CAAC;AAEvE;;GAEG;AACH,QAAA,MAAM,cAAc;;;;EAIlB,CAAC;AACH,MAAM,WAAW,aAAc,SAAQ,MA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G;;EAEH,CAAC;AAEH,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;EAGrB,CAAC;AACH,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,SAAS;;EAEpB,CAAC;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;EAExB,CAAC;AACH,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,aAAa,CAAC;CAAG;AAElF;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;IAAqD,CAAC;AACxE,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,eAAO,MAAM,KAAK,UAAW,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,SA2BjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,GAAG,UAAW,KAAK,UAAU,CAAC,IAAI,EAAE,KAAK,KAAK,KAAK,KAAG,KA0BlE,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,KAAG,CAAC,EA0BpE,CAAC"}
@@ -1,76 +1,22 @@
1
- import { DXN, type PublicKey } from '@dxos/keys';
2
- import { type ObjectId } from '@dxos/protocols';
3
- import { type Reference as ReferenceProto } from '@dxos/protocols/proto/dxos/echo/model/document';
4
- /**
5
- * Runtime representation of an reference in ECHO.
6
- * Implemented as a DXN, but we might extend it to other URIs in the future.
7
- * @deprecated Use `EncodedReference` instead.
8
- */
9
- export declare class Reference {
10
- private readonly _objectId;
11
- private readonly _protocol?;
12
- private readonly _host?;
13
- private readonly _dxn?;
14
- /**
15
- * Protocol references to runtime registered types.
16
- * @deprecated
17
- */
18
- static TYPE_PROTOCOL: string;
19
- static fromDXN(dxn: DXN): Reference;
20
- static fromValue(value: ReferenceProto): Reference;
21
- /**
22
- * Reference an object in the local space.
23
- */
24
- static localObjectReference(objectId: ObjectId): Reference;
25
- /**
26
- * @deprecated
27
- */
28
- static fromLegacyTypename(type: string): Reference;
29
- /**
30
- * @deprecated
31
- */
32
- static fromObjectIdAndSpaceKey(objectId: ObjectId, spaceKey: PublicKey): Reference;
33
- private constructor();
34
- get dxn(): DXN | undefined;
35
- /**
36
- * @deprecated
37
- */
38
- get objectId(): ObjectId;
39
- /**
40
- * @deprecated
41
- */
42
- get protocol(): string | undefined;
43
- /**
44
- * @deprecated
45
- */
46
- get host(): string | undefined;
47
- encode(): ReferenceProto;
48
- toDXN(): DXN;
49
- }
1
+ import { URI } from '@dxos/keys';
50
2
  export declare const REFERENCE_TYPE_TAG = "dxos.echo.model.document.Reference";
51
3
  /**
52
4
  * Reference as it is stored in Automerge document.
53
5
  */
54
6
  export type EncodedReference = {
55
- '/': string;
7
+ '/': URI.URI;
56
8
  };
57
- /**
58
- * @deprecated Use `EncodedReference.fromDXN` instead.
59
- */
60
- export declare const encodeReference: (reference: Reference) => EncodedReference;
61
- /**
62
- * @deprecated Use `EncodedReference.toDXN` instead.
63
- */
64
- export declare const decodeReference: (value: any) => Reference;
65
- /**
66
- * @deprecated Use `EncodedReference.isEncodedReference` instead.
67
- */
68
9
  export declare const isEncodedReference: (value: any) => value is EncodedReference;
69
10
  export declare const EncodedReference: Readonly<{
70
11
  isEncodedReference: (value: any) => value is EncodedReference;
71
- getReferenceString: (value: EncodedReference) => string;
72
- toDXN: (value: EncodedReference) => DXN;
73
- fromDXN: (dxn: DXN) => EncodedReference;
74
- fromLegacyTypename: (typename: string) => EncodedReference;
12
+ /**
13
+ * Returns the opaque URI stored in the encoded reference (any scheme: `echo:` or `dxn:`).
14
+ * Consumers can narrow with `EID.isEID(uri)` / `DXN.isDXN(uri)`.
15
+ */
16
+ toURI: (value: EncodedReference) => URI.URI;
17
+ /**
18
+ * Creates an encoded reference from an opaque URI.
19
+ */
20
+ fromURI: (uri: URI.URI) => EncodedReference;
75
21
  }>;
76
22
  //# sourceMappingURL=reference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/reference.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,SAAS,IAAI,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAElG;;;;GAIG;AACH,qBAAa,SAAS;IAqDlB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAvDxB;;;OAGG;IACH,MAAM,CAAC,aAAa,SAAc;IAElC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAalC;IAED,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAEjD;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAEzD;IAED;;OAEG;IAEH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAEjD;IAED;;OAEG;IAEH,MAAM,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,CAGjF;IAGD,OAAO,eAMH;IA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