@asaidimu/hestia 1.13.0 → 1.15.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/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { QueryDSL, QueryFilter, SortConfiguration } from "@asaidimu/query";
2
+ import { SchemaDefinition } from "@asaidimu/utils-schema";
2
3
  import { ApiResponse } from "@asaidimu/network-client";
3
4
  import { Issue, SystemError } from "@asaidimu/utils-error";
4
5
  import { DataStore, ReactiveDataStore } from "@asaidimu/utils-store";
5
6
  import { SimplePersistence } from "@asaidimu/utils-persistence";
6
- import { SchemaDefinition } from "@asaidimu/utils-schema";
7
7
  //#region core/types.d.ts
8
- interface DocumentMetadata$1 {
8
+ interface DocumentMetadata {
9
9
  checksum: string;
10
10
  created: string;
11
11
  updated: string;
@@ -13,7 +13,7 @@ interface DocumentMetadata$1 {
13
13
  }
14
14
  interface BaseDocument$1 {
15
15
  _id_: string;
16
- _metadata_: DocumentMetadata$1;
16
+ _metadata_: DocumentMetadata;
17
17
  }
18
18
  type Document<T extends Record<string, any>> = BaseDocument$1 & T;
19
19
  /**
@@ -142,12 +142,15 @@ interface DocumentStore<T extends Record<string, any>, TFindOptions = Record<str
142
142
  */
143
143
  delete: (options: TDeleteOptions) => Promise<void>;
144
144
  /**
145
- * Updates an existing record.
146
- * @param props An object containing the ID of the record to update, the partial data, and optional update options.
145
+ * Updates existing records.
146
+ * @param props An object containing the partial data plus exactly one
147
+ * target: an `id` or a `filter`. Optional update options ride in `options`.
147
148
  * @returns A promise that resolves to the updated record or undefined if not found.
148
149
  */
149
150
  update: (props: {
150
151
  data: Partial<T>;
152
+ id?: string;
153
+ filter?: QueryFilter<T>;
151
154
  options?: TUpdateOptions;
152
155
  }) => Promise<Document<T> | undefined>;
153
156
  /**
@@ -356,17 +359,17 @@ declare const ROUTE_TABLE$1: {
356
359
  };
357
360
  readonly "system:blobs:blob:delete": {
358
361
  readonly method: "DELETE";
359
- readonly route: "/system/blobs/blob/delete/{ns}/{key}";
362
+ readonly route: "/system/blobs/blob/delete/{ns}/{key*}";
360
363
  readonly arguments: readonly ["ns", "key"];
361
364
  };
362
365
  readonly "system:blobs:blob:download": {
363
366
  readonly method: "GET";
364
- readonly route: "/system/blobs/blob/download/{ns}/{key}";
367
+ readonly route: "/system/blobs/blob/download/{ns}/{key*}";
365
368
  readonly arguments: readonly ["ns", "key"];
366
369
  };
367
370
  readonly "system:blobs:blob:head": {
368
371
  readonly method: "POST";
369
- readonly route: "/system/blobs/blob/head/{ns}/{key}";
372
+ readonly route: "/system/blobs/blob/head/{ns}/{key*}";
370
373
  readonly arguments: readonly ["ns", "key"];
371
374
  };
372
375
  readonly "system:blobs:blob:list": {
@@ -381,17 +384,17 @@ declare const ROUTE_TABLE$1: {
381
384
  };
382
385
  readonly "system:blobs:blob:rename": {
383
386
  readonly method: "PATCH";
384
- readonly route: "/system/blobs/blob/rename/{ns}/{key}";
387
+ readonly route: "/system/blobs/blob/rename/{ns}/{key*}";
385
388
  readonly arguments: readonly ["ns", "key"];
386
389
  };
387
390
  readonly "system:blobs:blob:update": {
388
391
  readonly method: "PATCH";
389
- readonly route: "/system/blobs/blob/update/{ns}/{key}";
392
+ readonly route: "/system/blobs/blob/update/{ns}/{key*}";
390
393
  readonly arguments: readonly ["ns", "key"];
391
394
  };
392
395
  readonly "system:blobs:blob:upload": {
393
396
  readonly method: "POST";
394
- readonly route: "/system/blobs/blob/upload/{ns}/{key}";
397
+ readonly route: "/system/blobs/blob/upload/{ns}/{key*}";
395
398
  readonly arguments: readonly ["ns", "key"];
396
399
  };
397
400
  readonly "system:blobs:namespace:compact": {
@@ -474,11 +477,31 @@ declare const ROUTE_TABLE$1: {
474
477
  readonly route: "/system/collections/document/update/{name}/{doc_id}";
475
478
  readonly arguments: readonly ["name", "doc_id"];
476
479
  };
480
+ readonly "system:collections:document:update_many": {
481
+ readonly method: "PATCH";
482
+ readonly route: "/system/collections/document/update_many/{name}";
483
+ readonly arguments: readonly ["name"];
484
+ };
485
+ readonly "system:collections:operation_policy:query": {
486
+ readonly method: "POST";
487
+ readonly route: "/system/collections/operation_policy/query";
488
+ readonly arguments: readonly [];
489
+ };
477
490
  readonly "system:collections:user:query": {
478
491
  readonly method: "POST";
479
492
  readonly route: "/system/collections/user/query";
480
493
  readonly arguments: readonly [];
481
494
  };
495
+ readonly "system:collections:view:create": {
496
+ readonly method: "POST";
497
+ readonly route: "/system/collections/view/create/{name}";
498
+ readonly arguments: readonly ["name"];
499
+ };
500
+ readonly "system:collections:view:refresh": {
501
+ readonly method: "PATCH";
502
+ readonly route: "/system/collections/view/refresh/{name}";
503
+ readonly arguments: readonly ["name"];
504
+ };
482
505
  readonly "system:core:capability:list": {
483
506
  readonly method: "GET";
484
507
  readonly route: "/system/core/capability/list";
@@ -894,8 +917,9 @@ declare class HttpTransport<R extends string = RouteName$1> implements Transport
894
917
  private baseUrl;
895
918
  private apiPrefix;
896
919
  private onAuthStateChanged?;
920
+ private defaultHeaders?;
897
921
  private raw;
898
- constructor(baseUrl: string, apiPrefix: string, onAuthStateChanged?: (() => void) | undefined);
922
+ constructor(baseUrl: string, apiPrefix: string, onAuthStateChanged?: (() => void) | undefined, defaultHeaders?: Record<string, string> | undefined);
899
923
  private substituteArgs;
900
924
  dispatch<T>(name: R, input?: DispatchInput): Promise<HestiaResponse<T>>;
901
925
  routeUrl(name: R, args?: Record<string, string>): string;
@@ -963,6 +987,27 @@ declare class WailsTransport implements Transport<RouteName$1> {
963
987
  openStream(path: string, handlers: StreamHandlers, _options?: StreamOptions): Promise<void>;
964
988
  }
965
989
  //#endregion
990
+ //#region core/document.d.ts
991
+ /** Methods attached to every document via {@link proxiedDocument}. */
992
+ interface DocumentMethods {
993
+ /** The document's envelope id (`_id_`). */
994
+ id(): string;
995
+ /** The document's envelope metadata (`_metadata_`). */
996
+ metadata(): DocumentMetadata;
997
+ }
998
+ /** A document with {@link DocumentMethods} attached. */
999
+ type ProxiedDocument<T extends Record<string, any>> = Document<T> & DocumentMethods;
1000
+ /**
1001
+ * Wraps a document in a Proxy exposing `id()` and `metadata()` alongside
1002
+ * every payload field. Property reads/writes, `Object.keys`, spread, and
1003
+ * `JSON.stringify` behave exactly as on the raw document (the methods are
1004
+ * not own properties, so serialisation is unaffected). A payload field
1005
+ * literally named `id` or `metadata` wins over the method.
1006
+ */
1007
+ declare function proxiedDocument<T extends Record<string, any>>(doc: Document<T>): ProxiedDocument<T>;
1008
+ /** Maps a page's documents through {@link proxiedDocument}. */
1009
+ declare function proxiedPage<T extends Record<string, any>>(page: Page<T>): Page<ProxiedDocument<T>>;
1010
+ //#endregion
966
1011
  //#region core/collection.d.ts
967
1012
  declare class HestiaCollection<T extends Record<string, any>> implements DocumentStore<T, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
968
1013
  private client;
@@ -972,17 +1017,18 @@ declare class HestiaCollection<T extends Record<string, any>> implements Documen
972
1017
  private pager;
973
1018
  constructor(client: Transport, collectionName: string, defaultLimit?: number);
974
1019
  name(): string;
975
- find(query?: Record<string, unknown>): Promise<Page<T>>;
976
- read(id: string): Promise<Document<T> | undefined>;
1020
+ find(query?: QueryDSL<T>): Promise<Page<ProxiedDocument<T>>>;
1021
+ read(id: string): Promise<ProxiedDocument<T> | undefined>;
977
1022
  create(props: {
978
1023
  data: Partial<T>;
979
- }): Promise<Document<T> | undefined>;
1024
+ }): Promise<ProxiedDocument<T> | undefined>;
980
1025
  update(props: {
981
1026
  data: Partial<T>;
982
- options?: string;
983
- }): Promise<Document<T> | undefined>;
1027
+ id?: string;
1028
+ filter?: QueryFilter<T>;
1029
+ }): Promise<ProxiedDocument<T> | undefined>;
984
1030
  delete(id: string): Promise<void>;
