@dxos/echo-query 0.9.0 → 0.9.1-main.c7dcc2e112

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.
@@ -8785,27 +8785,8 @@ type MaybePromise<T$1> = T$1 | Promise<T$1>;
8785
8785
  */
8786
8786
  type ToMutable<T$1> = T$1 extends object ? { -readonly [K in keyof T$1]: T$1[K] extends readonly (infer U)[] ? U[] : T$1[K] } : T$1;
8787
8787
  //#endregion
8788
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/AtomHttpApi.d.ts
8789
- declare global {
8790
- interface ErrorConstructor {
8791
- stackTraceLimit: number;
8792
- }
8793
- }
8794
- /**
8795
- * @since 1.0.0
8796
- * @category Constructors
8797
- */
8798
- //#endregion
8799
- //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/AtomRpc.d.ts
8800
- declare global {
8801
- interface ErrorConstructor {
8802
- stackTraceLimit: number;
8803
- }
8804
- }
8805
- /**
8806
- * @since 1.0.0
8807
- * @category Constructors
8808
- */
8788
+ //#region ../../../common/async/dist/types/src/cleanup.d.ts
8789
+ type CleanupFn = () => void;
8809
8790
  //#endregion
8810
8791
  //#region ../../../common/context/dist/types/src/context.d.ts
8811
8792
  type ContextErrorHandler = (error: Error, ctx: Context$1) => void;
@@ -8863,18 +8844,6 @@ declare class Context$1 {
8863
8844
  [Symbol.asyncDispose](): Promise<void>;
8864
8845
  }
8865
8846
  //#endregion
8866
- //#region ../../../common/effect/dist/types/src/internal/json-path.d.ts
8867
- type JsonPath = string & {
8868
- __JsonPath: true;
8869
- };
8870
- /**
8871
- * https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html
8872
- */
8873
- declare const JsonPath: Schema<JsonPath>;
8874
- //#endregion
8875
- //#region ../../../common/async/dist/types/src/cleanup.d.ts
8876
- type CleanupFn = () => void;
8877
- //#endregion
8878
8847
  //#region ../../../common/async/dist/types/src/events.d.ts
8879
8848
  type Effect = () => CleanupFn | undefined;
