@asaidimu/hestia 1.12.1 → 1.14.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/LICENSE.md +13 -18
- package/README.md +2 -0
- package/index.cjs +4 -4
- package/index.d.cts +239 -41
- package/index.d.mts +137 -29
- package/index.mjs +4 -4
- package/package.json +1 -1
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
|
|
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
|
|
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
|
|
146
|
-
* @param props An object containing the
|
|
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
|
/**
|
|
@@ -474,11 +477,26 @@ 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
|
+
};
|
|
477
485
|
readonly "system:collections:user:query": {
|
|
478
486
|
readonly method: "POST";
|
|
479
487
|
readonly route: "/system/collections/user/query";
|
|
480
488
|
readonly arguments: readonly [];
|
|
481
489
|
};
|
|
490
|
+
readonly "system:collections:view:create": {
|
|
491
|
+
readonly method: "POST";
|
|
492
|
+
readonly route: "/system/collections/view/create/{name}";
|
|
493
|
+
readonly arguments: readonly ["name"];
|
|
494
|
+
};
|
|
495
|
+
readonly "system:collections:view:refresh": {
|
|
496
|
+
readonly method: "PATCH";
|
|
497
|
+
readonly route: "/system/collections/view/refresh/{name}";
|
|
498
|
+
readonly arguments: readonly ["name"];
|
|
499
|
+
};
|
|
482
500
|
readonly "system:core:capability:list": {
|
|
483
501
|
readonly method: "GET";
|
|
484
502
|
readonly route: "/system/core/capability/list";
|
|
@@ -963,6 +981,27 @@ declare class WailsTransport implements Transport<RouteName$1> {
|
|
|
963
981
|
openStream(path: string, handlers: StreamHandlers, _options?: StreamOptions): Promise<void>;
|
|
964
982
|
}
|
|
965
983
|
//#endregion
|
|
984
|
+
//#region core/document.d.ts
|
|
985
|
+
/** Methods attached to every document via {@link proxiedDocument}. */
|
|
986
|
+
interface DocumentMethods {
|
|
987
|
+
/** The document's envelope id (`_id_`). */
|
|
988
|
+
id(): string;
|
|
989
|
+
/** The document's envelope metadata (`_metadata_`). */
|
|
990
|
+
metadata(): DocumentMetadata;
|
|
991
|
+
}
|
|
992
|
+
/** A document with {@link DocumentMethods} attached. */
|
|
993
|
+
type ProxiedDocument<T extends Record<string, any>> = Document<T> & DocumentMethods;
|
|
994
|
+
/**
|
|
995
|
+
* Wraps a document in a Proxy exposing `id()` and `metadata()` alongside
|
|
996
|
+
* every payload field. Property reads/writes, `Object.keys`, spread, and
|
|
997
|
+
* `JSON.stringify` behave exactly as on the raw document (the methods are
|
|
998
|
+
* not own properties, so serialisation is unaffected). A payload field
|
|
999
|
+
* literally named `id` or `metadata` wins over the method.
|
|
1000
|
+
*/
|
|
1001
|
+
declare function proxiedDocument<T extends Record<string, any>>(doc: Document<T>): ProxiedDocument<T>;
|
|
1002
|
+
/** Maps a page's documents through {@link proxiedDocument}. */
|
|
1003
|
+
declare function proxiedPage<T extends Record<string, any>>(page: Page<T>): Page<ProxiedDocument<T>>;
|
|
1004
|
+
//#endregion
|
|
966
1005
|
//#region core/collection.d.ts
|
|
967
1006
|
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
1007
|
private client;
|
|
@@ -972,17 +1011,18 @@ declare class HestiaCollection<T extends Record<string, any>> implements Documen
|
|
|
972
1011
|
private pager;
|
|
973
1012
|
constructor(client: Transport, collectionName: string, defaultLimit?: number);
|
|
974
1013
|
name(): string;
|
|
975
|
-
find(query?:
|
|
976
|
-
read(id: string): Promise<
|
|
1014
|
+
find(query?: QueryDSL<T>): Promise<Page<ProxiedDocument<T>>>;
|
|
1015
|
+
read(id: string): Promise<ProxiedDocument<T> | undefined>;
|
|
977
1016
|
create(props: {
|
|
978
1017
|
data: Partial<T>;
|
|
979
|
-
}): Promise<
|
|
1018
|
+
}): Promise<ProxiedDocument<T> | undefined>;
|
|
980
1019
|
update(props: {
|
|
981
1020
|
data: Partial<T>;
|
|
982
|
-
|
|
983
|
-
|
|
1021
|
+
id?: string;
|
|
1022
|
+
filter?: QueryFilter<T>;
|
|
1023
|
+
}): Promise<ProxiedDocument<T> | undefined>;
|
|
984
1024
|
delete(id: string): Promise<void>;
|
|
985
|
-
list(options?: Record<string, unknown>): Promise<Page<T
|
|
1025
|
+
list(options?: Record<string, unknown>): Promise<Page<ProxiedDocument<T>>>;
|
|
986
1026
|
upload(_props: {
|
|
987
1027
|
file: File;
|
|
988
1028
|
}): Promise<Document<T> | undefined>;
|
|
@@ -996,6 +1036,77 @@ declare class HestiaCollection<T extends Record<string, any>> implements Documen
|
|
|
996
1036
|
page(_options?: Record<string, unknown>): PagedData<T>;
|
|
997
1037
|
}
|
|
998
1038
|
//#endregion
|
|
1039
|
+
//#region system/collections/types.d.ts
|
|
1040
|
+
interface CollectionMeta {
|
|
1041
|
+
name: string;
|
|
1042
|
+
schema: SchemaDefinition;
|
|
1043
|
+
created: string;
|
|
1044
|
+
updated: string;
|
|
1045
|
+
}
|
|
1046
|
+
type CollectionDocument = Document<{
|
|
1047
|
+
schema: SchemaDefinition;
|
|
1048
|
+
}>;
|
|
1049
|
+
interface DataViewMeta {
|
|
1050
|
+
name: string;
|
|
1051
|
+
materialized: boolean;
|
|
1052
|
+
target: string;
|
|
1053
|
+
}
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region core/data-view.d.ts
|
|
1056
|
+
interface DataViewDefinition<T extends Record<string, any>> {
|
|
1057
|
+
name: string;
|
|
1058
|
+
/** Stored query. `target.name` pins the underlying collection (required by the server). */
|
|
1059
|
+
query: QueryDSL<T> & {
|
|
1060
|
+
target: {
|
|
1061
|
+
name: string;
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
materialized?: boolean;
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Read-only view over a stored server query — the view counterpart to
|
|
1068
|
+
* HestiaCollection. Reads flow through the regular document:query /
|
|
1069
|
+
* document:get messages addressed at the view name; document writes are
|
|
1070
|
+
* rejected server-side (ERR_PERSISTENCE_READ_ONLY) and throw client-side.
|
|
1071
|
+
* Materialized snapshots are rebuilt via refresh().
|
|
1072
|
+
*/
|
|
1073
|
+
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>> {
|
|
1074
|
+
private client;
|
|
1075
|
+
private viewName;
|
|
1076
|
+
private defaultLimit;
|
|
1077
|
+
private pagerOptions;
|
|
1078
|
+
private pager;
|
|
1079
|
+
constructor(client: Transport, viewName: string, defaultLimit?: number);
|
|
1080
|
+
/** Registers a view on the server and returns a handle to it. */
|
|
1081
|
+
static create<T extends Record<string, any>>(client: Transport, definition: DataViewDefinition<T>): Promise<HestiaDataView<T>>;
|
|
1082
|
+
name(): string;
|
|
1083
|
+
find(query?: QueryDSL<T>): Promise<Page<ProxiedDocument<T>>>;
|
|
1084
|
+
read(id: string): Promise<ProxiedDocument<T> | undefined>;
|
|
1085
|
+
/** Rebuilds a materialized view's snapshot. Fails on virtual views. */
|
|
1086
|
+
refresh(): Promise<ProxiedDocument<DataViewMeta> | undefined>;
|
|
1087
|
+
create(_props: {
|
|
1088
|
+
data: Partial<T>;
|
|
1089
|
+
}): Promise<ProxiedDocument<T> | undefined>;
|
|
1090
|
+
update(_props: {
|
|
1091
|
+
data: Partial<T>;
|
|
1092
|
+
id?: string;
|
|
1093
|
+
filter?: QueryFilter<T>;
|
|
1094
|
+
}): Promise<ProxiedDocument<T> | undefined>;
|
|
1095
|
+
delete(_id: string): Promise<void>;
|
|
1096
|
+
list(options?: Record<string, unknown>): Promise<Page<ProxiedDocument<T>>>;
|
|
1097
|
+
upload(_props: {
|
|
1098
|
+
file: File;
|
|
1099
|
+
}): Promise<ProxiedDocument<T> | undefined>;
|
|
1100
|
+
subscribe(_scope: string, _callback: (event: StoreEvent) => void): Promise<() => void>;
|
|
1101
|
+
notify(_event: StoreEvent): Promise<void>;
|
|
1102
|
+
stream(_options: Record<string, unknown>, _onStreamChange: () => void): {
|
|
1103
|
+
stream: () => AsyncIterable<Document<T>>;
|
|
1104
|
+
cancel: () => void;
|
|
1105
|
+
status: () => "active" | "cancelled" | "completed";
|
|
1106
|
+
};
|
|
1107
|
+
page(_options?: Record<string, unknown>): PagedData<T>;
|
|
1108
|
+
}
|
|
1109
|
+
//#endregion
|
|
999
1110
|
//#region core/errors.d.ts
|
|
1000
1111
|
interface ServerErrorBody {
|
|
1001
1112
|
code?: string;
|
|
@@ -1070,8 +1181,9 @@ declare class HestiaUsers implements DocumentStore<UserData, QueryDSL<UserData>,
|
|
|
1070
1181
|
list(options?: QueryDSL<UserData>): Promise<Page<UserData>>;
|
|
1071
1182
|
read(id: string): Promise<Document<UserData> | undefined>;
|
|
1072
1183
|
update(props: {
|
|
1184
|
+
id?: string;
|
|
1073
1185
|
data: Partial<UserData>;
|
|
1074
|
-
|
|
1186
|
+
filter?: QueryFilter<UserData>;
|
|
1075
1187
|
}): Promise<Document<UserData> | undefined>;
|
|
1076
1188
|
delete(id: string): Promise<void>;
|
|
1077
1189
|
create({ data: payload }: {
|
|
@@ -1133,8 +1245,9 @@ declare class HestiaKeyStore implements DocumentStore<APIKey, QueryDSL<APIKey>,
|
|
|
1133
1245
|
data: Partial<APIKey>;
|
|
1134
1246
|
}): Promise<Document<APIKey> | undefined>;
|
|
1135
1247
|
update(props: {
|
|
1248
|
+
id?: string;
|
|
1136
1249
|
data: Partial<APIKey>;
|
|
1137
|
-
|
|
1250
|
+
filter?: QueryFilter<APIKey>;
|
|
1138
1251
|
}): Promise<Document<APIKey> | undefined>;
|
|
1139
1252
|
delete(id: string): Promise<void>;
|
|
1140
1253
|
upload(_props: {
|
|
@@ -1272,8 +1385,9 @@ declare class HestiaPolicies implements DocumentStore<Policy, QueryDSL<Policy>,
|
|
|
1272
1385
|
options?: string;
|
|
1273
1386
|
}): Promise<Document<Policy> | undefined>;
|
|
1274
1387
|
update(props: {
|
|
1388
|
+
id?: string;
|
|
1275
1389
|
data: UpdatePolicyRequest;
|
|
1276
|
-
|
|
1390
|
+
filter?: QueryFilter<Policy>;
|
|
1277
1391
|
}): Promise<Document<Policy> | undefined>;
|
|
1278
1392
|
setEnabled(name: string, enabled: boolean): Promise<Document<Policy>>;
|
|
1279
1393
|
delete(_id: string): Promise<void>;
|
|
@@ -1302,8 +1416,9 @@ declare class HestiaRules implements DocumentStore<PolicyRule, Record<string, un
|
|
|
1302
1416
|
options?: string;
|
|
1303
1417
|
}): Promise<Document<PolicyRule> | undefined>;
|
|
1304
1418
|
update(props: {
|
|
1419
|
+
id?: string;
|
|
1305
1420
|
data: UpdateRuleRequest;
|
|
1306
|
-
|
|
1421
|
+
filter?: QueryFilter<PolicyRule>;
|
|
1307
1422
|
}): Promise<Document<PolicyRule> | undefined>;
|
|
1308
1423
|
delete(name: string): Promise<void>;
|
|
1309
1424
|
validate(request: ValidateRuleRequest): Promise<ValidateRuleResult>;
|
|
@@ -1375,7 +1490,7 @@ declare class HestiaAuditLogs implements DocumentStore<AuditEntry, QueryDSL<Audi
|
|
|
1375
1490
|
}): Promise<Document<AuditEntry> | undefined>;
|
|
1376
1491
|
update(_props: {
|
|
1377
1492
|
data: Partial<AuditEntry>;
|
|
1378
|
-
|
|
1493
|
+
id?: string;
|
|
1379
1494
|
}): Promise<Document<AuditEntry> | undefined>;
|
|
1380
1495
|
delete(_id: string): Promise<void>;
|
|
1381
1496
|
upload(_props: {
|
|
@@ -1771,8 +1886,9 @@ declare class BlobNamespace implements DocumentStore<BlobMeta, QueryDSL<BlobMeta
|
|
|
1771
1886
|
data: Partial<BlobMeta>;
|
|
1772
1887
|
}): Promise<Document<BlobMeta> | undefined>;
|
|
1773
1888
|
update(props: {
|
|
1889
|
+
id?: string;
|
|
1774
1890
|
data: Partial<BlobMeta>;
|
|
1775
|
-
|
|
1891
|
+
filter?: QueryFilter<BlobMeta>;
|
|
1776
1892
|
}): Promise<Document<BlobMeta> | undefined>;
|
|
1777
1893
|
delete(key: string): Promise<void>;
|
|
1778
1894
|
rename(oldKey: string, newKey: string): Promise<void>;
|
|
@@ -1834,17 +1950,6 @@ declare class HestiaBlobClient {
|
|
|
1834
1950
|
namespace(ns: string): BlobNamespace;
|
|
1835
1951
|
}
|
|
1836
1952
|
//#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
1953
|
//#region system/collections/store.d.ts
|
|
1849
1954
|
declare class HestiaCollections implements DocumentStore<CollectionMeta, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
|
|
1850
1955
|
private client;
|
|
@@ -1856,7 +1961,7 @@ declare class HestiaCollections implements DocumentStore<CollectionMeta, Record<
|
|
|
1856
1961
|
}): Promise<Document<CollectionMeta> | undefined>;
|
|
1857
1962
|
update(_props: {
|
|
1858
1963
|
data: Partial<CollectionMeta>;
|
|
1859
|
-
|
|
1964
|
+
id?: string;
|
|
1860
1965
|
}): Promise<Document<CollectionMeta> | undefined>;
|
|
1861
1966
|
delete(name: string): Promise<void>;
|
|
1862
1967
|
list(_options?: Record<string, unknown>): Promise<Page<CollectionMeta>>;
|
|
@@ -1872,6 +1977,7 @@ declare class HestiaCollections implements DocumentStore<CollectionMeta, Record<
|
|
|
1872
1977
|
};
|
|
1873
1978
|
page(_options?: Record<string, unknown>): PagedData<CollectionMeta>;
|
|
1874
1979
|
documents<T extends Record<string, any>>(collectionName: string): HestiaCollection<T>;
|
|
1980
|
+
view<T extends Record<string, any>>(viewName: string): HestiaDataView<T>;
|
|
1875
1981
|
}
|
|
1876
1982
|
//#endregion
|
|
1877
1983
|
//#region system/notifications/types.d.ts
|
|
@@ -2314,7 +2420,7 @@ declare class HestiaCore implements DocumentStore<any, Record<string, unknown>,
|
|
|
2314
2420
|
}): Promise<Document<any> | undefined>;
|
|
2315
2421
|
update(_props: {
|
|
2316
2422
|
data: Partial<any>;
|
|
2317
|
-
|
|
2423
|
+
id?: string;
|
|
2318
2424
|
}): Promise<Document<any> | undefined>;
|
|
2319
2425
|
delete(_id: string): Promise<void>;
|
|
2320
2426
|
list(_options?: Record<string, unknown>): Promise<Page<any>>;
|
|
@@ -2333,7 +2439,7 @@ declare class HestiaCore implements DocumentStore<any, Record<string, unknown>,
|
|
|
2333
2439
|
//#endregion
|
|
2334
2440
|
//#region dist/index.d.mts
|
|
2335
2441
|
//#region core/types.d.ts
|
|
2336
|
-
interface DocumentMetadata {
|
|
2442
|
+
interface DocumentMetadata$1 {
|
|
2337
2443
|
checksum: string;
|
|
2338
2444
|
created: string;
|
|
2339
2445
|
updated: string;
|
|
@@ -2341,7 +2447,7 @@ interface DocumentMetadata {
|
|
|
2341
2447
|
}
|
|
2342
2448
|
interface BaseDocument {
|
|
2343
2449
|
_id_: string;
|
|
2344
|
-
_metadata_: DocumentMetadata;
|
|
2450
|
+
_metadata_: DocumentMetadata$1;
|
|
2345
2451
|
}
|
|
2346
2452
|
type Document$1<T extends Record<string, any>> = BaseDocument & T;
|
|
2347
2453
|
/**
|
|
@@ -2470,12 +2576,15 @@ interface DocumentStore$1<T extends Record<string, any>, TFindOptions = Record<s
|
|
|
2470
2576
|
*/
|
|
2471
2577
|
delete: (options: TDeleteOptions) => Promise<void>;
|
|
2472
2578
|
/**
|
|
2473
|
-
* Updates
|
|
2474
|
-
* @param props An object containing the
|
|
2579
|
+
* Updates existing records.
|
|
2580
|
+
* @param props An object containing the partial data plus exactly one
|
|
2581
|
+
* target: an `id` or a `filter`. Optional update options ride in `options`.
|
|
2475
2582
|
* @returns A promise that resolves to the updated record or undefined if not found.
|
|
2476
2583
|
*/
|
|
2477
2584
|
update: (props: {
|
|
2478
2585
|
data: Partial<T>;
|
|
2586
|
+
id?: string;
|
|
2587
|
+
filter?: QueryFilter<T>;
|
|
2479
2588
|
options?: TUpdateOptions;
|
|
2480
2589
|
}) => Promise<Document$1<T> | undefined>;
|
|
2481
2590
|
/**
|
|
@@ -2773,11 +2882,26 @@ declare const ROUTE_TABLE: {
|
|
|
2773
2882
|
readonly route: "/system/collections/document/update/{name}/{doc_id}";
|
|
2774
2883
|
readonly arguments: readonly ["name", "doc_id"];
|
|
2775
2884
|
};
|
|
2885
|
+
readonly "system:collections:document:update_many": {
|
|
2886
|
+
readonly method: "PATCH";
|
|
2887
|
+
readonly route: "/system/collections/document/update_many/{name}";
|
|
2888
|
+
readonly arguments: readonly ["name"];
|
|
2889
|
+
};
|
|
2776
2890
|
readonly "system:collections:user:query": {
|
|
2777
2891
|
readonly method: "POST";
|
|
2778
2892
|
readonly route: "/system/collections/user/query";
|
|
2779
2893
|
readonly arguments: readonly [];
|
|
2780
2894
|
};
|
|
2895
|
+
readonly "system:collections:view:create": {
|
|
2896
|
+
readonly method: "POST";
|
|
2897
|
+
readonly route: "/system/collections/view/create/{name}";
|
|
2898
|
+
readonly arguments: readonly ["name"];
|
|
2899
|
+
};
|
|
2900
|
+
readonly "system:collections:view:refresh": {
|
|
2901
|
+
readonly method: "PATCH";
|
|
2902
|
+
readonly route: "/system/collections/view/refresh/{name}";
|
|
2903
|
+
readonly arguments: readonly ["name"];
|
|
2904
|
+
};
|
|
2781
2905
|
readonly "system:core:capability:list": {
|
|
2782
2906
|
readonly method: "GET";
|
|
2783
2907
|
readonly route: "/system/core/capability/list";
|
|
@@ -3195,6 +3319,17 @@ declare global {
|
|
|
3195
3319
|
}
|
|
3196
3320
|
}
|
|
3197
3321
|
//#endregion
|
|
3322
|
+
//#region core/document.d.ts
|
|
3323
|
+
/** Methods attached to every document via {@link proxiedDocument}. */
|
|
3324
|
+
interface DocumentMethods$1 {
|
|
3325
|
+
/** The document's envelope id (`_id_`). */
|
|
3326
|
+
id(): string;
|
|
3327
|
+
/** The document's envelope metadata (`_metadata_`). */
|
|
3328
|
+
metadata(): DocumentMetadata$1;
|
|
3329
|
+
}
|
|
3330
|
+
/** A document with {@link DocumentMethods} attached. */
|
|
3331
|
+
type ProxiedDocument$1<T extends Record<string, any>> = Document$1<T> & DocumentMethods$1;
|
|
3332
|
+
//#endregion
|
|
3198
3333
|
//#region core/collection.d.ts
|
|
3199
3334
|
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
3335
|
private client;
|
|
@@ -3204,17 +3339,18 @@ declare class HestiaCollection$1<T extends Record<string, any>> implements Docum
|
|
|
3204
3339
|
private pager;
|
|
3205
3340
|
constructor(client: Transport$1, collectionName: string, defaultLimit?: number);
|
|
3206
3341
|
name(): string;
|
|
3207
|
-
find(query?:
|
|
3208
|
-
read(id: string): Promise<
|
|
3342
|
+
find(query?: QueryDSL<T>): Promise<Page$1<ProxiedDocument$1<T>>>;
|
|
3343
|
+
read(id: string): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3209
3344
|
create(props: {
|
|
3210
3345
|
data: Partial<T>;
|
|
3211
|
-
}): Promise<
|
|
3346
|
+
}): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3212
3347
|
update(props: {
|
|
3213
3348
|
data: Partial<T>;
|
|
3214
|
-
|
|
3215
|
-
|
|
3349
|
+
id?: string;
|
|
3350
|
+
filter?: QueryFilter<T>;
|
|
3351
|
+
}): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3216
3352
|
delete(id: string): Promise<void>;
|
|
3217
|
-
list(options?: Record<string, unknown>): Promise<Page$1<T
|
|
3353
|
+
list(options?: Record<string, unknown>): Promise<Page$1<ProxiedDocument$1<T>>>;
|
|
3218
3354
|
upload(_props: {
|
|
3219
3355
|
file: File;
|
|
3220
3356
|
}): Promise<Document$1<T> | undefined>;
|
|
@@ -3227,6 +3363,66 @@ declare class HestiaCollection$1<T extends Record<string, any>> implements Docum
|
|
|
3227
3363
|
};
|
|
3228
3364
|
page(_options?: Record<string, unknown>): PagedData$1<T>;
|
|
3229
3365
|
}
|
|
3366
|
+
interface DataViewMeta$1 {
|
|
3367
|
+
name: string;
|
|
3368
|
+
materialized: boolean;
|
|
3369
|
+
target: string;
|
|
3370
|
+
}
|
|
3371
|
+
//#endregion
|
|
3372
|
+
//#region core/data-view.d.ts
|
|
3373
|
+
interface DataViewDefinition$1<T extends Record<string, any>> {
|
|
3374
|
+
name: string;
|
|
3375
|
+
/** Stored query. `target.name` pins the underlying collection (required by the server). */
|
|
3376
|
+
query: QueryDSL<T> & {
|
|
3377
|
+
target: {
|
|
3378
|
+
name: string;
|
|
3379
|
+
};
|
|
3380
|
+
};
|
|
3381
|
+
materialized?: boolean;
|
|
3382
|
+
}
|
|
3383
|
+
/**
|
|
3384
|
+
* Read-only view over a stored server query — the view counterpart to
|
|
3385
|
+
* HestiaCollection. Reads flow through the regular document:query /
|
|
3386
|
+
* document:get messages addressed at the view name; document writes are
|
|
3387
|
+
* rejected server-side (ERR_PERSISTENCE_READ_ONLY) and throw client-side.
|
|
3388
|
+
* Materialized snapshots are rebuilt via refresh().
|
|
3389
|
+
*/
|
|
3390
|
+
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>> {
|
|
3391
|
+
private client;
|
|
3392
|
+
private viewName;
|
|
3393
|
+
private defaultLimit;
|
|
3394
|
+
private pagerOptions;
|
|
3395
|
+
private pager;
|
|
3396
|
+
constructor(client: Transport$1, viewName: string, defaultLimit?: number);
|
|
3397
|
+
/** Registers a view on the server and returns a handle to it. */
|
|
3398
|
+
static create<T extends Record<string, any>>(client: Transport$1, definition: DataViewDefinition$1<T>): Promise<HestiaDataView$1<T>>;
|
|
3399
|
+
name(): string;
|
|
3400
|
+
find(query?: QueryDSL<T>): Promise<Page$1<ProxiedDocument$1<T>>>;
|
|
3401
|
+
read(id: string): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3402
|
+
/** Rebuilds a materialized view's snapshot. Fails on virtual views. */
|
|
3403
|
+
refresh(): Promise<ProxiedDocument$1<DataViewMeta$1> | undefined>;
|
|
3404
|
+
create(_props: {
|
|
3405
|
+
data: Partial<T>;
|
|
3406
|
+
}): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3407
|
+
update(_props: {
|
|
3408
|
+
data: Partial<T>;
|
|
3409
|
+
id?: string;
|
|
3410
|
+
filter?: QueryFilter<T>;
|
|
3411
|
+
}): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3412
|
+
delete(_id: string): Promise<void>;
|
|
3413
|
+
list(options?: Record<string, unknown>): Promise<Page$1<ProxiedDocument$1<T>>>;
|
|
3414
|
+
upload(_props: {
|
|
3415
|
+
file: File;
|
|
3416
|
+
}): Promise<ProxiedDocument$1<T> | undefined>;
|
|
3417
|
+
subscribe(_scope: string, _callback: (event: StoreEvent$1) => void): Promise<() => void>;
|
|
3418
|
+
notify(_event: StoreEvent$1): Promise<void>;
|
|
3419
|
+
stream(_options: Record<string, unknown>, _onStreamChange: () => void): {
|
|
3420
|
+
stream: () => AsyncIterable<Document$1<T>>;
|
|
3421
|
+
cancel: () => void;
|
|
3422
|
+
status: () => "active" | "cancelled" | "completed";
|
|
3423
|
+
};
|
|
3424
|
+
page(_options?: Record<string, unknown>): PagedData$1<T>;
|
|
3425
|
+
}
|
|
3230
3426
|
//#endregion
|
|
3231
3427
|
//#region container.d.ts
|
|
3232
3428
|
interface HestiaConfig {
|
|
@@ -3258,6 +3454,7 @@ declare class HestiaClient {
|
|
|
3258
3454
|
readonly settings: HestiaSettingStore;
|
|
3259
3455
|
readonly updates: HestiaUpdates;
|
|
3260
3456
|
readonly workflows: HestiaWorkflowStore;
|
|
3457
|
+
readonly operations: HestiaOperations;
|
|
3261
3458
|
private tokenProvider;
|
|
3262
3459
|
private onAuthStateChanged?;
|
|
3263
3460
|
constructor(config: HestiaConfig);
|
|
@@ -3268,6 +3465,7 @@ declare class HestiaClient {
|
|
|
3268
3465
|
startHeartbeat(intervalMs?: number): void;
|
|
3269
3466
|
stopHeartbeat(): void;
|
|
3270
3467
|
collection<T extends Record<string, any>>(name: string): HestiaCollection$1<T>;
|
|
3468
|
+
view<T extends Record<string, any>>(name: string): HestiaDataView$1<T>;
|
|
3271
3469
|
ready(): Promise<void>;
|
|
3272
3470
|
}
|
|
3273
3471
|
//#endregion
|
|
@@ -3288,4 +3486,4 @@ interface ArrayPagerOptions<T extends Record<string, any>, F = any> {
|
|
|
3288
3486
|
}
|
|
3289
3487
|
declare function createArrayPager<T extends Record<string, any>, F = any>(options: ArrayPagerOptions<T, F>): PagedData<T>;
|
|
3290
3488
|
//#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 };
|
|
3489
|
+
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 };
|