985
- list(options?: Record<string, unknown>): Promise<Page<T>>;
1031
+ list(options?: Record<string, unknown>): Promise<Page<ProxiedDocument<T>>>;
986
1032
  upload(_props: {
987
1033
  file: File;
988
1034
  }): Promise<Document<T> | undefined>;
@@ -996,6 +1042,77 @@ declare class HestiaCollection<T extends Record<string, any>> implements Documen
996
1042
  page(_options?: Record<string, unknown>): PagedData<T>;
997
1043
  }
998
1044
  //#endregion
1045
+ //#region system/collections/types.d.ts
1046
+ interface CollectionMeta {
1047
+ name: string;
1048
+ schema: SchemaDefinition;
1049
+ created: string;
1050
+ updated: string;
1051
+ }
1052
+ type CollectionDocument = Document<{
1053
+ schema: SchemaDefinition;
1054
+ }>;
1055
+ interface DataViewMeta {
1056
+ name: string;
1057
+ materialized: boolean;
1058
+ target: string;
1059
+ }
1060
+ //#endregion
1061
+ //#region core/data-view.d.ts
1062
+ interface DataViewDefinition<T extends Record<string, any>> {
1063
+ name: string;
1064
+ /** Stored query. `target.name` pins the underlying collection (required by the server). */
1065
+ query: QueryDSL<T> & {
1066
+ target: {
1067
+ name: string;
1068
+ };
1069
+ };
1070
+ materialized?: boolean;
1071
+ }
1072
+ /**
1073
+ * Read-only view over a stored server query — the view counterpart to
1074
+ * HestiaCollection. Reads flow through the regular document:query /
1075
+ * document:get messages addressed at the view name; document writes are
1076
+ * rejected server-side (ERR_PERSISTENCE_READ_ONLY) and throw client-side.
1077
+ * Materialized snapshots are rebuilt via refresh().
1078
+ */
1079
+ declare class HestiaDataView<T extends Record<string, any>> implements DocumentStore<T, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
1080
+ private client;
1081
+ private viewName;
1082
+ private defaultLimit;
1083
+ private pagerOptions;
1084
+ private pager;
1085
+ constructor(client: Transport, viewName: string, defaultLimit?: number);
1086
+ /** Registers a view on the server and returns a handle to it. */
1087
+ static create<T extends Record<string, any>>(client: Transport, definition: DataViewDefinition<T>): Promise<HestiaDataView<T>>;
1088
+ name(): string;
1089
+ find(query?: QueryDSL<T>): Promise<Page<ProxiedDocument<T>>>;
1090
+ read(id: string): Promise<ProxiedDocument<T> | undefined>;
1091
+ /** Rebuilds a materialized view's snapshot. Fails on virtual views. */
1092
+ refresh(): Promise<ProxiedDocument<DataViewMeta> | undefined>;
1093
+ create(_props: {
1094
+ data: Partial<T>;
1095
+ }): Promise<ProxiedDocument<T> | undefined>;
1096
+ update(_props: {
1097
+ data: Partial<T>;
1098
+ id?: string;
1099
+ filter?: QueryFilter<T>;
1100
+ }): Promise<ProxiedDocument<T> | undefined>;
1101
+ delete(_id: string): Promise<void>;
1102
+ list(options?: Record<string, unknown>): Promise<Page<ProxiedDocument<T>>>;
1103
+ upload(_props: {
1104
+ file: File;
1105
+ }): Promise<ProxiedDocument<T> | undefined>;
1106
+ subscribe(_scope: string, _callback: (event: StoreEvent) => void): Promise<() => void>;
1107
+ notify(_event: StoreEvent): Promise<void>;
1108
+ stream(_options: Record<string, unknown>, _onStreamChange: () => void): {
1109
+ stream: () => AsyncIterable<Document<T>>;
1110
+ cancel: () => void;
1111
+ status: () => "active" | "cancelled" | "completed";
1112
+ };
1113
+ page(_options?: Record<string, unknown>): PagedData<T>;
1114
+ }
1115
+ //#endregion
999
1116
  //#region core/errors.d.ts
