@dxos/echo-query 0.9.1-main.c7dcc2e112 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/query-lite/index.d.ts +1577 -1502
- package/dist/query-lite/index.d.ts.map +1 -1
- package/dist/query-lite/index.js +106 -57
- package/dist/query-lite/index.js.map +1 -1
- package/dist/types/src/query-lite/query-lite.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/query-lite/query-lite.ts +158 -63
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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$
|
|
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$
|
|
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
|
|
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=
|
|
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=
|
|
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
|
/**
|
|
@@ -9065,1711 +9005,1846 @@ interface ReadOnlyEvent<T$1 = void> {
|
|
|
9065
9005
|
debounce(timeout?: number): Event$1<void>;
|
|
9066
9006
|
}
|
|
9067
9007
|
//#endregion
|
|
9068
|
-
//#region
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9008
|
+
//#region ../echo/dist/types/src/internal/common/types/entity.d.ts
|
|
9009
|
+
/**
|
|
9010
|
+
* String key used to identify the kind of an entity instance (object or relation).
|
|
9011
|
+
*/
|
|
9012
|
+
declare const KindId$1: '~@dxos/echo/Kind';
|
|
9013
|
+
type KindId$1 = typeof KindId$1;
|
|
9014
|
+
/**
|
|
9015
|
+
* String key used to identify the kind of a schema (object schema or relation schema).
|
|
9016
|
+
* Parallels KindId which identifies instance kinds.
|
|
9017
|
+
*/
|
|
9018
|
+
declare const SchemaKindId: '~@dxos/echo/SchemaKind';
|
|
9019
|
+
type SchemaKindId = typeof SchemaKindId;
|
|
9020
|
+
/**
|
|
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).
|
|
9025
|
+
*/
|
|
9026
|
+
declare const StaticTypeSchemaSlot: '~@dxos/echo/Type.StaticSchema';
|
|
9027
|
+
type StaticTypeSchemaSlot = typeof StaticTypeSchemaSlot;
|
|
9028
|
+
/**
|
|
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`).
|
|
9033
|
+
*
|
|
9034
|
+
* Stored as a string key so declarations remain portable across packages
|
|
9035
|
+
* (see KindId comment above).
|
|
9036
|
+
*/
|
|
9037
|
+
declare const InstancePhantomId$1: '~@dxos/echo/Type.Instance';
|
|
9038
|
+
type InstancePhantomId$1 = typeof InstancePhantomId$1;
|
|
9039
|
+
/**
|
|
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.
|
|
9044
|
+
*
|
|
9045
|
+
* Stored as a string key so declarations remain portable across packages
|
|
9046
|
+
* (see KindId comment above).
|
|
9047
|
+
*/
|
|
9048
|
+
declare const UnknownTypeSchemaBrandId: '~@dxos/echo/UnknownTypeSchemaBrand';
|
|
9049
|
+
type UnknownTypeSchemaBrandId = typeof UnknownTypeSchemaBrandId;
|
|
9050
|
+
/**
|
|
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.
|
|
9055
|
+
*/
|
|
9056
|
+
interface UnknownTypeSchema<A$1, K$1 extends EntityKind> extends Schema<A$1, any, never> {
|
|
9057
|
+
readonly [UnknownTypeSchemaBrandId]: K$1;
|
|
9073
9058
|
}
|
|
9074
9059
|
/**
|
|
9075
|
-
*
|
|
9076
|
-
* @category Constructors
|
|
9060
|
+
* Kinds of entities stored in ECHO: objects, relations, and types.
|
|
9077
9061
|
*/
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
stackTraceLimit: number;
|
|
9083
|
-
}
|
|
9062
|
+
declare enum EntityKind {
|
|
9063
|
+
Object = "object",
|
|
9064
|
+
Relation = "relation",
|
|
9065
|
+
Type = "type",
|
|
9084
9066
|
}
|
|
9067
|
+
//#endregion
|
|
9068
|
+
//#region ../echo/dist/types/src/Relation.d.ts
|
|
9069
|
+
type Endpoints$1<Source$1, Target$2> = {
|
|
9070
|
+
[Source$1]: Source$1;
|
|
9071
|
+
[Target$2]: Target$2;
|
|
9072
|
+
};
|
|
9085
9073
|
/**
|
|
9086
|
-
*
|
|
9087
|
-
* @
|
|
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>;
|
|
9104
|
+
/**
|
|
9105
|
+
* Get relation source type.
|
|
9088
9106
|
*/
|
|
9107
|
+
type SourceOf<A$1> = A$1 extends Endpoints$1<infer S, infer _T> ? S : never;
|
|
9108
|
+
/**
|
|
9109
|
+
* Get relation target type.
|
|
9110
|
+
*/
|
|
9111
|
+
type TargetOf<A$1> = A$1 extends Endpoints$1<infer _S, infer T> ? T : never;
|
|
9089
9112
|
//#endregion
|
|
9090
|
-
//#region
|
|
9091
|
-
|
|
9092
|
-
|
|
9113
|
+
//#region ../echo/dist/types/src/Ref.d.ts
|
|
9114
|
+
/**
|
|
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
|
+
* ```
|
|
9131
|
+
*/
|
|
9132
|
+
type Ref$1<T$1> = Ref<T$1>;
|
|
9133
|
+
type Unknown$2 = Ref<Unknown$1>;
|
|
9134
|
+
/**
|
|
9135
|
+
* Factory function to create a Ref schema for the given target schema.
|
|
9136
|
+
* Use this in schema definitions to declare reference fields.
|
|
9137
|
+
*
|
|
9138
|
+
* @example
|
|
9139
|
+
* ```ts
|
|
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
|
+
* ) {}
|
|
9145
|
+
* ```
|
|
9146
|
+
*/
|
|
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>;
|
|
9093
9152
|
};
|
|
9094
9153
|
/**
|
|
9095
|
-
*
|
|
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.
|
|
9157
|
+
*
|
|
9158
|
+
* @example
|
|
9159
|
+
* ```ts
|
|
9160
|
+
* // Schema type annotation (rarely needed, usually inferred):
|
|
9161
|
+
* const refSchema: Ref.RefSchema<typeof Task> = Ref.Ref(Task);
|
|
9162
|
+
*
|
|
9163
|
+
* // Instance type annotation (use Ref.Ref instead):
|
|
9164
|
+
* const refInstance: Ref.Ref<Task> = Ref.make(task);
|
|
9165
|
+
* ```
|
|
9096
9166
|
*/
|
|
9097
|
-
|
|
9167
|
+
interface RefSchema$1<T$1 extends Unknown> extends RefSchema<T$1> {}
|
|
9168
|
+
/**
|
|
9169
|
+
* Extract reference target.
|
|
9170
|
+
*/
|
|
9171
|
+
type Target$1<R$1 extends Unknown$2> = R$1 extends Ref<infer T> ? T : never;
|
|
9172
|
+
/**
|
|
9173
|
+
* Reference resolver.
|
|
9174
|
+
*/
|
|
9175
|
+
type Resolver = RefResolver;
|
|
9098
9176
|
//#endregion
|
|
9099
|
-
//#region ../echo/dist/types/src/
|
|
9177
|
+
//#region ../echo/dist/types/src/Obj.d.ts
|
|
9100
9178
|
/**
|
|
9101
|
-
*
|
|
9102
|
-
* Contains extensions for ECHO (e.g., references).
|
|
9103
|
-
* Ref: https://json-schema.org/draft-07/schema
|
|
9179
|
+
* Base type for all ECHO objects.
|
|
9104
9180
|
*/
|
|
9105
|
-
|
|
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
|
-
}>;
|
|
9181
|
+
interface BaseObj extends AnyEntity, OfKind<typeof Kind.Object> {}
|
|
9305
9182
|
/**
|
|
9306
|
-
*
|
|
9183
|
+
* Object type with specific properties.
|
|
9307
9184
|
*/
|
|
9308
|
-
|
|
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>;
|
|
9185
|
+
type OfShape<Props$2> = BaseObj & Props$2;
|
|
9313
9186
|
/**
|
|
9314
|
-
*
|
|
9315
|
-
*
|
|
9316
|
-
*
|
|
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`.
|
|
9190
|
+
*
|
|
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)`.
|
|
9317
9193
|
*/
|
|
9318
|
-
|
|
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
|
-
};
|
|
9194
|
+
interface Unknown$1 extends BaseObj {}
|
|
9329
9195
|
/**
|
|
9330
|
-
*
|
|
9331
|
-
*
|
|
9332
|
-
* identical to a persisted `Type.Type` except for database attachment.
|
|
9196
|
+
* Runtime Effect schema for any ECHO object.
|
|
9197
|
+
* Use for validation, parsing, or as a reference target for collections.
|
|
9333
9198
|
*
|
|
9334
|
-
*
|
|
9335
|
-
* `
|
|
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.
|
|
9201
|
+
*
|
|
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
|
+
* ```
|
|
9336
9215
|
*/
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
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 };
|
|
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;
|
|
9240
|
+
/**
|
|
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.
|
|
9251
|
+
*
|
|
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)`.
|
|
9256
|
+
*/
|
|
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
|
+
};
|
|
9264
|
+
/**
|
|
9265
|
+
* Filter by tag.
|
|
9266
|
+
*/
|
|
9267
|
+
declare const tag: (tag: string) => Any$3;
|
|
9268
|
+
/**
|
|
9269
|
+
* Options for {@link key} filter.
|
|
9270
|
+
*/
|
|
9271
|
+
type KeyFilterOptions = {
|
|
9272
|
+
/**
|
|
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).
|
|
9373
9276
|
*/
|
|
9374
|
-
|
|
9375
|
-
|
|
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
|
|
9277
|
+
version?: string;
|
|
9278
|
+
};
|
|
9383
9279
|
/**
|
|
9384
|
-
*
|
|
9280
|
+
* Filter by registry key stored in object meta.
|
|
9385
9281
|
*
|
|
9386
|
-
*
|
|
9387
|
-
*
|
|
9282
|
+
* @example
|
|
9283
|
+
* ```ts
|
|
9284
|
+
* Filter.key('org.example.type.foo');
|
|
9285
|
+
* Filter.key('org.example.type.foo', { version: '^1.2.3' });
|
|
9286
|
+
* ```
|
|
9388
9287
|
*/
|
|
9389
|
-
|
|
9288
|
+
declare const key$1: (key: string, options?: KeyFilterOptions) => Any$3;
|
|
9390
9289
|
/**
|
|
9391
|
-
*
|
|
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.
|
|
9290
|
+
* Filter by properties.
|
|
9396
9291
|
*/
|
|
9397
|
-
declare const
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
}) => EchoTypeKindSchema<Self, Fields>;
|
|
9292
|
+
declare const props: <T$1>(props: Props$1<T$1>) => Filter<T$1>;
|
|
9293
|
+
type TextSearchOptions = {
|
|
9294
|
+
type?: 'full-text' | 'vector';
|
|
9401
9295
|
};
|
|
9402
|
-
//#endregion
|
|
9403
|
-
//#region ../echo/dist/types/src/internal/Type/type-schema.d.ts
|
|
9404
9296
|
/**
|
|
9405
|
-
*
|
|
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).
|
|
9408
|
-
*
|
|
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.
|
|
9297
|
+
* Full-text or vector search.
|
|
9414
9298
|
*/
|
|
9415
|
-
declare const
|
|
9416
|
-
name: optional<typeof String$>;
|
|
9417
|
-
jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
|
|
9418
|
-
}>;
|
|
9299
|
+
declare const text: (text: string, options?: TextSearchOptions) => Any$3;
|
|
9419
9300
|
/**
|
|
9420
|
-
*
|
|
9301
|
+
* Filter by foreign keys.
|
|
9421
9302
|
*/
|
|
9422
|
-
declare const
|
|
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
|
-
}>>;
|
|
9303
|
+
declare const foreignKeys: <S$1 extends AnyEntity$1 | URI>(schema: S$1, keys: ForeignKey[]) => Filter<S$1 extends AnyEntity$1 ? InstanceType$1<S$1> : unknown>;
|
|
9429
9304
|
/**
|
|
9430
|
-
*
|
|
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.
|
|
9305
|
+
* Predicate for property to be equal to the provided value.
|
|
9439
9306
|
*/
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9307
|
+
declare const eq: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
9308
|
+
/**
|
|
9309
|
+
* Predicate for property to be not equal to the provided value.
|
|
9310
|
+
*/
|
|
9311
|
+
declare const neq: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
9312
|
+
/**
|
|
9313
|
+
* Predicate for property to be greater than the provided value.
|
|
9314
|
+
*/
|
|
9315
|
+
declare const gt: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
9316
|
+
/**
|
|
9317
|
+
* Predicate for property to be greater than or equal to the provided value.
|
|
9318
|
+
*/
|
|
9319
|
+
declare const gte: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
9320
|
+
/**
|
|
9321
|
+
* Predicate for property to be less than the provided value.
|
|
9322
|
+
*/
|
|
9323
|
+
declare const lt: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
9324
|
+
/**
|
|
9325
|
+
* Predicate for property to be less than or equal to the provided value.
|
|
9326
|
+
*/
|
|
9327
|
+
declare const lte: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
9328
|
+
/**
|
|
9329
|
+
* Predicate for property to be in the provided array.
|
|
9330
|
+
* @param values - Values to check against.
|
|
9331
|
+
*/
|
|
9332
|
+
declare const in$: <T$1>(...values: T$1[]) => Filter<T$1>;
|
|
9333
|
+
/**
|
|
9334
|
+
* Predicate for an array property to contain the provided value.
|
|
9335
|
+
* @param value - Value to check against.
|
|
9336
|
+
*/
|
|
9337
|
+
declare const contains: <T$1>(value: T$1) => Filter<readonly T$1[] | undefined>;
|
|
9338
|
+
/**
|
|
9339
|
+
* Predicate for property to be in the provided range.
|
|
9340
|
+
* @param from - Start of the range (inclusive).
|
|
9341
|
+
* @param to - End of the range (exclusive).
|
|
9342
|
+
*/
|
|
9343
|
+
declare const between: <T$1>(from: T$1, to: T$1) => Filter<T$1>;
|
|
9344
|
+
type TimeRange = {
|
|
9345
|
+
after?: Date | number;
|
|
9346
|
+
before?: Date | number;
|
|
9449
9347
|
};
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9348
|
+
/**
|
|
9349
|
+
* Filter objects by updatedAt timestamp.
|
|
9350
|
+
*/
|
|
9351
|
+
declare const updated$1: (range: TimeRange) => Any$3;
|
|
9352
|
+
/**
|
|
9353
|
+
* Filter objects by createdAt timestamp.
|
|
9354
|
+
*/
|
|
9355
|
+
declare const created$1: (range: TimeRange) => Any$3;
|
|
9356
|
+
type ChildOfOptions = {
|
|
9357
|
+
/** Whether to match transitively (grandchildren, etc.). Defaults to true. */
|
|
9358
|
+
transitive?: boolean;
|
|
9455
9359
|
};
|
|
9456
9360
|
/**
|
|
9457
|
-
*
|
|
9361
|
+
* Filter objects that are children of the specified parent(s).
|
|
9362
|
+
* Accepts ECHO objects, Refs, or arrays of either.
|
|
9363
|
+
* Refs are resolved to DXNs without loading; objects use {@link Obj.getURI}.
|
|
9364
|
+
* With transitive=true (default), also matches grandchildren and beyond.
|
|
9458
9365
|
*/
|
|
9459
|
-
|
|
9366
|
+
declare const childOf: (parents: Unknown$1 | Unknown$2 | readonly (Unknown$1 | Unknown$2)[], options?: ChildOfOptions) => Any$3;
|
|
9460
9367
|
/**
|
|
9461
|
-
*
|
|
9368
|
+
* Negate the filter.
|
|
9462
9369
|
*/
|
|
9463
|
-
|
|
9464
|
-
//#endregion
|
|
9465
|
-
//#region ../echo/dist/types/src/Type.d.ts
|
|
9370
|
+
declare const not: <F extends Any$3>(filter: F) => Filter<Type$3<F>>;
|
|
9466
9371
|
/**
|
|
9467
|
-
*
|
|
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.
|
|
9372
|
+
* Combine filters with a logical AND.
|
|
9471
9373
|
*/
|
|
9472
|
-
|
|
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
|
-
}
|
|
9374
|
+
declare const and: <Filters extends readonly Any$3[]>(...filters: Filters) => Filter<Type$3<Filters[number]>>;
|
|
9492
9375
|
/**
|
|
9493
|
-
*
|
|
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>`.
|
|
9503
|
-
*
|
|
9504
|
-
* @example
|
|
9505
|
-
* ```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>;
|
|
9511
|
-
* ```
|
|
9376
|
+
* Combine filters with a logical OR.
|
|
9512
9377
|
*/
|
|
9513
|
-
|
|
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
|
-
}
|
|
9378
|
+
declare const or: <Filters extends readonly Any$3[]>(...filters: Filters) => Filter<Type$3<Filters[number]>>;
|
|
9524
9379
|
/**
|
|
9525
|
-
*
|
|
9526
|
-
* with the object entity kind, i.e. what `Type.makeObject(dxn)` produces.
|
|
9380
|
+
* Returns a human-readable string representation of a Filter AST.
|
|
9527
9381
|
*/
|
|
9528
|
-
|
|
9382
|
+
declare const pretty$1: (filter: Any$3) => string;
|
|
9529
9383
|
/**
|
|
9530
|
-
*
|
|
9531
|
-
* Type-kind sibling of `Type.makeObject(...)` / `Type.makeRelation(...)` outputs.
|
|
9532
|
-
* Stored types live under this entity; filter via `Filter.type(Type.Type)`.
|
|
9384
|
+
* Create a predicate from a filter.
|
|
9533
9385
|
*/
|
|
9534
|
-
declare const
|
|
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
|
+
};
|
|
9390
|
+
//#endregion
|
|
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
|
+
}, {}>;
|
|
9535
9396
|
/**
|
|
9536
|
-
*
|
|
9537
|
-
*
|
|
9538
|
-
* `T` is the instance-property type produced by `Relation.make(...)` (excluding
|
|
9539
|
-
* source/target endpoints). `Source` and `Target` are the endpoint types.
|
|
9540
|
-
*
|
|
9541
|
-
* **Not a `Schema.Schema`.** See {@link Obj}'s note.
|
|
9397
|
+
* A an ordered set of objects.
|
|
9542
9398
|
*/
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
* Allows accessing field definitions for introspection.
|
|
9551
|
-
*/
|
|
9552
|
-
readonly fields: Fields;
|
|
9399
|
+
declare class Collection extends Collection_base {}
|
|
9400
|
+
//#endregion
|
|
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
|
+
}
|
|
9553
9406
|
}
|
|
9554
9407
|
/**
|
|
9555
|
-
*
|
|
9556
|
-
*
|
|
9408
|
+
* @since 1.0.0
|
|
9409
|
+
* @category Constructors
|
|
9557
9410
|
*/
|
|
9558
|
-
|
|
9411
|
+
//#endregion
|
|
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
|
+
}
|
|
9559
9418
|
/**
|
|
9560
|
-
*
|
|
9561
|
-
*
|
|
9562
|
-
* Mirrors {@link AnyObj} / {@link AnyRelation} for the third sibling kind.
|
|
9419
|
+
* @since 1.0.0
|
|
9420
|
+
* @category Constructors
|
|
9563
9421
|
*/
|
|
9564
|
-
|
|
9422
|
+
//#endregion
|
|
9423
|
+
//#region ../../../common/effect/dist/types/src/internal/json-path.d.ts
|
|
9424
|
+
type JsonPath = string & {
|
|
9425
|
+
__JsonPath: true;
|
|
9426
|
+
};
|
|
9565
9427
|
/**
|
|
9566
|
-
*
|
|
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`.
|
|
9428
|
+
* https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html
|
|
9569
9429
|
*/
|
|
9570
|
-
|
|
9430
|
+
declare const JsonPath: Schema<JsonPath>;
|
|
9431
|
+
//#endregion
|
|
9432
|
+
//#region ../echo/dist/types/src/View.d.ts
|
|
9433
|
+
declare const View_base: ObjClass<View, {
|
|
9434
|
+
readonly query: {
|
|
9435
|
+
readonly raw?: string | undefined;
|
|
9436
|
+
readonly ast: QueryFilterClause | QueryFromClause | QueryHierarchyTraversalClause | QueryIncomingReferencesClause | QueryLimitClause | QueryOptionsClause | QueryOrderClause | QueryReferenceTraversalClause | QueryRelationClause | QueryRelationTraversalClause | QuerySelectClause | QuerySetDifferenceClause | QueryUnionClause;
|
|
9437
|
+
};
|
|
9438
|
+
readonly projection: {
|
|
9439
|
+
readonly schema?: JsonSchemaType | undefined;
|
|
9440
|
+
readonly fields: readonly {
|
|
9441
|
+
readonly id: string;
|
|
9442
|
+
readonly path: JsonPath;
|
|
9443
|
+
readonly visible?: boolean | undefined;
|
|
9444
|
+
readonly referencePath?: JsonPath | undefined;
|
|
9445
|
+
}[];
|
|
9446
|
+
readonly pivotFieldId?: string | undefined;
|
|
9447
|
+
};
|
|
9448
|
+
}, {}>;
|
|
9571
9449
|
/**
|
|
9572
|
-
*
|
|
9573
|
-
*
|
|
9574
|
-
* since `Type.makeObject(dxn)` does not return a `Schema.Schema`.
|
|
9575
|
-
*
|
|
9576
|
-
* Re-exported from the internal types layer so both `Type.ts` and internal
|
|
9577
|
-
* helpers (`makeObject`, `createObject`) reference the same phantom key.
|
|
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.
|
|
9578
9452
|
*/
|
|
9579
|
-
declare
|
|
9580
|
-
|
|
9453
|
+
declare class View extends View_base {}
|
|
9454
|
+
//#endregion
|
|
9455
|
+
//#region ../echo/dist/types/src/Dataset.d.ts
|
|
9581
9456
|
/**
|
|
9582
|
-
*
|
|
9583
|
-
*
|
|
9584
|
-
*
|
|
9585
|
-
*
|
|
9586
|
-
* Not a `Schema.Schema`. Use `Type.getSchema(value)` to obtain the underlying
|
|
9587
|
-
* Effect Schema and `Type.update(value, draft => ...)` to mutate.
|
|
9588
|
-
*
|
|
9589
|
-
* `A` is the instance-type phantom — what `Obj.make(value, ...)` would produce.
|
|
9590
|
-
* Merged with the `Type` const value via TypeScript declaration merging.
|
|
9457
|
+
* Abstract set of objects, represented by a view, feed, or collection.
|
|
9458
|
+
* Schema-level union of the underlying type entities (rebuilt via
|
|
9459
|
+
* `Type.getSchema`) so this can still be consumed by Schema-side APIs such
|
|
9460
|
+
* as `Filter.type(...)` on a union.
|
|
9591
9461
|
*/
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
readonly [StaticTypeSchemaSlot]: Schema.AnyNoContext;
|
|
9462
|
+
type Dataset = Feed | Collection | View;
|
|
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>]>;
|
|
9464
|
+
declare namespace Order_d_exports {
|
|
9465
|
+
export { Any$2 as Any, Order, created, natural, property, rank, updated };
|
|
9597
9466
|
}
|
|
9467
|
+
interface Order<T$1> {
|
|
9468
|
+
'~Order': {
|
|
9469
|
+
value: T$1;
|
|
9470
|
+
};
|
|
9471
|
+
'ast': Order$1;
|
|
9472
|
+
}
|
|
9473
|
+
type Any$2 = Order<any>;
|
|
9474
|
+
declare const natural: Order<any>;
|
|
9475
|
+
declare const property: <T$1>(property: keyof T$1 & string, direction: OrderDirection) => Order<T$1>;
|
|
9598
9476
|
/**
|
|
9599
|
-
*
|
|
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.
|
|
9606
|
-
*
|
|
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>`
|
|
9477
|
+
* Order by relevance rank (for FTS/vector search results).
|
|
9478
|
+
* Higher rank = better match. Default direction is 'desc' (best matches first).
|
|
9611
9479
|
*/
|
|
9612
|
-
|
|
9613
|
-
//#endregion
|
|
9614
|
-
//#region ../echo/dist/types/src/internal/Ref/ref.d.ts
|
|
9615
|
-
declare const RefTypeId: unique symbol;
|
|
9480
|
+
declare const rank: <T$1>(direction?: OrderDirection) => Order<T$1>;
|
|
9616
9481
|
/**
|
|
9617
|
-
*
|
|
9482
|
+
* Order by the system `updatedAt` timestamp (last re-indexed). Default direction is 'desc'
|
|
9483
|
+
* (most-recently-updated first). Mirrors {@link Filter.updated}.
|
|
9618
9484
|
*/
|
|
9619
|
-
|
|
9485
|
+
declare const updated: <T$1>(direction?: OrderDirection) => Order<T$1>;
|
|
9620
9486
|
/**
|
|
9621
|
-
*
|
|
9487
|
+
* Order by the system `createdAt` timestamp (first indexed). Default direction is 'desc'
|
|
9488
|
+
* (most-recently-created first). Mirrors {@link Filter.created}.
|
|
9622
9489
|
*/
|
|
9623
|
-
|
|
9624
|
-
|
|
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>;
|
|
9645
|
-
/**
|
|
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).
|
|
9648
|
-
*/
|
|
9649
|
-
fromURI: (uri: URI) => Ref<any>;
|
|
9490
|
+
declare const created: <T$1>(direction?: OrderDirection) => Order<T$1>;
|
|
9491
|
+
declare namespace Query_d_exports {
|
|
9492
|
+
export { Any$1 as Any, Query, Type$2 as Type, all, from, fromAst, is, pretty, select, type$1 as type, without };
|
|
9650
9493
|
}
|
|
9651
9494
|
/**
|
|
9652
|
-
*
|
|
9653
|
-
*/
|
|
9654
|
-
declare const Ref: RefFn;
|
|
9655
|
-
/**
|
|
9656
|
-
* Represents materialized reference to a target.
|
|
9657
|
-
* This is the data type for the fields marked as ref.
|
|
9495
|
+
* All property paths inside T that are references.
|
|
9658
9496
|
*/
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9497
|
+
type RefPropKey<T$1> = keyof T$1 & string;
|
|
9498
|
+
type RefArrayElement<A$1> = A$1 extends readonly (infer E)[] ? E : A$1 extends (infer E)[] ? E : never;
|
|
9499
|
+
/** Target entity when traversing an outgoing ref or array-of-refs property. */
|
|
9500
|
+
type ReferenceTraversalTarget<P$1> = P$1 extends Unknown$2 ? Target$1<P$1> : P$1 extends Unknown$2 | undefined ? Target$1<Exclude<P$1, undefined>> : RefArrayElement<P$1> extends Unknown$2 ? Target$1<RefArrayElement<P$1>> : never;
|
|
9501
|
+
interface Query<T$1> {
|
|
9502
|
+
'~Query': {
|
|
9503
|
+
value: T$1;
|
|
9504
|
+
};
|
|
9505
|
+
'ast': Query$1;
|
|
9664
9506
|
/**
|
|
9665
|
-
*
|
|
9507
|
+
* Filter the current selection based on a filter.
|
|
9508
|
+
* @param filter - Filter to select the objects.
|
|
9509
|
+
* @returns Query for the selected objects.
|
|
9666
9510
|
*/
|
|
9667
|
-
|
|
9511
|
+
'select'(filter: Filter<T$1>): Query<T$1>;
|
|
9512
|
+
'select'(props: Props$1<T$1>): Query<T$1>;
|
|
9668
9513
|
/**
|
|
9669
|
-
*
|
|
9670
|
-
*
|
|
9671
|
-
*
|
|
9514
|
+
* Traverse an outgoing reference.
|
|
9515
|
+
* @param key - Property path inside T that is a reference or optional reference.
|
|
9516
|
+
* @returns Query for the target of the reference.
|
|
9672
9517
|
*/
|
|
9673
|
-
|
|
9518
|
+
'reference'<K$1 extends RefPropKey<T$1>>(key: K$1): Query<ReferenceTraversalTarget<T$1[K$1]>>;
|
|
9674
9519
|
/**
|
|
9675
|
-
*
|
|
9676
|
-
*
|
|
9677
|
-
* @
|
|
9520
|
+
* Find objects referencing this object.
|
|
9521
|
+
* @param target - Schema of the referencing object. If not provided, matches any type.
|
|
9522
|
+
* @param key - Property path inside the referencing object that is a reference. If not provided, matches any property.
|
|
9523
|
+
* @returns Query for the referencing objects.
|
|
9678
9524
|
*/
|
|
9679
|
-
|
|
9525
|
+
'referencedBy'<S$1 extends AnyEntity$1>(target: S$1 | URI, key: RefPropKey<InstanceType$1<S$1>>): Query<InstanceType$1<S$1>>;
|
|
9526
|
+
'referencedBy'<S$1 extends AnyEntity$1>(target: S$1 | URI): Query<InstanceType$1<S$1>>;
|
|
9527
|
+
'referencedBy'(): Query<any>;
|
|
9680
9528
|
/**
|
|
9681
|
-
*
|
|
9529
|
+
* Find relations where this object is the source.
|
|
9530
|
+
* @returns Query for the relation objects.
|
|
9531
|
+
* @param relation - Schema of the relation.
|
|
9532
|
+
* @param predicates - Predicates to filter the relation objects.
|
|
9682
9533
|
*/
|
|
9683
|
-
|
|
9534
|
+
'sourceOf'<R$1 extends AnyRelation>(relation?: R$1 | URI, predicates?: Props$1<InstanceType$1<R$1>>): Query<InstanceType$1<R$1>>;
|
|
9684
9535
|
/**
|
|
9685
|
-
*
|
|
9686
|
-
*
|
|
9687
|
-
*
|
|
9688
|
-
*
|
|
9689
|
-
* via {@link target} while it is not yet loaded.
|
|
9690
|
-
* @returns Function that unsubscribes the callback.
|
|
9536
|
+
* Find relations where this object is the target.
|
|
9537
|
+
* @returns Query for the relation objects.
|
|
9538
|
+
* @param relation - Type entity of the relation.
|
|
9539
|
+
* @param predicates - Predicates to filter the relation objects.
|
|
9691
9540
|
*/
|
|
9692
|
-
|
|
9541
|
+
'targetOf'<R$1 extends AnyRelation>(relation?: R$1 | URI, predicates?: Props$1<InstanceType$1<R$1>>): Query<InstanceType$1<R$1>>;
|
|
9693
9542
|
/**
|
|
9694
|
-
*
|
|
9695
|
-
*
|
|
9696
|
-
*
|
|
9697
|
-
* When serialized with toJSON, the difference is between:
|
|
9698
|
-
* `{ "/": "dxn:..." }`
|
|
9699
|
-
* and
|
|
9700
|
-
* `{ "/": "dxn:...", "target": { ... } }`
|
|
9701
|
-
*
|
|
9702
|
-
* Clones the reference object.
|
|
9543
|
+
* For a query for relations, get the source objects.
|
|
9544
|
+
* @returns Query for the source objects.
|
|
9703
9545
|
*/
|
|
9704
|
-
|
|
9546
|
+
'source'(): Query<SourceOf<T$1>>;
|
|
9705
9547
|
/**
|
|
9706
|
-
*
|
|
9707
|
-
*
|
|
9708
|
-
* Use `Obj.atom(ref)` if you need reactive snapshots that update on every object mutation.
|
|
9548
|
+
* For a query for relations, get the target objects.
|
|
9549
|
+
* @returns Query for the target objects.
|
|
9709
9550
|
*/
|
|
9710
|
-
|
|
9551
|
+
'target'(): Query<TargetOf<T$1>>;
|
|
9711
9552
|
/**
|
|
9712
|
-
*
|
|
9713
|
-
*
|
|
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": { ... } }`
|
|
9553
|
+
* Get the parent object of the current selection.
|
|
9554
|
+
* @returns Query for the parent objects.
|
|
9720
9555
|
*/
|
|
9721
|
-
|
|
9722
|
-
[RefTypeId]: {
|
|
9723
|
-
_T: T$1;
|
|
9724
|
-
};
|
|
9725
|
-
}
|
|
9726
|
-
declare namespace Ref {
|
|
9556
|
+
'parent'(): Query<any>;
|
|
9727
9557
|
/**
|
|
9728
|
-
*
|
|
9558
|
+
* Get all child objects of the current selection.
|
|
9559
|
+
* @returns Query for the child objects.
|
|
9729
9560
|
*/
|
|
9730
|
-
|
|
9731
|
-
}
|
|
9732
|
-
/**
|
|
9733
|
-
* Load-source ceiling for a resolution request. Cheaper tiers are always probed first; the
|
|
9734
|
-
* ceiling caps how far a request is allowed to reach:
|
|
9735
|
-
* - `working-set`: synchronous, in-memory only. A miss settles `unavailable` immediately.
|
|
9736
|
-
* - `disk`: probe the working set, then local storage; never the network.
|
|
9737
|
-
* - `network`: probe the working set, disk, then fetch from peers.
|
|
9738
|
-
*
|
|
9739
|
-
* `unavailable` is always relative to the requested ceiling (disk-unavailable ≠ network-unavailable).
|
|
9740
|
-
*/
|
|
9741
|
-
type RefSource = 'working-set' | 'disk' | 'network';
|
|
9742
|
-
/**
|
|
9743
|
-
* A stateful, closure-aware handle to an in-flight (or settled) reference resolution.
|
|
9744
|
-
*
|
|
9745
|
-
* `ready` means the entity is FULLY USABLE: its own body and its strong-dependency closure are all
|
|
9746
|
-
* materialized. The body-vs-closure split is internal; `requesting` transparently covers "a
|
|
9747
|
-
* dependency is still loading".
|
|
9748
|
-
*/
|
|
9749
|
-
interface RefResolverRequest {
|
|
9561
|
+
'children'(): Query<any>;
|
|
9750
9562
|
/**
|
|
9751
|
-
*
|
|
9752
|
-
*
|
|
9753
|
-
*
|
|
9563
|
+
* Order the query results.
|
|
9564
|
+
* Orders are specified in priority order. The first order will be applied first, etc.
|
|
9565
|
+
* @param order - Order to sort the results.
|
|
9566
|
+
* @returns Query for the ordered results.
|
|
9754
9567
|
*/
|
|
9755
|
-
|
|
9568
|
+
'orderBy'(...order: NonEmptyArray<Order<T$1>>): Query<T$1>;
|
|
9756
9569
|
/**
|
|
9757
|
-
*
|
|
9570
|
+
* Limit the number of results.
|
|
9571
|
+
* @param limit - Maximum number of results to return.
|
|
9572
|
+
* @returns Query for the limited results.
|
|
9758
9573
|
*/
|
|
9759
|
-
|
|
9574
|
+
'limit'(limit: number): Query<T$1>;
|
|
9760
9575
|
/**
|
|
9761
|
-
*
|
|
9576
|
+
* Query from selected databases only.
|
|
9577
|
+
*
|
|
9578
|
+
* Example:
|
|
9579
|
+
*
|
|
9580
|
+
* ```ts
|
|
9581
|
+
* Query.select(Filter.type(Person)).from(db);
|
|
9582
|
+
* ```
|
|
9583
|
+
*
|
|
9584
|
+
* @param options.includeFeeds [false] - Whether to include feeds in the query. Default is to query from automerge documents only.
|
|
9762
9585
|
*/
|
|
9763
|
-
|
|
9586
|
+
'from'(database: Database | Database[], options?: {
|
|
9587
|
+
includeFeeds?: boolean;
|
|
9588
|
+
}): Query<T$1>;
|
|
9764
9589
|
/**
|
|
9765
|
-
*
|
|
9590
|
+
* Query from selected feeds only.
|
|
9591
|
+
*
|
|
9592
|
+
* Example:
|
|
9593
|
+
*
|
|
9594
|
+
* ```ts
|
|
9595
|
+
* Query.select(Filter.type(Person)).from(feed);
|
|
9596
|
+
* ```
|
|
9597
|
+
*
|
|
9766
9598
|
*/
|
|
9767
|
-
|
|
9599
|
+
'from'(feeds: Feed | Feed[]): Query<T$1>;
|
|
9768
9600
|
/**
|
|
9769
|
-
*
|
|
9601
|
+
* Query from all accessible spaces.
|
|
9602
|
+
*
|
|
9603
|
+
* Example:
|
|
9604
|
+
*
|
|
9605
|
+
* ```ts
|
|
9606
|
+
* Query.select(Filter.type(Person)).from('all-accessible-spaces');
|
|
9607
|
+
* ```
|
|
9608
|
+
*
|
|
9609
|
+
* @param options.includeFeeds [false] - Whether to include feeds in the query. Default is to query from automerge documents only.
|
|
9770
9610
|
*/
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9611
|
+
'from'(allSpaces: 'all-accessible-spaces', options?: {
|
|
9612
|
+
includeFeeds?: boolean;
|
|
9613
|
+
}): Query<T$1>;
|
|
9774
9614
|
/**
|
|
9775
|
-
*
|
|
9776
|
-
*
|
|
9615
|
+
* Query from a dataset.
|
|
9616
|
+
* Currently only feeds are supported.
|
|
9617
|
+
*
|
|
9618
|
+
* Example:
|
|
9619
|
+
*
|
|
9620
|
+
* ```ts
|
|
9621
|
+
* Query.type(Person).from(feed);
|
|
9622
|
+
* ```
|
|
9777
9623
|
*/
|
|
9778
|
-
|
|
9779
|
-
source: RefSource;
|
|
9780
|
-
}): RefResolverRequest;
|
|
9624
|
+
'from'(dataset: Dataset): Query<T$1>;
|
|
9781
9625
|
/**
|
|
9782
|
-
*
|
|
9626
|
+
* Query from the results of another query.
|
|
9783
9627
|
*
|
|
9784
|
-
*
|
|
9785
|
-
*
|
|
9786
|
-
*
|
|
9787
|
-
*
|
|
9628
|
+
* Example:
|
|
9629
|
+
*
|
|
9630
|
+
* ```ts
|
|
9631
|
+
* Query.select(Filter.props({ foo: 'foo' })).from(Query.select(Filter.type(Contact)).reference('org'));
|
|
9632
|
+
* ```
|
|
9788
9633
|
*/
|
|
9789
|
-
|
|
9634
|
+
'from'(query: Any$1): Query<T$1>;
|
|
9790
9635
|
/**
|
|
9791
|
-
*
|
|
9792
|
-
*
|
|
9636
|
+
* Query from one or more raw scopes.
|
|
9637
|
+
*
|
|
9638
|
+
* Use the {@link Scope} constructors rather than raw tagged objects:
|
|
9639
|
+
*
|
|
9640
|
+
* ```ts
|
|
9641
|
+
* Query.select(Filter.type(Type.Type)).from(Scope.space(), Scope.registry());
|
|
9642
|
+
* ```
|
|
9793
9643
|
*/
|
|
9794
|
-
|
|
9644
|
+
'from'(...scopes: Scope[]): Query<T$1>;
|
|
9795
9645
|
/**
|
|
9796
|
-
*
|
|
9646
|
+
* Query from a raw scope or array of scopes.
|
|
9797
9647
|
*/
|
|
9798
|
-
|
|
9648
|
+
'from'(scope: Scope | Scope[]): Query<T$1>;
|
|
9799
9649
|
/**
|
|
9800
|
-
*
|
|
9801
|
-
* deserialization paths (`Obj.fromJSON`) to set the back-reference accessed
|
|
9802
|
-
* via `Obj.getType` / `Entity.getType`. Optional — resolvers that only
|
|
9803
|
-
* carry raw schemas may leave this unimplemented; the deserializer falls
|
|
9804
|
-
* back to leaving the type entity unset.
|
|
9805
|
-
* @deprecated Use {@link resolve}. Removed in Task 11.
|
|
9650
|
+
* Add options to a query.
|
|
9806
9651
|
*/
|
|
9807
|
-
|
|
9808
|
-
}
|
|
9809
|
-
//#endregion
|
|
9810
|
-
//#region ../echo/dist/types/src/Ref.d.ts
|
|
9811
|
-
/**
|
|
9812
|
-
* Instance type for a reference.
|
|
9813
|
-
*
|
|
9814
|
-
* Reference can point to any object or relation.
|
|
9815
|
-
* References are lazy loaded.
|
|
9816
|
-
*
|
|
9817
|
-
* `ref.dxn` is the DXN of the referenced object.
|
|
9818
|
-
*
|
|
9819
|
-
* @example
|
|
9820
|
-
* ```ts
|
|
9821
|
-
* const taskRef: Ref<Task> = Ref.make(task);
|
|
9822
|
-
*
|
|
9823
|
-
* await taskRef.load(); // Returns Promise<Task>
|
|
9824
|
-
* yield* Database.load(taskRef); // Effectful version.
|
|
9825
|
-
*
|
|
9826
|
-
* database.makeRef(dxn); // Create a ref from a DXN.
|
|
9827
|
-
* ```
|
|
9828
|
-
*/
|
|
9829
|
-
type Ref$1<T$1> = Ref<T$1>;
|
|
9830
|
-
type Unknown$2 = Ref<Unknown$1>;
|
|
9831
|
-
/**
|
|
9832
|
-
* Factory function to create a Ref schema for the given target schema.
|
|
9833
|
-
* Use this in schema definitions to declare reference fields.
|
|
9834
|
-
*
|
|
9835
|
-
* @example
|
|
9836
|
-
* ```ts
|
|
9837
|
-
* const Task = Schema.Struct({
|
|
9838
|
-
* assignee: Ref.Ref(Person), // Creates a Ref schema
|
|
9839
|
-
* }).pipe(Type.makeObject(DXN.make('com.example.type.task', '0.1.0')));
|
|
9840
|
-
* ```
|
|
9841
|
-
*/
|
|
9842
|
-
declare const Ref$1: {
|
|
9843
|
-
<S$1 extends AnyObj | AnyRelation>(type: S$1): RefSchema<InstanceType$1<S$1> & Unknown$1>;
|
|
9844
|
-
<T$1 extends Type$3<any>>(type: T$1): RefSchema<InstanceType$1<T$1>>;
|
|
9845
|
-
<S$1 extends UnknownTypeSchema<any, any>>(schema: S$1): RefSchema<Schema.Type<S$1> & Unknown$1>;
|
|
9846
|
-
};
|
|
9847
|
-
/**
|
|
9848
|
-
* TypeScript type for a Ref schema.
|
|
9849
|
-
* This is the type of the SCHEMA itself, not the runtime ref instance.
|
|
9850
|
-
* For the instance type, use `Ref.Ref<T>` from the Ref module.
|
|
9851
|
-
*
|
|
9852
|
-
* @example
|
|
9853
|
-
* ```ts
|
|
9854
|
-
* // Schema type annotation (rarely needed, usually inferred):
|
|
9855
|
-
* const refSchema: Ref.RefSchema<typeof Task> = Ref.Ref(Task);
|
|
9856
|
-
*
|
|
9857
|
-
* // Instance type annotation (use Ref.Ref instead):
|
|
9858
|
-
* const refInstance: Ref.Ref<Task> = Ref.make(task);
|
|
9859
|
-
* ```
|
|
9860
|
-
*/
|
|
9861
|
-
interface RefSchema<T$1 extends Unknown> extends RefSchema$1<T$1> {}
|
|
9862
|
-
/**
|
|
9863
|
-
* Extract reference target.
|
|
9864
|
-
*/
|
|
9865
|
-
type Target$1<R$1 extends Unknown$2> = R$1 extends Ref<infer T> ? T : never;
|
|
9866
|
-
/**
|
|
9867
|
-
* Reference resolver.
|
|
9868
|
-
*/
|
|
9869
|
-
type Resolver = RefResolver;
|
|
9870
|
-
//#endregion
|
|
9871
|
-
//#region ../echo/dist/types/src/Obj.d.ts
|
|
9872
|
-
/**
|
|
9873
|
-
* Base type for all ECHO objects.
|
|
9874
|
-
*/
|
|
9875
|
-
interface BaseObj extends AnyEntity, OfKind<typeof Kind.Object> {}
|
|
9876
|
-
/**
|
|
9877
|
-
* Object type with specific properties.
|
|
9878
|
-
*/
|
|
9879
|
-
type OfShape<Props$2> = BaseObj & Props$2;
|
|
9880
|
-
/**
|
|
9881
|
-
* Object with no known properties beyond id and kind.
|
|
9882
|
-
* Use this when the object's schema/properties are not known.
|
|
9883
|
-
* For objects with arbitrary properties, use `Obj.AnyProps`.
|
|
9884
|
-
*
|
|
9885
|
-
* NOTE: This is a TypeScript type only, not a schema.
|
|
9886
|
-
* To validate that a value is an ECHO object, use `Schema.is(Type.Obj)`.
|
|
9887
|
-
*/
|
|
9888
|
-
interface Unknown$1 extends BaseObj {}
|
|
9889
|
-
/**
|
|
9890
|
-
* Runtime Effect schema for any ECHO object.
|
|
9891
|
-
* Use for validation, parsing, or as a reference target for collections.
|
|
9892
|
-
*
|
|
9893
|
-
* NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).
|
|
9894
|
-
* Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.
|
|
9895
|
-
*
|
|
9896
|
-
* @example
|
|
9897
|
-
* ```ts
|
|
9898
|
-
* // Structural type guard (accepts any object with id field)
|
|
9899
|
-
* if (Schema.is(Type.Obj)(unknownValue)) { ... }
|
|
9900
|
-
*
|
|
9901
|
-
* // ECHO instance type guard (checks KindId brand)
|
|
9902
|
-
* if (Obj.isObject(unknownValue)) { ... }
|
|
9903
|
-
*
|
|
9904
|
-
* // Reference to any object type
|
|
9905
|
-
* const Collection = Schema.Struct({
|
|
9906
|
-
* objects: Schema.Array(Ref.Ref(Obj.Unknown)),
|
|
9907
|
-
* }).pipe(Type.makeObject(DXN.make('com.example.type.collection', '0.1.0')));
|
|
9908
|
-
* ```
|
|
9909
|
-
*/
|
|
9910
|
-
declare const Unknown$1: UnknownTypeSchema<Unknown$1, typeof Kind.Object>;
|
|
9911
|
-
declare namespace Filter_d_exports {
|
|
9912
|
-
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 };
|
|
9913
|
-
}
|
|
9914
|
-
interface Filter<T$1> {
|
|
9915
|
-
'~Filter': {
|
|
9916
|
-
value: Covariant<T$1>;
|
|
9917
|
-
};
|
|
9918
|
-
ast: Filter$1;
|
|
9919
|
-
}
|
|
9920
|
-
type Props$1<T$1> = { [K in keyof T$1 & string]?: Filter<T$1[K]> | T$1[K] };
|
|
9921
|
-
type Any$3 = Filter<any>;
|
|
9922
|
-
type Type$2<F extends Any$3> = F extends Filter<infer T> ? T : never;
|
|
9923
|
-
declare class FilterClass implements Any$3 {
|
|
9924
|
-
readonly ast: Filter$1;
|
|
9925
|
-
private static 'variance';
|
|
9926
|
-
constructor(ast: Filter$1);
|
|
9927
|
-
'~Filter': {
|
|
9928
|
-
value: Covariant<any>;
|
|
9929
|
-
};
|
|
9930
|
-
}
|
|
9931
|
-
declare const is$1: (value: unknown) => value is Any$3;
|
|
9932
|
-
/** Construct a filter from an ast. */
|
|
9933
|
-
declare const fromAst$1: (ast: Filter$1) => Any$3;
|
|
9934
|
-
/**
|
|
9935
|
-
* Filter that matches all objects.
|
|
9936
|
-
*/
|
|
9937
|
-
declare const everything: () => FilterClass;
|
|
9938
|
-
/**
|
|
9939
|
-
* Filter that matches no objects.
|
|
9940
|
-
*/
|
|
9941
|
-
declare const nothing: () => FilterClass;
|
|
9942
|
-
declare const id: (...ids: EntityId[]) => Any$3;
|
|
9943
|
-
/**
|
|
9944
|
-
* Filter by type.
|
|
9945
|
-
*
|
|
9946
|
-
* Accepts a `Type.Type` entity (the value produced by `Type.makeObject` /
|
|
9947
|
-
* `Type.makeRelation`), a `Schema.Union` of such entities (for filtering across a
|
|
9948
|
-
* union of ECHO types), or a fully-qualified type URI — an `echo:` EID (stored schema)
|
|
9949
|
-
* or a `dxn:` DXN (static schema). To filter by a bare typename, wrap it: `DXN.make(typename)`.
|
|
9950
|
-
*/
|
|
9951
|
-
declare const type$2: {
|
|
9952
|
-
<T$1 extends AnyEntity$1>(type: T$1, props?: Props$1<InstanceType$1<T$1>>): Filter<InstanceType$1<T$1>>;
|
|
9953
|
-
<S$1 extends UnknownTypeSchema<any, any>>(schema: S$1, props?: Props$1<Schema.Type<S$1>>): Filter<Schema.Type<S$1>>;
|
|
9954
|
-
<S$1 extends Union<readonly Schema.AnyNoContext[]>>(union: S$1, props?: Props$1<Schema.Type<S$1>>): Filter<Schema.Type<S$1>>;
|
|
9955
|
-
(uri: URI, props?: Props$1<unknown>): Filter<any>;
|
|
9956
|
-
(input: AnyEntity$1 | URI, props?: Props$1<unknown>): Filter<unknown>;
|
|
9957
|
-
};
|
|
9958
|
-
/**
|
|
9959
|
-
* Filter by tag.
|
|
9960
|
-
*/
|
|
9961
|
-
declare const tag: (tag: string) => Any$3;
|
|
9962
|
-
/**
|
|
9963
|
-
* Options for {@link key} filter.
|
|
9964
|
-
*/
|
|
9965
|
-
type KeyFilterOptions = {
|
|
9652
|
+
'options'(options: QueryOptions): Query<T$1>;
|
|
9966
9653
|
/**
|
|
9967
|
-
*
|
|
9968
|
-
* Matches the object's meta `version` field against the range.
|
|
9969
|
-
* If omitted, matches any version (including objects with no version).
|
|
9654
|
+
* Attach a diagnostic label for logs and tooling (execution semantics unchanged).
|
|
9970
9655
|
*/
|
|
9971
|
-
|
|
9972
|
-
}
|
|
9656
|
+
'debugLabel'(label: string): Query<T$1>;
|
|
9657
|
+
}
|
|
9658
|
+
type Any$1 = Query<any>;
|
|
9659
|
+
type Type$2<Q extends Any$1> = Q extends Query<infer T> ? T : never;
|
|
9660
|
+
declare const is: (value: unknown) => value is Any$1;
|
|
9661
|
+
/** Construct a query from an ast. */
|
|
9662
|
+
declare const fromAst: (ast: Query$1) => Any$1;
|
|
9973
9663
|
/**
|
|
9974
|
-
*
|
|
9975
|
-
*
|
|
9976
|
-
* @
|
|
9977
|
-
* ```ts
|
|
9978
|
-
* Filter.key('org.example.type.foo');
|
|
9979
|
-
* Filter.key('org.example.type.foo', { version: '^1.2.3' });
|
|
9980
|
-
* ```
|
|
9664
|
+
* Select objects based on a filter.
|
|
9665
|
+
* @param filter - Filter to select the objects.
|
|
9666
|
+
* @returns Query for the selected objects.
|
|
9981
9667
|
*/
|
|
9982
|
-
declare const
|
|
9668
|
+
declare const select: <F extends Any$3>(filter: F) => Query<Type$3<F>>;
|
|
9983
9669
|
/**
|
|
9984
|
-
*
|
|
9670
|
+
* Query for objects of a given schema.
|
|
9671
|
+
* @param schema - Schema of the objects.
|
|
9672
|
+
* @param predicates - Predicates to filter the objects.
|
|
9673
|
+
* @returns Query for the objects.
|
|
9674
|
+
*
|
|
9675
|
+
* Shorthand for: `Query.select(Filter.type(schema, predicates))`.
|
|
9985
9676
|
*/
|
|
9986
|
-
declare const
|
|
9987
|
-
type
|
|
9988
|
-
|
|
9677
|
+
declare const type$1: {
|
|
9678
|
+
<T$1 extends AnyEntity$1>(type: T$1, predicates?: Props$1<InstanceType$1<T$1>>): Query<InstanceType$1<T$1>>;
|
|
9679
|
+
<S$1 extends UnknownTypeSchema<any, any>>(schema: S$1, predicates?: Props$1<Schema.Type<S$1>>): Query<Schema.Type<S$1>>;
|
|
9680
|
+
<S$1 extends Union<readonly Schema.AnyNoContext[]>>(union: S$1, predicates?: Props$1<Schema.Type<S$1>>): Query<Schema.Type<S$1>>;
|
|
9681
|
+
(uri: URI, predicates?: Props$1<unknown>): Query<any>;
|
|
9989
9682
|
};
|
|
9990
9683
|
/**
|
|
9991
|
-
*
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
/**
|
|
9995
|
-
* Filter by foreign keys.
|
|
9996
|
-
*/
|
|
9997
|
-
declare const foreignKeys: <S$1 extends AnyEntity$1 | URI>(schema: S$1, keys: ForeignKey[]) => Filter<S$1 extends AnyEntity$1 ? InstanceType$1<S$1> : unknown>;
|
|
9998
|
-
/**
|
|
9999
|
-
* Predicate for property to be equal to the provided value.
|
|
10000
|
-
*/
|
|
10001
|
-
declare const eq: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
10002
|
-
/**
|
|
10003
|
-
* Predicate for property to be not equal to the provided value.
|
|
10004
|
-
*/
|
|
10005
|
-
declare const neq: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
10006
|
-
/**
|
|
10007
|
-
* Predicate for property to be greater than the provided value.
|
|
10008
|
-
*/
|
|
10009
|
-
declare const gt: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
10010
|
-
/**
|
|
10011
|
-
* Predicate for property to be greater than or equal to the provided value.
|
|
10012
|
-
*/
|
|
10013
|
-
declare const gte: <T$1>(value: T$1) => Filter<T$1 | undefined>;
|
|
10014
|
-
/**
|
|
10015
|
-
* Predicate for property to be less than the provided value.
|
|
9684
|
+
* Combine results of multiple queries.
|
|
9685
|
+
* @param queries - Queries to combine.
|
|
9686
|
+
* @returns Query for the combined results.
|
|
10016
9687
|
*/
|
|
10017
|
-
declare const
|
|
9688
|
+
declare const all: (...queries: Any$1[]) => Any$1;
|
|
10018
9689
|
/**
|
|
10019
|
-
*
|
|
9690
|
+
* Subtract one query from another.
|
|
9691
|
+
* @param source - Query to subtract from.
|
|
9692
|
+
* @param exclude - Query to subtract.
|
|
9693
|
+
* @returns Query for the results of the source query minus the results of the exclude query.
|
|
10020
9694
|
*/
|
|
10021
|
-
declare const
|
|
9695
|
+
declare const without: <T$1>(source: Query<T$1>, exclude: Query<T$1>) => Query<T$1>;
|
|
10022
9696
|
/**
|
|
10023
|
-
*
|
|
10024
|
-
*
|
|
9697
|
+
* Create a query scoped to a data source.
|
|
9698
|
+
* The returned query selects everything from the source; chain `.select()` to narrow results.
|
|
9699
|
+
*
|
|
9700
|
+
* @param source - Data source: database, feed, 'all-accessible-spaces', or another query.
|
|
9701
|
+
* @returns Query scoped to the given source.
|
|
10025
9702
|
*/
|
|
10026
|
-
declare const
|
|
9703
|
+
declare const from: (...args: [(Database | Database[] | Feed | Feed[] | Any$1 | Scope | Scope[] | 'all-accessible-spaces'), {
|
|
9704
|
+
includeFeeds?: boolean;
|
|
9705
|
+
}?] | Scope[]) => Any$1;
|
|
10027
9706
|
/**
|
|
10028
|
-
*
|
|
10029
|
-
* @param value - Value to check against.
|
|
9707
|
+
* Returns a human-readable string representation of a Query AST.
|
|
10030
9708
|
*/
|
|
10031
|
-
declare const
|
|
9709
|
+
declare const pretty: (query: Any$1) => string;
|
|
9710
|
+
//#endregion
|
|
9711
|
+
//#region ../echo/dist/types/src/QueryResult.d.ts
|
|
10032
9712
|
/**
|
|
10033
|
-
*
|
|
10034
|
-
* @param from - Start of the range (inclusive).
|
|
10035
|
-
* @param to - End of the range (exclusive).
|
|
9713
|
+
* Individual query result entry.
|
|
10036
9714
|
*/
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
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
|
+
};
|
|
10041
9737
|
};
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
/**
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
type ChildOfOptions = {
|
|
10051
|
-
/** Whether to match transitively (grandchildren, etc.). Defaults to true. */
|
|
10052
|
-
transitive?: boolean;
|
|
9738
|
+
type RunOptions = {
|
|
9739
|
+
timeout?: number;
|
|
9740
|
+
};
|
|
9741
|
+
type SubscriptionOptions = {
|
|
9742
|
+
/**
|
|
9743
|
+
* Fire the callback immediately.
|
|
9744
|
+
*/
|
|
9745
|
+
fire?: boolean;
|
|
10053
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
|
+
}, {}>;
|
|
10054
9803
|
/**
|
|
10055
|
-
*
|
|
10056
|
-
*
|
|
10057
|
-
*
|
|
10058
|
-
*
|
|
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
|
+
* ```
|
|
10059
9810
|
*/
|
|
10060
|
-
declare
|
|
9811
|
+
declare class Feed extends Feed_base {}
|
|
10061
9812
|
/**
|
|
10062
|
-
*
|
|
9813
|
+
* Sync options for a feed.
|
|
10063
9814
|
*/
|
|
10064
|
-
|
|
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
|
+
}
|
|
10065
9821
|
/**
|
|
10066
|
-
*
|
|
9822
|
+
* Queue replication backlog for a feed namespace.
|
|
9823
|
+
* `0` / `0` means caught up on pull and push.
|
|
10067
9824
|
*/
|
|
10068
|
-
|
|
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
|
|
9834
|
+
//#region ../echo/dist/types/src/Registry.d.ts
|
|
10069
9835
|
/**
|
|
10070
|
-
*
|
|
9836
|
+
* Identifier denoting an ECHO Registry.
|
|
10071
9837
|
*/
|
|
10072
|
-
declare const
|
|
9838
|
+
declare const TypeId$1: unique symbol;
|
|
9839
|
+
type TypeId$1 = typeof TypeId$1;
|
|
10073
9840
|
/**
|
|
10074
|
-
*
|
|
9841
|
+
* Composable, in-memory registry of keyed ECHO entities.
|
|
9842
|
+
*
|
|
9843
|
+
* Entities are stored by id and queried via the standard ECHO Query API.
|
|
9844
|
+
* A registry may delegate to an optional upstream registry: results from the local
|
|
9845
|
+
* registry take precedence and upstream results fill in anything not found locally.
|
|
9846
|
+
*
|
|
9847
|
+
* Intended use cases include caches of schemas, operations, skills, routines, plugins,
|
|
9848
|
+
* etc., sourced from 3rd-party plugins, local code, or local space objects.
|
|
9849
|
+
*
|
|
9850
|
+
* Types (schema-definition entities produced by `Type.makeObject` / `Type.makeRelation`) are
|
|
9851
|
+
* stored the same way as any other entity — via `add()`. Use `list().filter(Type.isType)` to
|
|
9852
|
+
* retrieve them.
|
|
9853
|
+
*
|
|
9854
|
+
* Scope: a Registry is independent of any ECHO space or Hypergraph — it is a process-local,
|
|
9855
|
+
* in-memory cache. Wire one per space (e.g. as a Layer scoped to the space's Effect runtime)
|
|
9856
|
+
* or share a single instance across spaces depending on the use case.
|
|
9857
|
+
*
|
|
9858
|
+
* The concrete implementation (and the `makeRegistry` / `registryLayer` factories) lives in
|
|
9859
|
+
* `@dxos/echo-client`; this module declares only the interface so that the `@dxos/echo` API surface
|
|
9860
|
+
* stays free of query-matching dependencies.
|
|
10075
9861
|
*/
|
|
10076
|
-
|
|
9862
|
+
interface Registry {
|
|
9863
|
+
readonly [TypeId$1]: TypeId$1;
|
|
9864
|
+
/**
|
|
9865
|
+
* Stable per-instance identifier. Used to key process-local resources (e.g. memoized
|
|
9866
|
+
* reactive atoms) to a specific registry instance, analogous to {@link Database.spaceId}.
|
|
9867
|
+
*/
|
|
9868
|
+
readonly id: string;
|
|
9869
|
+
/**
|
|
9870
|
+
* Fires whenever local registry contents change (add, remove, or clear).
|
|
9871
|
+
*/
|
|
9872
|
+
readonly changed: ReadOnlyEvent<void>;
|
|
9873
|
+
/**
|
|
9874
|
+
* All locally-stored entities.
|
|
9875
|
+
* Does not include upstream entities — use {@link list} for that.
|
|
9876
|
+
*/
|
|
9877
|
+
readonly local: readonly Unknown[];
|
|
9878
|
+
/**
|
|
9879
|
+
* Add or replace one or more entities in the local registry.
|
|
9880
|
+
* Existing entries with the same id are replaced.
|
|
9881
|
+
* Also indexes type entities by DXN for fast lookup.
|
|
9882
|
+
*/
|
|
9883
|
+
add(entities: readonly Unknown[]): void;
|
|
9884
|
+
/**
|
|
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
|
+
}
|
|
10077
9924
|
//#endregion
|
|
10078
|
-
//#region ../echo/dist/types/src/
|
|
9925
|
+
//#region ../echo/dist/types/src/Hypergraph.d.ts
|
|
10079
9926
|
/**
|
|
10080
|
-
*
|
|
9927
|
+
* Resolution context.
|
|
9928
|
+
* Affects how non-absolute DXNs are resolved.
|
|
10081
9929
|
*/
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
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
|
+
}
|
|
10089
9948
|
/**
|
|
10090
|
-
*
|
|
10091
|
-
* They are used to configure the visual representation of the data.
|
|
9949
|
+
* Manages cross-space database interactions.
|
|
10092
9950
|
*/
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
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
|
+
}
|
|
10111
9982
|
//#endregion
|
|
10112
|
-
//#region ../echo/dist/types/src/
|
|
9983
|
+
//#region ../echo/dist/types/src/Database.d.ts
|
|
10113
9984
|
/**
|
|
10114
|
-
*
|
|
10115
|
-
* Schema-level union of the underlying type entities (rebuilt via
|
|
10116
|
-
* `Type.getSchema`) so this can still be consumed by Schema-side APIs such
|
|
10117
|
-
* as `Filter.type(...)` on a union.
|
|
9985
|
+
* `query` API function declaration.
|
|
10118
9986
|
*/
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
readonly kind?: string | undefined;
|
|
10123
|
-
readonly namespace?: "data" | "trace" | undefined;
|
|
10124
|
-
} & OfKind<EntityKind.Object>, {
|
|
10125
|
-
readonly name?: string | undefined;
|
|
10126
|
-
readonly kind?: string | undefined;
|
|
10127
|
-
readonly namespace?: "data" | "trace" | undefined;
|
|
10128
|
-
} & OfKind<EntityKind.Object>, never>, Schema<{
|
|
10129
|
-
readonly name?: string | undefined;
|
|
10130
|
-
readonly objects: readonly Ref<Unknown$1>[];
|
|
10131
|
-
} & OfKind<EntityKind.Object>, {
|
|
10132
|
-
readonly name?: string | undefined;
|
|
10133
|
-
readonly objects: readonly Ref<Unknown$1>[];
|
|
10134
|
-
} & OfKind<EntityKind.Object>, never>, Schema<View & OfKind<EntityKind.Object>, View & OfKind<EntityKind.Object>, never>]>;
|
|
10135
|
-
declare namespace Order_d_exports {
|
|
10136
|
-
export { Any$2 as Any, Order, created, natural, property, rank, updated };
|
|
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>>;
|
|
10137
9990
|
}
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
9991
|
+
/**
|
|
9992
|
+
* Common interface for Database, Feed, and Hypergraph.
|
|
9993
|
+
*/
|
|
9994
|
+
interface Queryable {
|
|
9995
|
+
query: QueryFn;
|
|
10143
9996
|
}
|
|
10144
|
-
type
|
|
10145
|
-
|
|
10146
|
-
|
|
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
|
+
};
|
|
10147
10012
|
/**
|
|
10148
|
-
*
|
|
10149
|
-
*
|
|
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.
|
|
10150
10017
|
*/
|
|
10151
|
-
|
|
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
|
+
};
|
|
10152
10040
|
/**
|
|
10153
|
-
*
|
|
10154
|
-
* (most-recently-updated first). Mirrors {@link Filter.updated}.
|
|
10041
|
+
* Identifier denoting an ECHO Database.
|
|
10155
10042
|
*/
|
|
10156
|
-
declare const
|
|
10043
|
+
declare const TypeId: unique symbol;
|
|
10044
|
+
type TypeId = typeof TypeId;
|
|
10157
10045
|
/**
|
|
10158
|
-
*
|
|
10159
|
-
* (most-recently-created first). Mirrors {@link Filter.created}.
|
|
10046
|
+
* ECHO Database interface.
|
|
10160
10047
|
*/
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
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>;
|
|
10164
10128
|
}
|
|
10129
|
+
declare const Database: Schema<Database>;
|
|
10130
|
+
//#endregion
|
|
10131
|
+
//#region ../echo/dist/types/src/internal/JsonSchema/json-schema-type.d.ts
|
|
10165
10132
|
/**
|
|
10166
|
-
*
|
|
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
|
|
10167
10136
|
*/
|
|
10168
|
-
|
|
10169
|
-
type RefArrayElement<A$1> = A$1 extends readonly (infer E)[] ? E : A$1 extends (infer E)[] ? E : never;
|
|
10170
|
-
/** Target entity when traversing an outgoing ref or array-of-refs property. */
|
|
10171
|
-
type ReferenceTraversalTarget<P$1> = P$1 extends Unknown$2 ? Target$1<P$1> : P$1 extends Unknown$2 | undefined ? Target$1<Exclude<P$1, undefined>> : RefArrayElement<P$1> extends Unknown$2 ? Target$1<RefArrayElement<P$1>> : never;
|
|
10172
|
-
interface Query<T$1> {
|
|
10173
|
-
'~Query': {
|
|
10174
|
-
value: T$1;
|
|
10175
|
-
};
|
|
10176
|
-
ast: Query$1;
|
|
10137
|
+
declare const _JsonSchemaType: Struct<{
|
|
10177
10138
|
/**
|
|
10178
|
-
*
|
|
10179
|
-
*
|
|
10180
|
-
* @returns Query for the selected objects.
|
|
10139
|
+
* Identifier for this schema.
|
|
10140
|
+
* This schema might be referenced by $ref clause in other schemas.
|
|
10181
10141
|
*/
|
|
10182
|
-
|
|
10183
|
-
'select'(props: Props$1<T$1>): Query<T$1>;
|
|
10142
|
+
$id: optional<typeof String$>;
|
|
10184
10143
|
/**
|
|
10185
|
-
*
|
|
10186
|
-
*
|
|
10187
|
-
* @returns Query for the target of the reference.
|
|
10144
|
+
* Schema of this schema.
|
|
10145
|
+
* Set to "https://json-schema.org/draft-07/schema".
|
|
10188
10146
|
*/
|
|
10189
|
-
|
|
10147
|
+
$schema: optional<typeof String$>;
|
|
10190
10148
|
/**
|
|
10191
|
-
*
|
|
10192
|
-
* @param target - Schema of the referencing object. If not provided, matches any type.
|
|
10193
|
-
* @param key - Property path inside the referencing object that is a reference. If not provided, matches any property.
|
|
10194
|
-
* @returns Query for the referencing objects.
|
|
10149
|
+
* Reference to another schema.
|
|
10195
10150
|
*/
|
|
10196
|
-
|
|
10197
|
-
'referencedBy'<S$1 extends AnyEntity$1>(target: S$1 | URI): Query<InstanceType$1<S$1>>;
|
|
10198
|
-
'referencedBy'(): Query<any>;
|
|
10151
|
+
$ref: optional<typeof String$>;
|
|
10199
10152
|
/**
|
|
10200
|
-
*
|
|
10201
|
-
* @returns Query for the relation objects.
|
|
10202
|
-
* @param relation - Schema of the relation.
|
|
10203
|
-
* @param predicates - Predicates to filter the relation objects.
|
|
10153
|
+
* Comments are ignored when interpreting the schema.
|
|
10204
10154
|
*/
|
|
10205
|
-
|
|
10155
|
+
$comment: optional<typeof String$>;
|
|
10206
10156
|
/**
|
|
10207
|
-
*
|
|
10208
|
-
* @returns Query for the relation objects.
|
|
10209
|
-
* @param relation - Type entity of the relation.
|
|
10210
|
-
* @param predicates - Predicates to filter the relation objects.
|
|
10157
|
+
* Defines whether this schema is an object schema or a relation schema.
|
|
10211
10158
|
*/
|
|
10212
|
-
|
|
10159
|
+
entityKind: optional<Enums<typeof EntityKind>>;
|
|
10213
10160
|
/**
|
|
10214
|
-
*
|
|
10215
|
-
*
|
|
10161
|
+
* Typename of this schema.
|
|
10162
|
+
* Only on schema representing an ECHO object.
|
|
10163
|
+
*
|
|
10164
|
+
* @example 'com.example.type.my-type'
|
|
10216
10165
|
*/
|
|
10217
|
-
|
|
10166
|
+
typename: optional<typeof String$>;
|
|
10218
10167
|
/**
|
|
10219
|
-
*
|
|
10220
|
-
*
|
|
10168
|
+
* Version of this schema.
|
|
10169
|
+
* Custom dialect for ECHO.
|
|
10221
10170
|
*/
|
|
10222
|
-
|
|
10171
|
+
version: optional<typeof String$>;
|
|
10223
10172
|
/**
|
|
10224
|
-
*
|
|
10225
|
-
*
|
|
10173
|
+
* Target of this relation.
|
|
10174
|
+
* Only for relation schemas.
|
|
10175
|
+
* The referenced schema must be an object schema.
|
|
10226
10176
|
*/
|
|
10227
|
-
|
|
10177
|
+
relationTarget: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
|
|
10228
10178
|
/**
|
|
10229
|
-
*
|
|
10230
|
-
*
|
|
10179
|
+
* Source of this relation.
|
|
10180
|
+
* Only for relation schemas.
|
|
10181
|
+
* The referenced schema must be an object schema.
|
|
10231
10182
|
*/
|
|
10232
|
-
|
|
10183
|
+
relationSource: optional<suspend<JsonSchemaType, JsonSchemaType, never>>;
|
|
10233
10184
|
/**
|
|
10234
|
-
*
|
|
10235
|
-
* Orders are specified in priority order. The first order will be applied first, etc.
|
|
10236
|
-
* @param order - Order to sort the results.
|
|
10237
|
-
* @returns Query for the ordered results.
|
|
10185
|
+
* Title of this schema.
|
|
10238
10186
|
*/
|
|
10239
|
-
|
|
10187
|
+
title: optional<typeof String$>;
|
|
10240
10188
|
/**
|
|
10241
|
-
*
|
|
10242
|
-
* @param limit - Maximum number of results to return.
|
|
10243
|
-
* @returns Query for the limited results.
|
|
10189
|
+
* Description of this schema.
|
|
10244
10190
|
*/
|
|
10245
|
-
|
|
10191
|
+
description: optional<typeof String$>;
|
|
10246
10192
|
/**
|
|
10247
|
-
*
|
|
10248
|
-
*
|
|
10249
|
-
* Example:
|
|
10250
|
-
*
|
|
10251
|
-
* ```ts
|
|
10252
|
-
* Query.select(Filter.type(Person)).from(db);
|
|
10253
|
-
* ```
|
|
10254
|
-
*
|
|
10255
|
-
* @param options.includeFeeds [false] - Whether to include feeds in the query. Default is to query from automerge documents only.
|
|
10193
|
+
* Whether this schema is read-only.
|
|
10256
10194
|
*/
|
|
10257
|
-
|
|
10258
|
-
includeFeeds?: boolean;
|
|
10259
|
-
}): Query<T$1>;
|
|
10195
|
+
readOnly: optional<typeof Boolean$>;
|
|
10260
10196
|
/**
|
|
10261
|
-
*
|
|
10262
|
-
*
|
|
10263
|
-
* Example:
|
|
10264
|
-
*
|
|
10265
|
-
* ```ts
|
|
10266
|
-
* Query.select(Filter.type(Person)).from(feed);
|
|
10267
|
-
* ```
|
|
10268
|
-
*
|
|
10197
|
+
* Whether this schema is write-only.
|
|
10269
10198
|
*/
|
|
10270
|
-
|
|
10199
|
+
writeOnly: optional<typeof Boolean$>;
|
|
10271
10200
|
/**
|
|
10272
|
-
*
|
|
10273
|
-
*
|
|
10274
|
-
* Example:
|
|
10275
|
-
*
|
|
10276
|
-
* ```ts
|
|
10277
|
-
* Query.select(Filter.type(Person)).from('all-accessible-spaces');
|
|
10278
|
-
* ```
|
|
10279
|
-
*
|
|
10280
|
-
* @param options.includeFeeds [false] - Whether to include feeds in the query. Default is to query from automerge documents only.
|
|
10201
|
+
* Examples of instances of this schema.
|
|
10281
10202
|
*/
|
|
10282
|
-
|
|
10283
|
-
includeFeeds?: boolean;
|
|
10284
|
-
}): Query<T$1>;
|
|
10203
|
+
examples: optional<Array$<typeof Any$4>>;
|
|
10285
10204
|
/**
|
|
10286
|
-
*
|
|
10287
|
-
* Currently only feeds are supported.
|
|
10288
|
-
*
|
|
10289
|
-
* Example:
|
|
10290
|
-
*
|
|
10291
|
-
* ```ts
|
|
10292
|
-
* Query.type(Person).from(feed);
|
|
10293
|
-
* ```
|
|
10205
|
+
* Default value for this schema.
|
|
10294
10206
|
*/
|
|
10295
|
-
|
|
10207
|
+
default: optional<typeof Any$4>;
|
|
10296
10208
|
/**
|
|
10297
|
-
*
|
|
10298
|
-
|
|
10299
|
-
|
|
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.
|
|
10300
10248
|
*
|
|
10301
|
-
*
|
|
10302
|
-
|
|
10303
|
-
|
|
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.
|
|
10304
10307
|
*/
|
|
10305
|
-
|
|
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 = {
|
|
10306
10351
|
/**
|
|
10307
|
-
*
|
|
10308
|
-
*
|
|
10309
|
-
* Use the {@link Scope} constructors rather than raw tagged objects:
|
|
10352
|
+
* Override the entity id stamped on the in-memory `Type.Type` value.
|
|
10310
10353
|
*
|
|
10311
|
-
*
|
|
10312
|
-
*
|
|
10313
|
-
*
|
|
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.
|
|
10314
10358
|
*/
|
|
10315
|
-
|
|
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> {
|
|
10316
10370
|
/**
|
|
10317
|
-
*
|
|
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]`.
|
|
10318
10375
|
*/
|
|
10319
|
-
|
|
10376
|
+
readonly [KindId$1]: EntityKind.Type;
|
|
10377
|
+
/** Schema-kind brand indicating what kind of instance this type describes. */
|
|
10378
|
+
readonly [SchemaKindId]: K$1;
|
|
10320
10379
|
/**
|
|
10321
|
-
*
|
|
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).
|
|
10322
10384
|
*/
|
|
10323
|
-
|
|
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>;
|
|
10324
10393
|
/**
|
|
10325
|
-
*
|
|
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.
|
|
10326
10405
|
*/
|
|
10327
|
-
|
|
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
|
+
} : {});
|
|
10328
10412
|
}
|
|
10329
|
-
|
|
10330
|
-
type
|
|
10331
|
-
declare const is: (value: unknown) => value is Any$1;
|
|
10332
|
-
/** Construct a query from an ast. */
|
|
10333
|
-
declare const fromAst: (ast: Query$1) => Any$1;
|
|
10334
|
-
/**
|
|
10335
|
-
* Select objects based on a filter.
|
|
10336
|
-
* @param filter - Filter to select the objects.
|
|
10337
|
-
* @returns Query for the selected objects.
|
|
10338
|
-
*/
|
|
10339
|
-
declare const select: <F extends Any$3>(filter: F) => Query<Type$2<F>>;
|
|
10413
|
+
//#endregion
|
|
10414
|
+
//#region ../echo/dist/types/src/internal/Entity/type-kind.d.ts
|
|
10340
10415
|
/**
|
|
10341
|
-
*
|
|
10342
|
-
* @param schema - Schema of the objects.
|
|
10343
|
-
* @param predicates - Predicates to filter the objects.
|
|
10344
|
-
* @returns Query for the objects.
|
|
10416
|
+
* Type-kind schema marker — produced by {@link EchoTypeKindSchema}.
|
|
10345
10417
|
*
|
|
10346
|
-
*
|
|
10347
|
-
|
|
10348
|
-
declare const type$1: {
|
|
10349
|
-
<T$1 extends AnyEntity$1>(type: T$1, predicates?: Props$1<InstanceType$1<T$1>>): Query<InstanceType$1<T$1>>;
|
|
10350
|
-
<S$1 extends UnknownTypeSchema<any, any>>(schema: S$1, predicates?: Props$1<Schema.Type<S$1>>): Query<Schema.Type<S$1>>;
|
|
10351
|
-
<S$1 extends Union<readonly Schema.AnyNoContext[]>>(union: S$1, predicates?: Props$1<Schema.Type<S$1>>): Query<Schema.Type<S$1>>;
|
|
10352
|
-
(uri: URI, predicates?: Props$1<unknown>): Query<any>;
|
|
10353
|
-
};
|
|
10354
|
-
/**
|
|
10355
|
-
* Combine results of multiple queries.
|
|
10356
|
-
* @param queries - Queries to combine.
|
|
10357
|
-
* @returns Query for the combined results.
|
|
10418
|
+
* Distinguishes meta-schemas (entities of `EntityKind.Type`, such as the
|
|
10419
|
+
* built-in `Type.Type` TypeSchema) from object and relation types.
|
|
10358
10420
|
*/
|
|
10359
|
-
|
|
10421
|
+
type EchoTypeKindSchema<Self extends Schema.Any, Fields extends Struct.Fields = Struct.Fields> = EchoTypeSchema<Self, {}, EntityKind.Type, Fields>;
|
|
10360
10422
|
/**
|
|
10361
|
-
*
|
|
10362
|
-
* @
|
|
10363
|
-
*
|
|
10364
|
-
*
|
|
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.
|
|
10365
10428
|
*/
|
|
10366
|
-
declare const
|
|
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
|
|
10367
10436
|
/**
|
|
10368
|
-
*
|
|
10369
|
-
*
|
|
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).
|
|
10370
10440
|
*
|
|
10371
|
-
*
|
|
10372
|
-
*
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
}?] | Scope[]) => Any$1;
|
|
10377
|
-
/**
|
|
10378
|
-
* Returns a human-readable string representation of a Query AST.
|
|
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.
|
|
10379
10446
|
*/
|
|
10380
|
-
declare const
|
|
10381
|
-
|
|
10382
|
-
|
|
10447
|
+
declare const TypeSchemaStruct: Struct<{
|
|
10448
|
+
name: optional<typeof String$>;
|
|
10449
|
+
jsonSchema: Schema<JsonSchemaType, JsonSchemaType, never>;
|
|
10450
|
+
}>;
|
|
10383
10451
|
/**
|
|
10384
|
-
*
|
|
10452
|
+
* Persistent representation of a schema.
|
|
10385
10453
|
*/
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
/**
|
|
10424
|
-
* Currently available results.
|
|
10425
|
-
*/
|
|
10426
|
-
readonly results: T$1[];
|
|
10427
|
-
/**
|
|
10428
|
-
* Returns all known results.
|
|
10429
|
-
*/
|
|
10430
|
-
run(opts?: RunOptions): Promise<T$1[]>;
|
|
10431
|
-
/**
|
|
10432
|
-
* Returns all known results along with their match metadata.
|
|
10433
|
-
*/
|
|
10434
|
-
runEntries(opts?: RunOptions): Promise<Entry$1<T$1>[]>;
|
|
10435
|
-
/**
|
|
10436
|
-
* Returns currently available results synchronously.
|
|
10437
|
-
*/
|
|
10438
|
-
runSync(): T$1[];
|
|
10439
|
-
/**
|
|
10440
|
-
* Returns currently available results synchronously along with their match metadata.
|
|
10441
|
-
*/
|
|
10442
|
-
runSyncEntries(): Entry$1<T$1>[];
|
|
10443
|
-
/**
|
|
10444
|
-
* Returns first result.
|
|
10445
|
-
*/
|
|
10446
|
-
first(opts?: RunOptions): Promise<T$1>;
|
|
10447
|
-
/**
|
|
10448
|
-
* Returns first result if there is one.
|
|
10449
|
-
*/
|
|
10450
|
-
firstOrUndefined(opts?: RunOptions): Promise<T$1 | undefined>;
|
|
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> {
|
|
10451
10491
|
/**
|
|
10452
|
-
*
|
|
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.
|
|
10453
10496
|
*/
|
|
10454
|
-
|
|
10497
|
+
readonly [KindId$1]: EntityKind.Type;
|
|
10455
10498
|
/**
|
|
10456
|
-
*
|
|
10457
|
-
*
|
|
10458
|
-
*
|
|
10459
|
-
*
|
|
10460
|
-
* `
|
|
10461
|
-
* where `db.query(...)` is called fresh on each re-evaluation: every run constructs a new
|
|
10462
|
-
* QueryResult and so a new atom + subscription, leaking the previous ones. Use the memoized
|
|
10463
|
-
* {@link atom} family there instead.
|
|
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`).
|
|
10464
10504
|
*/
|
|
10465
|
-
readonly
|
|
10505
|
+
readonly id: EntityId;
|
|
10506
|
+
readonly name?: string;
|
|
10507
|
+
readonly jsonSchema: JsonSchemaType;
|
|
10508
|
+
readonly [InstancePhantomId]?: A$1;
|
|
10466
10509
|
}
|
|
10467
|
-
//#endregion
|
|
10468
|
-
//#region ../echo/dist/types/src/Feed.d.ts
|
|
10469
10510
|
/**
|
|
10470
|
-
*
|
|
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>`.
|
|
10471
10521
|
*
|
|
10472
10522
|
* @example
|
|
10473
10523
|
* ```ts
|
|
10474
|
-
*
|
|
10524
|
+
* class Person extends Type.makeObject<Person>(DXN.make('com.example.type.person', '0.1.0'))(
|
|
10525
|
+
* Schema.Struct({ name: Schema.String }),
|
|
10526
|
+
* ) {}
|
|
10475
10527
|
* ```
|
|
10476
10528
|
*/
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
readonly
|
|
10480
|
-
|
|
10481
|
-
|
|
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
|
+
}
|
|
10482
10540
|
/**
|
|
10483
|
-
*
|
|
10541
|
+
* Return type for {@link makeObject}.
|
|
10542
|
+
*
|
|
10543
|
+
* Not to be used directly, but must be exported for typescript to infer the type.
|
|
10484
10544
|
*/
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
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
|
+
}
|
|
10488
10548
|
/**
|
|
10489
|
-
*
|
|
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.
|
|
10490
10551
|
*/
|
|
10491
|
-
|
|
10492
|
-
type TypeId$1 = typeof TypeId$1;
|
|
10552
|
+
type AnyObj = Obj$1<unknown>;
|
|
10493
10553
|
/**
|
|
10494
|
-
*
|
|
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.
|
|
10495
10561
|
*
|
|
10496
|
-
*
|
|
10497
|
-
*
|
|
10498
|
-
* registry take precedence and upstream results fill in anything not found locally.
|
|
10562
|
+
* `T` is the instance-property type produced by `Relation.make(...)` (excluding
|
|
10563
|
+
* source/target endpoints). `Source` and `Target` are the endpoint types.
|
|
10499
10564
|
*
|
|
10500
|
-
*
|
|
10501
|
-
|
|
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}.
|
|
10502
10580
|
*
|
|
10503
|
-
*
|
|
10504
|
-
|
|
10505
|
-
|
|
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`.
|
|
10506
10607
|
*
|
|
10507
|
-
*
|
|
10508
|
-
*
|
|
10509
|
-
|
|
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.
|
|
10510
10617
|
*
|
|
10511
|
-
*
|
|
10512
|
-
*
|
|
10513
|
-
*
|
|
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.
|
|
10514
10623
|
*/
|
|
10515
|
-
interface
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
*/
|
|
10521
|
-
readonly id: string;
|
|
10522
|
-
/**
|
|
10523
|
-
* Fires whenever local registry contents change (add, remove, or clear).
|
|
10524
|
-
*/
|
|
10525
|
-
readonly changed: ReadOnlyEvent<void>;
|
|
10526
|
-
/**
|
|
10527
|
-
* All locally-stored entities.
|
|
10528
|
-
* Does not include upstream entities — use {@link list} for that.
|
|
10529
|
-
*/
|
|
10530
|
-
readonly local: readonly Unknown[];
|
|
10531
|
-
/**
|
|
10532
|
-
* Add or replace one or more entities in the local registry.
|
|
10533
|
-
* Existing entries with the same id are replaced.
|
|
10534
|
-
* Also indexes type entities by DXN for fast lookup.
|
|
10535
|
-
*/
|
|
10536
|
-
add(entities: readonly Unknown[]): void;
|
|
10537
|
-
/**
|
|
10538
|
-
* Remove an entity by id from the local registry.
|
|
10539
|
-
* @returns true if an entity was removed, false if it was not found.
|
|
10540
|
-
*/
|
|
10541
|
-
remove(id: string): boolean;
|
|
10542
|
-
/**
|
|
10543
|
-
* Remove all locally-stored entities.
|
|
10544
|
-
* Does not affect the upstream registry.
|
|
10545
|
-
*/
|
|
10546
|
-
clear(): void;
|
|
10547
|
-
/**
|
|
10548
|
-
* Get an entity by id.
|
|
10549
|
-
* Searches the local registry first, then falls back to the upstream registry.
|
|
10550
|
-
*/
|
|
10551
|
-
get(id: string): Unknown | undefined;
|
|
10552
|
-
/**
|
|
10553
|
-
* Get an entity by one of its addressing URIs — a type entity by its typename DXN (or, when
|
|
10554
|
-
* persisted, its identifier EID), a keyed entity by its `dxn:<key>[:<version>]`. Accepts legacy
|
|
10555
|
-
* DXN forms (normalized internally). Searches the local registry first, then falls back to the
|
|
10556
|
-
* upstream registry. Narrow the result with `Type.isType` when a type entity is required.
|
|
10557
|
-
*/
|
|
10558
|
-
getByURI(uri: string): Unknown | undefined;
|
|
10559
|
-
/**
|
|
10560
|
-
* List all entities.
|
|
10561
|
-
* Local entities take precedence over upstream entities with the same id.
|
|
10562
|
-
*/
|
|
10563
|
-
list(): Unknown[];
|
|
10564
|
-
/**
|
|
10565
|
-
* Run an ECHO query against the registry's entities (implements {@link Database.Queryable}).
|
|
10566
|
-
*
|
|
10567
|
-
* Matching happens in-memory over {@link list}. Scope (`from`) clauses are unwrapped and
|
|
10568
|
-
* ignored — a direct registry query always targets the registry's own entities. The primary
|
|
10569
|
-
* way to query registry contents is still through the database (`db.query(...).from(Scope.registry())`),
|
|
10570
|
-
* which fans the database and registry together; this method is for querying a registry directly.
|
|
10571
|
-
*
|
|
10572
|
-
* Only locally-evaluable AST nodes are supported: `select`, `filter`, `limit`, `from`, `options`,
|
|
10573
|
-
* and boolean combinators. Server-side concerns (order, traversal, text/timestamp filters) throw.
|
|
10574
|
-
*/
|
|
10575
|
-
query: QueryFn;
|
|
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;
|
|
10576
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;
|
|
10577
10645
|
//#endregion
|
|
10578
|
-
//#region ../echo/dist/types/src/
|
|
10646
|
+
//#region ../echo/dist/types/src/internal/Ref/ref.d.ts
|
|
10647
|
+
declare const RefTypeId: unique symbol;
|
|
10579
10648
|
/**
|
|
10580
|
-
*
|
|
10581
|
-
|
|
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.
|
|
10582
10654
|
*/
|
|
10583
|
-
interface
|
|
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>;
|
|
10584
10657
|
/**
|
|
10585
|
-
*
|
|
10658
|
+
* @returns True if the object is a reference.
|
|
10586
10659
|
*/
|
|
10587
|
-
|
|
10660
|
+
isRef: (obj: unknown) => obj is Ref<any>;
|
|
10588
10661
|
/**
|
|
10589
|
-
*
|
|
10590
|
-
* This feed will be searched first, and then the space it belongs to.
|
|
10662
|
+
* @returns True if the reference points to the given object id.
|
|
10591
10663
|
*/
|
|
10592
|
-
|
|
10593
|
-
}
|
|
10594
|
-
interface RefResolverOptions {
|
|
10664
|
+
hasEntityId: (id: EntityId) => (ref: Ref<any>) => boolean;
|
|
10595
10665
|
/**
|
|
10596
|
-
*
|
|
10597
|
-
* Affects how non-absolute DXNs are resolved.
|
|
10666
|
+
* @returns True if the schema is a reference schema.
|
|
10598
10667
|
*/
|
|
10599
|
-
|
|
10668
|
+
isRefSchema: (schema: Schema<any, any>) => schema is RefSchema<any>;
|
|
10669
|
+
/**
|
|
10670
|
+
* @returns True if the schema AST is a reference schema.
|
|
10671
|
+
*/
|
|
10672
|
+
isRefSchemaAST: (ast: AST) => boolean;
|
|
10673
|
+
/**
|
|
10674
|
+
* Constructs a reference that points to the given object.
|
|
10675
|
+
*/
|
|
10676
|
+
make: <T$1 extends AnyEntity>(object: T$1) => Ref<T$1>;
|
|
10600
10677
|
/**
|
|
10601
|
-
*
|
|
10602
|
-
*
|
|
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).
|
|
10603
10680
|
*/
|
|
10604
|
-
|
|
10681
|
+
fromURI: (uri: URI) => Ref<any>;
|
|
10605
10682
|
}
|
|
10606
10683
|
/**
|
|
10607
|
-
*
|
|
10684
|
+
* Schema builder for references.
|
|
10608
10685
|
*/
|
|
10609
|
-
|
|
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 {
|
|
10610
10692
|
/**
|
|
10611
|
-
*
|
|
10612
|
-
* Populated at startup via `registry.add(objects)` / `registry.add(schemas)`.
|
|
10613
|
-
* Queries that include no explicit from() clause will fan out to this registry automatically.
|
|
10693
|
+
* Target URI (either an `echo:` EID for an object reference or a `dxn:` DXN for a type reference).
|
|
10614
10694
|
*/
|
|
10615
|
-
get
|
|
10695
|
+
get uri(): URI;
|
|
10616
10696
|
/**
|
|
10617
|
-
*
|
|
10697
|
+
* Returns true if the reference has a target available (inlined or resolver set).
|
|
10618
10698
|
*/
|
|
10619
|
-
|
|
10699
|
+
get isAvailable(): boolean;
|
|
10620
10700
|
/**
|
|
10621
|
-
*
|
|
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.
|
|
10704
|
+
*/
|
|
10705
|
+
get target(): T$1 | undefined;
|
|
10706
|
+
/**
|
|
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.
|
|
10622
10711
|
*
|
|
10623
|
-
*
|
|
10624
|
-
*
|
|
10625
|
-
* `
|
|
10626
|
-
*
|
|
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
|
|
10627
10717
|
*/
|
|
10628
|
-
|
|
10718
|
+
load(): Promise<T$1>;
|
|
10629
10719
|
/**
|
|
10630
|
-
* @
|
|
10631
|
-
* @param middleware Called with the loaded object. The caller may change the object.
|
|
10632
|
-
* @returns Result of `onLoad`.
|
|
10720
|
+
* @returns Promise that will resolves with the target object or undefined if the object is not loaded locally.
|
|
10633
10721
|
*/
|
|
10634
|
-
|
|
10722
|
+
tryLoad(): Promise<T$1 | undefined>;
|
|
10635
10723
|
/**
|
|
10636
|
-
*
|
|
10637
|
-
*
|
|
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.
|
|
10638
10730
|
*/
|
|
10639
|
-
|
|
10640
|
-
}
|
|
10641
|
-
//#endregion
|
|
10642
|
-
//#region ../echo/dist/types/src/Database.d.ts
|
|
10643
|
-
/**
|
|
10644
|
-
* `query` API function declaration.
|
|
10645
|
-
*/
|
|
10646
|
-
interface QueryFn {
|
|
10647
|
-
<Q extends Any$1>(query: Q): QueryResult<Type$1<Q>>;
|
|
10648
|
-
<F extends Any$3>(filter: F): QueryResult<Type$2<F>>;
|
|
10649
|
-
}
|
|
10650
|
-
/**
|
|
10651
|
-
* Common interface for Database, Feed, and Hypergraph.
|
|
10652
|
-
*/
|
|
10653
|
-
interface Queryable {
|
|
10654
|
-
query: QueryFn;
|
|
10655
|
-
}
|
|
10656
|
-
type GetObjectByIdOptions = {
|
|
10657
|
-
deleted?: boolean;
|
|
10658
|
-
};
|
|
10659
|
-
type ObjectPlacement = 'root-doc' | 'linked-doc';
|
|
10660
|
-
type AddOptions = {
|
|
10731
|
+
onResolved(callback: () => void): () => void;
|
|
10661
10732
|
/**
|
|
10662
|
-
*
|
|
10663
|
-
*
|
|
10664
|
-
* Linked documents are loaded lazily.
|
|
10665
|
-
* Placing large number of objects in the root document may slow down the initial load.
|
|
10733
|
+
* Do not inline the target object in the reference.
|
|
10734
|
+
* Makes .target unavailable unless the reference is connected to a database context.
|
|
10666
10735
|
*
|
|
10667
|
-
*
|
|
10736
|
+
* When serialized with toJSON, the difference is between:
|
|
10737
|
+
* `{ "/": "dxn:..." }`
|
|
10738
|
+
* and
|
|
10739
|
+
* `{ "/": "dxn:...", "target": { ... } }`
|
|
10740
|
+
*
|
|
10741
|
+
* Clones the reference object.
|
|
10668
10742
|
*/
|
|
10669
|
-
|
|
10670
|
-
};
|
|
10671
|
-
/**
|
|
10672
|
-
* Rejects Type entities from {@link Database.add} at compile time via their `[KindId]` brand. Used
|
|
10673
|
-
* as `T & RejectTypeEntity<T>` to preserve inference of `T`. Bounding `add` on
|
|
10674
|
-
* `Obj.Unknown | Relation.Unknown` instead would reject broadly-typed instance adds (e.g.
|
|
10675
|
-
* `Entity.Any`, `Obj.OfShape<T>`), forcing casts repo-wide.
|
|
10676
|
-
*/
|
|
10677
|
-
type RejectTypeEntity<T$1> = T$1 extends {
|
|
10678
|
-
readonly [KindId$1]: EntityKind.Type;
|
|
10679
|
-
} ? {
|
|
10680
|
-
__error: 'Type entities must be persisted via db.addType(), not db.add().';
|
|
10681
|
-
} : T$1;
|
|
10682
|
-
type FlushOptions = {
|
|
10743
|
+
noInline(): Ref<T$1>;
|
|
10683
10744
|
/**
|
|
10684
|
-
*
|
|
10685
|
-
*
|
|
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.
|
|
10686
10748
|
*/
|
|
10687
|
-
|
|
10749
|
+
get atom(): Atom<T$1 | undefined>;
|
|
10688
10750
|
/**
|
|
10689
|
-
*
|
|
10690
|
-
*
|
|
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": { ... } }`
|
|
10691
10759
|
*/
|
|
10692
|
-
|
|
10760
|
+
encode(): EncodedReference;
|
|
10761
|
+
[RefTypeId]: {
|
|
10762
|
+
_T: T$1;
|
|
10763
|
+
};
|
|
10764
|
+
}
|
|
10765
|
+
declare namespace Ref {
|
|
10693
10766
|
/**
|
|
10694
|
-
*
|
|
10695
|
-
* @default false
|
|
10767
|
+
* Target of the reference.
|
|
10696
10768
|
*/
|
|
10697
|
-
|
|
10698
|
-
}
|
|
10769
|
+
type Target<R$1> = R$1 extends Ref<infer U> ? U : never;
|
|
10770
|
+
}
|
|
10699
10771
|
/**
|
|
10700
|
-
*
|
|
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).
|
|
10701
10779
|
*/
|
|
10702
|
-
|
|
10703
|
-
type TypeId = typeof TypeId;
|
|
10780
|
+
type RefSource = 'working-set' | 'disk' | 'network';
|
|
10704
10781
|
/**
|
|
10705
|
-
*
|
|
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".
|
|
10706
10787
|
*/
|
|
10707
|
-
interface
|
|
10708
|
-
readonly [TypeId]: TypeId;
|
|
10709
|
-
get spaceId(): SpaceId;
|
|
10710
|
-
get graph(): Hypergraph;
|
|
10788
|
+
interface RefResolverRequest {
|
|
10711
10789
|
/**
|
|
10712
|
-
*
|
|
10713
|
-
*
|
|
10714
|
-
*
|
|
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.
|
|
10715
10793
|
*/
|
|
10716
|
-
readonly
|
|
10717
|
-
toJSON(): object;
|
|
10794
|
+
readonly state: 'pending' | 'requesting' | 'ready' | 'unavailable';
|
|
10718
10795
|
/**
|
|
10719
|
-
*
|
|
10720
|
-
* @deprecated Use `db.query(Filter.id(id)).runSync()[0]` for a working-set lookup, or resolve via a {@link Ref}.
|
|
10796
|
+
* Fires (deferred to a microtask) whenever {@link state} changes.
|
|
10721
10797
|
*/
|
|
10722
|
-
|
|
10798
|
+
readonly stateChanged: Event$1<void>;
|
|
10723
10799
|
/**
|
|
10724
|
-
*
|
|
10800
|
+
* Synchronous snapshot of the resolved entity; defined iff `state === 'ready'`.
|
|
10725
10801
|
*/
|
|
10726
|
-
|
|
10802
|
+
getResult(): AnyProperties | undefined;
|
|
10727
10803
|
/**
|
|
10728
|
-
*
|
|
10729
|
-
*
|
|
10730
|
-
* NOTE: The reference may be dangling if the object is not present in the database.
|
|
10731
|
-
* NOTE: Difference from `Ref.fromURI`
|
|
10732
|
-
* `Ref.fromURI(dxn)` returns an unhydrated reference. The `.load` and `.target` APIs will not work.
|
|
10733
|
-
* `db.makeRef(dxn)` is preferable in cases with access to the database.
|
|
10804
|
+
* Settles when `state ∈ {ready, unavailable}`.
|
|
10734
10805
|
*/
|
|
10735
|
-
|
|
10806
|
+
wait(): Promise<AnyProperties | undefined>;
|
|
10736
10807
|
/**
|
|
10737
|
-
*
|
|
10738
|
-
*
|
|
10739
|
-
* Only Object and Relation entities are accepted. To persist a Type definition use
|
|
10740
|
-
* {@link addType} — passing a Type entity is rejected at compile time (and at runtime).
|
|
10808
|
+
* Decrements the refcount on the shared load op(s); cancels the underlying IO at zero.
|
|
10741
10809
|
*/
|
|
10742
|
-
|
|
10810
|
+
abort(): void;
|
|
10811
|
+
}
|
|
10812
|
+
interface RefResolver {
|
|
10743
10813
|
/**
|
|
10744
|
-
*
|
|
10745
|
-
*
|
|
10746
|
-
* Runs a conflict query first: if a type with the same typename + version already exists in
|
|
10747
|
-
* this space, the existing persisted entity is returned and no duplicate is created. This is
|
|
10748
|
-
* the only supported way to add Type entities — {@link add} rejects them.
|
|
10814
|
+
* Resolve a reference, returning a stateful handle. `source` is a required ceiling; cheaper
|
|
10815
|
+
* tiers are always probed first.
|
|
10749
10816
|
*/
|
|
10750
|
-
|
|
10817
|
+
resolve(uri: URI, options: {
|
|
10818
|
+
source: RefSource;
|
|
10819
|
+
}): RefResolverRequest;
|
|
10751
10820
|
/**
|
|
10752
|
-
*
|
|
10821
|
+
* Resolve ref synchronously from the objects in the working set.
|
|
10822
|
+
*
|
|
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.
|
|
10753
10827
|
*/
|
|
10754
|
-
|
|
10828
|
+
resolveSync(uri: URI, load: boolean, onLoad?: () => void): AnyProperties | undefined;
|
|
10755
10829
|
/**
|
|
10756
|
-
*
|
|
10757
|
-
*
|
|
10758
|
-
* The feed must already be stored in the database (added via {@link add}); its underlying
|
|
10759
|
-
* queue is addressed by the feed object's URI.
|
|
10830
|
+
* Resolver ref asynchronously.
|
|
10831
|
+
* @deprecated Use {@link resolve} with `{ source: 'network' }`. Removed in Task 11.
|
|
10760
10832
|
*/
|
|
10761
|
-
|
|
10833
|
+
resolveLegacy(uri: URI): Promise<AnyProperties | undefined>;
|
|
10762
10834
|
/**
|
|
10763
|
-
*
|
|
10835
|
+
* @deprecated Use {@link resolve} + `Type.getSchema`. Removed in Task 11.
|
|
10764
10836
|
*/
|
|
10765
|
-
|
|
10837
|
+
resolveSchema(uri: URI): Promise<Schema.AnyNoContext | undefined>;
|
|
10766
10838
|
/**
|
|
10767
|
-
*
|
|
10768
|
-
*
|
|
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.
|
|
10769
10845
|
*/
|
|
10770
|
-
|
|
10846
|
+
resolveType?(uri: URI): Promise<unknown | undefined>;
|
|
10771
10847
|
}
|
|
10772
|
-
declare const Database: Schema<Database>;
|
|
10773
10848
|
//#endregion
|
|
10774
10849
|
//#region ../echo/dist/types/src/Entity.d.ts
|
|
10775
10850
|
declare const KindId: "~@dxos/echo/Kind";
|