@dxos/echo-query 0.9.0 → 0.9.1-staging.ee54ba693a

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.
@@ -4710,7 +4710,7 @@ declare namespace FastCheck_d_exports {
4710
4710
  export { Arbitrary, ArrayConstraints$1 as ArrayConstraints, AsyncCommand, AsyncPropertyHookFunction, BigIntArrayConstraints, BigIntConstraints$1 as BigIntConstraints, BigUintConstraints, CloneValue, Command, CommandsContraints, ContextValue, DateConstraints$1 as DateConstraints, DepthContext, DepthIdentifier, DepthSize, DictionaryConstraints, DomainConstraints, DoubleConstraints, EmailAddressConstraints, ExecutionStatus, ExecutionTree, FalsyContraints, FalsyValue, Float32ArrayConstraints, Float64ArrayConstraints, FloatConstraints, GeneratorValue, GlobalAsyncPropertyHookFunction, GlobalParameters, GlobalPropertyHookFunction, IAsyncProperty, IAsyncPropertyWithHooks, ICommand, IProperty, IPropertyWithHooks, IRawProperty, IntArrayConstraints, IntegerConstraints, JsonSharedConstraints, JsonValue, LetrecLooselyTypedBuilder, LetrecLooselyTypedTie, LetrecTypedBuilder, LetrecTypedTie, LetrecValue, LoremConstraints, MaybeWeightedArbitrary, Memo, MixedCaseConstraints, ModelRunAsyncSetup, ModelRunSetup, NatConstraints, ObjectConstraints, OneOfConstraints, OneOfValue, OptionConstraints, Parameters$1 as Parameters, PreconditionFailure, PropertyFailure, PropertyHookFunction, Random, RandomType, RecordConstraints, RecordValue, RunDetails, RunDetailsCommon, RunDetailsFailureInterrupted, RunDetailsFailureProperty, RunDetailsFailureTooManySkips, RunDetailsSuccess, Scheduler, SchedulerAct, SchedulerConstraints, SchedulerReportItem, SchedulerSequenceItem, ShuffledSubarrayConstraints, Size, SizeForArbitrary, SparseArrayConstraints, Stream$1 as Stream, StringConstraints$1 as StringConstraints, StringMatchingConstraints, StringSharedConstraints, SubarrayConstraints, UnicodeJsonSharedConstraints, UniqueArrayConstraints, UniqueArrayConstraintsCustomCompare, UniqueArrayConstraintsCustomCompareSelect, UniqueArrayConstraintsRecommended, UniqueArraySharedConstraints, UuidConstraints, Value$1 as Value, VerbosityLevel, WebAuthorityConstraints, WebFragmentsConstraints, WebPathConstraints, WebQueryParametersConstraints, WebSegmentConstraints, WebUrlConstraints, WeightedArbitrary, WithAsyncToStringMethod, WithCloneMethod, WithToStringMethod, __commitHash, __type, __version, anything, array, ascii, asciiString, assert, asyncDefaultReportMessage, asyncModelRun, asyncProperty, asyncStringify, asyncToStringMethod, base64, base64String, bigInt, bigInt64Array, bigIntN, bigUint, bigUint64Array, bigUintN, boolean, char, char16bits, check, clone, cloneIfNeeded, cloneMethod, commands, compareBooleanFunc, compareFunc, configureGlobal, constant, constantFrom, context, createDepthIdentifier, date, defaultReportMessage, dictionary, domain, double, emailAddress, falsy, float, float32Array, float64Array, fullUnicode, fullUnicodeString, func, gen, getDepthContextFor, hasAsyncToStringMethod, hasCloneMethod, hasToStringMethod, hash, hexa, hexaString, infiniteStream, int16Array, int32Array, int8Array, integer, ipV4, ipV4Extended, ipV6, json, jsonValue, letrec, limitShrink, lorem, mapToConstant, maxSafeInteger, maxSafeNat, memo, mixedCase, modelRun, nat, noBias, noShrink, object, oneof, option, pre, property$1 as property, readConfigureGlobal, record, resetConfigureGlobal, sample, scheduledModelRun, scheduler, schedulerFor, shuffledSubarray, sparseArray, statistics, stream, string, string16bits, stringMatching, stringOf, stringify, subarray, toStringMethod, tuple, uint16Array, uint32Array, uint8Array, uint8ClampedArray, ulid, unicode, unicodeJson, unicodeJsonValue, unicodeString, uniqueArray, uuid, uuidV, webAuthority, webFragments, webPath, webQueryParameters, webSegment, webUrl };
4711
4711
  }
4712
4712
  //#endregion
4713
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Arbitrary.d.ts
4713
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Arbitrary.d.ts
4714
4714
  /**
4715
4715
  * @category model
4716
4716
  * @since 3.10.0
@@ -4755,7 +4755,7 @@ interface DateConstraints {
4755
4755
  readonly constraints: DateConstraints$1;
4756
4756
  }
4757
4757
  //#endregion
4758
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Types.d.ts
4758
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Types.d.ts
4759
4759
  /**
4760
4760
  * A utility type that transforms a union type `T` into an intersection type.
4761
4761
  *
@@ -4846,7 +4846,7 @@ declare namespace Contravariant {
4846
4846
  type Type<A$1> = A$1 extends Contravariant<infer U> ? U : never;
4847
4847
  }
4848
4848
  //#endregion
4849
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Equivalence.d.ts
4849
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Equivalence.d.ts
4850
4850
  /**
4851
4851
  * @category type class
4852
4852
  * @since 2.0.0
@@ -4855,7 +4855,7 @@ interface Equivalence<in A$1> {
4855
4855
  (self: A$1, that: A$1): boolean;
4856
4856
  }
4857
4857
  //#endregion
4858
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Hash.d.ts
4858
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Hash.d.ts
4859
4859
  /**
4860
4860
  * @since 2.0.0
4861
4861
  * @category models
@@ -4864,7 +4864,7 @@ interface Hash {
4864
4864
  [symbol](): number;
4865
4865
  }
4866
4866
  //#endregion
4867
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Equal.d.ts
4867
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Equal.d.ts
4868
4868
  /**
4869
4869
  * @since 2.0.0
4870
4870
  * @category models
@@ -4873,7 +4873,7 @@ interface Equal extends Hash {
4873
4873
  [symbol](that: Equal): boolean;
4874
4874
  }
4875
4875
  //#endregion
4876
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Pipeable.d.ts
4876
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Pipeable.d.ts
4877
4877
  /**
4878
4878
  * @since 2.0.0
4879
4879
  * @category Models
@@ -4903,7 +4903,7 @@ interface Pipeable {
4903
4903
  pipe<A$1, B$1 = never, C = never, D = never, E$1 = never, F = never, G = never, H$1 = never, I$1 = never, J = never, K$1 = never, L$1 = never, M = never, N = never, O = never, P$1 = never, Q = never, R$1 = never, S$1 = never, T$1 = never, U$1 = never>(this: A$1, ab: (_: A$1) => B$1, bc: (_: B$1) => C, cd: (_: C) => D, de: (_: D) => E$1, ef: (_: E$1) => F, fg: (_: F) => G, gh: (_: G) => H$1, hi: (_: H$1) => I$1, ij: (_: I$1) => J, jk: (_: J) => K$1, kl: (_: K$1) => L$1, lm: (_: L$1) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P$1, pq: (_: P$1) => Q, qr: (_: Q) => R$1, rs: (_: R$1) => S$1, st: (_: S$1) => T$1, tu: (_: T$1) => U$1): U$1;
4904
4904
  }
4905
4905
  //#endregion
4906
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Unify.d.ts
4906
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Unify.d.ts
4907
4907
  /**
4908
4908
  * @since 2.0.0
4909
4909
  */
@@ -4932,7 +4932,7 @@ declare const ignoreSymbol: unique symbol;
4932
4932
  */
4933
4933
  type ignoreSymbol = typeof ignoreSymbol;
4934
4934
  //#endregion
4935
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Utils.d.ts
4935
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Utils.d.ts
4936
4936
  /**
4937
4937
  * @since 3.0.6
4938
4938
  */
@@ -4949,7 +4949,7 @@ declare class YieldWrap<T$1> {
4949
4949
  [YieldWrapTypeId](): T$1;
4950
4950
  }
4951
4951
  //#endregion
4952
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Option.d.ts
4952
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Option.d.ts
4953
4953
  /**
4954
4954
  * The `Option` data type represents optional values. An `Option<A>` can either
4955
4955
  * be `Some<A>`, containing a value of type `A`, or `None`, representing the
@@ -5050,7 +5050,7 @@ declare namespace Option {
5050
5050
  */
5051
5051
  interface OptionUnifyIgnore {}
5052
5052
  //#endregion
5053
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Context.d.ts
5053
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Context.d.ts
5054
5054
  /**
5055
5055
  * @since 2.0.0
5056
5056
  * @category symbol
@@ -5175,7 +5175,7 @@ interface Context$3<in Services> extends Equal, Pipeable, Inspectable {
5175
5175
  */
5176
5176
  declare const Tag$2: <const Id$1 extends string>(id: Id$1) => <Self, Shape>() => TagClass<Self, Id$1, Shape>;
5177
5177
  //#endregion
5178
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/FiberId.d.ts
5178
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/FiberId.d.ts
5179
5179
  /**
5180
5180
  * @since 2.0.0
5181
5181
  * @category symbols
@@ -5227,7 +5227,7 @@ interface Composite$1 extends Equal, Inspectable {
5227
5227
  readonly right: FiberId;
5228
5228
  }
5229
5229
  //#endregion
5230
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Sink.d.ts
5230
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Sink.d.ts
5231
5231
  /**
5232
5232
  * @since 2.0.0
5233
5233
  * @category symbols
@@ -5283,7 +5283,7 @@ declare namespace Sink {
5283
5283
  }
5284
5284
  }
5285
5285
  //#endregion
5286
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/STM.d.ts
5286
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/STM.d.ts
5287
5287
  /**
5288
5288
  * @since 2.0.0
5289
5289
  * @category symbols
@@ -5402,7 +5402,7 @@ declare namespace STM {
5402
5402
  }
5403
5403
  }
5404
5404
  //#endregion
5405
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Stream.d.ts
5405
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Stream.d.ts
5406
5406
  /**
5407
5407
  * @since 2.0.0
5408
5408
  * @category symbols
@@ -5515,7 +5515,7 @@ declare namespace Stream {
5515
5515
  type DynamicTupleOf<T$1, N extends number, R$1 extends Array<unknown>> = R$1["length"] extends N ? R$1 : DynamicTupleOf<T$1, N, [T$1, ...R$1]>;
5516
5516
  }
5517
5517
  //#endregion
5518
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Channel.d.ts
5518
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Channel.d.ts
5519
5519
  /**
5520
5520
  * @since 2.0.0
5521
5521
  * @category symbols
@@ -5609,7 +5609,7 @@ declare namespace Channel {
5609
5609
  }
5610
5610
  }
5611
5611
  //#endregion
5612
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Cause.d.ts
5612
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Cause.d.ts
5613
5613
  /**
5614
5614
  * A unique symbol identifying the `Cause` type.
5615
5615
  *
@@ -5910,7 +5910,7 @@ declare const NoSuchElementException: new (message?: string | undefined) => NoSu
5910
5910
  */
5911
5911
  declare const UnknownException: new (error: unknown, message?: string | undefined) => UnknownException;
5912
5912
  //#endregion
5913
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Effect.d.ts
5913
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Effect.d.ts
5914
5914
  /**
5915
5915
  * @since 2.0.0
5916
5916
  * @category Symbols
@@ -6140,7 +6140,7 @@ declare const Tag$1: <const Id$1 extends string>(id: Id$1) => <Self, Type$6 exte
6140
6140
  use: <X>(body: (_: Type$6) => X) => [X] extends [Effect$1<infer A, infer E, infer R>] ? Effect$1<A, E, R | Self> : [X] extends [PromiseLike<infer A>] ? Effect$1<A, UnknownException, Self> : Effect$1<X, never, Self>;
6141
6141
  };
6142
6142
  //#endregion
6143
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Inspectable.d.ts
6143
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Inspectable.d.ts
6144
6144
  /**
6145
6145
  * @since 2.0.0
6146
6146
  * @category models
@@ -6151,7 +6151,7 @@ interface Inspectable {
6151
6151
  [NodeInspectSymbol](): unknown;
6152
6152
  }
6153
6153
  //#endregion
6154
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Either.d.ts
6154
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Either.d.ts
6155
6155
  /**
6156
6156
  * @category models
6157
6157
  * @since 2.0.0
@@ -6229,7 +6229,7 @@ declare namespace Either {
6229
6229
  type Right<T$1 extends Either<any, any>> = [T$1] extends [Either<infer _A, infer _E>] ? _A : never;
6230
6230
  }
6231
6231
  //#endregion
6232
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Array.d.ts
6232
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Array.d.ts
6233
6233
  /**
6234
6234
  * @category models
6235
6235
  * @since 2.0.0
@@ -6241,7 +6241,7 @@ type NonEmptyReadonlyArray<A$1> = readonly [A$1, ...Array<A$1>];
6241
6241
  */
6242
6242
  type NonEmptyArray<A$1> = [A$1, ...Array<A$1>];
6243
6243
  //#endregion
6244
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/SchemaAST.d.ts
6244
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/SchemaAST.d.ts
6245
6245
  /**
6246
6246
  * @category model
6247
6247
  * @since 3.10.0
@@ -7053,7 +7053,7 @@ declare class TypeLiteralTransformation {
7053
7053
  constructor(propertySignatureTransformations: ReadonlyArray<PropertySignatureTransformation$1>);
7054
7054
  }
7055
7055
  //#endregion
7056
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/ParseResult.d.ts
7056
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/ParseResult.d.ts
7057
7057
  /**
7058
7058
  * `ParseIssue` is a type that represents the different types of errors that can occur when decoding/encoding a value.
7059
7059
  *
@@ -7225,7 +7225,7 @@ declare class Forbidden {
7225
7225
  constructor(ast: AST, actual: unknown, message?: string | undefined);
7226
7226
  }
7227
7227
  //#endregion
7228
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Pretty.d.ts
7228
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Pretty.d.ts
7229
7229
  /**
7230
7230
  * @category model
7231
7231
  * @since 3.10.0
@@ -7239,7 +7239,7 @@ interface Pretty<To> {
7239
7239
  */
7240
7240
  type PrettyAnnotation<A$1, TypeParameters extends ReadonlyArray<any> = readonly []> = (...pretties: { readonly [K in keyof TypeParameters]: Pretty<TypeParameters[K]> }) => Pretty<A$1>;
7241
7241
  //#endregion
7242
- //#region ../../../../node_modules/.pnpm/effect@3.21.3/node_modules/effect/dist/dts/Schema.d.ts
7242
+ //#region ../../../../node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/dts/Schema.d.ts
7243
7243
  /**
7244
7244
  * @since 3.10.0
7245
7245
  */
@@ -7410,7 +7410,7 @@ declare const Unknown_base: SchemaClass<unknown, unknown, never>;
7410
7410
  * @category primitives
7411
7411
  * @since 3.10.0
7412
7412
  */
7413
- declare class Unknown$3 extends Unknown_base {}
7413
+ declare class Unknown$4 extends Unknown_base {}
7414
7414
  declare const Any_base: SchemaClass<any, any, never>;
7415
7415
  /**
7416
7416
  * @category primitives
@@ -8187,7 +8187,7 @@ declare const FilterObject: Schema<FilterObject>;
8187
8187
  declare const FilterCompare_: Struct<{
8188
8188
  type: Literal<["compare"]>;
8189
8189
  operator: Literal<["eq", "neq", "gt", "gte", "lt", "lte"]>;
8190
- value: typeof Unknown$3;
8190
+ value: typeof Unknown$4;
8191
8191
  }>;
8192
8192
  interface FilterCompare extends Schema.Type<typeof FilterCompare_> {}
8193
8193
  declare const FilterCompare: Schema<FilterCompare>;
@@ -8542,67 +8542,7 @@ declare const Scope: Union<[TaggedStruct<"space", {
8542
8542
  }>]>;
8543
8543
  type Scope = Schema.Type<typeof Scope>;
8544
8544
  //#endregion
8545
- //#region ../echo/dist/types/src/internal/common/types/entity.d.ts
8546
- /**
8547
- * String key used to identify the kind of an entity instance (object or relation).
8548
- */
8549
- declare const KindId$1: '~@dxos/echo/Kind';
8550
- type KindId$1 = typeof KindId$1;
8551
- /**
8552
- * String key used to identify the kind of a schema (object schema or relation schema).
8553
- * Parallels KindId which identifies instance kinds.
8554
- */
8555
- declare const SchemaKindId: '~@dxos/echo/SchemaKind';
8556
- type SchemaKindId = typeof SchemaKindId;
8557
- /**
8558
- * Hidden slot on a static `Type.Type` entity that holds the source Effect
8559
- * Schema. `Type.getSchema(...)` reads this for static types; persisted types
8560
- * rebuild from `jsonSchema` instead. Stored as a string key for declaration
8561
- * portability (see KindId comment above).
8562
- */
8563
- declare const StaticTypeSchemaSlot: '~@dxos/echo/Type.StaticSchema';
8564
- type StaticTypeSchemaSlot = typeof StaticTypeSchemaSlot;
8565
- /**
8566
- * Phantom string key on `Type<A>` entities that carries the instance type `A`.
8567
- * Lets internal helpers (`makeObject`, `createObject`, etc.) pattern-match the
8568
- * instance type from an entity input without importing from the top-level
8569
- * `Type` module. Mirrors `Type.InstancePhantomId` (declared in `Type.ts`).
8570
- *
8571
- * Stored as a string key so declarations remain portable across packages
8572
- * (see KindId comment above).
8573
- */
8574
- declare const InstancePhantomId$1: '~@dxos/echo/Type.Instance';
8575
- type InstancePhantomId$1 = typeof InstancePhantomId$1;
8576
- /**
8577
- * Nominal brand carried by the well-known "any object" / "any relation"
8578
- * schemas (`Obj.Unknown`, `Relation.Unknown`). The brand lets `Ref.Ref`,
8579
- * `Filter.type`, and `Query.type` accept these schemas in addition to
8580
- * `Type.Type` entities, without opening the door to arbitrary raw schemas.
8581
- *
8582
- * Stored as a string key so declarations remain portable across packages
8583
- * (see KindId comment above).
8584
- */
8585
- declare const UnknownTypeSchemaBrandId: '~@dxos/echo/UnknownTypeSchemaBrand';
8586
- type UnknownTypeSchemaBrandId = typeof UnknownTypeSchemaBrandId;
8587
- /**
8588
- * Schema-side companion to `Type.Type` entities for the "any object" /
8589
- * "any relation" cases. Branded so `Ref.Ref` / `Filter.type` / `Query.type`
8590
- * can pattern-match on it; arbitrary `Schema.Schema` values do not satisfy
8591
- * this shape.
8592
- */
8593
- interface UnknownTypeSchema<A$1, K$1 extends EntityKind> extends Schema<A$1, any, never> {
8594
- readonly [UnknownTypeSchemaBrandId]: K$1;
8595
- }
8596
- /**
8597
- * Kinds of entities stored in ECHO: objects, relations, and types.
8598
- */
8599
- declare enum EntityKind {
8600
- Object = "object",
8601
- Relation = "relation",
8602
- Type = "type",
8603
- }
8604
- //#endregion
8605
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/Result.d.ts
8545
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_8e9863696f10bf243333e2648ae3a1f9/node_modules/@effect-atom/atom/dist/dts/Result.d.ts
8606
8546
  type TypeId$4 = "~effect-atom/atom/Result";