1000
1117
  interface ServerErrorBody {
1001
1118
  code?: string;
@@ -1070,8 +1187,9 @@ declare class HestiaUsers implements DocumentStore<UserData, QueryDSL<UserData>,
1070
1187
  list(options?: QueryDSL<UserData>): Promise<Page<UserData>>;
1071
1188
  read(id: string): Promise<Document<UserData> | undefined>;
1072
1189
  update(props: {
1190
+ id?: string;
1073
1191
  data: Partial<UserData>;
1074
- options?: string;
1192
+ filter?: QueryFilter<UserData>;
1075
1193
  }): Promise<Document<UserData> | undefined>;
1076
1194
  delete(id: string): Promise<void>;
1077
1195
  create({ data: payload }: {
@@ -1133,8 +1251,9 @@ declare class HestiaKeyStore implements DocumentStore<APIKey, QueryDSL<APIKey>,
1133
1251
  data: Partial<APIKey>;
1134
1252
  }): Promise<Document<APIKey> | undefined>;
1135
1253
  update(props: {
1254
+ id?: string;
1136
1255
  data: Partial<APIKey>;
1137
- options?: string;
1256
+ filter?: QueryFilter<APIKey>;
1138
1257
  }): Promise<Document<APIKey> | undefined>;
1139
1258
  delete(id: string): Promise<void>;
1140
1259
  upload(_props: {
@@ -1272,8 +1391,9 @@ declare class HestiaPolicies implements DocumentStore<Policy, QueryDSL<Policy>,
1272
1391
  options?: string;
1273
1392
  }): Promise<Document<Policy> | undefined>;
1274
1393
  update(props: {
1394
+ id?: string;
1275
1395
  data: UpdatePolicyRequest;
1276
- options?: string;
1396
+ filter?: QueryFilter<Policy>;
1277
1397
  }): Promise<Document<Policy> | undefined>;
1278
1398
  setEnabled(name: string, enabled: boolean): Promise<Document<Policy>>;
1279
1399
  delete(_id: string): Promise<void>;
@@ -1302,8 +1422,9 @@ declare class HestiaRules implements DocumentStore<PolicyRule, Record<string, un
1302
1422
  options?: string;
1303
1423
  }): Promise<Document<PolicyRule> | undefined>;