8880
8849
  interface EventEmitterLike {
@@ -9096,6 +9065,37 @@ interface ReadOnlyEvent<T$1 = void> {
9096
9065
  debounce(timeout?: number): Event$1<void>;
9097
9066
  }
9098
9067
  //#endregion
9068
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/AtomHttpApi.d.ts
9069
+ declare global {
9070
+ interface ErrorConstructor {
9071
+ stackTraceLimit: number;
9072
+ }
9073
+ }
9074
+ /**
9075
+ * @since 1.0.0
9076
+ * @category Constructors
9077
+ */
9078
+ //#endregion
9079
+ //#region ../../../../node_modules/.pnpm/@effect-atom+atom@0.5.3_patch_hash=90a97dcb5aa93197ad34b41c932b405a7ba98679af6885de637f_c6b09d1bd6f76cb9fa1ec87ff9f87185/node_modules/@effect-atom/atom/dist/dts/AtomRpc.d.ts
9080
+ declare global {
9081
+ interface ErrorConstructor {
9082
+ stackTraceLimit: number;
9083
+ }
9084
+ }
9085
+ /**
9086
+ * @since 1.0.0
9087
+ * @category Constructors
9088
+ */
9089
+ //#endregion
9090
+ //#region ../../../common/effect/dist/types/src/internal/json-path.d.ts
9091
+ type JsonPath = string & {
9092
+ __JsonPath: true;
9093
+ };
9094
+ /**
9095
+ * https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html
9096
+ */
9097
+ declare const JsonPath: Schema<JsonPath>;
9098
+ //#endregion
9099
9099
  //#region ../echo/dist/types/src/internal/JsonSchema/json-schema-type.d.ts
9100
9100
  /**
9101
9101
  * Describes a schema for the JSON-schema objects stored in ECHO.
@@ -9729,19 +9729,72 @@ declare namespace Ref {
9729
9729
  */
9730
9730
  type Target<R$1> = R$1 extends Ref<infer U> ? U : never;
9731
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 {
9750
+ /**
9751
+ * `pending` is a one-way entry state (never re-entered). `requesting` means the body and/or
9752
+ * closure is still loading. `ready` means fully usable. `unavailable` means unreachable at the
9753
+ * requested ceiling.
9754
+ */
9755
+ readonly state: 'pending' | 'requesting' | 'ready' | 'unavailable';
9756
+ /**
9757
+ * Fires (deferred to a microtask) whenever {@link state} changes.
9758
+ */
9759
+ readonly stateChanged: Event$1<void>;
9760
+ /**
9761
+ * Synchronous snapshot of the resolved entity; defined iff `state === 'ready'`.
9762
+ */
9763
+ getResult(): AnyProperties | undefined;
9764
+ /**
9765
+ * Settles when `state ∈ {ready, unavailable}`.
9766
+ */
9767
+ wait(): Promise<AnyProperties | undefined>;
9768
+ /**
9769
+ * Decrements the refcount on the shared load op(s); cancels the underlying IO at zero.
9770
+ */
9771
+ abort(): void;
9772
+ }
9732
9773
  interface RefResolver {
9774
+ /**
9775
+ * Resolve a reference, returning a stateful handle. `source` is a required ceiling; cheaper
9776
+ * tiers are always probed first.
9777
+ */
9778
+ resolve(uri: URI, options: {
9779
+ source: RefSource;
9780
+ }): RefResolverRequest;
9733
9781
  /**
9734
9782
  * Resolve ref synchronously from the objects in the working set.
9735
9783
  *
9736
9784
  * @param uri
9737
9785
  * @param load If true the resolver should attempt to load the object from disk.
9738
9786
  * @param onLoad Callback to call when the object is loaded.
9787
+ * @deprecated Use {@link resolve} with `{ source: 'working-set' }`. Removed in Task 11.
9739
9788
  */
9740
9789
  resolveSync(uri: URI, load: boolean, onLoad?: () => void): AnyProperties | undefined;
9741
9790
  /**
9742
9791
  * Resolver ref asynchronously.
9792
+ * @deprecated Use {@link resolve} with `{ source: 'network' }`. Removed in Task 11.
9793
+ */
9794
+ resolveLegacy(uri: URI): Promise<AnyProperties | undefined>;
9795
+ /**
9796
+ * @deprecated Use {@link resolve} + `Type.getSchema`. Removed in Task 11.
9743
9797
  */
9744
- resolve(uri: URI): Promise<AnyProperties | undefined>;
9745
9798
  resolveSchema(uri: URI): Promise<Schema.AnyNoContext | undefined>;
9746
9799
  /**
9747
9800
  * Resolve the source `Type.AnyEntity` entity for a type URI. Used by
@@ -9749,6 +9802,7 @@ interface RefResolver {
9749
9802
  * via `Obj.getType` / `Entity.getType`. Optional — resolvers that only
9750
9803
  * carry raw schemas may leave this unimplemented; the deserializer falls
9751
9804
  * back to leaving the type entity unset.
9805
+ * @deprecated Use {@link resolve}. Removed in Task 11.
9752
9806
  */
9753
9807
  resolveType?(uri: URI): Promise<unknown | undefined>;
9754
9808
  }
@@ -10031,111 +10085,6 @@ declare const Collection: Obj$1<{
10031
10085
  }, Struct.Fields>;
10032
10086
  type Collection = InstanceType$1<typeof Collection>;
10033
10087
  //#endregion
10034
- //#region ../echo/dist/types/src/QueryResult.d.ts
10035
- /**
10036
- * Individual query result entry.
10037
- */
10038
- type Entry$1<T$1> = {
10039
- id: string;
10040
- /**
10041
- * May not be present for remote results.
10042
- */
10043
- result?: T$1;
10044
- match?: {
10045
- /**
10046
- * Higher means better match.
10047
- */
10048
- rank: number;
10049
- };
10050
- /**
10051
- * Query resolution metadata.
10052
- */
10053
- resolution?: {
10054
- source: 'remote' | 'local' | 'index';
10055
- /**
10056
- * Query resolution time in milliseconds.
10057
- */
10058
- time: number;
10059
- };
10060
- };
10061
- type RunOptions = {
10062
- timeout?: number;
10063
- };
10064
- type SubscriptionOptions = {
10065
- /**
10066
- * Fire the callback immediately.
10067
- */
10068
- fire?: boolean;
10069
- };
10070
- interface QueryResult<T$1> {
10071
- /**
10072
- * Currently available results along with their match metadata.
10073
- */
10074
- readonly entries: Entry$1<T$1>[];
10075
- /**
10076
- * Currently available results.
10077
- */
10078
- readonly results: T$1[];
10079
- /**
10080
- * Returns all known results.
10081
- */
10082
- run(opts?: RunOptions): Promise<T$1[]>;
10083
- /**
10084
- * Returns all known results along with their match metadata.
10085
- */
10086
- runEntries(opts?: RunOptions): Promise<Entry$1<T$1>[]>;
10087
- /**
10088
- * Returns currently available results synchronously.
10089
- */
10090
- runSync(): T$1[];
10091
- /**
10092
- * Returns currently available results synchronously along with their match metadata.
10093
- */
10094
- runSyncEntries(): Entry$1<T$1>[];
10095
- /**
10096
- * Returns first result.
10097
- */
10098
- first(opts?: RunOptions): Promise<T$1>;
10099
- /**
10100
- * Returns first result if there is one.
10101
- */
10102
- firstOrUndefined(opts?: RunOptions): Promise<T$1 | undefined>;
10103
- /**
10104
- * Subscribes to changes in query results.
10105
- */
10106
- subscribe(callback?: (query: QueryResult<T$1>) => void, opts?: SubscriptionOptions): CleanupFn;
10107
- /**
10108
- * Self-updating atom. Updates automatically when query results change.
10109
- *
10110
- * Memoized per QueryResult instance — repeated accesses on the same instance return the same
10111
- * Atom. Safe only when the QueryResult is itself held stable across re-renders (e.g. behind a
10112
- * `useMemo`). It must NOT be used in graph-builder connectors/actions or other atom computes,
10113
- * where `db.query(...)` is called fresh on each re-evaluation: every run constructs a new
10114
- * QueryResult and so a new atom + subscription, leaking the previous ones. Use the memoized
10115
- * {@link atom} family there instead.
10116
- */
10117
- readonly atom: Atom<T$1[]>;
10118
- }
10119
- //#endregion
10120
- //#region ../echo/dist/types/src/Feed.d.ts
10121
- /**
10122
- * Runtime schema for a Feed object.
10123
- *
10124
- * @example
10125
- * ```ts
10126
- * const feed = Obj.make(Feed.Feed, { name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });
10127
- * ```
10128
- */
10129
- declare const Feed: Obj$1<{
10130
- readonly name?: string | undefined;
10131
- readonly kind?: string | undefined;
10132
- readonly namespace?: "data" | "trace" | undefined;
10133
- }, Struct.Fields>;
10134
- /**
10135
- * TypeScript instance type for a Feed object.
10136
- */
10137
- type Feed = InstanceType$1<typeof Feed>;
10138
- //#endregion
10139
10088
  //#region ../echo/dist/types/src/View.d.ts
10140
10089
  /**
10141
10090
  * Views are generated or user-defined projections of a schema's properties.
@@ -10430,6 +10379,111 @@ declare const from: (...args: [(Database | Database[] | Feed | Feed[] | Any$1 |
10430
10379
  */
10431
10380
  declare const pretty: (query: Any$1) => string;
10432
10381
  //#endregion
10382
+ //#region ../echo/dist/types/src/QueryResult.d.ts
10383
+ /**
10384
+ * Individual query result entry.
10385
+ */
10386
+ type Entry$1<T$1> = {
10387
+ id: string;
10388
+ /**
10389
+ * May not be present for remote results.
10390
+ */
10391
+ result?: T$1;
10392
+ match?: {
10393
+ /**
10394
+ * Higher means better match.
10395
+ */
10396
+ rank: number;
10397
+ };
10398
+ /**
10399
+ * Query resolution metadata.
10400
+ */
10401
+ resolution?: {
10402
+ source: 'remote' | 'local' | 'index';
10403
+ /**
10404
+ * Query resolution time in milliseconds.
10405
+ */
10406
+ time: number;
10407
+ };
10408
+ };
10409
+ type RunOptions = {
10410
+ timeout?: number;
10411
+ };
10412
+ type SubscriptionOptions = {
10413
+ /**
10414
+ * Fire the callback immediately.
10415
+ */
10416
+ fire?: boolean;
10417
+ };
10418
+ interface QueryResult<T$1> {
10419
+ /**
10420
+ * Currently available results along with their match metadata.
10421
+ */
10422
+ readonly entries: Entry$1<T$1>[];
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>;
10451
+ /**
10452
+ * Subscribes to changes in query results.
10453
+ */
10454
+ subscribe(callback?: (query: QueryResult<T$1>) => void, opts?: SubscriptionOptions): CleanupFn;
10455
+ /**
10456
+ * Self-updating atom. Updates automatically when query results change.
10457
+ *
10458
+ * Memoized per QueryResult instance — repeated accesses on the same instance return the same
10459
+ * Atom. Safe only when the QueryResult is itself held stable across re-renders (e.g. behind a
10460
+ * `useMemo`). It must NOT be used in graph-builder connectors/actions or other atom computes,
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.
10464
+ */
10465
+ readonly atom: Atom<T$1[]>;
10466
+ }
10467
+ //#endregion
10468
+ //#region ../echo/dist/types/src/Feed.d.ts
10469
+ /**
10470
+ * Runtime schema for a Feed object.
10471
+ *
10472
+ * @example
10473
+ * ```ts
10474
+ * const feed = Obj.make(Feed.Feed, { name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });
10475
+ * ```
10476
+ */
10477
+ declare const Feed: Obj$1<{
10478
+ readonly name?: string | undefined;
10479
+ readonly kind?: string | undefined;
10480
+ readonly namespace?: "data" | "trace" | undefined;
10481
+ }, Struct.Fields>;
10482
+ /**
10483
+ * TypeScript instance type for a Feed object.
10484
+ */
10485
+ type Feed = InstanceType$1<typeof Feed>;
10486
+ //#endregion
10433
10487
  //#region ../echo/dist/types/src/Registry.d.ts
10434
10488
  /**
10435
10489
  * Identifier denoting an ECHO Registry.
@@ -10698,6 +10752,17 @@ interface Database extends Queryable {
10698
10752
  * Removes object from the database.
10699
10753
  */
10700
10754
  remove(obj: Unknown): void;
10755
+ /**
10756
+ * Appends entities to a feed.
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.
10760
+ */
10761
+ appendToFeed(feed: Feed, entities: Unknown[]): Promise<void>;
10762
+ /**
10763
+ * Removes entities from a feed.
10764
+ */
10765
+ deleteFromFeed(feed: Feed, entities: Unknown[]): Promise<void>;
10701
10766
  /**
10702
10767
  * Wait for all pending changes to be saved to disk.
10703
10768
  * Optionaly waits for changes to be propagated to indexes and event handlers.