8607
8547
  declare const TypeId$4: TypeId$4;
8608
8548
  /**
@@ -8661,7 +8601,7 @@ interface Failure$1<A$1, E$1 = never> extends Result.Proto<A$1, E$1> {
8661
8601
  readonly previousSuccess: Option<Success$1<A$1, E$1>>;
8662
8602
  }
8663
8603
  //#endregion
8664
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/Registry.d.ts
8604
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_8e9863696f10bf243333e2648ae3a1f9/node_modules/@effect-atom/atom/dist/dts/Registry.d.ts
8665
8605
  declare const TypeId$3: TypeId$3;
8666
8606
  type TypeId$3 = "~effect-atom/atom/Registry";
8667
8607
  /**
@@ -8702,7 +8642,7 @@ interface Node<A$1> {
8702
8642
  * @category constructors
8703
8643
  */
8704
8644
  //#endregion
8705
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/Atom.d.ts
8645
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_8e9863696f10bf243333e2648ae3a1f9/node_modules/@effect-atom/atom/dist/dts/Atom.d.ts
8706
8646
  declare const TypeId$2: TypeId$2;
8707
8647
  type TypeId$2 = "~effect-atom/atom/Atom";
8708
8648
  /**
@@ -8785,27 +8725,8 @@ type MaybePromise<T$1> = T$1 | Promise<T$1>;
8785
8725
  */
8786
8726
  type ToMutable<T$1> = T$1 extends object ? { -readonly [K in keyof T$1]: T$1[K] extends readonly (infer U)[] ? U[] : T$1[K] } : T$1;
8787
8727
  //#endregion
8788
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/AtomHttpApi.d.ts
8789
- declare global {
8790
- interface ErrorConstructor {
8791
- stackTraceLimit: number;
8792
- }
8793
- }
8794
- /**
8795
- * @since 1.0.0
8796
- * @category Constructors
8797
- */
8798
- //#endregion
8799
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/AtomRpc.d.ts
8800
- declare global {
8801
- interface ErrorConstructor {
8802
- stackTraceLimit: number;
8803
- }
8804
- }
8805
- /**
8806
- * @since 1.0.0
8807
- * @category Constructors
8808
- */
8728
+ //#region ../../../common/async/dist/types/src/cleanup.d.ts
8729
+ type CleanupFn = () => void;
8809
8730
  //#endregion
8810
8731
  //#region ../../../common/context/dist/types/src/context.d.ts
8811
8732
  type ContextErrorHandler = (error: Error, ctx: Context$1) => void;
@@ -8863,18 +8784,6 @@ declare class Context$1 {
8863
8784
  [Symbol.asyncDispose](): Promise<void>;
8864
8785
  }
8865
8786
  //#endregion
8866
- //#region ../../../common/effect/dist/types/src/internal/json-path.d.ts
8867
- type JsonPath = string & {
8868
- __JsonPath: true;
8869
- };
8870
- /**
8871
- * https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html
8872
- */
8873
- declare const JsonPath: Schema<JsonPath>;
8874
- //#endregion
8875
- //#region ../../../common/async/dist/types/src/cleanup.d.ts
8876
- type CleanupFn = () => void;
8877
- //#endregion
8878
8787
  //#region ../../../common/async/dist/types/src/events.d.ts
8879
8788
  type Effect = () => CleanupFn | undefined;