1304
1424
  update(props: {
1425
+ id?: string;
1305
1426
  data: UpdateRuleRequest;
1306
- options?: string;
1427
+ filter?: QueryFilter<PolicyRule>;
1307
1428
  }): Promise<Document<PolicyRule> | undefined>;
1308
1429
  delete(name: string): Promise<void>;
1309
1430
  validate(request: ValidateRuleRequest): Promise<ValidateRuleResult>;
@@ -1375,7 +1496,7 @@ declare class HestiaAuditLogs implements DocumentStore<AuditEntry, QueryDSL<Audi
1375
1496
  }): Promise<Document<AuditEntry> | undefined>;
1376
1497
  update(_props: {
1377
1498
  data: Partial<AuditEntry>;
1378
- options?: string;
1499
+ id?: string;
1379
1500
  }): Promise<Document<AuditEntry> | undefined>;
1380
1501
  delete(_id: string): Promise<void>;
1381
1502
  upload(_props: {
@@ -1771,8 +1892,9 @@ declare class BlobNamespace implements DocumentStore<BlobMeta, QueryDSL<BlobMeta
1771
1892
  data: Partial<BlobMeta>;
1772
1893
  }): Promise<Document<BlobMeta> | undefined>;
1773
1894
  update(props: {
1895
+ id?: string;
1774
1896
  data: Partial<BlobMeta>;
1775
- options?: Record<string, any>;
1897
+ filter?: QueryFilter<BlobMeta>;
1776
1898
  }): Promise<Document<BlobMeta> | undefined>;
1777
1899
  delete(key: string): Promise<void>;
1778
1900
  rename(oldKey: string, newKey: string): Promise<void>;
@@ -1834,17 +1956,6 @@ declare class HestiaBlobClient {
1834
1956
  namespace(ns: string): BlobNamespace;
1835
1957
  }
1836
1958
  //#endregion
1837
- //#region system/collections/types.d.ts
1838
- interface CollectionMeta {
1839
- name: string;
1840
- schema: SchemaDefinition;
1841
- created: string;
1842
- updated: string;
1843
- }
1844
- type CollectionDocument = Document<{
1845
- schema: SchemaDefinition;
1846
- }>;
1847
- //#endregion
1848
1959
  //#region system/collections/store.d.ts
1849
1960
  declare class HestiaCollections implements DocumentStore<CollectionMeta, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
1850
1961
  private client;
@@ -1856,7 +1967,7 @@ declare class HestiaCollections implements DocumentStore<CollectionMeta, Record<
1856
1967
  }): Promise<Document<CollectionMeta> | undefined>;
1857
1968
  update(_props: {
1858
1969
  data: Partial<CollectionMeta>;
1859
- options?: string;
1970
+ id?: string;
1860
1971
  }): Promise<Document<CollectionMeta> | undefined>;
1861
1972
  delete(name: string): Promise<void>;
1862
1973
  list(_options?: Record<string, unknown>): Promise<Page<CollectionMeta>>;
@@ -1872,6 +1983,7 @@ declare class HestiaCollections implements DocumentStore<CollectionMeta, Record<
1872
1983
  };
1873
1984
  page(_options?: Record<string, unknown>): PagedData<CollectionMeta>;
1874
1985
  documents<T extends Record<string, any>>(collectionName: string): HestiaCollection<T>;
1986
+ view<T extends Record<string, any>>(viewName: string): HestiaDataView<T>;
1875
1987
  }
1876
1988
  //#endregion
1877
1989
  //#region system/notifications/types.d.ts
@@ -1911,7 +2023,7 @@ declare class HestiaNotificationStore {
1911
2023
  private client;
1912
2024
  constructor(client: Transport<string>);
1913
2025
  /**
1914
- * Create an in-app notification for a user (administrator-gated). Content
2026
+ * Create an in-app notification for a user (root-gated). Content
1915
2027
  * is taken verbatim — no template rendering.
1916
2028
  */
1917
2029
  create(input: CreateNotificationInput): Promise<Document<Notification>>;
@@ -2073,7 +2185,7 @@ declare class HestiaUpdates {
2073
2185
  checkAvailability(): Promise<UpdateAvailability>;
2074
2186
  /**
2075
2187
  * Download and stage the newest release without applying it. Notifies
2076
- * administrators when a release was newly staged.
2188
+ * root users when a release was newly staged.
2077
2189
  */
2078
2190
  stage(): Promise<UpdateStageResult>;
2079
2191
  /**
@@ -2314,7 +2426,7 @@ declare class HestiaCore implements DocumentStore<any, Record<string, unknown>,
2314
2426
  }): Promise<Document<any> | undefined>;
2315
2427
  update(_props: {
2316
2428
  data: Partial<any>;
2317
- options?: string;
2429
+ id?: string;
2318
2430
  }): Promise<Document<any> | undefined>;
2319
2431
  delete(_id: string): Promise<void>;
2320
2432
  list(_options?: Record<string, unknown>): Promise<Page<any>>;
@@ -2333,7 +2445,7 @@ declare class HestiaCore implements DocumentStore<any, Record<string, unknown>,
2333
2445
  //#endregion
2334
2446
  //#region dist/index.d.mts
2335
2447
  //#region core/types.d.ts
2336
- interface DocumentMetadata {
2448
+ interface DocumentMetadata$1 {
2337
2449
  checksum: string;
2338
2450
  created: string;
2339
2451
  updated: string;
@@ -2341,7 +2453,7 @@ interface DocumentMetadata {
2341
2453
  }
2342
2454
  interface BaseDocument {
2343
2455
  _id_: string;
2344
- _metadata_: DocumentMetadata;
2456
+ _metadata_: DocumentMetadata$1;
2345
2457
  }
2346
2458
  type Document$1<T extends Record<string, any>> = BaseDocument & T;
2347
2459
  /**
@@ -2470,12 +2582,15 @@ interface DocumentStore$1<T extends Record<string, any>, TFindOptions = Record<s
2470
2582
  */
2471
2583
  delete: (options: TDeleteOptions) => Promise<void>;
2472
2584
  /**
2473
- * Updates an existing record.
2474
- * @param props An object containing the ID of the record to update, the partial data, and optional update options.
2585
+ * Updates existing records.
2586
+ * @param props An object containing the partial data plus exactly one
2587
+ * target: an `id` or a `filter`. Optional update options ride in `options`.
2475
2588
  * @returns A promise that resolves to the updated record or undefined if not found.
2476
2589
  */
2477
2590
  update: (props: {
2478
2591
  data: Partial<T>;
2592
+ id?: string;
2593
+ filter?: QueryFilter<T>;
2479
2594
  options?: TUpdateOptions;
2480
2595
  }) => Promise<Document$1<T> | undefined>;
2481
2596
  /**
@@ -2655,17 +2770,17 @@ declare const ROUTE_TABLE: {
2655
2770
  };
2656
2771
  readonly "system:blobs:blob:delete": {
2657
2772
  readonly method: "DELETE";
2658
- readonly route: "/system/blobs/blob/delete/{ns}/{key}";
2773
+ readonly route: "/system/blobs/blob/delete/{ns}/{key*}";
2659
2774
  readonly arguments: readonly ["ns", "key"];
2660
2775
  };
2661
2776
  readonly "system:blobs:blob:download": {
2662
2777
  readonly method: "GET";
2663
- readonly route: "/system/blobs/blob/download/{ns}/{key}";
2778
+ readonly route: "/system/blobs/blob/download/{ns}/{key*}";
2664
2779
  readonly arguments: readonly ["ns", "key"];
2665
2780
  };
2666
2781
  readonly "system:blobs:blob:head": {
2667
2782
  readonly method: "POST";
2668
- readonly route: "/system/blobs/blob/head/{ns}/{key}";
2783
+ readonly route: "/system/blobs/blob/head/{ns}/{key*}";
2669
2784
  readonly arguments: readonly ["ns", "key"];
2670
2785
  };
2671
2786
  readonly "system:blobs:blob:list": {
@@ -2680,17 +2795,17 @@ declare const ROUTE_TABLE: {
2680
2795
  };
2681
2796
  readonly "system:blobs:blob:rename": {
2682
2797
  readonly method: "PATCH";
2683
- readonly route: "/system/blobs/blob/rename/{ns}/{key}";
2798
+ readonly route: "/system/blobs/blob/rename/{ns}/{key*}";
2684
2799
  readonly arguments: readonly ["ns", "key"];
2685
2800
  };
2686
2801
  readonly "system:blobs:blob:update": {
2687
2802
  readonly method: "PATCH";
2688
- readonly route: "/system/blobs/blob/update/{ns}/{key}";
2803
+ readonly route: "/system/blobs/blob/update/{ns}/{key*}";
2689
2804
  readonly arguments: readonly ["ns", "key"];
2690
2805
  };
2691
2806
  readonly "system:blobs:blob:upload": {
2692
2807
  readonly method: "POST";
2693
- readonly route: "/system/blobs/blob/upload/{ns}/{key}";
2808
+ readonly route: "/system/blobs/blob/upload/{ns}/{key*}";
2694
2809
  readonly arguments: readonly ["ns", "key"];
2695
2810
  };
2696
2811
  readonly "system:blobs:namespace:compact": {
@@ -2773,11 +2888,31 @@ declare const ROUTE_TABLE: {
2773
2888
  readonly route: "/system/collections/document/update/{name}/{doc_id}";
2774
2889
  readonly arguments: readonly ["name", "doc_id"];
2775
2890
  };
2891
+ readonly "system:collections:document:update_many": {
2892
+ readonly method: "PATCH";
2893
+ readonly route: "/system/collections/document/update_many/{name}";
2894
+ readonly arguments: readonly ["name"];
2895
+ };
2896
+ readonly "system:collections:operation_policy:query": {
2897
+ readonly method: "POST";
2898
+ readonly route: "/system/collections/operation_policy/query";
2899
+ readonly arguments: readonly [];
2900
+ };
2776
2901
  readonly "system:collections:user:query": {
2777
2902
  readonly method: "POST";
2778
2903
  readonly route: "/system/collections/user/query";
2779
2904
  readonly arguments: readonly [];
2780
2905
  };
2906
+ readonly "system:collections:view:create": {
2907
+ readonly method: "POST";
2908
+ readonly route: "/system/collections/view/create/{name}";
2909
+ readonly arguments: readonly ["name"];
2910
+ };
2911
+ readonly "system:collections:view:refresh": {
2912
+ readonly method: "PATCH";
2913
+ readonly route: "/system/collections/view/refresh/{name}";
2914
+ readonly arguments: readonly ["name"];
2915
+ };
2781
2916
  readonly "system:core:capability:list": {
2782
2917
  readonly method: "GET";
2783
2918
  readonly route: "/system/core/capability/list";
@@ -3195,6 +3330,17 @@ declare global {
3195
3330
  }
3196
3331
  }
3197
3332
  //#endregion
3333
+ //#region core/document.d.ts
3334
+ /** Methods attached to every document via {@link proxiedDocument}. */
3335
+ interface DocumentMethods$1 {
3336
+ /** The document's envelope id (`_id_`). */
3337
+ id(): string;
3338
+ /** The document's envelope metadata (`_metadata_`). */
3339
+ metadata(): DocumentMetadata$1;
3340
+ }
3341
+ /** A document with {@link DocumentMethods} attached. */
3342
+ type ProxiedDocument$1<T extends Record<string, any>> = Document$1<T> & DocumentMethods$1;
3343
+ //#endregion
3198
3344
  //#region core/collection.d.ts
3199
3345
  declare class HestiaCollection$1<T extends Record<string, any>> implements DocumentStore$1<T, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
3200
3346
  private client;
@@ -3204,17 +3350,18 @@ declare class HestiaCollection$1<T extends Record<string, any>> implements Docum
3204
3350
  private pager;
3205
3351
  constructor(client: Transport$1, collectionName: string, defaultLimit?: number);
3206
3352
  name(): string;
3207
- find(query?: Record<string, unknown>): Promise<Page$1<T>>;
3208
- read(id: string): Promise<Document$1<T> | undefined>;
3353
+ find(query?: QueryDSL<T>): Promise<Page$1<ProxiedDocument$1<T>>>;
3354
+ read(id: string): Promise<ProxiedDocument$1<T> | undefined>;
3209
3355
  create(props: {
3210
3356
  data: Partial<T>;
3211
- }): Promise<Document$1<T> | undefined>;
3357
+ }): Promise<ProxiedDocument$1<T> | undefined>;
3212
3358
  update(props: {
3213
3359
  data: Partial<T>;
3214
- options?: string;
3215
- }): Promise<Document$1<T> | undefined>;
3360
+ id?: string;
3361
+ filter?: QueryFilter<T>;
3362
+ }): Promise<ProxiedDocument$1<T> | undefined>;
3216
3363
  delete(id: string): Promise<void>;