8880
8789
  interface EventEmitterLike {
@@ -9096,363 +9005,102 @@ interface ReadOnlyEvent<T$1 = void> {
9096
9005
  debounce(timeout?: number): Event$1<void>;
9097
9006
  }
9098
9007
  //#endregion
9099
- //#region ../echo/dist/types/src/internal/JsonSchema/json-schema-type.d.ts
9008
+ //#region ../echo/dist/types/src/internal/common/types/entity.d.ts
9100
9009
  /**
9101
- * Describes a schema for the JSON-schema objects stored in ECHO.
9102
- * Contains extensions for ECHO (e.g., references).
9103
- * Ref: https://json-schema.org/draft-07/schema
9010
+ * String key used to identify the kind of an entity instance (object or relation).
9104
9011
  */
9105
- declare const _JsonSchemaType: Struct<{
9106
- /**
9107
- * Identifier for this schema.
9108
- * This schema might be referenced by $ref clause in other schemas.
9109
- */
9110
- $id: optional<typeof String$>;
9111
- /**
9112
- * Schema of this schema.
9113
- * Set to "https://json-schema.org/draft-07/schema".
9114
- */
9115
- $schema: optional<typeof String$>;
9116
- /**
9117
- * Reference to another schema.
9118
- */
9119
- $ref: optional<typeof String$>;
9120
- /**
9121
- * Comments are ignored when interpreting the schema.
9122
- */
9123
- $comment: optional<typeof String$>;
9124
- /**
9125
- * Defines whether this schema is an object schema or a relation schema.
9126
- */
9127
- entityKind: optional<Enums<typeof EntityKind>>;
9128
- /**
9129
- * Typename of this schema.
9130
- * Only on schema representing an ECHO object.
9131
- *
9132
- * @example 'com.example.type.my-type'
9133
- */
9134
- typename: optional<typeof String$>;
9135
- /**
9136
- * Version of this schema.
9137
- * Custom dialect for ECHO.
9138
- */
9139
- version: optional<typeof String$>;
9140
- /**
9141
- * Target of this relation.
9142
- * Only for relation schemas.
9143
- * The referenced schema must be an object schema.
9144
- */
9145
- relationTarget: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9146
- /**
9147
- * Source of this relation.
9148
- * Only for relation schemas.
9149
- * The referenced schema must be an object schema.
9150
- */
9151
- relationSource: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9152
- /**
9153
- * Title of this schema.
9154
- */
9155
- title: optional<typeof String$>;
9156
- /**
9157
- * Description of this schema.
9158
- */
9159
- description: optional<typeof String$>;
9160
- /**
9161
- * Whether this schema is read-only.
9162
- */
9163
- readOnly: optional<typeof Boolean$>;
9164
- /**
9165
- * Whether this schema is write-only.
9166
- */
9167
- writeOnly: optional<typeof Boolean$>;
9168
- /**
9169
- * Examples of instances of this schema.
9170
- */
9171
- examples: optional<Array$<typeof Any$4>>;
9172
- /**
9173
- * Default value for this schema.
9174
- */
9175
- default: optional<typeof Any$4>;
9176
- /**
9177
- * This schema only matches values that are equal to this value.
9178
- */
9179
- const: optional<typeof Any$4>;
9180
- /**
9181
- * This schema only matches one of the values in this array.
9182
- */
9183
- enum: optional<Array$<typeof Any$4>>;
9184
- /**
9185
- * Base type of the schema.
9186
- */
9187
- type: optional<Union<[Literal<["array", "boolean", "integer", "null", "number", "object", "string"]>, Array$<Literal<["array", "boolean", "integer", "null", "number", "object", "string"]>>]>>;
9188
- multipleOf: optional<filter<typeof Number$>>;
9189
- maximum: optional<typeof Number$>;
9190
- exclusiveMaximum: optional<typeof Number$>;
9191
- minimum: optional<typeof Number$>;
9192
- exclusiveMinimum: optional<typeof Number$>;
9193
- maxLength: optional<filter<typeof Number$>>;
9194
- /**
9195
- * Regex pattern for strings.
9196
- */
9197
- pattern: optional<typeof String$>;
9198
- /**
9199
- * Serialized from {@link FormatAnnotationId}.
9200
- */
9201
- format: optional<typeof String$>;
9202
- minLength: optional<filter<typeof Number$>>;
9203
- items: optional<Union<[suspend<JsonSchemaType, JsonSchemaType, never>, Array$<suspend<JsonSchemaType, JsonSchemaType, never>>]>>;
9204
- additionalItems: optional<Union<[suspend<JsonSchemaType, JsonSchemaType, never>, typeof Boolean$]>>;
9205
- maxItems: optional<filter<typeof Number$>>;
9206
- minItems: optional<filter<typeof Number$>>;
9207
- uniqueItems: optional<typeof Boolean$>;
9208
- contains: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9209
- maxProperties: optional<filter<typeof Number$>>;
9210
- minProperties: optional<filter<typeof Number$>>;
9211
- required: optional<Array$<typeof String$>>;
9212
- /**
9213
- * Non-standard JSON Schema extension.
9214
- * Defines the order of properties in the object.
9215
- * The unmentioned properties are placed at the end.
9216
- *
9217
- * Related: https://github.com/json-schema/json-schema/issues/119
9218
- */
9219
- propertyOrder: optional<Array$<typeof String$>>;
9220
- additionalProperties: optional<Union<[suspend<JsonSchemaType, JsonSchemaType, never>, typeof Boolean$]>>;
9221
- properties: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
9222
- patternProperties: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
9223
- propertyNames: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9224
- definitions: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
9225
- dependencies: optional<Record$<typeof String$, suspend<string | JsonSchemaType | readonly string[], string | JsonSchemaType | readonly string[], never>>>;
9226
- contentMediaType: optional<typeof String$>;
9227
- contentEncoding: optional<typeof String$>;
9228
- if: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9229
- then: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9230
- else: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9231
- allOf: optional<Array$<suspend<JsonSchemaType, JsonSchemaType, never>>>;
9232
- anyOf: optional<Array$<suspend<JsonSchemaType, JsonSchemaType, never>>>;
9233
- oneOf: optional<Array$<suspend<JsonSchemaType, JsonSchemaType, never>>>;
9234
- not: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
9235
- $defs: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
9236
- currency: optional<typeof String$>;
9237
- reference: optional<Struct<{
9238
- schema: suspend<JsonSchemaType, JsonSchemaType, never>;
9239
- schemaVersion: optional<typeof String$>;
9240
- schemaObject: optional<typeof String$>;
9241
- }>>;
9242
- /**
9243
- * ECHO-specific annotations.
9244
- */
9245
- annotations: optional<Struct<{
9246
- /**
9247
- * Label for this schema.
9248
- * Mapped from {@link LabelAnnotationId}.
9249
- */
9250
- labelProp: optional<Union<[Schema<JsonPath, JsonPath, never>, Array$<Schema<JsonPath, JsonPath, never>>]>>;
9251
- /**
9252
- * Generator function for this schema.
9253
- * Mapped from {@link GeneratorAnnotationId}.
9254
- */
9255
- generator: optional<Union<[typeof String$, Tuple2<typeof String$, typeof Number$>]>>;
9256
- /**
9257
- * {@link PropertyMeta} annotations get serialized here.
9258
- */
9259
- meta: optional<Record$<typeof String$, typeof Any$4>>;
9260
- /**
9261
- * @deprecated
9262
- */
9263
- type: optional<Struct<{
9264
- typename: typeof String$;
9265
- version: typeof String$;
9266
- schemaId: optional<typeof String$>;
9267
- }>>;
9268
- /**
9269
- * @deprecated Superseded by `meta`.
9270
- */
9271
- annotations: optional<Record$<typeof String$, typeof Any$4>>;
9272
- }>>;
9273
- /**
9274
- * @deprecated Use `annotations` instead.
9275
- */
9276
- echo: optional<Struct<{
9277
- /**
9278
- * Label for this schema.
9279
- * Mapped from {@link LabelAnnotationId}.
9280
- */
9281
- labelProp: optional<Union<[Schema<JsonPath, JsonPath, never>, Array$<Schema<JsonPath, JsonPath, never>>]>>;
9282
- /**
9283
- * Generator function for this schema.
9284
- * Mapped from {@link GeneratorAnnotationId}.
9285
- */
9286
- generator: optional<Union<[typeof String$, Tuple2<typeof String$, typeof Number$>]>>;
9287
- /**
9288
- * {@link PropertyMeta} annotations get serialized here.
9289
- */
9290
- meta: optional<Record$<typeof String$, typeof Any$4>>;
9291
- /**
9292
- * @deprecated
9293
- */
9294
- type: optional<Struct<{
9295
- typename: typeof String$;
9296
- version: typeof String$;
9297
- schemaId: optional<typeof String$>;
9298
- }>>;
9299
- /**
9300
- * @deprecated Superseded by `meta`.
9301
- */
9302
- annotations: optional<Record$<typeof String$, typeof Any$4>>;
9303
- }>>;
9304
- }>;
9305
- /**
9306
- * https://json-schema.org/draft-07/schema
9307
- */
9308
- interface JsonSchemaType extends Schema.Type<typeof _JsonSchemaType> {}
9309
- declare const JsonSchemaType: Schema<JsonSchemaType>;
9310
- //#endregion
9311
- //#region ../echo/dist/types/src/internal/Entity/entity.d.ts
9312
- type EchoTypeSchemaProps<T$1, ExtraFields = {}> = Simplify$1<AnyEntity & ToMutable<T$1> & ExtraFields>;
9012
+ declare const KindId$1: '~@dxos/echo/Kind';
9013
+ type KindId$1 = typeof KindId$1;
9313
9014
  /**
9314
- * Options accepted by every `Type.makeObject` / `Type.makeRelation` / type-kind
9315
- * factory. Defaults are derived from `(typename, version)` so callers normally
9316
- * pass nothing.
9015
+ * String key used to identify the kind of a schema (object schema or relation schema).
9016
+ * Parallels KindId which identifies instance kinds.
9317
9017
  */
9318
- type EchoTypeOptions = {
9319
- /**
9320
- * Override the entity id stamped on the in-memory `Type.Type` value.
9321
- *
9322
- * Defaults to `EntityId.deterministic(typename, version)` — stable across processes
9323
- * and workerd-safe (no `crypto.getRandomValues()` at module-evaluation time).
9324
- * Pass an explicit id (typically `EntityId.random()`) to opt out of the
9325
- * deterministic default.
9326
- */
9327
- id?: EntityId;
9328
- };
9018
+ declare const SchemaKindId: '~@dxos/echo/SchemaKind';
9019
+ type SchemaKindId = typeof SchemaKindId;
9329
9020
  /**
9330
- * In-memory `Type.Type` entity shape produced by `Type.makeObject(dxn)` /
9331
- * `Type.makeRelation({...})`. A live reactive `TypeSchema` instance
9332
- * identical to a persisted `Type.Type` except for database attachment.
9333
- *
9334
- * NOT a `Schema.Schema`. The underlying Effect Schema is cached on the hidden
9335
- * `StaticTypeSchemaSlot` slot — retrieve it via `Type.getSchema(...)`.
9021
+ * Hidden slot on a static `Type.Type` entity that holds the source Effect
9022
+ * Schema. `Type.getSchema(...)` reads this for static types; persisted types
9023
+ * rebuild from `jsonSchema` instead. Stored as a string key for declaration
9024
+ * portability (see KindId comment above).
9336
9025
  */
9337
- interface EchoTypeSchema<Self extends Schema.Any, ExtraFields = {}, K$1 extends EntityKind = EntityKind, Fields extends Struct.Fields = Struct.Fields> {
9338
- /**
9339
- * Entity-kind brand. Type entities are their own kind (`Type`) regardless of
9340
- * the kind of instance they describe — `[SchemaKindId]` carries the latter.
9341
- * This lets predicates like `Obj.isObject` / `Relation.isRelation` cleanly
9342
- * reject type entities without also having to inspect `[SchemaKindId]`.
9343
- */
9344
- readonly [KindId$1]: EntityKind.Type;
9345
- /** Schema-kind brand indicating what kind of instance this type describes. */
9346
- readonly [SchemaKindId]: K$1;
9347
- /**
9348
- * Entity id. Always present — stamped at construction — but NOT the type's
9349
- * identity while in-memory: an unattached type resolves its URI to the typename
9350
- * DXN, switching to `echo:/<id>` only once attached to a database (see
9351
- * `getTypeURIFromSpecifier`, which discriminates by database attachment).
9352
- */
9353
- readonly id: EntityId;
9354
- /** Source Effect Schema (kept on a hidden slot for `Type.getSchema`). */
9355
- readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
9356
- readonly jsonSchema: JsonSchemaType;
9357
- /** Struct fields for introspection. */
9358
- readonly fields: Fields;
9359
- /** Phantom — instance type produced by `Obj.make(self, ...)`. */
9360
- readonly _instance?: EchoTypeSchemaProps<Schema.Type<Self>, ExtraFields>;
9361
- /**
9362
- * Phantom slot mirroring `Type<A>` so internal helpers (`makeObject`,
9363
- * `createObject`, `Ref.make`) infer the instance type uniformly whether
9364
- * the caller passes an `EchoTypeSchema` or a top-level `Type.Type` entity.
9365
- *
9366
- * Includes the instance-kind brand (`[KindId]`) so the phantom is assignable
9367
- * to the matching public-side interface in `Type.ts` (`Type.Obj` /
9368
- * `Type.Relation` / `Type.Type`). Each kind projects identity: instances of
9369
- * an object-kind schema are object-kind entities, type-kind schemas produce
9370
- * type-kind (persisted Type.Type) entities — the latter additionally carry
9371
- * the `[SchemaKindId]` / `[StaticTypeSchemaSlot]` brands the echo-handler
9372
- * proxy exposes on persisted Type entities.
9373
- */
9374
- readonly [InstancePhantomId$1]?: EchoTypeSchemaProps<Schema.Type<Self>, ExtraFields> & {
9375
- readonly [KindId$1]: K$1;
9376
- } & (K$1 extends EntityKind.Type ? {
9377
- readonly [SchemaKindId]: EntityKind.Type;
9378
- readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
9379
- } : {});
9380
- }
9381
- //#endregion
9382
- //#region ../echo/dist/types/src/internal/Entity/type-kind.d.ts
9026
+ declare const StaticTypeSchemaSlot: '~@dxos/echo/Type.StaticSchema';
9027
+ type StaticTypeSchemaSlot = typeof StaticTypeSchemaSlot;
9383
9028
  /**
9384
- * Type-kind schema marker produced by {@link EchoTypeKindSchema}.
9029
+ * Phantom string key on `Type<A>` entities that carries the instance type `A`.
9030
+ * Lets internal helpers (`makeObject`, `createObject`, etc.) pattern-match the
9031
+ * instance type from an entity input without importing from the top-level
9032
+ * `Type` module. Mirrors `Type.InstancePhantomId` (declared in `Type.ts`).
9385
9033
  *
9386
- * Distinguishes meta-schemas (entities of `EntityKind.Type`, such as the
9387
- * built-in `Type.Type` TypeSchema) from object and relation types.
9388
- */
9389
- type EchoTypeKindSchema<Self extends Schema.Any, Fields extends Struct.Fields = Struct.Fields> = EchoTypeSchema<Self, {}, EntityKind.Type, Fields>;
9390
- /**
9391
- * Pipeable that brands a schema as a type-kind ECHO entity. Mirrors
9392
- * {@link EchoObjectSchema} / {@link EchoRelationSchema}, but stamps the
9393
- * resulting entity with `[SchemaKindId]: EntityKind.Type` and a matching
9394
- * `TypeAnnotation.kind = 'type'` so meta-schemas surface uniformly through
9395
- * `Type.isTypeKind`, `Filter.type`, etc.
9034
+ * Stored as a string key so declarations remain portable across packages
9035
+ * (see KindId comment above).
9396
9036
  */
9397
- declare const EchoTypeKindSchema: {
9398
- (dxn: DXN, options?: EchoTypeOptions): <Self extends Schema.Any, Fields extends Struct.Fields = Struct.Fields>(self: Self & {
9399
- fields?: Fields;
9400
- }) => EchoTypeKindSchema<Self, Fields>;
9401
- };
9402
- //#endregion
9403
- //#region ../echo/dist/types/src/internal/Type/type-schema.d.ts
9037
+ declare const InstancePhantomId$1: '~@dxos/echo/Type.Instance';
9038
+ type InstancePhantomId$1 = typeof InstancePhantomId$1;
9404
9039
  /**
9405
- * Raw struct backing {@link TypeSchema}. Exposed only so `TypeSchema`
9406
- * (the TS type) can derive its data fields via `Schema.Schema.Type<typeof ...>`;
9407
- * runtime callers should use {@link TypeSchema} (the piped, branded entity).
9040
+ * Nominal brand carried by the well-known "any object" / "any relation"
9041
+ * schemas (`Obj.Unknown`, `Relation.Unknown`). The brand lets `Ref.Ref`,
9042
+ * `Filter.type`, and `Query.type` accept these schemas in addition to
9043
+ * `Type.Type` entities, without opening the door to arbitrary raw schemas.
9408
9044
  *
9409
- * `typename` and `version` are NOT data fields they live in `EntityMeta.key` /
9410
- * `EntityMeta.version` (the canonical registry-provenance pair, queryable via
9411
- * `Filter.key(...)`). The same `jsonSchema` payload also embeds them so a
9412
- * standalone JSON-Schema export remains self-describing, but the schema-registry
9413
- * reads/writes them through meta.
9045
+ * Stored as a string key so declarations remain portable across packages
9046
+ * (see KindId comment above).
9414
9047
  */
9415
- declare const TypeSchemaStruct: Struct<{
9416
- name: optional<typeof String$>;
9417
- jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
9418
- }>;
9048
+ declare const UnknownTypeSchemaBrandId: '~@dxos/echo/UnknownTypeSchemaBrand';
9049
+ type UnknownTypeSchemaBrandId = typeof UnknownTypeSchemaBrandId;
9419
9050
  /**
9420
- * Persistent representation of a schema.
9051
+ * Schema-side companion to `Type.Type` entities for the "any object" /
9052
+ * "any relation" cases. Branded so `Ref.Ref` / `Filter.type` / `Query.type`
9053
+ * can pattern-match on it; arbitrary `Schema.Schema` values do not satisfy
9054
+ * this shape.
9421
9055
  */
9422
- declare const TypeSchema: EchoTypeKindSchema<Struct<{
9423
- name: optional<typeof String$>;
9424
- jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
9425
- }>, Readonly<{
9426
- name: optional<typeof String$>;
9427
- jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
9428
- }>>;
9056
+ interface UnknownTypeSchema<A$1, K$1 extends EntityKind> extends Schema<A$1, any, never> {
9057
+ readonly [UnknownTypeSchemaBrandId]: K$1;
9058
+ }
9429
9059
  /**
9430
- * Persistent representation of a schema the runtime shape that
9431
- * `db.addType(Type.makeObjectFromJsonSchema(...))` produces
9432
- * and `Filter.type(Type.Type).run()` returns.
9433
- *
9434
- * Structurally identical to a static `Type.Type` entity: the entity-handler's
9435
- * `get` trap exposes `[SchemaKindId]` (derived from `system.kind` and
9436
- * `data.jsonSchema.entityKind`) and rebuilds `[StaticTypeSchemaSlot]` lazily
9437
- * from `jsonSchema`, so a persisted instance satisfies the public `Type<A>`
9438
- * interface without casting.
9060
+ * Kinds of entities stored in ECHO: objects, relations, and types.
9439
9061
  */
9440
- type TypeSchema = Schema.Type<typeof TypeSchemaStruct> & {
9441
- /** Object identifier — injected by `EchoTypeKindSchema` and stamped at construction. */
9442
- readonly id: string;
9443
- /** Entity-kind discriminator (object/relation/type) carried on every entity instance. */
9444
- readonly [KindId$1]: EntityKind.Type;
9445
- /** Kind of schema described by this meta-instance — always `EntityKind.Type` for `Type.Type` itself. */
9446
- readonly [SchemaKindId]: EntityKind.Type;
9447
- /** Effect Schema rebuilt lazily from `jsonSchema`; satisfies `Type.getSchema(...)` without an extra cast. */
9448
- readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
9449
- };
9062
+ declare enum EntityKind {
9063
+ Object = "object",
9064
+ Relation = "relation",
9065
+ Type = "type",
9066
+ }
9450
9067
  //#endregion
9451
9068
  //#region ../echo/dist/types/src/Relation.d.ts
9452
9069
  type Endpoints$1<Source$1, Target$2> = {
9453
9070
  [Source$1]: Source$1;
9454
9071
  [Target$2]: Target$2;
9455
9072
  };
9073
+ /**
9074
+ * Base type for all ECHO relations.
9075
+ * @private
9076
+ */
9077
+ interface BaseRelation<Source$1, Target$2> extends AnyEntity, Endpoints$1<Source$1, Target$2>, OfKind<EntityKind.Relation> {}
9078
+ /**
9079
+ * Relation with no known properties beyond id, kind, source, and target.
9080
+ * Use this when the relation's schema/properties are not known.
9081
+ *
9082
+ * NOTE: This is a TypeScript type only, not a schema.
9083
+ * To validate that a value is an ECHO relation, use `Relation.isRelation`.
9084
+ */
9085
+ interface Unknown$3 extends BaseRelation<Unknown$1, Unknown$1> {}
9086
+ /**
9087
+ * Runtime Effect schema for any ECHO relation.
9088
+ * Use for validation, parsing, or as a reference target for collections.
9089
+ * A relation has `id`, source, and target fields plus any additional properties.
9090
+ *
9091
+ * NOTE: `Schema.is(Type.Relation)` does STRUCTURAL validation only (checks for `id` field).
9092
+ * Use `Relation.isRelation()` for proper ECHO instance type guards that check the KindId brand.
9093
+ *
9094
+ * @example
9095
+ * ```ts
9096
+ * // Structural type guard (accepts any object with id field)
9097
+ * if (Schema.is(Type.Relation)(unknownValue)) { ... }
9098
+ *
9099
+ * // ECHO instance type guard (checks KindId brand)
9100
+ * if (Relation.isRelation(unknownValue)) { ... }
9101
+ * ```
9102
+ */
9103
+ declare const Unknown$3: UnknownTypeSchema<Unknown$3, typeof Kind.Relation>;
9456
9104
  /**
9457
9105
  * Get relation source type.
9458
9106
  */
@@ -9462,472 +9110,184 @@ type SourceOf<A$1> = A$1 extends Endpoints$1<infer S, infer _T> ? S : never;
9462
9110
  */
9463
9111
  type TargetOf<A$1> = A$1 extends Endpoints$1<infer _S, infer T> ? T : never;
9464
9112
  //#endregion
9465
- //#region ../echo/dist/types/src/Type.d.ts
9113
+ //#region ../echo/dist/types/src/Ref.d.ts
9466
9114
  /**
9467
- * Structural base shared by the three sibling type-entity interfaces
9468
- * ({@link Obj}, {@link Relation}, {@link Type}). NOT exported — callers
9469
- * should constrain on {@link AnyEntity} when they want "any of the three"
9470
- * and on the specific kind interface otherwise.
9115
+ * Instance type for a reference.
9116
+ *
9117
+ * Reference can point to any object or relation.
9118
+ * References are lazy loaded.
9119
+ *
9120
+ * `ref.dxn` is the DXN of the referenced object.
9121
+ *
9122
+ * @example
9123
+ * ```ts
9124
+ * const taskRef: Ref<Task> = Ref.make(task);
9125
+ *
9126
+ * await taskRef.load(); // Returns Promise<Task>
9127
+ * yield* Database.load(taskRef); // Effectful version.
9128
+ *
9129
+ * database.makeRef(dxn); // Create a ref from a DXN.
9130
+ * ```
9471
9131
  */
9472
- interface BaseTypeEntity<A$1> {
9473
- /**
9474
- * Entity-kind brand of the type-entity value itself — always `EntityKind.Type`.
9475
- * The kind of instance the type *describes* lives on `[SchemaKindId]`
9476
- * (Object / Relation / Type). Lets `Obj.isObject` / `Relation.isRelation`
9477
- * reject type entities by a single `[KindId]` check.
9478
- */
9479
- readonly [KindId$1]: EntityKind.Type;
9480
- /**
9481
- * Object id. Like all ECHO entities, type entities always carry an id —
9482
- * stamped at construction for in-memory (static) declarations and assigned by
9483
- * the database once persisted. The id does NOT determine the entity's URI:
9484
- * static types resolve to their typename DXN, persisted types to `echo:/<id>`
9485
- * (see `getTypeURIFromSpecifier`).
9486
- */
9487
- readonly id: EntityId;
9488
- readonly name?: string;
9489
- readonly jsonSchema: JsonSchemaType;
9490
- readonly [InstancePhantomId]?: A$1;
9491
- }
9132
+ type Ref$1<T$1> = Ref<T$1>;
9133
+ type Unknown$2 = Ref<Unknown$1>;
9492
9134
  /**
9493
- * TypeScript type for an ECHO object type a `Type.Type<A>` entity.
9494
- *
9495
- * `T` is the instance type produced by `Obj.make(Foo, props)`. `Fields` is
9496
- * retained as a structural hint (the runtime value still carries `.fields`),
9497
- * but consumers should derive instance/encoded types via `Type.InstanceType`.
9498
- *
9499
- * **Not a `Schema.Schema`.** `Foo.ast` / `Schema.Schema.Type<typeof Foo>` /
9500
- * `Schema.extend(Foo)` no longer typecheck — extract the Effect Schema via
9501
- * `Type.getSchema(Foo)` first, or derive instance types via
9502
- * `Type.InstanceType<typeof Foo>`.
9135
+ * Factory function to create a Ref schema for the given target schema.
9136
+ * Use this in schema definitions to declare reference fields.
9503
9137
  *
9504
9138
  * @example
9505
9139
  * ```ts
9506
- * const Person = Schema.Struct({
9507
- * name: Schema.String,
9508
- * }).pipe(Type.makeObject(DXN.make('com.example.type.person', '0.1.0')));
9509
- *
9510
- * type Person = Type.InstanceType<typeof Person>;
9140
+ * class Task extends Type.makeObject<Task>(DXN.make('com.example.type.task', '0.1.0'))(
9141
+ * Schema.Struct({
9142
+ * assignee: Ref.Ref(Person), // Creates a Ref schema
9143
+ * }),
9144
+ * ) {}
9511
9145
  * ```
9512
9146
  */
9513
- interface Obj$1<T$1, Fields extends Struct.Fields = Struct.Fields> extends BaseTypeEntity<T$1 & OfKind<typeof Kind.Object>> {
9514
- /** Schema-kind brand (object). */
9515
- readonly [SchemaKindId]: EntityKind.Object;
9516
- /** Source Effect Schema — used internally by `Type.getSchema(self)`. */
9517
- readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
9518
- /**
9519
- * The fields defined in the original struct schema.
9520
- * Allows accessing field definitions for introspection.
9521
- */
9522
- readonly fields: Fields;
9523
- }
9524
- /**
9525
- * Type that represents any ECHO object type — a `Type.Type` entity branded
9526
- * with the object entity kind, i.e. what `Type.makeObject(dxn)` produces.
9527
- */
9528
- type AnyObj = Obj$1<unknown>;
9529
- /**
9530
- * ECHO meta-schema entity — stores `{ name?, typename, version, jsonSchema }`.
9531
- * Type-kind sibling of `Type.makeObject(...)` / `Type.makeRelation(...)` outputs.
9532
- * Stored types live under this entity; filter via `Filter.type(Type.Type)`.
9533
- */
9534
- declare const Type$3: Type$3<TypeSchema>;
9147
+ declare const Ref$1: {
9148
+ <S$1 extends AnyObj>(type: S$1): RefSchema$1<InstanceType$1<S$1> & Unknown$1>;
9149
+ <S$1 extends AnyRelation>(type: S$1): RefSchema$1<InstanceType$1<S$1> & Unknown$3>;
9150
+ <T$1 extends Type$1<any>>(type: T$1): RefSchema$1<InstanceType$1<T$1>>;
9151
+ <S$1 extends UnknownTypeSchema<any, any>>(schema: S$1): RefSchema$1<Schema.Type<S$1> & Unknown$1>;
9152
+ };
9535
9153
  /**
9536
- * TypeScript type for an ECHO relation type — a `Type.Type<A>` entity.
9154
+ * TypeScript type for a Ref schema.
9155
+ * This is the type of the SCHEMA itself, not the runtime ref instance.
9156
+ * For the instance type, use `Ref.Ref<T>` from the Ref module.
9537
9157
  *
9538
- * `T` is the instance-property type produced by `Relation.make(...)` (excluding
9539
- * source/target endpoints). `Source` and `Target` are the endpoint types.
9158
+ * @example
9159
+ * ```ts
9160
+ * // Schema type annotation (rarely needed, usually inferred):
9161
+ * const refSchema: Ref.RefSchema<typeof Task> = Ref.Ref(Task);
9540
9162
  *
9541
- * **Not a `Schema.Schema`.** See {@link Obj}'s note.
9163
+ * // Instance type annotation (use Ref.Ref instead):
9164
+ * const refInstance: Ref.Ref<Task> = Ref.make(task);
9165
+ * ```
9542
9166
  */
9543
- interface Relation<T$1, Source$1, Target$2, Fields extends Struct.Fields = Struct.Fields> extends BaseTypeEntity<Endpoints$1<Source$1, Target$2> & T$1 & OfKind<typeof Kind.Relation>> {
9544
- /** Schema-kind brand (relation). */
9545
- readonly [SchemaKindId]: EntityKind.Relation;
9546
- /** Source Effect Schema — used internally by `Type.getSchema(self)`. */
9547
- readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
9548
- /**
9549
- * The fields defined in the original struct schema.
9550
- * Allows accessing field definitions for introspection.
9551
- */
9552
- readonly fields: Fields;
9553
- }
9167
+ interface RefSchema$1<T$1 extends Unknown> extends RefSchema<T$1> {}
9554
9168
  /**
9555
- * Type that represents any ECHO relation type — a `Type.Type` entity branded
9556
- * with the relation entity kind, i.e. what `Type.makeRelation(...)` produces.
9169
+ * Extract reference target.
9557
9170
  */
9558
- type AnyRelation = Relation<unknown, unknown, unknown>;
9171
+ type Target$1<R$1 extends Unknown$2> = R$1 extends Ref<infer T> ? T : never;
9559
9172
  /**
9560
- * Type that represents any ECHO type-kind entity — a `Type.Type` meta-schema
9561
- * value (static `Type.Type` or a persisted draft from `db.addType(...)`).
9562
- * Mirrors {@link AnyObj} / {@link AnyRelation} for the third sibling kind.
9173
+ * Reference resolver.
9563
9174
  */
9564
- type AnyType = Type$3<unknown>;
9175
+ type Resolver = RefResolver;
9176
+ //#endregion
9177
+ //#region ../echo/dist/types/src/Obj.d.ts
9565
9178
  /**
9566
- * Any ECHO type-entity one of the three sibling kinds: object-kind, relation-kind,
9567
- * or type-kind (the meta-schema). APIs that want "any ECHO type" use this union;
9568
- * the underlying Effect Schema is retrieved via `Type.getSchema`.
9179
+ * Base type for all ECHO objects.
9569
9180
  */
9570
- type AnyEntity$1 = AnyObj | AnyRelation | AnyType;
9181
+ interface BaseObj extends AnyEntity, OfKind<typeof Kind.Object> {}
9571
9182
  /**
9572
- * String key used to phantom-carry the instance type produced by a `Type.Type`.
9573
- * Used by `Type.InstanceType<typeof Foo>` to recover the schema instance type
9574
- * since `Type.makeObject(dxn)` does not return a `Schema.Schema`.
9183
+ * Object type with specific properties.
9184
+ */
9185
+ type OfShape<Props$2> = BaseObj & Props$2;
9186
+ /**
9187
+ * Object with no known properties beyond id and kind.
9188
+ * Use this when the object's schema/properties are not known.
9189
+ * For objects with arbitrary properties, use `Obj.AnyProps`.
9575
9190
  *
9576
- * Re-exported from the internal types layer so both `Type.ts` and internal
9577
- * helpers (`makeObject`, `createObject`) reference the same phantom key.
9191
+ * NOTE: This is a TypeScript type only, not a schema.
9192
+ * To validate that a value is an ECHO object, use `Schema.is(Type.Obj)`.
9578
9193
  */
9579
- declare const InstancePhantomId: "~@dxos/echo/Type.Instance";
9580
- type InstancePhantomId = InstancePhantomId$1;
9194
+ interface Unknown$1 extends BaseObj {}
9581
9195
  /**
9582
- * Sibling of {@link Obj} / {@link Relation} for the third ECHO entity kind:
9583
- * **type-kind** entities (meta-schemas). The singleton {@link Type} const is
9584
- * the canonical example — it describes stored type definitions themselves.
9196
+ * Runtime Effect schema for any ECHO object.
9197
+ * Use for validation, parsing, or as a reference target for collections.
9585
9198
  *
9586
- * Not a `Schema.Schema`. Use `Type.getSchema(value)` to obtain the underlying
9587
- * Effect Schema and `Type.update(value, draft => ...)` to mutate.
9199
+ * NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).
9200
+ * Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.
9588
9201
  *
9589
- * `A` is the instance-type phantom — what `Obj.make(value, ...)` would produce.
9590
- * Merged with the `Type` const value via TypeScript declaration merging.
9202
+ * @example
9203
+ * ```ts
9204
+ * // Structural type guard (accepts any object with id field)
9205
+ * if (Schema.is(Type.Obj)(unknownValue)) { ... }
9206
+ *
9207
+ * // ECHO instance type guard (checks KindId brand)
9208
+ * if (Obj.isObject(unknownValue)) { ... }
9209
+ *
9210
+ * // Reference to any object type
9211
+ * class Collection extends Type.makeObject<Collection>(DXN.make('com.example.type.collection', '0.1.0'))(
9212
+ * Schema.Struct({ objects: Schema.Array(Ref.Ref(Obj.Unknown)) }),
9213
+ * ) {}
9214
+ * ```
9591
9215
  */
9592
- interface Type$3<A$1 = unknown> extends BaseTypeEntity<A$1 & OfKind<typeof Kind.Type>> {
9593
- /** Schema-kind brand (type — the meta-schema kind). */
9594
- readonly [SchemaKindId]: EntityKind.Type;
9595
- /** Source Effect Schema — used internally by `Type.getSchema(self)`. */
9596
- readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
9216
+ declare const Unknown$1: UnknownTypeSchema<Unknown$1, typeof Kind.Object>;
9217
+ declare namespace Filter_d_exports {
9218
+ export { Any$3 as Any, ChildOfOptions, Filter, KeyFilterOptions, Props$1 as Props, TextSearchOptions, Type$3 as Type, and, between, childOf, contains, created$1 as created, eq, everything, foreignKeys, fromAst$1 as fromAst, gt, gte, id, in$ as in, is$1 as is, key$1 as key, lt, lte, neq, not, nothing, or, pretty$1 as pretty, props, tag, text, toPredicate, type$2 as type, updated$1 as updated };
9597
9219
  }
9220
+ interface Filter<T$1> {
9221
+ '~Filter': {
9222
+ value: Covariant<T$1>;
9223
+ };
9224
+ 'ast': Filter$1;
9225
+ }
9226
+ type Props$1<T$1> = { [K in keyof T$1 & string]?: Filter<T$1[K]> | T$1[K] };
9227
+ type Any$3 = Filter<any>;
9228
+ type Type$3<F extends Any$3> = F extends Filter<infer T> ? T : never;
9229
+ declare class FilterClass implements Any$3 {
9230
+ readonly ast: Filter$1;
9231
+ private static 'variance';
9232
+ constructor(ast: Filter$1);
9233
+ '~Filter': {
9234
+ value: Covariant<any>;
9235
+ };
9236
+ }
9237
+ declare const is$1: (value: unknown) => value is Any$3;
9238
+ /** Construct a filter from an ast. */
9239
+ declare const fromAst$1: (ast: Filter$1) => Any$3;
9598
9240
  /**
9599
- * Instance type produced by a Type entity.
9600
- *
9601
- * Accepts ONLY {@link AnyEntity} inputs — `Type.Obj`, `Type.Relation`, or
9602
- * `Type.Type`. Raw Effect `Schema.Schema` values are rejected: for those, use
9603
- * `Schema.Schema.Type<typeof Foo>` directly. This separation keeps the type
9604
- * system honest about which values represent ECHO entities versus plain
9605
- * Effect schemas.
9241
+ * Filter that matches all objects.
9242
+ */
9243
+ declare const everything: () => FilterClass;
9244
+ /**
9245
+ * Filter that matches no objects.
9246
+ */
9247
+ declare const nothing: () => FilterClass;
9248
+ declare const id: (...ids: EntityId[]) => Any$3;
9249
+ /**
9250
+ * Filter by type.
9606
9251
  *
9607
- * Dispatches on the entity kind:
9608
- * - `Relation<Props, S, T>` `Endpoints<S,T> & Props & OfKind<Relation>`
9609
- * - `Obj<A>` → `A & OfKind<Object>`
9610
- * - `Type<A>` → `A & OfKind<Type>`
9252
+ * Accepts a `Type.Type` entity (the value produced by `Type.makeObject` /
9253
+ * `Type.makeRelation`), a `Schema.Union` of such entities (for filtering across a
9254
+ * union of ECHO types), or a fully-qualified type URI — an `echo:` EID (stored schema)
9255
+ * or a `dxn:` DXN (static schema). To filter by a bare typename, wrap it: `DXN.make(typename)`.
9611
9256
  */
9612
- type InstanceType$1<T$1 extends AnyEntity$1> = T$1 extends Relation<infer Props, infer Source, infer Target, any> ? Endpoints$1<Source, Target> & Props & OfKind<typeof Kind.Relation> : T$1 extends Obj$1<infer A, any> ? A & OfKind<typeof Kind.Object> : T$1 extends Type$3<infer A> ? A & OfKind<typeof Kind.Type> : never;
9613
- //#endregion
9614
- //#region ../echo/dist/types/src/internal/Ref/ref.d.ts
9615
- declare const RefTypeId: unique symbol;
9257
+ declare const type$2: {
9258
+ <T$1 extends AnyEntity$1>(type: T$1, props?: Props$1<InstanceType$1<T$1>>): Filter<InstanceType$1<T$1>>;
9259
+ <S$1 extends UnknownTypeSchema<any, any>>(schema: S$1, props?: Props$1<Schema.Type<S$1>>): Filter<Schema.Type<S$1>>;
9260
+ <S$1 extends Union<readonly Schema.AnyNoContext[]>>(union: S$1, props?: Props$1<Schema.Type<S$1>>): Filter<Schema.Type<S$1>>;
9261
+ (uri: URI, props?: Props$1<unknown>): Filter<any>;
9262
+ (input: AnyEntity$1 | URI, props?: Props$1<unknown>): Filter<unknown>;
9263
+ };
9616
9264
  /**
9617
- * Reference Schema.
9265
+ * Filter by tag.
9618
9266
  */
9619
- interface RefSchema$1<T$1 extends AnyEntity> extends SchemaClass<Ref<T$1>, EncodedReference> {}
9267
+ declare const tag: (tag: string) => Any$3;
9620
9268
  /**
9621
- * Type of the `Ref` function and extra methods attached to it.
9269
+ * Options for {@link key} filter.
9622
9270
  */
9623
- interface RefFn {
9624
- <S$1 extends AnyEntity$1 | UnknownTypeSchema<any, any> = AnyEntity$1>(schema: S$1): RefSchema$1<S$1 extends AnyType ? AnyEntity$1 : S$1 extends AnyObj | AnyRelation ? InstanceType$1<S$1> : S$1 extends UnknownTypeSchema<infer A, any> ? A : never>;
9625
- /**
9626
- * @returns True if the object is a reference.
9627
- */
9628
- isRef: (obj: unknown) => obj is Ref<any>;
9629
- /**
9630
- * @returns True if the reference points to the given object id.
9631
- */
9632
- hasEntityId: (id: EntityId) => (ref: Ref<any>) => boolean;
9633
- /**
9634
- * @returns True if the schema is a reference schema.
9635
- */
9636
- isRefSchema: (schema: Schema<any, any>) => schema is RefSchema$1<any>;
9637
- /**
9638
- * @returns True if the schema AST is a reference schema.
9639
- */
9640
- isRefSchemaAST: (ast: AST) => boolean;
9641
- /**
9642
- * Constructs a reference that points to the given object.
9643
- */
9644
- make: <T$1 extends AnyEntity>(object: T$1) => Ref<T$1>;
9271
+ type KeyFilterOptions = {
9645
9272
  /**
9646
- * Constructs a reference that points to the object specified by the provided URI
9647
- * (either an `echo:` EID for an object reference or a `dxn:` DXN for a type reference).
9273
+ * Optional semver range expression (e.g. `^1.2.3`, `~2.0.0`, `>=1.0.0 <2.0.0`).
9274
+ * Matches the object's meta `version` field against the range.
9275
+ * If omitted, matches any version (including objects with no version).
9648
9276
  */
9649
- fromURI: (uri: URI) => Ref<any>;
9650
- }
9277
+ version?: string;
9278
+ };
9651
9279
  /**
9652
- * Schema builder for references.
9280
+ * Filter by registry key stored in object meta.
9281
+ *
9282
+ * @example
9283
+ * ```ts
9284
+ * Filter.key('org.example.type.foo');
9285
+ * Filter.key('org.example.type.foo', { version: '^1.2.3' });
9286
+ * ```
9653
9287
  */
9654
- declare const Ref: RefFn;
9288
+ declare const key$1: (key: string, options?: KeyFilterOptions) => Any$3;
9655
9289
  /**
9656
- * Represents materialized reference to a target.
9657
- * This is the data type for the fields marked as ref.
9658
- */
9659
- interface Ref<T$1> extends Pipeable {
9660
- /**
9661
- * Target URI (either an `echo:` EID for an object reference or a `dxn:` DXN for a type reference).
9662
- */
9663
- get uri(): URI;
9664
- /**
9665
- * Returns true if the reference has a target available (inlined or resolver set).
9666
- */
9667
- get isAvailable(): boolean;
9668
- /**
9669
- * @returns The reference target.
9670
- * May return `undefined` if the object is not loaded in the working set.
9671
- * Accessing this property, even if it returns `undefined` will trigger the object to be loaded to the working set.
9672
- */
9673
- get target(): T$1 | undefined;
9674
- /**
9675
- * @returns Promise that will resolves with the target object.
9676
- * Will load the object from disk if it is not present in the working set.
9677
- * @throws If the object is not available locally.
9678
- */
9679
- load(): Promise<T$1>;
9680
- /**
9681
- * @returns Promise that will resolves with the target object or undefined if the object is not loaded locally.
9682
- */
9683
- tryLoad(): Promise<T$1 | undefined>;
9684
- /**
9685
- * Subscribe to the ref's resolution event.
9686
- * The callback fires when the target object becomes available in the working set
9687
- * (e.g. when its document is loaded after sibling-client mutation).
9688
- * Note: the resolver only schedules a notification when the target is requested
9689
- * via {@link target} while it is not yet loaded.
9690
- * @returns Function that unsubscribes the callback.
9691
- */
9692
- onResolved(callback: () => void): () => void;
9693
- /**
9694
- * Do not inline the target object in the reference.
9695
- * Makes .target unavailable unless the reference is connected to a database context.
9696
- *
9697
- * When serialized with toJSON, the difference is between:
9698
- * `{ "/": "dxn:..." }`
9699
- * and
9700
- * `{ "/": "dxn:...", "target": { ... } }`
9701
- *
9702
- * Clones the reference object.
9703
- */
9704
- noInline(): Ref<T$1>;
9705
- /**
9706
- * Read-only atom for the ref target.
9707
- * Resolves once when the target loads; does NOT subscribe to target object mutations.
9708
- * Use `Obj.atom(ref)` if you need reactive snapshots that update on every object mutation.
9709
- */
9710
- get atom(): Atom<T$1 | undefined>;
9711
- /**
9712
- * Serializes the reference to a JSON object.
9713
- * The serialization format is compatible with the IPLD-style encoded references.
9714
- * When a reference has a saved target (i.e. the target or object holding the reference is not in the database),
9715
- * the target is included in the serialized object.
9716
- *
9717
- * Examples:
9718
- * `{ "/": "dxn:..." }`
9719
- * `{ "/": "dxn:...", "target": { ... } }`
9720
- */
9721
- encode(): EncodedReference;
9722
- [RefTypeId]: {
9723
- _T: T$1;
9724
- };
9725
- }
9726
- declare namespace Ref {
9727
- /**
9728
- * Target of the reference.
9729
- */
9730
- type Target<R$1> = R$1 extends Ref<infer U> ? U : never;
9731
- }
9732
- interface RefResolver {
9733
- /**
9734
- * Resolve ref synchronously from the objects in the working set.
9735
- *
9736
- * @param uri
9737
- * @param load If true the resolver should attempt to load the object from disk.
9738
- * @param onLoad Callback to call when the object is loaded.
9739
- */
9740
- resolveSync(uri: URI, load: boolean, onLoad?: () => void): AnyProperties | undefined;
9741
- /**
9742
- * Resolver ref asynchronously.
9743
- */
9744
- resolve(uri: URI): Promise<AnyProperties | undefined>;
9745
- resolveSchema(uri: URI): Promise<Schema.AnyNoContext | undefined>;
9746
- /**
9747
- * Resolve the source `Type.AnyEntity` entity for a type URI. Used by
9748
- * deserialization paths (`Obj.fromJSON`) to set the back-reference accessed
9749
- * via `Obj.getType` / `Entity.getType`. Optional — resolvers that only
9750
- * carry raw schemas may leave this unimplemented; the deserializer falls
9751
- * back to leaving the type entity unset.
9752
- */
9753
- resolveType?(uri: URI): Promise<unknown | undefined>;
9754
- }
9755
- //#endregion
9756
- //#region ../echo/dist/types/src/Ref.d.ts
9757
- /**
9758
- * Instance type for a reference.
9759
- *
9760
- * Reference can point to any object or relation.
9761
- * References are lazy loaded.
9762
- *
9763
- * `ref.dxn` is the DXN of the referenced object.
9764
- *
9765
- * @example
9766
- * ```ts
9767
- * const taskRef: Ref<Task> = Ref.make(task);
9768
- *
9769
- * await taskRef.load(); // Returns Promise<Task>
9770
- * yield* Database.load(taskRef); // Effectful version.
9771
- *
9772
- * database.makeRef(dxn); // Create a ref from a DXN.
9773
- * ```
9774
- */
9775
- type Ref$1<T$1> = Ref<T$1>;
9776
- type Unknown$2 = Ref<Unknown$1>;
9777
- /**
9778
- * Factory function to create a Ref schema for the given target schema.
9779
- * Use this in schema definitions to declare reference fields.
9780
- *
9781
- * @example
9782
- * ```ts
9783
- * const Task = Schema.Struct({
9784
- * assignee: Ref.Ref(Person), // Creates a Ref schema
9785
- * }).pipe(Type.makeObject(DXN.make('com.example.type.task', '0.1.0')));
9786
- * ```
9787
- */
9788
- declare const Ref$1: {
9789
- <S$1 extends AnyObj | AnyRelation>(type: S$1): RefSchema<InstanceType$1<S$1> & Unknown$1>;
9790
- <T$1 extends Type$3<any>>(type: T$1): RefSchema<InstanceType$1<T$1>>;
9791
- <S$1 extends UnknownTypeSchema<any, any>>(schema: S$1): RefSchema<Schema.Type<S$1> & Unknown$1>;
9792
- };
9793
- /**
9794
- * TypeScript type for a Ref schema.
9795
- * This is the type of the SCHEMA itself, not the runtime ref instance.
9796
- * For the instance type, use `Ref.Ref<T>` from the Ref module.
9797
- *
9798
- * @example
9799
- * ```ts
9800
- * // Schema type annotation (rarely needed, usually inferred):
9801
- * const refSchema: Ref.RefSchema<typeof Task> = Ref.Ref(Task);
9802
- *
9803
- * // Instance type annotation (use Ref.Ref instead):
9804
- * const refInstance: Ref.Ref<Task> = Ref.make(task);
9805
- * ```
9806
- */
9807
- interface RefSchema<T$1 extends Unknown> extends RefSchema$1<T$1> {}
9808
- /**
9809
- * Extract reference target.
9810
- */
9811
- type Target$1<R$1 extends Unknown$2> = R$1 extends Ref<infer T> ? T : never;
9812
- /**
9813
- * Reference resolver.
9814
- */
9815
- type Resolver = RefResolver;
9816
- //#endregion
9817
- //#region ../echo/dist/types/src/Obj.d.ts
9818
- /**
9819
- * Base type for all ECHO objects.
9820
- */
9821
- interface BaseObj extends AnyEntity, OfKind<typeof Kind.Object> {}
9822
- /**
9823
- * Object type with specific properties.
9824
- */
9825
- type OfShape<Props$2> = BaseObj & Props$2;
9826
- /**
9827
- * Object with no known properties beyond id and kind.
9828
- * Use this when the object's schema/properties are not known.
9829
- * For objects with arbitrary properties, use `Obj.AnyProps`.
9830
- *
9831
- * NOTE: This is a TypeScript type only, not a schema.
9832
- * To validate that a value is an ECHO object, use `Schema.is(Type.Obj)`.
9833
- */
9834
- interface Unknown$1 extends BaseObj {}
9835
- /**
9836
- * Runtime Effect schema for any ECHO object.
9837
- * Use for validation, parsing, or as a reference target for collections.
9838
- *
9839
- * NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).
9840
- * Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.
9841
- *
9842
- * @example
9843
- * ```ts
9844
- * // Structural type guard (accepts any object with id field)
9845
- * if (Schema.is(Type.Obj)(unknownValue)) { ... }
9846
- *
9847
- * // ECHO instance type guard (checks KindId brand)
9848
- * if (Obj.isObject(unknownValue)) { ... }
9849
- *
9850
- * // Reference to any object type
9851
- * const Collection = Schema.Struct({
9852
- * objects: Schema.Array(Ref.Ref(Obj.Unknown)),
9853
- * }).pipe(Type.makeObject(DXN.make('com.example.type.collection', '0.1.0')));
9854
- * ```
9855
- */
9856
- declare const Unknown$1: UnknownTypeSchema<Unknown$1, typeof Kind.Object>;
9857
- declare namespace Filter_d_exports {
9858
- export { Any$3 as Any, ChildOfOptions, Filter, KeyFilterOptions, Props$1 as Props, TextSearchOptions, Type$2 as Type, and, between, childOf, contains, created$1 as created, eq, everything, foreignKeys, fromAst$1 as fromAst, gt, gte, id, in$ as in, is$1 as is, key$1 as key, lt, lte, neq, not, nothing, or, pretty$1 as pretty, props, tag, text, type$2 as type, updated$1 as updated };
9859
- }
9860
- interface Filter<T$1> {
9861
- '~Filter': {
9862
- value: Covariant<T$1>;
9863
- };
9864
- ast: Filter$1;
9865
- }
9866
- type Props$1<T$1> = { [K in keyof T$1 & string]?: Filter<T$1[K]> | T$1[K] };
9867
- type Any$3 = Filter<any>;
9868
- type Type$2<F extends Any$3> = F extends Filter<infer T> ? T : never;
9869
- declare class FilterClass implements Any$3 {
9870
- readonly ast: Filter$1;
9871
- private static 'variance';
9872
- constructor(ast: Filter$1);
9873
- '~Filter': {
9874
- value: Covariant<any>;
9875
- };
9876
- }
9877
- declare const is$1: (value: unknown) => value is Any$3;
9878
- /** Construct a filter from an ast. */
9879
- declare const fromAst$1: (ast: Filter$1) => Any$3;
9880
- /**
9881
- * Filter that matches all objects.
9882
- */
9883
- declare const everything: () => FilterClass;
9884
- /**
9885
- * Filter that matches no objects.
9886
- */
9887
- declare const nothing: () => FilterClass;
9888
- declare const id: (...ids: EntityId[]) => Any$3;
9889
- /**
9890
- * Filter by type.
9891
- *
9892
- * Accepts a `Type.Type` entity (the value produced by `Type.makeObject` /
9893
- * `Type.makeRelation`), a `Schema.Union` of such entities (for filtering across a
9894
- * union of ECHO types), or a fully-qualified type URI — an `echo:` EID (stored schema)
9895
- * or a `dxn:` DXN (static schema). To filter by a bare typename, wrap it: `DXN.make(typename)`.
9896
- */
9897
- declare const type$2: {
9898
- <T$1 extends AnyEntity$1>(type: T$1, props?: Props$1<InstanceType$1<T$1>>): Filter<InstanceType$1<T$1>>;
9899
- <S$1 extends UnknownTypeSchema<any, any>>(schema: S$1, props?: Props$1<Schema.Type<S$1>>): Filter<Schema.Type<S$1>>;
9900
- <S$1 extends Union<readonly Schema.AnyNoContext[]>>(union: S$1, props?: Props$1<Schema.Type<S$1>>): Filter<Schema.Type<S$1>>;
9901
- (uri: URI, props?: Props$1<unknown>): Filter<any>;
9902
- (input: AnyEntity$1 | URI, props?: Props$1<unknown>): Filter<unknown>;
9903
- };
9904
- /**
9905
- * Filter by tag.
9906
- */
9907
- declare const tag: (tag: string) => Any$3;
9908
- /**
9909
- * Options for {@link key} filter.
9910
- */
9911
- type KeyFilterOptions = {
9912
- /**
9913
- * Optional semver range expression (e.g. `^1.2.3`, `~2.0.0`, `>=1.0.0 <2.0.0`).
9914
- * Matches the object's meta `version` field against the range.
9915
- * If omitted, matches any version (including objects with no version).
9916
- */
9917
- version?: string;
9918
- };
9919
- /**
9920
- * Filter by registry key stored in object meta.
9921
- *
9922
- * @example
9923
- * ```ts
9924
- * Filter.key('org.example.type.foo');
9925
- * Filter.key('org.example.type.foo', { version: '^1.2.3' });
9926
- * ```
9927
- */
9928
- declare const key$1: (key: string, options?: KeyFilterOptions) => Any$3;
9929
- /**
9930
- * Filter by properties.
9290
+ * Filter by properties.
9931
9291
  */
9932
9292
  declare const props: <T$1>(props: Props$1<T$1>) => Filter<T$1>;
9933
9293
  type TextSearchOptions = {
@@ -10007,141 +9367,70 @@ declare const childOf: (parents: Unknown$1 | Unknown$2 | readonly (Unknown$1 | U
10007
9367
  /**
10008
9368
  * Negate the filter.
10009
9369
  */
10010
- declare const not: <F extends Any$3>(filter: F) => Filter<Type$2<F>>;
9370
+ declare const not: <F extends Any$3>(filter: F) => Filter<Type$3<F>>;
10011
9371
  /**
10012
9372
  * Combine filters with a logical AND.
10013
9373
  */
10014
- declare const and: <Filters extends readonly Any$3[]>(...filters: Filters) => Filter<Type$2<Filters[number]>>;
9374
+ declare const and: <Filters extends readonly Any$3[]>(...filters: Filters) => Filter<Type$3<Filters[number]>>;
10015
9375
  /**
10016
9376
  * Combine filters with a logical OR.
10017
9377
  */
10018
- declare const or: <Filters extends readonly Any$3[]>(...filters: Filters) => Filter<Type$2<Filters[number]>>;
9378
+ declare const or: <Filters extends readonly Any$3[]>(...filters: Filters) => Filter<Type$3<Filters[number]>>;
10019
9379
  /**
10020
9380
  * Returns a human-readable string representation of a Filter AST.
10021
9381
  */
10022
9382
  declare const pretty$1: (filter: Any$3) => string;
9383
+ /**
9384
+ * Create a predicate from a filter.
9385
+ */
9386
+ declare const toPredicate: {
9387
+ <T$1 extends Unknown>(filter: Filter<T$1>): (entity: Unknown) => entity is T$1;
9388
+ <T$1 extends Unknown>(entity: Unknown, filter: Filter<T$1>): entity is T$1;
9389
+ };
10023
9390
  //#endregion
10024
9391
  //#region ../echo/dist/types/src/Collection.d.ts
9392
+ declare const Collection_base: ObjClass<Collection, {
9393
+ readonly name?: string | undefined;
9394
+ readonly objects: readonly Ref<Unknown$1>[];
9395
+ }, {}>;
10025
9396
  /**
10026
9397
  * A an ordered set of objects.
10027
9398
  */
10028
- declare const Collection: Obj$1<{
10029
- readonly name?: string | undefined;
10030
- readonly objects: readonly Ref<Unknown$1>[];
10031
- }, Struct.Fields>;
10032
- type Collection = InstanceType$1<typeof Collection>;
9399
+ declare class Collection extends Collection_base {}
10033
9400
  //#endregion
10034
- //#region ../echo/dist/types/src/QueryResult.d.ts
9401
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_8e9863696f10bf243333e2648ae3a1f9/node_modules/@effect-atom/atom/dist/dts/AtomHttpApi.d.ts
9402
+ declare global {
9403
+ interface ErrorConstructor {
9404
+ stackTraceLimit: number;
9405
+ }
9406
+ }
10035
9407
  /**
10036
- * Individual query result entry.
9408
+ * @since 1.0.0
9409
+ * @category Constructors
10037
9410
  */
10038
- type Entry$1<T$1> = {
10039
- id: string;
10040
- /**
10041
- * May not be present for remote results.
10042
- */
10043
- result?: T$1;
10044
- match?: {
10045
- /**
10046
- * Higher means better match.
10047
- */
10048
- rank: number;
10049
- };
10050
- /**
10051
- * Query resolution metadata.
10052
- */
10053
- resolution?: {
10054
- source: 'remote' | 'local' | 'index';
10055
- /**
10056
- * Query resolution time in milliseconds.
10057
- */
10058
- time: number;
10059
- };
10060
- };
10061
- type RunOptions = {
10062
- timeout?: number;
10063
- };
10064
- type SubscriptionOptions = {
10065
- /**
10066
- * Fire the callback immediately.
10067
- */
10068
- fire?: boolean;
10069
- };
10070
- interface QueryResult<T$1> {
10071
- /**
10072
- * Currently available results along with their match metadata.
10073
- */
10074
- readonly entries: Entry$1<T$1>[];
10075
- /**
10076
- * Currently available results.
10077
- */
10078
- readonly results: T$1[];
10079
- /**
10080
- * Returns all known results.
10081
- */
10082
- run(opts?: RunOptions): Promise<T$1[]>;
10083
- /**
10084
- * Returns all known results along with their match metadata.
10085
- */
10086
- runEntries(opts?: RunOptions): Promise<Entry$1<T$1>[]>;
10087
- /**
10088
- * Returns currently available results synchronously.
10089
- */
10090
- runSync(): T$1[];
10091
- /**
10092
- * Returns currently available results synchronously along with their match metadata.
10093
- */
10094
- runSyncEntries(): Entry$1<T$1>[];
10095
- /**
10096
- * Returns first result.
10097
- */
10098
- first(opts?: RunOptions): Promise<T$1>;
10099
- /**
10100
- * Returns first result if there is one.
10101
- */
10102
- firstOrUndefined(opts?: RunOptions): Promise<T$1 | undefined>;
10103
- /**
10104
- * Subscribes to changes in query results.
10105
- */
10106
- subscribe(callback?: (query: QueryResult<T$1>) => void, opts?: SubscriptionOptions): CleanupFn;
10107
- /**
10108
- * Self-updating atom. Updates automatically when query results change.
10109
- *
10110
- * Memoized per QueryResult instance — repeated accesses on the same instance return the same
10111
- * Atom. Safe only when the QueryResult is itself held stable across re-renders (e.g. behind a
10112
- * `useMemo`). It must NOT be used in graph-builder connectors/actions or other atom computes,
10113
- * where `db.query(...)` is called fresh on each re-evaluation: every run constructs a new
10114
- * QueryResult and so a new atom + subscription, leaking the previous ones. Use the memoized
10115
- * {@link atom} family there instead.
10116
- */
10117
- readonly atom: Atom<T$1[]>;
10118
- }
10119
9411
  //#endregion
10120
- //#region ../echo/dist/types/src/Feed.d.ts
9412
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_8e9863696f10bf243333e2648ae3a1f9/node_modules/@effect-atom/atom/dist/dts/AtomRpc.d.ts
9413
+ declare global {
9414
+ interface ErrorConstructor {
9415
+ stackTraceLimit: number;
9416
+ }
9417
+ }
10121
9418
  /**
10122
- * Runtime schema for a Feed object.
10123
- *
10124
- * @example
10125
- * ```ts
10126
- * const feed = Obj.make(Feed.Feed, { name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });
10127
- * ```
9419
+ * @since 1.0.0
9420
+ * @category Constructors
10128
9421
  */
10129
- declare const Feed: Obj$1<{
10130
- readonly name?: string | undefined;
10131
- readonly kind?: string | undefined;
10132
- readonly namespace?: "data" | "trace" | undefined;
10133
- }, Struct.Fields>;
9422
+ //#endregion
9423
+ //#region ../../../common/effect/dist/types/src/internal/json-path.d.ts
9424
+ type JsonPath = string & {
9425
+ __JsonPath: true;
9426
+ };
10134
9427
  /**
10135
- * TypeScript instance type for a Feed object.
9428
+ * https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html
10136
9429
  */
10137
- type Feed = InstanceType$1<typeof Feed>;
9430
+ declare const JsonPath: Schema<JsonPath>;
10138
9431
  //#endregion
10139
9432
  //#region ../echo/dist/types/src/View.d.ts
10140
- /**
10141
- * Views are generated or user-defined projections of a schema's properties.
10142
- * They are used to configure the visual representation of the data.
10143
- */
10144
- declare const ViewSchema: Obj$1<{
9433
+ declare const View_base: ObjClass<View, {
10145
9434
  readonly query: {
10146
9435
  readonly raw?: string | undefined;
10147
9436
  readonly ast: QueryFilterClause | QueryFromClause | QueryHierarchyTraversalClause | QueryIncomingReferencesClause | QueryLimitClause | QueryOptionsClause | QueryOrderClause | QueryReferenceTraversalClause | QueryRelationClause | QueryRelationTraversalClause | QuerySelectClause | QuerySetDifferenceClause | QueryUnionClause;
@@ -10156,9 +9445,12 @@ declare const ViewSchema: Obj$1<{
10156
9445
  }[];
10157
9446
  readonly pivotFieldId?: string | undefined;
10158
9447
  };
10159
- }, Struct.Fields>;
10160
- interface View extends InstanceType$1<typeof ViewSchema> {}
10161
- declare const View: Obj$1<View>;
9448
+ }, {}>;
9449
+ /**
9450
+ * Views are generated or user-defined projections of a schema's properties.
9451
+ * They are used to configure the visual representation of the data.
9452
+ */
9453
+ declare class View extends View_base {}
10162
9454
  //#endregion
10163
9455
  //#region ../echo/dist/types/src/Dataset.d.ts
10164
9456
  /**
@@ -10168,21 +9460,7 @@ declare const View: Obj$1<View>;
10168
9460
  * as `Filter.type(...)` on a union.
10169
9461
  */
10170
9462
  type Dataset = Feed | Collection | View;
10171
- declare const Dataset: Union<[Schema<{
10172
- readonly name?: string | undefined;
10173
- readonly kind?: string | undefined;
10174
- readonly namespace?: "data" | "trace" | undefined;
10175
- } & OfKind<EntityKind.Object>, {
10176
- readonly name?: string | undefined;
10177
- readonly kind?: string | undefined;
10178
- readonly namespace?: "data" | "trace" | undefined;
10179
- } & OfKind<EntityKind.Object>, never>, Schema<{
10180
- readonly name?: string | undefined;
10181
- readonly objects: readonly Ref<Unknown$1>[];
10182
- } & OfKind<EntityKind.Object>, {
10183
- readonly name?: string | undefined;
10184
- readonly objects: readonly Ref<Unknown$1>[];
10185
- } & OfKind<EntityKind.Object>, never>, Schema<View & OfKind<EntityKind.Object>, View & OfKind<EntityKind.Object>, never>]>;
9463
+ declare const Dataset: Union<[Schema<Feed & OfKind<EntityKind.Object>, Feed & OfKind<EntityKind.Object>, never>, Schema<Collection & OfKind<EntityKind.Object>, Collection & OfKind<EntityKind.Object>, never>, Schema<View & OfKind<EntityKind.Object>, View & OfKind<EntityKind.Object>, never>]>;
10186
9464
  declare namespace Order_d_exports {
10187
9465
  export { Any$2 as Any, Order, created, natural, property, rank, updated };
10188
9466
  }
@@ -10190,7 +9468,7 @@ interface Order<T$1> {
10190
9468
  '~Order': {
10191
9469
  value: T$1;
10192
9470
  };
10193
- ast: Order$1;
9471
+ 'ast': Order$1;
10194
9472
  }
10195
9473
  type Any$2 = Order<any>;
10196
9474
  declare const natural: Order<any>;
@@ -10211,7 +9489,7 @@ declare const updated: <T$1>(direction?: OrderDirection) => Order<T$1>;
10211
9489
  */
10212
9490
  declare const created: <T$1>(direction?: OrderDirection) => Order<T$1>;
10213
9491
  declare namespace Query_d_exports {
10214
- export { Any$1 as Any, Query, Type$1 as Type, all, from, fromAst, is, pretty, select, type$1 as type, without };
9492
+ export { Any$1 as Any, Query, Type$2 as Type, all, from, fromAst, is, pretty, select, type$1 as type, without };
10215
9493
  }
10216
9494
  /**
10217
9495
  * All property paths inside T that are references.
@@ -10224,7 +9502,7 @@ interface Query<T$1> {
10224
9502
  '~Query': {
10225
9503
  value: T$1;
10226
9504
  };
10227
- ast: Query$1;
9505
+ 'ast': Query$1;
10228
9506
  /**
10229
9507
  * Filter the current selection based on a filter.
10230
9508
  * @param filter - Filter to select the objects.
@@ -10378,7 +9656,7 @@ interface Query<T$1> {
10378
9656
  'debugLabel'(label: string): Query<T$1>;
10379
9657
  }
10380
9658
  type Any$1 = Query<any>;
10381
- type Type$1<Q extends Any$1> = Q extends Query<infer T> ? T : never;
9659
+ type Type$2<Q extends Any$1> = Q extends Query<infer T> ? T : never;
10382
9660
  declare const is: (value: unknown) => value is Any$1;
10383
9661
  /** Construct a query from an ast. */
10384
9662
  declare const fromAst: (ast: Query$1) => Any$1;
@@ -10387,7 +9665,7 @@ declare const fromAst: (ast: Query$1) => Any$1;
10387
9665
  * @param filter - Filter to select the objects.
10388
9666
  * @returns Query for the selected objects.
10389
9667
  */
10390
- declare const select: <F extends Any$3>(filter: F) => Query<Type$2<F>>;
9668
+ declare const select: <F extends Any$3>(filter: F) => Query<Type$3<F>>;
10391
9669
  /**
10392
9670
  * Query for objects of a given schema.
10393
9671
  * @param schema - Schema of the objects.
@@ -10430,6 +9708,129 @@ declare const from: (...args: [(Database | Database[] | Feed | Feed[] | Any$1 |
10430
9708
  */
10431
9709
  declare const pretty: (query: Any$1) => string;
10432
9710
  //#endregion
9711
+ //#region ../echo/dist/types/src/QueryResult.d.ts
9712
+ /**
9713
+ * Individual query result entry.
9714
+ */
9715
+ type Entry$1<T$1> = {
9716
+ id: string;
9717
+ /**
9718
+ * May not be present for remote results.
9719
+ */
9720
+ result?: T$1;
9721
+ match?: {
9722
+ /**
9723
+ * Higher means better match.
9724
+ */
9725
+ rank: number;
9726
+ };
9727
+ /**
9728
+ * Query resolution metadata.
9729
+ */
9730
+ resolution?: {
9731
+ source: 'remote' | 'local' | 'index';
9732
+ /**
9733
+ * Query resolution time in milliseconds.
9734
+ */
9735
+ time: number;
9736
+ };
9737
+ };
9738
+ type RunOptions = {
9739
+ timeout?: number;
9740
+ };
9741
+ type SubscriptionOptions = {
9742
+ /**
9743
+ * Fire the callback immediately.
9744
+ */
9745
+ fire?: boolean;
9746
+ };
9747
+ interface QueryResult<T$1> {
9748
+ /**
9749
+ * Currently available results along with their match metadata.
9750
+ */
9751
+ readonly entries: Entry$1<T$1>[];
9752
+ /**
9753
+ * Currently available results.
9754
+ */
9755
+ readonly results: T$1[];
9756
+ /**
9757
+ * Returns all known results.
9758
+ */
9759
+ run(opts?: RunOptions): Promise<T$1[]>;
9760
+ /**
9761
+ * Returns all known results along with their match metadata.
9762
+ */
9763
+ runEntries(opts?: RunOptions): Promise<Entry$1<T$1>[]>;
9764
+ /**
9765
+ * Returns currently available results synchronously.
9766
+ */
9767
+ runSync(): T$1[];
9768
+ /**
9769
+ * Returns currently available results synchronously along with their match metadata.
9770
+ */
9771
+ runSyncEntries(): Entry$1<T$1>[];
9772
+ /**
9773
+ * Returns first result.
9774
+ */
9775
+ first(opts?: RunOptions): Promise<T$1>;
9776
+ /**
9777
+ * Returns first result if there is one.
9778
+ */
9779
+ firstOrUndefined(opts?: RunOptions): Promise<T$1 | undefined>;
9780
+ /**
9781
+ * Subscribes to changes in query results.
9782
+ */
9783
+ subscribe(callback?: (query: QueryResult<T$1>) => void, opts?: SubscriptionOptions): CleanupFn;
9784
+ /**
9785
+ * Self-updating atom. Updates automatically when query results change.
9786
+ *
9787
+ * Memoized per QueryResult instance — repeated accesses on the same instance return the same
9788
+ * Atom. Safe only when the QueryResult is itself held stable across re-renders (e.g. behind a
9789
+ * `useMemo`). It must NOT be used in graph-builder connectors/actions or other atom computes,
9790
+ * where `db.query(...)` is called fresh on each re-evaluation: every run constructs a new
9791
+ * QueryResult and so a new atom + subscription, leaking the previous ones. Use the memoized
9792
+ * {@link atom} family there instead.
9793
+ */
9794
+ readonly atom: Atom<T$1[]>;
9795
+ }
9796
+ //#endregion
9797
+ //#region ../echo/dist/types/src/Feed.d.ts
9798
+ declare const Feed_base: ObjClass<Feed, {
9799
+ readonly name?: string | undefined;
9800
+ readonly kind?: string | undefined;
9801
+ readonly namespace?: "data" | "trace" | undefined;
9802
+ }, {}>;
9803
+ /**
9804
+ * Runtime schema for a Feed object.
9805
+ *
9806
+ * @example
9807
+ * ```ts
9808
+ * const feed = Obj.make(Feed.Feed, { name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });
9809
+ * ```
9810
+ */
9811
+ declare class Feed extends Feed_base {}
9812
+ /**
9813
+ * Sync options for a feed.
9814
+ */
9815
+ interface SyncOptions {
9816
+ /** Push local changes to the server. Defaults to true. */
9817
+ shouldPush?: boolean;
9818
+ /** Pull remote changes from the server. Defaults to true. */
9819
+ shouldPull?: boolean;
9820
+ }
9821
+ /**
9822
+ * Queue replication backlog for a feed namespace.
9823
+ * `0` / `0` means caught up on pull and push.
9824
+ */
9825
+ interface SyncState {
9826
+ /** Blocks still to pull from remote. */
9827
+ blocksToPull: number;
9828
+ /** Unpositioned blocks still to push to remote. */
9829
+ blocksToPush: number;
9830
+ /** Total blocks stored locally for the feed namespace. */
9831
+ totalBlocks: number;
9832
+ }
9833
+ //#endregion
10433
9834
  //#region ../echo/dist/types/src/Registry.d.ts
10434
9835
  /**
10435
9836
  * Identifier denoting an ECHO Registry.
@@ -10443,7 +9844,7 @@ type TypeId$1 = typeof TypeId$1;
10443
9844
  * A registry may delegate to an optional upstream registry: results from the local
10444
9845
  * registry take precedence and upstream results fill in anything not found locally.
10445
9846
  *
10446
- * Intended use cases include caches of schemas, operations, blueprints, routines, plugins,
9847
+ * Intended use cases include caches of schemas, operations, skills, routines, plugins,
10447
9848
  * etc., sourced from 3rd-party plugins, local code, or local space objects.
10448
9849
  *
10449
9850
  * Types (schema-definition entities produced by `Type.makeObject` / `Type.makeRelation`) are
@@ -10481,230 +9882,969 @@ interface Registry {
10481
9882
  */
10482
9883
  add(entities: readonly Unknown[]): void;
10483
9884
  /**
10484
- * Remove an entity by id from the local registry.
10485
- * @returns true if an entity was removed, false if it was not found.
9885
+ * Remove an entity by id from the local registry.
9886
+ * @returns true if an entity was removed, false if it was not found.
9887
+ */
9888
+ remove(id: string): boolean;
9889
+ /**
9890
+ * Remove all locally-stored entities.
9891
+ * Does not affect the upstream registry.
9892
+ */
9893
+ clear(): void;
9894
+ /**
9895
+ * Get an entity by id.
9896
+ * Searches the local registry first, then falls back to the upstream registry.
9897
+ */
9898
+ get(id: string): Unknown | undefined;
9899
+ /**
9900
+ * Get an entity by one of its addressing URIs — a type entity by its typename DXN (or, when
9901
+ * persisted, its identifier EID), a keyed entity by its `dxn:<key>[:<version>]`. Accepts legacy
9902
+ * DXN forms (normalized internally). Searches the local registry first, then falls back to the
9903
+ * upstream registry. Narrow the result with `Type.isType` when a type entity is required.
9904
+ */
9905
+ getByURI(uri: string): Unknown | undefined;
9906
+ /**
9907
+ * List all entities.
9908
+ * Local entities take precedence over upstream entities with the same id.
9909
+ */
9910
+ list(): Unknown[];
9911
+ /**
9912
+ * Run an ECHO query against the registry's entities (implements {@link Database.Queryable}).
9913
+ *
9914
+ * Matching happens in-memory over {@link list}. Scope (`from`) clauses are unwrapped and
9915
+ * ignored — a direct registry query always targets the registry's own entities. The primary
9916
+ * way to query registry contents is still through the database (`db.query(...).from(Scope.registry())`),
9917
+ * which fans the database and registry together; this method is for querying a registry directly.
9918
+ *
9919
+ * Only locally-evaluable AST nodes are supported: `select`, `filter`, `limit`, `from`, `options`,
9920
+ * and boolean combinators. Server-side concerns (order, traversal, text/timestamp filters) throw.
9921
+ */
9922
+ query: QueryFn;
9923
+ }
9924
+ //#endregion
9925
+ //#region ../echo/dist/types/src/Hypergraph.d.ts
9926
+ /**
9927
+ * Resolution context.
9928
+ * Affects how non-absolute DXNs are resolved.
9929
+ */
9930
+ interface RefResolutionContext {
9931
+ /**
9932
+ * Space that the resolution is happening from.
9933
+ */
9934
+ space?: SpaceId;
9935
+ /**
9936
+ * Feed that the resolution is happening from.
9937
+ * This feed will be searched first, and then the space it belongs to.
9938
+ */
9939
+ feed?: URI;
9940
+ }
9941
+ interface RefResolverOptions {
9942
+ /**
9943
+ * Resolution context.
9944
+ * Affects how non-absolute DXNs are resolved.
9945
+ */
9946
+ context?: RefResolutionContext;
9947
+ }
9948
+ /**
9949
+ * Manages cross-space database interactions.
9950
+ */
9951
+ interface Hypergraph extends Queryable {
9952
+ /**
9953
+ * In-process registry of keyed objects and static schema types.
9954
+ * Populated at startup via `registry.add(objects)` / `registry.add(schemas)`.
9955
+ * Queries that include no explicit from() clause will fan out to this registry automatically.
9956
+ */
9957
+ get registry(): Registry;
9958
+ /**
9959
+ * Query objects.
9960
+ */
9961
+ query: QueryFn;
9962
+ /**
9963
+ * Creates a reference to an existing object in the database.
9964
+ *
9965
+ * NOTE: The reference may be dangling if the object is not present in the database.
9966
+ * NOTE: Difference from `Ref.fromURI`
9967
+ * `Ref.fromURI(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.
9968
+ * `db.makeRef(dxn)` is preferable in cases with access to the database.
9969
+ */
9970
+ makeRef<T$1 extends Unknown = Unknown>(uri: URI): Ref$1<T$1>;
9971
+ /**
9972
+ * Create a resolver that dereferences `Ref`s against this graph. Persisted schema objects are
9973
+ * surfaced as their registered `Type.Type` entity.
9974
+ */
9975
+ createRefResolver(options: RefResolverOptions): Resolver;
9976
+ /**
9977
+ * Get a database by space ID.
9978
+ * @returns The database for the given space ID, or undefined if not found.
9979
+ */
9980
+ getDatabase(spaceId: SpaceId): Database | undefined;
9981
+ }
9982
+ //#endregion
9983
+ //#region ../echo/dist/types/src/Database.d.ts
9984
+ /**
9985
+ * `query` API function declaration.
9986
+ */
9987
+ interface QueryFn {
9988
+ <Q extends Any$1>(query: Q): QueryResult<Type$2<Q>>;
9989
+ <F extends Any$3>(filter: F): QueryResult<Type$3<F>>;
9990
+ }
9991
+ /**
9992
+ * Common interface for Database, Feed, and Hypergraph.
9993
+ */
9994
+ interface Queryable {
9995
+ query: QueryFn;
9996
+ }
9997
+ type GetObjectByIdOptions = {
9998
+ deleted?: boolean;
9999
+ };
10000
+ type ObjectPlacement = 'root-doc' | 'linked-doc';
10001
+ type AddOptions = {
10002
+ /**
10003
+ * Where to place the object in the Automerge document tree.
10004
+ * Root document is always loaded with the space.
10005
+ * Linked documents are loaded lazily.
10006
+ * Placing large number of objects in the root document may slow down the initial load.
10007
+ *
10008
+ * @default 'linked-doc'
10009
+ */
10010
+ placeIn?: ObjectPlacement;
10011
+ };
10012
+ /**
10013
+ * Rejects Type entities from {@link Database.add} at compile time via their `[KindId]` brand. Used
10014
+ * as `T & RejectTypeEntity<T>` to preserve inference of `T`. Bounding `add` on
10015
+ * `Obj.Unknown | Relation.Unknown` instead would reject broadly-typed instance adds (e.g.
10016
+ * `Entity.Any`, `Obj.OfShape<T>`), forcing casts repo-wide.
10017
+ */
10018
+ type RejectTypeEntity<T$1> = T$1 extends {
10019
+ readonly [KindId$1]: EntityKind.Type;
10020
+ } ? {
10021
+ __error: 'Type entities must be persisted via db.addType(), not db.add().';
10022
+ } : T$1;
10023
+ type FlushOptions = {
10024
+ /**
10025
+ * Write any pending changes to disk.
10026
+ * @default true
10027
+ */
10028
+ disk?: boolean;
10029
+ /**
10030
+ * Wait for pending index updates.
10031
+ * @default true
10032
+ */
10033
+ indexes?: boolean;
10034
+ /**
10035
+ * Flush pending updates to objects and queries.
10036
+ * @default false
10037
+ */
10038
+ updates?: boolean;
10039
+ };
10040
+ /**
10041
+ * Identifier denoting an ECHO Database.
10042
+ */
10043
+ declare const TypeId: unique symbol;
10044
+ type TypeId = typeof TypeId;
10045
+ /**
10046
+ * ECHO Database interface.
10047
+ */
10048
+ interface Database extends Queryable {
10049
+ readonly [TypeId]: TypeId;
10050
+ get spaceId(): SpaceId;
10051
+ get graph(): Hypergraph;
10052
+ /**
10053
+ * Registry for this database. Delegates type lookups to the shared hypergraph registry.
10054
+ * To persist a schema so it replicates to other clients, add the type entity with
10055
+ * {@link addType} (e.g. `await db.addType(Type.makeObjectFromJsonSchema(...))`).
10056
+ */
10057
+ readonly registry: Registry;
10058
+ toJSON(): object;
10059
+ /**
10060
+ * Return object by local ID.
10061
+ * @deprecated Use `db.query(Filter.id(id)).runSync()[0]` for a working-set lookup, or resolve via a {@link Ref}.
10062
+ */
10063
+ getObjectById<T$1 extends Unknown$1 = OfShape<AnyProperties>>(id: string, opts?: GetObjectByIdOptions): T$1 | undefined;
10064
+ /**
10065
+ * Query objects.
10066
+ */
10067
+ query: QueryFn;
10068
+ /**
10069
+ * Creates a reference to an existing object in the database.
10070
+ *
10071
+ * NOTE: The reference may be dangling if the object is not present in the database.
10072
+ * NOTE: Difference from `Ref.fromURI`
10073
+ * `Ref.fromURI(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.
10074
+ * `db.makeRef(dxn)` is preferable in cases with access to the database.
10075
+ */
10076
+ makeRef<T$1 extends Unknown = Unknown>(uri: URI): Ref<T$1>;
10077
+ /**
10078
+ * Adds an object or relation to the database.
10079
+ *
10080
+ * Only Object and Relation entities are accepted. To persist a Type definition use
10081
+ * {@link addType} — passing a Type entity is rejected at compile time (and at runtime).
10082
+ */
10083
+ add<T$1 extends Unknown = Unknown>(obj: T$1 & RejectTypeEntity<T$1>, opts?: AddOptions): T$1;
10084
+ /**
10085
+ * Persists a Type definition (clones/forks the entity) so it replicates to other peers.
10086
+ *
10087
+ * Runs a conflict query first: if a type with the same typename + version already exists in
10088
+ * this space, the existing persisted entity is returned and no duplicate is created. This is
10089
+ * the only supported way to add Type entities — {@link add} rejects them.
10090
+ */
10091
+ addType<T$1 extends AnyEntity$1>(type: T$1): Promise<T$1>;
10092
+ /**
10093
+ * Removes object from the database.
10094
+ */
10095
+ remove(obj: Unknown): void;
10096
+ /**
10097
+ * Appends entities to a feed.
10098
+ *
10099
+ * The feed must already be stored in the database (added via {@link add}); its underlying
10100
+ * queue is addressed by the feed object's URI.
10101
+ */
10102
+ appendToFeed(feed: Feed, entities: Unknown[]): Promise<void>;
10103
+ /**
10104
+ * Removes entities from a feed.
10105
+ */
10106
+ deleteFromFeed(feed: Feed, entities: Unknown[]): Promise<void>;
10107
+ /**
10108
+ * Wait for all pending changes to be saved to disk.
10109
+ * Optionaly waits for changes to be propagated to indexes and event handlers.
10110
+ */
10111
+ flush(opts?: FlushOptions): Promise<void>;
10112
+ /**
10113
+ * Removes feed items by ID.
10114
+ */
10115
+ removeFeedItemsByIds(feed: Feed, ids: string[]): Promise<void>;
10116
+ /**
10117
+ * Queries items in a feed associated with this database.
10118
+ */
10119
+ queryFeed(feed: Feed, queryOrFilter: Any$1 | Any$3): QueryResult<any>;
10120
+ /**
10121
+ * Syncs a feed with the server.
10122
+ */
10123
+ syncFeed(feed: Feed, options?: SyncOptions): Promise<void>;
10124
+ /**
10125
+ * Returns queue replication backlog for the feed's namespace.
10126
+ */
10127
+ getFeedSyncState(feed: Feed): Promise<SyncState>;
10128
+ }
10129
+ declare const Database: Schema<Database>;
10130
+ //#endregion
10131
+ //#region ../echo/dist/types/src/internal/JsonSchema/json-schema-type.d.ts
10132
+ /**
10133
+ * Describes a schema for the JSON-schema objects stored in ECHO.
10134
+ * Contains extensions for ECHO (e.g., references).
10135
+ * Ref: https://json-schema.org/draft-07/schema
10136
+ */
10137
+ declare const _JsonSchemaType: Struct<{
10138
+ /**
10139
+ * Identifier for this schema.
10140
+ * This schema might be referenced by $ref clause in other schemas.
10141
+ */
10142
+ $id: optional<typeof String$>;
10143
+ /**
10144
+ * Schema of this schema.
10145
+ * Set to "https://json-schema.org/draft-07/schema".
10146
+ */
10147
+ $schema: optional<typeof String$>;
10148
+ /**
10149
+ * Reference to another schema.
10150
+ */
10151
+ $ref: optional<typeof String$>;
10152
+ /**
10153
+ * Comments are ignored when interpreting the schema.
10154
+ */
10155
+ $comment: optional<typeof String$>;
10156
+ /**
10157
+ * Defines whether this schema is an object schema or a relation schema.
10158
+ */
10159
+ entityKind: optional<Enums<typeof EntityKind>>;
10160
+ /**
10161
+ * Typename of this schema.
10162
+ * Only on schema representing an ECHO object.
10163
+ *
10164
+ * @example 'com.example.type.my-type'
10165
+ */
10166
+ typename: optional<typeof String$>;
10167
+ /**
10168
+ * Version of this schema.
10169
+ * Custom dialect for ECHO.
10170
+ */
10171
+ version: optional<typeof String$>;
10172
+ /**
10173
+ * Target of this relation.
10174
+ * Only for relation schemas.
10175
+ * The referenced schema must be an object schema.
10176
+ */
10177
+ relationTarget: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10178
+ /**
10179
+ * Source of this relation.
10180
+ * Only for relation schemas.
10181
+ * The referenced schema must be an object schema.
10182
+ */
10183
+ relationSource: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10184
+ /**
10185
+ * Title of this schema.
10186
+ */
10187
+ title: optional<typeof String$>;
10188
+ /**
10189
+ * Description of this schema.
10190
+ */
10191
+ description: optional<typeof String$>;
10192
+ /**
10193
+ * Whether this schema is read-only.
10194
+ */
10195
+ readOnly: optional<typeof Boolean$>;
10196
+ /**
10197
+ * Whether this schema is write-only.
10198
+ */
10199
+ writeOnly: optional<typeof Boolean$>;
10200
+ /**
10201
+ * Examples of instances of this schema.
10202
+ */
10203
+ examples: optional<Array$<typeof Any$4>>;
10204
+ /**
10205
+ * Default value for this schema.
10206
+ */
10207
+ default: optional<typeof Any$4>;
10208
+ /**
10209
+ * This schema only matches values that are equal to this value.
10210
+ */
10211
+ const: optional<typeof Any$4>;
10212
+ /**
10213
+ * This schema only matches one of the values in this array.
10214
+ */
10215
+ enum: optional<Array$<typeof Any$4>>;
10216
+ /**
10217
+ * Base type of the schema.
10218
+ */
10219
+ type: optional<Union<[Literal<["array", "boolean", "integer", "null", "number", "object", "string"]>, Array$<Literal<["array", "boolean", "integer", "null", "number", "object", "string"]>>]>>;
10220
+ multipleOf: optional<filter<typeof Number$>>;
10221
+ maximum: optional<typeof Number$>;
10222
+ exclusiveMaximum: optional<typeof Number$>;
10223
+ minimum: optional<typeof Number$>;
10224
+ exclusiveMinimum: optional<typeof Number$>;
10225
+ maxLength: optional<filter<typeof Number$>>;
10226
+ /**
10227
+ * Regex pattern for strings.
10228
+ */
10229
+ pattern: optional<typeof String$>;
10230
+ /**
10231
+ * Serialized from {@link FormatAnnotationId}.
10232
+ */
10233
+ format: optional<typeof String$>;
10234
+ minLength: optional<filter<typeof Number$>>;
10235
+ items: optional<Union<[suspend<JsonSchemaType, JsonSchemaType, never>, Array$<suspend<JsonSchemaType, JsonSchemaType, never>>]>>;
10236
+ additionalItems: optional<Union<[suspend<JsonSchemaType, JsonSchemaType, never>, typeof Boolean$]>>;
10237
+ maxItems: optional<filter<typeof Number$>>;
10238
+ minItems: optional<filter<typeof Number$>>;
10239
+ uniqueItems: optional<typeof Boolean$>;
10240
+ contains: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10241
+ maxProperties: optional<filter<typeof Number$>>;
10242
+ minProperties: optional<filter<typeof Number$>>;
10243
+ required: optional<Array$<typeof String$>>;
10244
+ /**
10245
+ * Non-standard JSON Schema extension.
10246
+ * Defines the order of properties in the object.
10247
+ * The unmentioned properties are placed at the end.
10248
+ *
10249
+ * Related: https://github.com/json-schema/json-schema/issues/119
10250
+ */
10251
+ propertyOrder: optional<Array$<typeof String$>>;
10252
+ additionalProperties: optional<Union<[suspend<JsonSchemaType, JsonSchemaType, never>, typeof Boolean$]>>;
10253
+ properties: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
10254
+ patternProperties: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
10255
+ propertyNames: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10256
+ definitions: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
10257
+ dependencies: optional<Record$<typeof String$, suspend<string | JsonSchemaType | readonly string[], string | JsonSchemaType | readonly string[], never>>>;
10258
+ contentMediaType: optional<typeof String$>;
10259
+ contentEncoding: optional<typeof String$>;
10260
+ if: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10261
+ then: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10262
+ else: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10263
+ allOf: optional<Array$<suspend<JsonSchemaType, JsonSchemaType, never>>>;
10264
+ anyOf: optional<Array$<suspend<JsonSchemaType, JsonSchemaType, never>>>;
10265
+ oneOf: optional<Array$<suspend<JsonSchemaType, JsonSchemaType, never>>>;
10266
+ not: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
10267
+ $defs: optional<Record$<typeof String$, suspend<JsonSchemaType, JsonSchemaType, never>>>;
10268
+ currency: optional<typeof String$>;
10269
+ reference: optional<Struct<{
10270
+ schema: suspend<JsonSchemaType, JsonSchemaType, never>;
10271
+ schemaVersion: optional<typeof String$>;
10272
+ schemaObject: optional<typeof String$>;
10273
+ }>>;
10274
+ /**
10275
+ * ECHO-specific annotations.
10276
+ */
10277
+ annotations: optional<Struct<{
10278
+ /**
10279
+ * Label for this schema.
10280
+ * Mapped from {@link LabelAnnotationId}.
10281
+ */
10282
+ labelProp: optional<Union<[Schema<JsonPath, JsonPath, never>, Array$<Schema<JsonPath, JsonPath, never>>]>>;
10283
+ /**
10284
+ * Generator function for this schema.
10285
+ * Mapped from {@link GeneratorAnnotationId}.
10286
+ */
10287
+ generator: optional<Union<[typeof String$, Tuple2<typeof String$, typeof Number$>]>>;
10288
+ /**
10289
+ * {@link PropertyMeta} annotations get serialized here.
10290
+ */
10291
+ meta: optional<Record$<typeof String$, typeof Any$4>>;
10292
+ /**
10293
+ * @deprecated
10294
+ */
10295
+ type: optional<Struct<{
10296
+ typename: typeof String$;
10297
+ version: typeof String$;
10298
+ schemaId: optional<typeof String$>;
10299
+ }>>;
10300
+ /**
10301
+ * @deprecated Superseded by `meta`.
10302
+ */
10303
+ annotations: optional<Record$<typeof String$, typeof Any$4>>;
10304
+ }>>;
10305
+ /**
10306
+ * @deprecated Use `annotations` instead.
10307
+ */
10308
+ echo: optional<Struct<{
10309
+ /**
10310
+ * Label for this schema.
10311
+ * Mapped from {@link LabelAnnotationId}.
10312
+ */
10313
+ labelProp: optional<Union<[Schema<JsonPath, JsonPath, never>, Array$<Schema<JsonPath, JsonPath, never>>]>>;
10314
+ /**
10315
+ * Generator function for this schema.
10316
+ * Mapped from {@link GeneratorAnnotationId}.
10317
+ */
10318
+ generator: optional<Union<[typeof String$, Tuple2<typeof String$, typeof Number$>]>>;
10319
+ /**
10320
+ * {@link PropertyMeta} annotations get serialized here.
10321
+ */
10322
+ meta: optional<Record$<typeof String$, typeof Any$4>>;
10323
+ /**
10324
+ * @deprecated
10325
+ */
10326
+ type: optional<Struct<{
10327
+ typename: typeof String$;
10328
+ version: typeof String$;
10329
+ schemaId: optional<typeof String$>;
10330
+ }>>;
10331
+ /**
10332
+ * @deprecated Superseded by `meta`.
10333
+ */
10334
+ annotations: optional<Record$<typeof String$, typeof Any$4>>;
10335
+ }>>;
10336
+ }>;
10337
+ /**
10338
+ * https://json-schema.org/draft-07/schema
10339
+ */
10340
+ interface JsonSchemaType extends Schema.Type<typeof _JsonSchemaType> {}
10341
+ declare const JsonSchemaType: Schema<JsonSchemaType>;
10342
+ //#endregion
10343
+ //#region ../echo/dist/types/src/internal/Entity/entity.d.ts
10344
+ type EchoTypeSchemaProps<T$1, ExtraFields = {}> = Simplify$1<AnyEntity & ToMutable<T$1> & ExtraFields>;
10345
+ /**
10346
+ * Options accepted by every `Type.makeObject` / `Type.makeRelation` / type-kind
10347
+ * factory. Defaults are derived from `(typename, version)` so callers normally
10348
+ * pass nothing.
10349
+ */
10350
+ type EchoTypeOptions = {
10351
+ /**
10352
+ * Override the entity id stamped on the in-memory `Type.Type` value.
10353
+ *
10354
+ * Defaults to `EntityId.deterministic(typename, version)` — stable across processes
10355
+ * and workerd-safe (no `crypto.getRandomValues()` at module-evaluation time).
10356
+ * Pass an explicit id (typically `EntityId.random()`) to opt out of the
10357
+ * deterministic default.
10358
+ */
10359
+ id?: EntityId;
10360
+ };
10361
+ /**
10362
+ * In-memory `Type.Type` entity shape produced by `Type.makeObject(dxn)` /
10363
+ * `Type.makeRelation({...})`. A live reactive `TypeSchema` instance —
10364
+ * identical to a persisted `Type.Type` except for database attachment.
10365
+ *
10366
+ * NOT a `Schema.Schema`. The underlying Effect Schema is cached on the hidden
10367
+ * `StaticTypeSchemaSlot` slot — retrieve it via `Type.getSchema(...)`.
10368
+ */
10369
+ interface EchoTypeSchema<Self extends Schema.Any, ExtraFields = {}, K$1 extends EntityKind = EntityKind, Fields extends Struct.Fields = Struct.Fields> {
10370
+ /**
10371
+ * Entity-kind brand. Type entities are their own kind (`Type`) regardless of
10372
+ * the kind of instance they describe — `[SchemaKindId]` carries the latter.
10373
+ * This lets predicates like `Obj.isObject` / `Relation.isRelation` cleanly
10374
+ * reject type entities without also having to inspect `[SchemaKindId]`.
10375
+ */
10376
+ readonly [KindId$1]: EntityKind.Type;
10377
+ /** Schema-kind brand indicating what kind of instance this type describes. */
10378
+ readonly [SchemaKindId]: K$1;
10379
+ /**
10380
+ * Entity id. Always present — stamped at construction — but NOT the type's
10381
+ * identity while in-memory: an unattached type resolves its URI to the typename
10382
+ * DXN, switching to `echo:/<id>` only once attached to a database (see
10383
+ * `getTypeURIFromSpecifier`, which discriminates by database attachment).
10384
+ */
10385
+ readonly id: EntityId;
10386
+ /** Source Effect Schema (kept on a hidden slot for `Type.getSchema`). */
10387
+ readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
10388
+ readonly jsonSchema: JsonSchemaType;
10389
+ /** Struct fields for introspection. */
10390
+ readonly fields: Fields;
10391
+ /** Phantom — instance type produced by `Obj.make(self, ...)`. */
10392
+ readonly _instance?: EchoTypeSchemaProps<Schema.Type<Self>, ExtraFields>;
10393
+ /**
10394
+ * Phantom slot mirroring `Type<A>` so internal helpers (`makeObject`,
10395
+ * `createObject`, `Ref.make`) infer the instance type uniformly whether
10396
+ * the caller passes an `EchoTypeSchema` or a top-level `Type.Type` entity.
10397
+ *
10398
+ * Includes the instance-kind brand (`[KindId]`) so the phantom is assignable
10399
+ * to the matching public-side interface in `Type.ts` (`Type.Obj` /
10400
+ * `Type.Relation` / `Type.Type`). Each kind projects identity: instances of
10401
+ * an object-kind schema are object-kind entities, type-kind schemas produce
10402
+ * type-kind (persisted Type.Type) entities — the latter additionally carry
10403
+ * the `[SchemaKindId]` / `[StaticTypeSchemaSlot]` brands the echo-handler
10404
+ * proxy exposes on persisted Type entities.
10405
+ */
10406
+ readonly [InstancePhantomId$1]?: EchoTypeSchemaProps<Schema.Type<Self>, ExtraFields> & {
10407
+ readonly [KindId$1]: K$1;
10408
+ } & (K$1 extends EntityKind.Type ? {
10409
+ readonly [SchemaKindId]: EntityKind.Type;
10410
+ readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
10411
+ } : {});
10412
+ }
10413
+ //#endregion
10414
+ //#region ../echo/dist/types/src/internal/Entity/type-kind.d.ts
10415
+ /**
10416
+ * Type-kind schema marker — produced by {@link EchoTypeKindSchema}.
10417
+ *
10418
+ * Distinguishes meta-schemas (entities of `EntityKind.Type`, such as the
10419
+ * built-in `Type.Type` TypeSchema) from object and relation types.
10420
+ */
10421
+ type EchoTypeKindSchema<Self extends Schema.Any, Fields extends Struct.Fields = Struct.Fields> = EchoTypeSchema<Self, {}, EntityKind.Type, Fields>;
10422
+ /**
10423
+ * Pipeable that brands a schema as a type-kind ECHO entity. Mirrors
10424
+ * {@link EchoObjectSchema} / {@link EchoRelationSchema}, but stamps the
10425
+ * resulting entity with `[SchemaKindId]: EntityKind.Type` and a matching
10426
+ * `TypeAnnotation.kind = 'type'` so meta-schemas surface uniformly through
10427
+ * `Type.isTypeKind`, `Filter.type`, etc.
10428
+ */
10429
+ declare const EchoTypeKindSchema: {
10430
+ (dxn: DXN, options?: EchoTypeOptions): <Self extends Schema.Any, Fields extends Struct.Fields = Struct.Fields>(self: Self & {
10431
+ fields?: Fields;
10432
+ }) => EchoTypeKindSchema<Self, Fields>;
10433
+ };
10434
+ //#endregion
10435
+ //#region ../echo/dist/types/src/internal/Type/type-schema.d.ts
10436
+ /**
10437
+ * Raw struct backing {@link TypeSchema}. Exposed only so `TypeSchema`
10438
+ * (the TS type) can derive its data fields via `Schema.Schema.Type<typeof ...>`;
10439
+ * runtime callers should use {@link TypeSchema} (the piped, branded entity).
10440
+ *
10441
+ * `typename` and `version` are NOT data fields — they live in `EntityMeta.key` /
10442
+ * `EntityMeta.version` (the canonical registry-provenance pair, queryable via
10443
+ * `Filter.key(...)`). The same `jsonSchema` payload also embeds them so a
10444
+ * standalone JSON-Schema export remains self-describing, but the schema-registry
10445
+ * reads/writes them through meta.
10446
+ */
10447
+ declare const TypeSchemaStruct: Struct<{
10448
+ name: optional<typeof String$>;
10449
+ jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
10450
+ }>;
10451
+ /**
10452
+ * Persistent representation of a schema.
10453
+ */
10454
+ declare const TypeSchema: EchoTypeKindSchema<Struct<{
10455
+ name: optional<typeof String$>;
10456
+ jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
10457
+ }>, Readonly<{
10458
+ name: optional<typeof String$>;
10459
+ jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
10460
+ }>>;
10461
+ /**
10462
+ * Persistent representation of a schema — the runtime shape that
10463
+ * `db.addType(Type.makeObjectFromJsonSchema(...))` produces
10464
+ * and `Filter.type(Type.Type).run()` returns.
10465
+ *
10466
+ * Structurally identical to a static `Type.Type` entity: the entity-handler's
10467
+ * `get` trap exposes `[SchemaKindId]` (derived from `system.kind` and
10468
+ * `data.jsonSchema.entityKind`) and rebuilds `[StaticTypeSchemaSlot]` lazily
10469
+ * from `jsonSchema`, so a persisted instance satisfies the public `Type<A>`
10470
+ * interface without casting.
10471
+ */
10472
+ type TypeSchema = Schema.Type<typeof TypeSchemaStruct> & {
10473
+ /** Object identifier — injected by `EchoTypeKindSchema` and stamped at construction. */
10474
+ readonly id: string;
10475
+ /** Entity-kind discriminator (object/relation/type) carried on every entity instance. */
10476
+ readonly [KindId$1]: EntityKind.Type;
10477
+ /** Kind of schema described by this meta-instance — always `EntityKind.Type` for `Type.Type` itself. */
10478
+ readonly [SchemaKindId]: EntityKind.Type;
10479
+ /** Effect Schema rebuilt lazily from `jsonSchema`; satisfies `Type.getSchema(...)` without an extra cast. */
10480
+ readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
10481
+ };
10482
+ //#endregion
10483
+ //#region ../echo/dist/types/src/Type.d.ts
10484
+ /**
10485
+ * Structural base shared by the three sibling type-entity interfaces
10486
+ * ({@link Obj}, {@link Relation}, {@link Type}). NOT exported — callers
10487
+ * should constrain on {@link AnyEntity} when they want "any of the three"
10488
+ * and on the specific kind interface otherwise.
10489
+ */
10490
+ interface BaseTypeEntity<A$1> {
10491
+ /**
10492
+ * Entity-kind brand of the type-entity value itself — always `EntityKind.Type`.
10493
+ * The kind of instance the type *describes* lives on `[SchemaKindId]`
10494
+ * (Object / Relation / Type). Lets `Obj.isObject` / `Relation.isRelation`
10495
+ * reject type entities by a single `[KindId]` check.
10496
+ */
10497
+ readonly [KindId$1]: EntityKind.Type;
10498
+ /**
10499
+ * Object id. Like all ECHO entities, type entities always carry an id —
10500
+ * stamped at construction for in-memory (static) declarations and assigned by
10501
+ * the database once persisted. The id does NOT determine the entity's URI:
10502
+ * static types resolve to their typename DXN, persisted types to `echo:/<id>`
10503
+ * (see `getTypeURIFromSpecifier`).
10504
+ */
10505
+ readonly id: EntityId;
10506
+ readonly name?: string;
10507
+ readonly jsonSchema: JsonSchemaType;
10508
+ readonly [InstancePhantomId]?: A$1;
10509
+ }
10510
+ /**
10511
+ * TypeScript type for an ECHO object type — a `Type.Type<A>` entity.
10512
+ *
10513
+ * `T` is the instance type produced by `Obj.make(Foo, props)`. `Fields` is
10514
+ * retained as a structural hint (the runtime value still carries `.fields`),
10515
+ * but consumers should derive instance/encoded types via `Type.InstanceType`.
10516
+ *
10517
+ * **Not a `Schema.Schema`.** `Foo.ast` / `Schema.Schema.Type<typeof Foo>` /
10518
+ * `Schema.extend(Foo)` no longer typecheck — extract the Effect Schema via
10519
+ * `Type.getSchema(Foo)` first, or derive instance types via
10520
+ * `Type.InstanceType<typeof Foo>`.
10521
+ *
10522
+ * @example
10523
+ * ```ts
10524
+ * class Person extends Type.makeObject<Person>(DXN.make('com.example.type.person', '0.1.0'))(
10525
+ * Schema.Struct({ name: Schema.String }),
10526
+ * ) {}
10527
+ * ```
10528
+ */
10529
+ interface Obj$1<T$1, Fields extends Struct.Fields = Struct.Fields> extends BaseTypeEntity<T$1 & OfKind<typeof Kind.Object>> {
10530
+ /** Schema-kind brand (object). */
10531
+ readonly [SchemaKindId]: EntityKind.Object;
10532
+ /** Source Effect Schema — used internally by `Type.getSchema(self)`. */
10533
+ readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
10534
+ /**
10535
+ * The fields defined in the original struct schema.
10536
+ * Allows accessing field definitions for introspection.
10537
+ */
10538
+ readonly fields: Fields;
10539
+ }
10540
+ /**
10541
+ * Return type for {@link makeObject}.
10542
+ *
10543
+ * Not to be used directly, but must be exported for typescript to infer the type.
10544
+ */
10545
+ interface ObjClass<Self, T$1, Fields extends Struct.Fields> extends Obj$1<Self, Fields> {
10546
+ new (_: never): T$1 & OfKind<typeof Kind.Object>;
10547
+ }
10548
+ /**
10549
+ * Type that represents any ECHO object type — a `Type.Type` entity branded
10550
+ * with the object entity kind, i.e. what `Type.makeObject(dxn)` produces.
10551
+ */
10552
+ type AnyObj = Obj$1<unknown>;
10553
+ /**
10554
+ * ECHO meta-schema entity — stores `{ name?, typename, version, jsonSchema }`.
10555
+ * Type-kind sibling of `Type.makeObject(...)` / `Type.makeRelation(...)` outputs.
10556
+ * Stored types live under this entity; filter via `Filter.type(Type.Type)`.
10557
+ */
10558
+ declare const Type$1: Type$1<TypeSchema>;
10559
+ /**
10560
+ * TypeScript type for an ECHO relation type — a `Type.Type<A>` entity.
10561
+ *
10562
+ * `T` is the instance-property type produced by `Relation.make(...)` (excluding
10563
+ * source/target endpoints). `Source` and `Target` are the endpoint types.
10564
+ *
10565
+ * **Not a `Schema.Schema`.** See {@link Obj}'s note.
10566
+ */
10567
+ interface Relation<T$1, Source$1, Target$2, Fields extends Struct.Fields = Struct.Fields> extends BaseTypeEntity<Endpoints$1<Source$1, Target$2> & T$1 & OfKind<typeof Kind.Relation>> {
10568
+ /** Schema-kind brand (relation). */
10569
+ readonly [SchemaKindId]: EntityKind.Relation;
10570
+ /** Source Effect Schema — used internally by `Type.getSchema(self)`. */
10571
+ readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
10572
+ /**
10573
+ * The fields defined in the original struct schema.
10574
+ * Allows accessing field definitions for introspection.
10575
+ */
10576
+ readonly fields: Fields;
10577
+ }
10578
+ /**
10579
+ * Return type for {@link makeRelation}.
10580
+ *
10581
+ * Not to be used directly, but must be exported for typescript to infer the type.
10582
+ */
10583
+ interface RelationClass<Self, T$1, Source$1, Target$2, Fields extends Struct.Fields> extends Relation<Self, Source$1, Target$2, Fields> {
10584
+ new (_: never): Endpoints$1<Source$1, Target$2> & T$1 & OfKind<typeof Kind.Relation>;
10585
+ }
10586
+ /**
10587
+ * Type that represents any ECHO relation type — a `Type.Type` entity branded
10588
+ * with the relation entity kind, i.e. what `Type.makeRelation(...)` produces.
10589
+ */
10590
+ type AnyRelation = Relation<unknown, unknown, unknown>;
10591
+ /**
10592
+ * Type that represents any ECHO type-kind entity — a `Type.Type` meta-schema
10593
+ * value (static `Type.Type` or a persisted draft from `db.addType(...)`).
10594
+ * Mirrors {@link AnyObj} / {@link AnyRelation} for the third sibling kind.
10595
+ */
10596
+ type AnyType = Type$1<unknown>;
10597
+ /**
10598
+ * Any ECHO type-entity — one of the three sibling kinds: object-kind, relation-kind,
10599
+ * or type-kind (the meta-schema). APIs that want "any ECHO type" use this union;
10600
+ * the underlying Effect Schema is retrieved via `Type.getSchema`.
10601
+ */
10602
+ type AnyEntity$1 = AnyObj | AnyRelation | AnyType;
10603
+ /**
10604
+ * String key used to phantom-carry the instance type produced by a `Type.Type`.
10605
+ * Used by `Type.InstanceType<typeof Foo>` to recover the schema instance type
10606
+ * since `Type.makeObject(dxn)` does not return a `Schema.Schema`.
10607
+ *
10608
+ * Re-exported from the internal types layer so both `Type.ts` and internal
10609
+ * helpers (`makeObject`, `createObject`) reference the same phantom key.
10610
+ */
10611
+ declare const InstancePhantomId: "~@dxos/echo/Type.Instance";
10612
+ type InstancePhantomId = InstancePhantomId$1;
10613
+ /**
10614
+ * Sibling of {@link Obj} / {@link Relation} for the third ECHO entity kind:
10615
+ * **type-kind** entities (meta-schemas). The singleton {@link Type} const is
10616
+ * the canonical example — it describes stored type definitions themselves.
10617
+ *
10618
+ * Not a `Schema.Schema`. Use `Type.getSchema(value)` to obtain the underlying
10619
+ * Effect Schema and `Type.update(value, draft => ...)` to mutate.
10620
+ *
10621
+ * `A` is the instance-type phantom — what `Obj.make(value, ...)` would produce.
10622
+ * Merged with the `Type` const value via TypeScript declaration merging.
10623
+ */
10624
+ interface Type$1<A$1 = unknown> extends BaseTypeEntity<A$1 & OfKind<typeof Kind.Type>> {
10625
+ /** Schema-kind brand (type — the meta-schema kind). */
10626
+ readonly [SchemaKindId]: EntityKind.Type;
10627
+ /** Source Effect Schema — used internally by `Type.getSchema(self)`. */
10628
+ readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
10629
+ }
10630
+ /**
10631
+ * Instance type produced by a Type entity.
10632
+ *
10633
+ * Accepts ONLY {@link AnyEntity} inputs — `Type.Obj`, `Type.Relation`, or
10634
+ * `Type.Type`. Raw Effect `Schema.Schema` values are rejected: for those, use
10635
+ * `Schema.Schema.Type<typeof Foo>` directly. This separation keeps the type
10636
+ * system honest about which values represent ECHO entities versus plain
10637
+ * Effect schemas.
10638
+ *
10639
+ * Dispatches on the entity kind:
10640
+ * - `Relation<Props, S, T>` → `Endpoints<S,T> & Props & OfKind<Relation>`
10641
+ * - `Obj<A>` → `A & OfKind<Object>`
10642
+ * - `Type<A>` → `A & OfKind<Type>`
10643
+ */
10644
+ type InstanceType$1<T$1 extends AnyEntity$1> = T$1 extends RelationClass<any, infer Props, infer Source, infer Target, any> ? Endpoints$1<Source, Target> & Props & OfKind<typeof Kind.Relation> : T$1 extends Relation<infer Props, infer Source, infer Target, any> ? Endpoints$1<Source, Target> & Props & OfKind<typeof Kind.Relation> : T$1 extends ObjClass<any, infer A, any> ? A & OfKind<typeof Kind.Object> : T$1 extends Obj$1<infer A, any> ? A & OfKind<typeof Kind.Object> : T$1 extends Type$1<infer A> ? A & OfKind<typeof Kind.Type> : never;
10645
+ //#endregion
10646
+ //#region ../echo/dist/types/src/internal/Ref/ref.d.ts
10647
+ declare const RefTypeId: unique symbol;
10648
+ /**
10649
+ * Reference Schema.
10650
+ */
10651
+ interface RefSchema<T$1 extends AnyEntity> extends SchemaClass<Ref<T$1>, EncodedReference> {}
10652
+ /**
10653
+ * Type of the `Ref` function and extra methods attached to it.
10654
+ */
10655
+ interface RefFn {
10656
+ <S$1 extends AnyEntity$1 | UnknownTypeSchema<any, any> = AnyEntity$1>(schema: S$1): RefSchema<S$1 extends AnyType ? AnyEntity$1 : S$1 extends AnyObj | AnyRelation ? InstanceType$1<S$1> : S$1 extends UnknownTypeSchema<infer A, any> ? A : never>;
10657
+ /**
10658
+ * @returns True if the object is a reference.
10486
10659
  */
10487
- remove(id: string): boolean;
10660
+ isRef: (obj: unknown) => obj is Ref<any>;
10488
10661
  /**
10489
- * Remove all locally-stored entities.
10490
- * Does not affect the upstream registry.
10662
+ * @returns True if the reference points to the given object id.
10491
10663
  */
10492
- clear(): void;
10664
+ hasEntityId: (id: EntityId) => (ref: Ref<any>) => boolean;
10493
10665
  /**
10494
- * Get an entity by id.
10495
- * Searches the local registry first, then falls back to the upstream registry.
10666
+ * @returns True if the schema is a reference schema.
10496
10667
  */
10497
- get(id: string): Unknown | undefined;
10668
+ isRefSchema: (schema: Schema<any, any>) => schema is RefSchema<any>;
10498
10669
  /**
10499
- * Get an entity by one of its addressing URIs — a type entity by its typename DXN (or, when
10500
- * persisted, its identifier EID), a keyed entity by its `dxn:<key>[:<version>]`. Accepts legacy
10501
- * DXN forms (normalized internally). Searches the local registry first, then falls back to the
10502
- * upstream registry. Narrow the result with `Type.isType` when a type entity is required.
10670
+ * @returns True if the schema AST is a reference schema.
10503
10671
  */
10504
- getByURI(uri: string): Unknown | undefined;
10672
+ isRefSchemaAST: (ast: AST) => boolean;
10505
10673
  /**
10506
- * List all entities.
10507
- * Local entities take precedence over upstream entities with the same id.
10674
+ * Constructs a reference that points to the given object.
10508
10675
  */
10509
- list(): Unknown[];
10676
+ make: <T$1 extends AnyEntity>(object: T$1) => Ref<T$1>;
10510
10677
  /**
10511
- * Run an ECHO query against the registry's entities (implements {@link Database.Queryable}).
10512
- *
10513
- * Matching happens in-memory over {@link list}. Scope (`from`) clauses are unwrapped and
10514
- * ignored — a direct registry query always targets the registry's own entities. The primary
10515
- * way to query registry contents is still through the database (`db.query(...).from(Scope.registry())`),
10516
- * which fans the database and registry together; this method is for querying a registry directly.
10517
- *
10518
- * Only locally-evaluable AST nodes are supported: `select`, `filter`, `limit`, `from`, `options`,
10519
- * and boolean combinators. Server-side concerns (order, traversal, text/timestamp filters) throw.
10678
+ * Constructs a reference that points to the object specified by the provided URI
10679
+ * (either an `echo:` EID for an object reference or a `dxn:` DXN for a type reference).
10520
10680
  */
10521
- query: QueryFn;
10681
+ fromURI: (uri: URI) => Ref<any>;
10522
10682
  }
10523
- //#endregion
10524
- //#region ../echo/dist/types/src/Hypergraph.d.ts
10525
10683
  /**
10526
- * Resolution context.
10527
- * Affects how non-absolute DXNs are resolved.
10684
+ * Schema builder for references.
10528
10685
  */
10529
- interface RefResolutionContext {
10686
+ declare const Ref: RefFn;
10687
+ /**
10688
+ * Represents materialized reference to a target.
10689
+ * This is the data type for the fields marked as ref.
10690
+ */
10691
+ interface Ref<T$1> extends Pipeable {
10530
10692
  /**
10531
- * Space that the resolution is happening from.
10693
+ * Target URI (either an `echo:` EID for an object reference or a `dxn:` DXN for a type reference).
10532
10694
  */
10533
- space?: SpaceId;
10695
+ get uri(): URI;
10534
10696
  /**
10535
- * Feed that the resolution is happening from.
10536
- * This feed will be searched first, and then the space it belongs to.
10697
+ * Returns true if the reference has a target available (inlined or resolver set).
10537
10698
  */
10538
- feed?: URI;
10539
- }
10540
- interface RefResolverOptions {
10699
+ get isAvailable(): boolean;
10541
10700
  /**
10542
- * Resolution context.
10543
- * Affects how non-absolute DXNs are resolved.
10701
+ * @returns The reference target.
10702
+ * May return `undefined` if the object is not loaded in the working set.
10703
+ * Accessing this property, even if it returns `undefined` will trigger the object to be loaded to the working set.
10544
10704
  */
10545
- context?: RefResolutionContext;
10705
+ get target(): T$1 | undefined;
10546
10706
  /**
10547
- * Middleware to change the resolved object before returning it.
10548
- * @deprecated On track to be removed.
10707
+ * @returns Promise that will resolves with the target object.
10708
+ * Will load the object from disk if it is not present in the working set.
10709
+ * Short-circuits immediately when the target is already loaded.
10710
+ * @throws If the object is not available locally.
10711
+ *
10712
+ * @idiom org.dxos.echo.refLoad
10713
+ * applies: Resolving a ref inside an async function or Effect handler — guarantees the object is available before proceeding
10714
+ * instead-of: `ref.target` — not guaranteed to be defined in async contexts; use `await ref.load()` (or `yield* Database.load(ref)` in Effect) to ensure the target is present
10715
+ * uses: {@link load}
10716
+ * related: org.dxos.echo-react.useObjectReactive
10549
10717
  */
10550
- middleware?: (obj: AnyProperties) => AnyProperties;
10551
- }
10552
- /**
10553
- * Manages cross-space database interactions.
10554
- */
10555
- interface Hypergraph extends Queryable {
10718
+ load(): Promise<T$1>;
10556
10719
  /**
10557
- * In-process registry of keyed objects and static schema types.
10558
- * Populated at startup via `registry.add(objects)` / `registry.add(schemas)`.
10559
- * Queries that include no explicit from() clause will fan out to this registry automatically.
10720
+ * @returns Promise that will resolves with the target object or undefined if the object is not loaded locally.
10560
10721
  */
10561
- get registry(): Registry;
10722
+ tryLoad(): Promise<T$1 | undefined>;
10562
10723
  /**
10563
- * Query objects.
10724
+ * Subscribe to the ref's resolution event.
10725
+ * The callback fires when the target object becomes available in the working set
10726
+ * (e.g. when its document is loaded after sibling-client mutation).
10727
+ * Note: the resolver only schedules a notification when the target is requested
10728
+ * via {@link target} while it is not yet loaded.
10729
+ * @returns Function that unsubscribes the callback.
10564
10730
  */
10565
- query: QueryFn;
10731
+ onResolved(callback: () => void): () => void;
10566
10732
  /**
10567
- * Creates a reference to an existing object in the database.
10733
+ * Do not inline the target object in the reference.
10734
+ * Makes .target unavailable unless the reference is connected to a database context.
10568
10735
  *
10569
- * NOTE: The reference may be dangling if the object is not present in the database.
10570
- * NOTE: Difference from `Ref.fromURI`
10571
- * `Ref.fromURI(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.
10572
- * `db.makeRef(dxn)` is preferable in cases with access to the database.
10736
+ * When serialized with toJSON, the difference is between:
10737
+ * `{ "/": "dxn:..." }`
10738
+ * and
10739
+ * `{ "/": "dxn:...", "target": { ... } }`
10740
+ *
10741
+ * Clones the reference object.
10573
10742
  */
10574
- makeRef<T$1 extends Unknown = Unknown>(uri: URI): Ref$1<T$1>;
10743
+ noInline(): Ref<T$1>;
10575
10744
  /**
10576
- * @param hostDb Host database for reference resolution.
10577
- * @param middleware Called with the loaded object. The caller may change the object.
10578
- * @returns Result of `onLoad`.
10745
+ * Read-only atom for the ref target.
10746
+ * Resolves once when the target loads; does NOT subscribe to target object mutations.
10747
+ * Use `Obj.atom(ref)` if you need reactive snapshots that update on every object mutation.
10579
10748
  */
10580
- createRefResolver(options: RefResolverOptions): Resolver;
10749
+ get atom(): Atom<T$1 | undefined>;
10581
10750
  /**
10582
- * Get a database by space ID.
10583
- * @returns The database for the given space ID, or undefined if not found.
10751
+ * Serializes the reference to a JSON object.
10752
+ * The serialization format is compatible with the IPLD-style encoded references.
10753
+ * When a reference has a saved target (i.e. the target or object holding the reference is not in the database),
10754
+ * the target is included in the serialized object.
10755
+ *
10756
+ * Examples:
10757
+ * `{ "/": "dxn:..." }`
10758
+ * `{ "/": "dxn:...", "target": { ... } }`
10584
10759
  */
10585
- getDatabase(spaceId: SpaceId): Database | undefined;
10760
+ encode(): EncodedReference;
10761
+ [RefTypeId]: {
10762
+ _T: T$1;
10763
+ };
10586
10764
  }
10587
- //#endregion
10588
- //#region ../echo/dist/types/src/Database.d.ts
10589
- /**
10590
- * `query` API function declaration.
10591
- */
10592
- interface QueryFn {
10593
- <Q extends Any$1>(query: Q): QueryResult<Type$1<Q>>;
10594
- <F extends Any$3>(filter: F): QueryResult<Type$2<F>>;
10765
+ declare namespace Ref {
10766
+ /**
10767
+ * Target of the reference.
10768
+ */
10769
+ type Target<R$1> = R$1 extends Ref<infer U> ? U : never;
10595
10770
  }
10596
10771
  /**
10597
- * Common interface for Database, Feed, and Hypergraph.
10772
+ * Load-source ceiling for a resolution request. Cheaper tiers are always probed first; the
10773
+ * ceiling caps how far a request is allowed to reach:
10774
+ * - `working-set`: synchronous, in-memory only. A miss settles `unavailable` immediately.
10775
+ * - `disk`: probe the working set, then local storage; never the network.
10776
+ * - `network`: probe the working set, disk, then fetch from peers.
10777
+ *
10778
+ * `unavailable` is always relative to the requested ceiling (disk-unavailable ≠ network-unavailable).
10598
10779
  */
10599
- interface Queryable {
10600
- query: QueryFn;
10601
- }
10602
- type GetObjectByIdOptions = {
10603
- deleted?: boolean;
10604
- };
10605
- type ObjectPlacement = 'root-doc' | 'linked-doc';
10606
- type AddOptions = {
10607
- /**
10608
- * Where to place the object in the Automerge document tree.
10609
- * Root document is always loaded with the space.
10610
- * Linked documents are loaded lazily.
10611
- * Placing large number of objects in the root document may slow down the initial load.
10612
- *
10613
- * @default 'linked-doc'
10614
- */
10615
- placeIn?: ObjectPlacement;
10616
- };
10780
+ type RefSource = 'working-set' | 'disk' | 'network';
10617
10781
  /**
10618
- * Rejects Type entities from {@link Database.add} at compile time via their `[KindId]` brand. Used
10619
- * as `T & RejectTypeEntity<T>` to preserve inference of `T`. Bounding `add` on
10620
- * `Obj.Unknown | Relation.Unknown` instead would reject broadly-typed instance adds (e.g.
10621
- * `Entity.Any`, `Obj.OfShape<T>`), forcing casts repo-wide.
10782
+ * A stateful, closure-aware handle to an in-flight (or settled) reference resolution.
10783
+ *
10784
+ * `ready` means the entity is FULLY USABLE: its own body and its strong-dependency closure are all
10785
+ * materialized. The body-vs-closure split is internal; `requesting` transparently covers "a
10786
+ * dependency is still loading".
10622
10787
  */
10623
- type RejectTypeEntity<T$1> = T$1 extends {
10624
- readonly [KindId$1]: EntityKind.Type;
10625
- } ? {
10626
- __error: 'Type entities must be persisted via db.addType(), not db.add().';
10627
- } : T$1;
10628
- type FlushOptions = {
10788
+ interface RefResolverRequest {
10629
10789
  /**
10630
- * Write any pending changes to disk.
10631
- * @default true
10632
- */
10633
- disk?: boolean;
10634
- /**
10635
- * Wait for pending index updates.
10636
- * @default true
10790
+ * `pending` is a one-way entry state (never re-entered). `requesting` means the body and/or
10791
+ * closure is still loading. `ready` means fully usable. `unavailable` means unreachable at the
10792
+ * requested ceiling.
10637
10793
  */
10638
- indexes?: boolean;
10794
+ readonly state: 'pending' | 'requesting' | 'ready' | 'unavailable';
10639
10795
  /**
10640
- * Flush pending updates to objects and queries.
10641
- * @default false
10796
+ * Fires (deferred to a microtask) whenever {@link state} changes.
10642
10797
  */
10643
- updates?: boolean;
10644
- };
10645
- /**
10646
- * Identifier denoting an ECHO Database.
10647
- */
10648
- declare const TypeId: unique symbol;
10649
- type TypeId = typeof TypeId;
10650
- /**
10651
- * ECHO Database interface.
10652
- */
10653
- interface Database extends Queryable {
10654
- readonly [TypeId]: TypeId;
10655
- get spaceId(): SpaceId;
10656
- get graph(): Hypergraph;
10798
+ readonly stateChanged: Event$1<void>;
10657
10799
  /**
10658
- * Registry for this database. Delegates type lookups to the shared hypergraph registry.
10659
- * To persist a schema so it replicates to other clients, add the type entity with
10660
- * {@link addType} (e.g. `await db.addType(Type.makeObjectFromJsonSchema(...))`).
10800
+ * Synchronous snapshot of the resolved entity; defined iff `state === 'ready'`.
10661
10801
  */
10662
- readonly registry: Registry;
10663
- toJSON(): object;
10802
+ getResult(): AnyProperties | undefined;
10664
10803
  /**
10665
- * Return object by local ID.
10666
- * @deprecated Use `db.query(Filter.id(id)).runSync()[0]` for a working-set lookup, or resolve via a {@link Ref}.
10804
+ * Settles when `state {ready, unavailable}`.
10667
10805
  */
10668
- getObjectById<T$1 extends Unknown$1 = OfShape<AnyProperties>>(id: string, opts?: GetObjectByIdOptions): T$1 | undefined;
10806
+ wait(): Promise<AnyProperties | undefined>;
10669
10807
  /**
10670
- * Query objects.
10808
+ * Decrements the refcount on the shared load op(s); cancels the underlying IO at zero.
10671
10809
  */
10672
- query: QueryFn;
10810
+ abort(): void;
10811
+ }
10812
+ interface RefResolver {
10673
10813
  /**
10674
- * Creates a reference to an existing object in the database.
10675
- *
10676
- * NOTE: The reference may be dangling if the object is not present in the database.
10677
- * NOTE: Difference from `Ref.fromURI`
10678
- * `Ref.fromURI(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.
10679
- * `db.makeRef(dxn)` is preferable in cases with access to the database.
10814
+ * Resolve a reference, returning a stateful handle. `source` is a required ceiling; cheaper
10815
+ * tiers are always probed first.
10680
10816
  */
10681
- makeRef<T$1 extends Unknown = Unknown>(uri: URI): Ref<T$1>;
10817
+ resolve(uri: URI, options: {
10818
+ source: RefSource;
10819
+ }): RefResolverRequest;
10682
10820
  /**
10683
- * Adds an object or relation to the database.
10821
+ * Resolve ref synchronously from the objects in the working set.
10684
10822
  *
10685
- * Only Object and Relation entities are accepted. To persist a Type definition use
10686
- * {@link addType} passing a Type entity is rejected at compile time (and at runtime).
10823
+ * @param uri
10824
+ * @param load If true the resolver should attempt to load the object from disk.
10825
+ * @param onLoad Callback to call when the object is loaded.
10826
+ * @deprecated Use {@link resolve} with `{ source: 'working-set' }`. Removed in Task 11.
10687
10827
  */
10688
- add<T$1 extends Unknown = Unknown>(obj: T$1 & RejectTypeEntity<T$1>, opts?: AddOptions): T$1;
10828
+ resolveSync(uri: URI, load: boolean, onLoad?: () => void): AnyProperties | undefined;
10689
10829
  /**
10690
- * Persists a Type definition (clones/forks the entity) so it replicates to other peers.
10691
- *
10692
- * Runs a conflict query first: if a type with the same typename + version already exists in
10693
- * this space, the existing persisted entity is returned and no duplicate is created. This is
10694
- * the only supported way to add Type entities — {@link add} rejects them.
10830
+ * Resolver ref asynchronously.
10831
+ * @deprecated Use {@link resolve} with `{ source: 'network' }`. Removed in Task 11.
10695
10832
  */
10696
- addType<T$1 extends AnyEntity$1>(type: T$1): Promise<T$1>;
10833
+ resolveLegacy(uri: URI): Promise<AnyProperties | undefined>;
10697
10834
  /**
10698
- * Removes object from the database.
10835
+ * @deprecated Use {@link resolve} + `Type.getSchema`. Removed in Task 11.
10699
10836
  */
10700
- remove(obj: Unknown): void;
10837
+ resolveSchema(uri: URI): Promise<Schema.AnyNoContext | undefined>;
10701
10838
  /**
10702
- * Wait for all pending changes to be saved to disk.
10703
- * Optionaly waits for changes to be propagated to indexes and event handlers.
10839
+ * Resolve the source `Type.AnyEntity` entity for a type URI. Used by
10840
+ * deserialization paths (`Obj.fromJSON`) to set the back-reference accessed
10841
+ * via `Obj.getType` / `Entity.getType`. Optional — resolvers that only
10842
+ * carry raw schemas may leave this unimplemented; the deserializer falls
10843
+ * back to leaving the type entity unset.
10844
+ * @deprecated Use {@link resolve}. Removed in Task 11.
10704
10845
  */
10705
- flush(opts?: FlushOptions): Promise<void>;
10846
+ resolveType?(uri: URI): Promise<unknown | undefined>;
10706
10847
  }
10707
- declare const Database: Schema<Database>;
10708
10848
  //#endregion
10709
10849
  //#region ../echo/dist/types/src/Entity.d.ts
10710
10850
  declare const KindId: "~@dxos/echo/Kind";