3217
- list(options?: Record<string, unknown>): Promise<Page$1<T>>;
3364
+ list(options?: Record<string, unknown>): Promise<Page$1<ProxiedDocument$1<T>>>;
3218
3365
  upload(_props: {
3219
3366
  file: File;
3220
3367
  }): Promise<Document$1<T> | undefined>;
@@ -3227,11 +3374,72 @@ declare class HestiaCollection$1<T extends Record<string, any>> implements Docum
3227
3374
  };
3228
3375
  page(_options?: Record<string, unknown>): PagedData$1<T>;
3229
3376
  }
3377
+ interface DataViewMeta$1 {
3378
+ name: string;
3379
+ materialized: boolean;
3380
+ target: string;
3381
+ }
3382
+ //#endregion
3383
+ //#region core/data-view.d.ts
3384
+ interface DataViewDefinition$1<T extends Record<string, any>> {
3385
+ name: string;
3386
+ /** Stored query. `target.name` pins the underlying collection (required by the server). */
3387
+ query: QueryDSL<T> & {
3388
+ target: {
3389
+ name: string;
3390
+ };
3391
+ };
3392
+ materialized?: boolean;
3393
+ }
3394
+ /**
3395
+ * Read-only view over a stored server query — the view counterpart to
3396
+ * HestiaCollection. Reads flow through the regular document:query /
3397
+ * document:get messages addressed at the view name; document writes are
3398
+ * rejected server-side (ERR_PERSISTENCE_READ_ONLY) and throw client-side.
3399
+ * Materialized snapshots are rebuilt via refresh().
3400
+ */
3401
+ declare class HestiaDataView$1<T extends Record<string, any>> implements DocumentStore$1<T, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
3402
+ private client;
3403
+ private viewName;
3404
+ private defaultLimit;
3405
+ private pagerOptions;
3406
+ private pager;
3407
+ constructor(client: Transport$1, viewName: string, defaultLimit?: number);
3408
+ /** Registers a view on the server and returns a handle to it. */
3409
+ static create<T extends Record<string, any>>(client: Transport$1, definition: DataViewDefinition$1<T>): Promise<HestiaDataView$1<T>>;
3410
+ name(): string;
3411
+ find(query?: QueryDSL<T>): Promise<Page$1<ProxiedDocument$1<T>>>;
3412
+ read(id: string): Promise<ProxiedDocument$1<T> | undefined>;
3413
+ /** Rebuilds a materialized view's snapshot. Fails on virtual views. */
3414
+ refresh(): Promise<ProxiedDocument$1<DataViewMeta$1> | undefined>;
3415
+ create(_props: {
3416
+ data: Partial<T>;
3417
+ }): Promise<ProxiedDocument$1<T> | undefined>;
3418
+ update(_props: {
3419
+ data: Partial<T>;
3420
+ id?: string;
3421
+ filter?: QueryFilter<T>;
3422
+ }): Promise<ProxiedDocument$1<T> | undefined>;
3423
+ delete(_id: string): Promise<void>;
3424
+ list(options?: Record<string, unknown>): Promise<Page$1<ProxiedDocument$1<T>>>;
3425
+ upload(_props: {
3426
+ file: File;
3427
+ }): Promise<ProxiedDocument$1<T> | undefined>;
3428
+ subscribe(_scope: string, _callback: (event: StoreEvent$1) => void): Promise<() => void>;
3429
+ notify(_event: StoreEvent$1): Promise<void>;
3430
+ stream(_options: Record<string, unknown>, _onStreamChange: () => void): {
3431
+ stream: () => AsyncIterable<Document$1<T>>;
3432
+ cancel: () => void;
3433
+ status: () => "active" | "cancelled" | "completed";
3434
+ };
3435
+ page(_options?: Record<string, unknown>): PagedData$1<T>;
3436
+ }
3230
3437
  //#endregion
3231
3438
  //#region container.d.ts
3232
3439
  interface HestiaConfig {
3233
3440
  baseUrl: string;
3234
3441
  apiPrefix?: string;
3442
+ apiKey?: string;
3235
3443
  persistence?: SimplePersistence<AuthState>;
3236
3444
  uploadPersistence?: UploadPersistence;
3237
3445
  transport?: Transport;
@@ -3258,7 +3466,9 @@ declare class HestiaClient {
3258
3466
  readonly settings: HestiaSettingStore;
3259
3467
  readonly updates: HestiaUpdates;
3260
3468
  readonly workflows: HestiaWorkflowStore;
3469
+ readonly operations: HestiaOperations;
3261
3470
  private tokenProvider;
3471
+ private readonly apiKeyMode;
3262
3472
  private onAuthStateChanged?;
3263
3473
  constructor(config: HestiaConfig);
3264
3474
  onAuthStateChange(callback: () => void): void;
@@ -3268,6 +3478,7 @@ declare class HestiaClient {
3268
3478
  startHeartbeat(intervalMs?: number): void;
3269
3479
  stopHeartbeat(): void;
3270
3480
  collection<T extends Record<string, any>>(name: string): HestiaCollection$1<T>;
3481
+ view<T extends Record<string, any>>(name: string): HestiaDataView$1<T>;
3271
3482
  ready(): Promise<void>;
3272
3483
  }
3273
3484
  //#endregion
@@ -3288,4 +3499,4 @@ interface ArrayPagerOptions<T extends Record<string, any>, F = any> {
3288
3499
  }
3289
3500
  declare function createArrayPager<T extends Record<string, any>, F = any>(options: ArrayPagerOptions<T, F>): PagedData<T>;
3290
3501
  //#endregion
3291
- export { APIKey, APIKeyWithSecret, AccessLogFields, AimdController, ArrayPagerOptions, AuditEntry, Binding, BlobDocument, BlobMeta, BlobNamespace, BootstrapPasswordRequest, ChangePasswordRequest, CollectionDocument, CollectionMeta, CompactResult, CompiledWorkflow, CreateKeyRequest, CreateNamespaceRequest, CreateNotificationInput, CreatePolicyRequest, CreateRuleRequest, CreateSchedulePayload, CreateUserRequest, DispatchInput, Document, DocumentStore, EdgeRole, EmitEventPayload, FetchResult, HandleKind, HandleSpec, HandleType, HestiaAppLogs, HestiaAuditLogs, HestiaAuth, HestiaBlobClient, HestiaClient, HestiaCollection, HestiaCollections, HestiaCore, HestiaKeyStore, HestiaNetworkClient, HestiaNotificationStore, HestiaOperations, HestiaPolicies, HestiaResponse, HestiaRules, HestiaScheduleStore, HestiaSettingStore, HestiaUpdates, HestiaUsers, HestiaWorkflowStore, HttpTransport, IdentityProvider, InvokeWorkflowPayload, InvokeWorkflowResult, ListBlobsRequest, LogEntry, LogFilter, LogListResult, LogQuery, LoginRequest, LoginResult, NamespaceInfo, NamespaceStats, NodeDefinition, NodeType, Notification, NotificationAction, Page, PagedData, PagerRefreshOptions, PaginationInfo, Policy, PolicyRule, RateLimitConfig, RegisterRequest, RegisterWorkflowPayload, ReloadResult, RequestLogEntry, RequestOptions, ResumableUpload, ResumeWorkflowPayload, ResumeWorkflowResult, RuleNode, RunMeta, RunOutcome, RunStatus, RunWorkflowPayload, Schedule, ServerHealth, SetPolicyEnabledRequest, SettingDocument, StoreEvent, StreamHandlers, StreamOptions, ThrottleAction, ThrottleConfig, TimelineEvent, Transport, UnreadCount, UpdateApplyResult, UpdateAvailability, UpdateChangelog, UpdateCheckResult, UpdateKeyRequest, UpdatePolicyRequest, UpdatePolicyRuleRequest, UpdateRuleRequest, UpdateSchedulePayload, UpdateStageResult, UpdateStatus, UpdateUserRequest, UploadBeginResult, UploadJobSnapshot, UploadJobStore, UploadJobsState, UploadOptions, UploadPersistence, UploadPhase, UploadProgressInfo, UploadProgressResult, UploadQueue, UploadQueueOptions, UploadStatus, UploadTransport, UserData, UserIdentity, ValidateRuleRequest, ValidateRuleResult, WailsTransport, WorkflowDefinition, WorkflowEdge, WorkflowNode, createArrayPager, createPagedController, getCachedHandles, getMissingRanges, internalError, notFound, parseErrorBody, permissionDenied, toSystemError };
3502
+ export { APIKey, APIKeyWithSecret, AccessLogFields, AimdController, ArrayPagerOptions, AuditEntry, Binding, BlobDocument, BlobMeta, BlobNamespace, BootstrapPasswordRequest, ChangePasswordRequest, CollectionDocument, CollectionMeta, CompactResult, CompiledWorkflow, CreateKeyRequest, CreateNamespaceRequest, CreateNotificationInput, CreatePolicyRequest, CreateRuleRequest, CreateSchedulePayload, CreateUserRequest, type DataViewDefinition, DataViewMeta, DispatchInput, Document, DocumentMetadata, type DocumentMethods, DocumentStore, EdgeRole, EmitEventPayload, FetchResult, HandleKind, HandleSpec, HandleType, HestiaAppLogs, HestiaAuditLogs, HestiaAuth, HestiaBlobClient, HestiaClient, HestiaCollection, HestiaCollections, HestiaCore, HestiaDataView, HestiaKeyStore, HestiaNetworkClient, HestiaNotificationStore, HestiaOperations, HestiaPolicies, HestiaResponse, HestiaRules, HestiaScheduleStore, HestiaSettingStore, HestiaUpdates, HestiaUsers, HestiaWorkflowStore, HttpTransport, IdentityProvider, InvokeWorkflowPayload, InvokeWorkflowResult, ListBlobsRequest, LogEntry, LogFilter, LogListResult, LogQuery, LoginRequest, LoginResult, NamespaceInfo, NamespaceStats, NodeDefinition, NodeType, Notification, NotificationAction, Page, PagedData, PagerRefreshOptions, PaginationInfo, Policy, PolicyRule, type ProxiedDocument, RateLimitConfig, RegisterRequest, RegisterWorkflowPayload, ReloadResult, RequestLogEntry, RequestOptions, ResumableUpload, ResumeWorkflowPayload, ResumeWorkflowResult, RuleNode, RunMeta, RunOutcome, RunStatus, RunWorkflowPayload, Schedule, ServerHealth, SetPolicyEnabledRequest, SettingDocument, StoreEvent, StreamHandlers, StreamOptions, ThrottleAction, ThrottleConfig, TimelineEvent, Transport, UnreadCount, UpdateApplyResult, UpdateAvailability, UpdateChangelog, UpdateCheckResult, UpdateKeyRequest, UpdatePolicyRequest, UpdatePolicyRuleRequest, UpdateRuleRequest, UpdateSchedulePayload, UpdateStageResult, UpdateStatus, UpdateUserRequest, UploadBeginResult, UploadJobSnapshot, UploadJobStore, UploadJobsState, UploadOptions, UploadPersistence, UploadPhase, UploadProgressInfo, UploadProgressResult, UploadQueue, UploadQueueOptions, UploadStatus, UploadTransport, UserData, UserIdentity, ValidateRuleRequest, ValidateRuleResult, WailsTransport, WorkflowDefinition, WorkflowEdge, WorkflowNode, createArrayPager, createPagedController, getCachedHandles, getMissingRanges, internalError, notFound, parseErrorBody, permissionDenied, proxiedDocument, proxiedPage, toSystemError };