@asaidimu/hestia 1.14.0 → 1.16.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
@@ -332,6 +332,11 @@ declare const ROUTE_TABLE$1: {
332
332
  readonly route: "/system/auth/session/delete";
333
333
  readonly arguments: readonly [];
334
334
  };
335
+ readonly "system:auth:session:get": {
336
+ readonly method: "GET";
337
+ readonly route: "/system/auth/session/get";
338
+ readonly arguments: readonly [];
339
+ };
335
340
  readonly "system:auth:token:elevate": {
336
341
  readonly method: "POST";
337
342
  readonly route: "/system/auth/token/elevate";
@@ -359,17 +364,17 @@ declare const ROUTE_TABLE$1: {
359
364
  };
360
365
  readonly "system:blobs:blob:delete": {
361
366
  readonly method: "DELETE";
362
- readonly route: "/system/blobs/blob/delete/{ns}/{key}";
367
+ readonly route: "/system/blobs/blob/delete/{ns}/{key*}";
363
368
  readonly arguments: readonly ["ns", "key"];
364
369
  };
365
370
  readonly "system:blobs:blob:download": {
366
371
  readonly method: "GET";
367
- readonly route: "/system/blobs/blob/download/{ns}/{key}";
372
+ readonly route: "/system/blobs/blob/download/{ns}/{key*}";
368
373
  readonly arguments: readonly ["ns", "key"];
369
374
  };
370
375
  readonly "system:blobs:blob:head": {
371
376
  readonly method: "POST";
372
- readonly route: "/system/blobs/blob/head/{ns}/{key}";
377
+ readonly route: "/system/blobs/blob/head/{ns}/{key*}";
373
378
  readonly arguments: readonly ["ns", "key"];
374
379
  };
375
380
  readonly "system:blobs:blob:list": {
@@ -384,17 +389,17 @@ declare const ROUTE_TABLE$1: {
384
389
  };
385
390
  readonly "system:blobs:blob:rename": {
386
391
  readonly method: "PATCH";
387
- readonly route: "/system/blobs/blob/rename/{ns}/{key}";
392
+ readonly route: "/system/blobs/blob/rename/{ns}/{key*}";
388
393
  readonly arguments: readonly ["ns", "key"];
389
394
  };
390
395
  readonly "system:blobs:blob:update": {
391
396
  readonly method: "PATCH";
392
- readonly route: "/system/blobs/blob/update/{ns}/{key}";
397
+ readonly route: "/system/blobs/blob/update/{ns}/{key*}";
393
398
  readonly arguments: readonly ["ns", "key"];
394
399
  };
395
400
  readonly "system:blobs:blob:upload": {
396
401
  readonly method: "POST";
397
- readonly route: "/system/blobs/blob/upload/{ns}/{key}";
402
+ readonly route: "/system/blobs/blob/upload/{ns}/{key*}";
398
403
  readonly arguments: readonly ["ns", "key"];
399
404
  };
400
405
  readonly "system:blobs:namespace:compact": {
@@ -482,6 +487,11 @@ declare const ROUTE_TABLE$1: {
482
487
  readonly route: "/system/collections/document/update_many/{name}";
483
488
  readonly arguments: readonly ["name"];
484
489
  };
490
+ readonly "system:collections:operation_policy:query": {
491
+ readonly method: "POST";
492
+ readonly route: "/system/collections/operation_policy/query";
493
+ readonly arguments: readonly [];
494
+ };
485
495
  readonly "system:collections:user:query": {
486
496
  readonly method: "POST";
487
497
  readonly route: "/system/collections/user/query";
@@ -883,6 +893,13 @@ interface StreamHandlers {
883
893
  interface StreamOptions {
884
894
  headers?: Record<string, string>;
885
895
  signal?: AbortSignal;
896
+ /**
897
+ * Fetch credentials mode for the stream request. Defaults to the browser's
898
+ * `same-origin`, which is enough for cookie sessions served from the same
899
+ * origin. Set `"include"` for credentialed cross-origin streams (the server
900
+ * must also allow credentials for that origin).
901
+ */
902
+ credentials?: "omit" | "same-origin" | "include";
886
903
  }
887
904
  interface DispatchInput {
888
905
  arguments?: Record<string, string>;
@@ -912,8 +929,9 @@ declare class HttpTransport<R extends string = RouteName$1> implements Transport
912
929
  private baseUrl;
913
930
  private apiPrefix;
914
931
  private onAuthStateChanged?;
932
+ private defaultHeaders?;
915
933
  private raw;
916
- constructor(baseUrl: string, apiPrefix: string, onAuthStateChanged?: (() => void) | undefined);
934
+ constructor(baseUrl: string, apiPrefix: string, onAuthStateChanged?: (() => void) | undefined, defaultHeaders?: Record<string, string> | undefined);
917
935
  private substituteArgs;
918
936
  dispatch<T>(name: R, input?: DispatchInput): Promise<HestiaResponse<T>>;
919
937
  routeUrl(name: R, args?: Record<string, string>): string;
@@ -933,6 +951,38 @@ declare class HttpTransport<R extends string = RouteName$1> implements Transport
933
951
  declare const HestiaNetworkClient: typeof HttpTransport;
934
952
  type HestiaNetworkClient = HttpTransport;
935
953
  //#endregion
954
+ //#region core/async-stream.d.ts
955
+ /**
956
+ * Helpers for turning callback-based SSE transports into async iterables.
957
+ *
958
+ * The stream stores (audit, logs, ...) used to build this queue/iterator dance
959
+ * by hand around the browser `EventSource` global. That tied them to the DOM,
960
+ * bypassed the transport's API-key header, and could not be cancelled
961
+ * deterministically. `createAsyncStream` centralises the queueing so a store
962
+ * only has to forward `openStream` callbacks into `push`/`end`.
963
+ */
964
+ type AsyncStreamStatus = "active" | "cancelled" | "completed";
965
+ interface AsyncStreamController<T> {
966
+ /** The async iterable of queued items. */
967
+ stream(): AsyncIterable<T>;
968
+ /** Queue an item. Ignored once the stream has ended or been cancelled. */
969
+ push(item: T): void;
970
+ /** Mark the stream complete (e.g. the server closed the connection). */
971
+ end(): void;
972
+ /** Mark the stream cancelled (e.g. the caller aborted it). */
973
+ cancel(): void;
974
+ /** Current lifecycle state. */
975
+ status(): AsyncStreamStatus;
976
+ }
977
+ /**
978
+ * Create an async stream backed by an unbounded in-memory queue.
979
+ *
980
+ * Consumers pull with `for await`, producers call `push`, and either side can
981
+ * stop the stream with `end`/`cancel`. `push` is safe to call before iteration
982
+ * starts — items are buffered until the consumer reads them.
983
+ */
984
+ declare function createAsyncStream<T>(): AsyncStreamController<T>;
985
+ //#endregion
936
986
  //#region core/wails-transport.d.ts
937
987
  declare global {
938
988
  interface Window {
@@ -1133,6 +1183,8 @@ declare function createPagedController<T extends Record<string, any>>(collection
1133
1183
  //#region system/auth/types.d.ts
1134
1184
  interface LoginResult {
1135
1185
  user: UserIdentity;
1186
+ /** Absolute session expiry, unix seconds (omitted by older servers). */
1187
+ expires_at?: number;
1136
1188
  }
1137
1189
  interface ServerHealth {
1138
1190
  bootstrapped: boolean;
@@ -1158,6 +1210,15 @@ declare class HestiaAuth {
1158
1210
  private provider;
1159
1211
  constructor(client: Transport, provider: IdentityProvider);
1160
1212
  health(): Promise<ServerHealth>;
1213
+ /**
1214
+ * Adopt the server's current session, if any. Used on tab boot and when a
1215
+ * cross-tab signal says auth changed.
1216
+ *
1217
+ * Returns `null` when the server says there is no session (401). Throws for
1218
+ * anything else (network error, 5xx): callers must be able to tell "not
1219
+ * logged in" from "could not check", or an offline blip logs the user out.
1220
+ */
1221
+ session(): Promise<LoginResult | null>;
1161
1222
  login(email: string, password: string): Promise<LoginResult>;
1162
1223
  register(email: string, password: string, name: string): Promise<{
1163
1224
  _id_: string;
@@ -2017,7 +2078,7 @@ declare class HestiaNotificationStore {
2017
2078
  private client;
2018
2079
  constructor(client: Transport<string>);
2019
2080
  /**
2020
- * Create an in-app notification for a user (administrator-gated). Content
2081
+ * Create an in-app notification for a user (root-gated). Content
2021
2082
  * is taken verbatim — no template rendering.
2022
2083
  */
2023
2084
  create(input: CreateNotificationInput): Promise<Document<Notification>>;
@@ -2179,7 +2240,7 @@ declare class HestiaUpdates {
2179
2240
  checkAvailability(): Promise<UpdateAvailability>;
2180
2241
  /**
2181
2242
  * Download and stage the newest release without applying it. Notifies
2182
- * administrators when a release was newly staged.
2243
+ * root users when a release was newly staged.
2183
2244
  */
2184
2245
  stage(): Promise<UpdateStageResult>;
2185
2246
  /**
@@ -2438,6 +2499,7 @@ declare class HestiaCore implements DocumentStore<any, Record<string, unknown>,
2438
2499
  }
2439
2500
  //#endregion
2440
2501
  //#region dist/index.d.mts
2502
+ //#endregion
2441
2503
  //#region core/types.d.ts
2442
2504
  interface DocumentMetadata$1 {
2443
2505
  checksum: string;
@@ -2737,6 +2799,11 @@ declare const ROUTE_TABLE: {
2737
2799
  readonly route: "/system/auth/session/delete";
2738
2800
  readonly arguments: readonly [];
2739
2801
  };
2802
+ readonly "system:auth:session:get": {
2803
+ readonly method: "GET";
2804
+ readonly route: "/system/auth/session/get";
2805
+ readonly arguments: readonly [];
2806
+ };
2740
2807
  readonly "system:auth:token:elevate": {
2741
2808
  readonly method: "POST";
2742
2809
  readonly route: "/system/auth/token/elevate";
@@ -2764,17 +2831,17 @@ declare const ROUTE_TABLE: {
2764
2831
  };
2765
2832
  readonly "system:blobs:blob:delete": {
2766
2833
  readonly method: "DELETE";
2767
- readonly route: "/system/blobs/blob/delete/{ns}/{key}";
2834
+ readonly route: "/system/blobs/blob/delete/{ns}/{key*}";
2768
2835
  readonly arguments: readonly ["ns", "key"];
2769
2836
  };
2770
2837
  readonly "system:blobs:blob:download": {
2771
2838
  readonly method: "GET";
2772
- readonly route: "/system/blobs/blob/download/{ns}/{key}";
2839
+ readonly route: "/system/blobs/blob/download/{ns}/{key*}";
2773
2840
  readonly arguments: readonly ["ns", "key"];
2774
2841
  };
2775
2842
  readonly "system:blobs:blob:head": {
2776
2843
  readonly method: "POST";
2777
- readonly route: "/system/blobs/blob/head/{ns}/{key}";
2844
+ readonly route: "/system/blobs/blob/head/{ns}/{key*}";
2778
2845
  readonly arguments: readonly ["ns", "key"];
2779
2846
  };
2780
2847
  readonly "system:blobs:blob:list": {
@@ -2789,17 +2856,17 @@ declare const ROUTE_TABLE: {
2789
2856
  };
2790
2857
  readonly "system:blobs:blob:rename": {
2791
2858
  readonly method: "PATCH";
2792
- readonly route: "/system/blobs/blob/rename/{ns}/{key}";
2859
+ readonly route: "/system/blobs/blob/rename/{ns}/{key*}";
2793
2860
  readonly arguments: readonly ["ns", "key"];
2794
2861
  };
2795
2862
  readonly "system:blobs:blob:update": {
2796
2863
  readonly method: "PATCH";
2797
- readonly route: "/system/blobs/blob/update/{ns}/{key}";
2864
+ readonly route: "/system/blobs/blob/update/{ns}/{key*}";
2798
2865
  readonly arguments: readonly ["ns", "key"];
2799
2866
  };
2800
2867
  readonly "system:blobs:blob:upload": {
2801
2868
  readonly method: "POST";
2802
- readonly route: "/system/blobs/blob/upload/{ns}/{key}";
2869
+ readonly route: "/system/blobs/blob/upload/{ns}/{key*}";
2803
2870
  readonly arguments: readonly ["ns", "key"];
2804
2871
  };
2805
2872
  readonly "system:blobs:namespace:compact": {
@@ -2887,6 +2954,11 @@ declare const ROUTE_TABLE: {
2887
2954
  readonly route: "/system/collections/document/update_many/{name}";
2888
2955
  readonly arguments: readonly ["name"];
2889
2956
  };
2957
+ readonly "system:collections:operation_policy:query": {
2958
+ readonly method: "POST";
2959
+ readonly route: "/system/collections/operation_policy/query";
2960
+ readonly arguments: readonly [];
2961
+ };
2890
2962
  readonly "system:collections:user:query": {
2891
2963
  readonly method: "POST";
2892
2964
  readonly route: "/system/collections/user/query";
@@ -3281,6 +3353,13 @@ interface StreamHandlers$1 {
3281
3353
  interface StreamOptions$1 {
3282
3354
  headers?: Record<string, string>;
3283
3355
  signal?: AbortSignal;
3356
+ /**
3357
+ * Fetch credentials mode for the stream request. Defaults to the browser's
3358
+ * `same-origin`, which is enough for cookie sessions served from the same
3359
+ * origin. Set `"include"` for credentialed cross-origin streams (the server
3360
+ * must also allow credentials for that origin).
3361
+ */
3362
+ credentials?: "omit" | "same-origin" | "include";
3284
3363
  }
3285
3364
  interface DispatchInput$1 {
3286
3365
  arguments?: Record<string, string>;
@@ -3428,9 +3507,16 @@ declare class HestiaDataView$1<T extends Record<string, any>> implements Documen
3428
3507
  interface HestiaConfig {
3429
3508
  baseUrl: string;
3430
3509
  apiPrefix?: string;
3510
+ apiKey?: string;
3431
3511
  persistence?: SimplePersistence<AuthState>;
3432
3512
  uploadPersistence?: UploadPersistence;
3433
3513
  transport?: Transport;
3514
+ /**
3515
+ * Start/stop the 5-minute session heartbeat automatically as the local
3516
+ * identity appears and disappears. Defaults to true; set false to manage it
3517
+ * with startHeartbeat()/stopHeartbeat().
3518
+ */
3519
+ autoHeartbeat?: boolean;
3434
3520
  }
3435
3521
  interface AuthState {
3436
3522
  identity: UserIdentity | null;
@@ -3456,9 +3542,14 @@ declare class HestiaClient {
3456
3542
  readonly workflows: HestiaWorkflowStore;
3457
3543
  readonly operations: HestiaOperations;
3458
3544
  private tokenProvider;
3459
- private onAuthStateChanged?;
3545
+ private readonly apiKeyMode;
3546
+ private readonly autoHeartbeat;
3547
+ private authChannel?;
3548
+ private applyingRemoteAuth;
3460
3549
  constructor(config: HestiaConfig);
3461
- onAuthStateChange(callback: () => void): void;
3550
+ private setupAuthChannel;
3551
+ private applyRemoteAuthChange;
3552
+ onAuthStateChange(callback: (identity: UserIdentity | null) => void): () => void;
3462
3553
  authenticated(): Promise<boolean>;
3463
3554
  private heartbeatTimer?;
3464
3555
  private defaultHeartbeatInterval;
@@ -3486,4 +3577,4 @@ interface ArrayPagerOptions<T extends Record<string, any>, F = any> {
3486
3577
  }
3487
3578
  declare function createArrayPager<T extends Record<string, any>, F = any>(options: ArrayPagerOptions<T, F>): PagedData<T>;
3488
3579
  //#endregion
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 };
3580
+ export { APIKey, APIKeyWithSecret, AccessLogFields, AimdController, ArrayPagerOptions, AsyncStreamController, AsyncStreamStatus, 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, createAsyncStream, createPagedController, getCachedHandles, getMissingRanges, internalError, notFound, parseErrorBody, permissionDenied, proxiedDocument, proxiedPage, toSystemError };
package/index.d.mts CHANGED
@@ -1,9 +1,11 @@
1
+ import { createRequire } from "node:module";
1
2
  import { ApiResponse } from "@asaidimu/network-client";
2
3
  import { Issue, SystemError } from "@asaidimu/utils-error";
3
4
  import { DataStore, ReactiveDataStore } from "@asaidimu/utils-store";
4
5
  import { QueryDSL, QueryFilter, SortConfiguration } from "@asaidimu/query";
5
6
  import { SchemaDefinition } from "@asaidimu/utils-schema";
6
7
  import { SimplePersistence } from "@asaidimu/utils-persistence";
8
+ //#endregion
7
9
  //#region core/types.d.ts
8
10
  interface DocumentMetadata {
9
11
  checksum: string;
@@ -332,6 +334,11 @@ declare const ROUTE_TABLE: {
332
334
  readonly route: "/system/auth/session/delete";
333
335
  readonly arguments: readonly [];
334
336
  };
337
+ readonly "system:auth:session:get": {
338
+ readonly method: "GET";
339
+ readonly route: "/system/auth/session/get";
340
+ readonly arguments: readonly [];
341
+ };
335
342
  readonly "system:auth:token:elevate": {
336
343
  readonly method: "POST";
337
344
  readonly route: "/system/auth/token/elevate";
@@ -359,17 +366,17 @@ declare const ROUTE_TABLE: {
359
366
  };
360
367
  readonly "system:blobs:blob:delete": {
361
368
  readonly method: "DELETE";
362
- readonly route: "/system/blobs/blob/delete/{ns}/{key}";
369
+ readonly route: "/system/blobs/blob/delete/{ns}/{key*}";
363
370
  readonly arguments: readonly ["ns", "key"];
364
371
  };
365
372
  readonly "system:blobs:blob:download": {
366
373
  readonly method: "GET";
367
- readonly route: "/system/blobs/blob/download/{ns}/{key}";
374
+ readonly route: "/system/blobs/blob/download/{ns}/{key*}";
368
375
  readonly arguments: readonly ["ns", "key"];
369
376
  };
370
377
  readonly "system:blobs:blob:head": {
371
378
  readonly method: "POST";
372
- readonly route: "/system/blobs/blob/head/{ns}/{key}";
379
+ readonly route: "/system/blobs/blob/head/{ns}/{key*}";
373
380
  readonly arguments: readonly ["ns", "key"];
374
381
  };
375
382
  readonly "system:blobs:blob:list": {
@@ -384,17 +391,17 @@ declare const ROUTE_TABLE: {
384
391
  };
385
392
  readonly "system:blobs:blob:rename": {
386
393
  readonly method: "PATCH";
387
- readonly route: "/system/blobs/blob/rename/{ns}/{key}";
394
+ readonly route: "/system/blobs/blob/rename/{ns}/{key*}";
388
395
  readonly arguments: readonly ["ns", "key"];
389
396
  };
390
397
  readonly "system:blobs:blob:update": {
391
398
  readonly method: "PATCH";
392
- readonly route: "/system/blobs/blob/update/{ns}/{key}";
399
+ readonly route: "/system/blobs/blob/update/{ns}/{key*}";
393
400
  readonly arguments: readonly ["ns", "key"];
394
401
  };
395
402
  readonly "system:blobs:blob:upload": {
396
403
  readonly method: "POST";
397
- readonly route: "/system/blobs/blob/upload/{ns}/{key}";
404
+ readonly route: "/system/blobs/blob/upload/{ns}/{key*}";
398
405
  readonly arguments: readonly ["ns", "key"];
399
406
  };
400
407
  readonly "system:blobs:namespace:compact": {
@@ -482,6 +489,11 @@ declare const ROUTE_TABLE: {
482
489
  readonly route: "/system/collections/document/update_many/{name}";
483
490
  readonly arguments: readonly ["name"];
484
491
  };
492
+ readonly "system:collections:operation_policy:query": {
493
+ readonly method: "POST";
494
+ readonly route: "/system/collections/operation_policy/query";
495
+ readonly arguments: readonly [];
496
+ };
485
497
  readonly "system:collections:user:query": {
486
498
  readonly method: "POST";
487
499
  readonly route: "/system/collections/user/query";
@@ -883,6 +895,13 @@ interface StreamHandlers {
883
895
  interface StreamOptions {
884
896
  headers?: Record<string, string>;
885
897
  signal?: AbortSignal;
898
+ /**
899
+ * Fetch credentials mode for the stream request. Defaults to the browser's
900
+ * `same-origin`, which is enough for cookie sessions served from the same
901
+ * origin. Set `"include"` for credentialed cross-origin streams (the server
902
+ * must also allow credentials for that origin).
903
+ */
904
+ credentials?: "omit" | "same-origin" | "include";
886
905
  }
887
906
  interface DispatchInput {
888
907
  arguments?: Record<string, string>;
@@ -912,8 +931,9 @@ declare class HttpTransport<R extends string = RouteName> implements Transport<R
912
931
  private baseUrl;
913
932
  private apiPrefix;
914
933
  private onAuthStateChanged?;
934
+ private defaultHeaders?;
915
935
  private raw;
916
- constructor(baseUrl: string, apiPrefix: string, onAuthStateChanged?: (() => void) | undefined);
936
+ constructor(baseUrl: string, apiPrefix: string, onAuthStateChanged?: (() => void) | undefined, defaultHeaders?: Record<string, string> | undefined);
917
937
  private substituteArgs;
918
938
  dispatch<T>(name: R, input?: DispatchInput): Promise<HestiaResponse<T>>;
919
939
  routeUrl(name: R, args?: Record<string, string>): string;
@@ -933,6 +953,38 @@ declare class HttpTransport<R extends string = RouteName> implements Transport<R
933
953
  declare const HestiaNetworkClient: typeof HttpTransport;
934
954
  type HestiaNetworkClient = HttpTransport;
935
955
  //#endregion
956
+ //#region core/async-stream.d.ts
957
+ /**
958
+ * Helpers for turning callback-based SSE transports into async iterables.
959
+ *
960
+ * The stream stores (audit, logs, ...) used to build this queue/iterator dance
961
+ * by hand around the browser `EventSource` global. That tied them to the DOM,
962
+ * bypassed the transport's API-key header, and could not be cancelled
963
+ * deterministically. `createAsyncStream` centralises the queueing so a store
964
+ * only has to forward `openStream` callbacks into `push`/`end`.
965
+ */
966
+ type AsyncStreamStatus = "active" | "cancelled" | "completed";
967
+ interface AsyncStreamController<T> {
968
+ /** The async iterable of queued items. */
969
+ stream(): AsyncIterable<T>;
970
+ /** Queue an item. Ignored once the stream has ended or been cancelled. */
971
+ push(item: T): void;
972
+ /** Mark the stream complete (e.g. the server closed the connection). */
973
+ end(): void;
974
+ /** Mark the stream cancelled (e.g. the caller aborted it). */
975
+ cancel(): void;
976
+ /** Current lifecycle state. */
977
+ status(): AsyncStreamStatus;
978
+ }
979
+ /**
980
+ * Create an async stream backed by an unbounded in-memory queue.
981
+ *
982
+ * Consumers pull with `for await`, producers call `push`, and either side can
983
+ * stop the stream with `end`/`cancel`. `push` is safe to call before iteration
984
+ * starts — items are buffered until the consumer reads them.
985
+ */
986
+ declare function createAsyncStream<T>(): AsyncStreamController<T>;
987
+ //#endregion
936
988
  //#region core/wails-transport.d.ts
937
989
  declare global {
938
990
  interface Window {
@@ -1133,6 +1185,8 @@ declare function createPagedController<T extends Record<string, any>>(collection
1133
1185
  //#region system/auth/types.d.ts
1134
1186
  interface LoginResult {
1135
1187
  user: UserIdentity;
1188
+ /** Absolute session expiry, unix seconds (omitted by older servers). */
1189
+ expires_at?: number;
1136
1190
  }
1137
1191
  interface ServerHealth {
1138
1192
  bootstrapped: boolean;
@@ -1158,6 +1212,15 @@ declare class HestiaAuth {
1158
1212
  private provider;
1159
1213
  constructor(client: Transport, provider: IdentityProvider);
1160
1214
  health(): Promise<ServerHealth>;
1215
+ /**
1216
+ * Adopt the server's current session, if any. Used on tab boot and when a
1217
+ * cross-tab signal says auth changed.
1218
+ *
1219
+ * Returns `null` when the server says there is no session (401). Throws for
1220
+ * anything else (network error, 5xx): callers must be able to tell "not
1221
+ * logged in" from "could not check", or an offline blip logs the user out.
1222
+ */
1223
+ session(): Promise<LoginResult | null>;
1161
1224
  login(email: string, password: string): Promise<LoginResult>;
1162
1225
  register(email: string, password: string, name: string): Promise<{
1163
1226
  _id_: string;
@@ -2017,7 +2080,7 @@ declare class HestiaNotificationStore {
2017
2080
  private client;
2018
2081
  constructor(client: Transport<string>);
2019
2082
  /**
2020
- * Create an in-app notification for a user (administrator-gated). Content
2083
+ * Create an in-app notification for a user (root-gated). Content
2021
2084
  * is taken verbatim — no template rendering.
2022
2085
  */
2023
2086
  create(input: CreateNotificationInput): Promise<Document<Notification>>;
@@ -2179,7 +2242,7 @@ declare class HestiaUpdates {
2179
2242
  checkAvailability(): Promise<UpdateAvailability>;
2180
2243
  /**
2181
2244
  * Download and stage the newest release without applying it. Notifies
2182
- * administrators when a release was newly staged.
2245
+ * root users when a release was newly staged.
2183
2246
  */
2184
2247
  stage(): Promise<UpdateStageResult>;
2185
2248
  /**
@@ -2436,14 +2499,19 @@ declare class HestiaCore implements DocumentStore<any, Record<string, unknown>,
2436
2499
  };
2437
2500
  page(_options?: Record<string, unknown>): PagedData<any>;
2438
2501
  }
2439
- //#endregion
2440
- //#region container.d.ts
2441
2502
  interface HestiaConfig {
2442
2503
  baseUrl: string;
2443
2504
  apiPrefix?: string;
2505
+ apiKey?: string;
2444
2506
  persistence?: SimplePersistence<AuthState>;
2445
2507
  uploadPersistence?: UploadPersistence;
2446
2508
  transport?: Transport;
2509
+ /**
2510
+ * Start/stop the 5-minute session heartbeat automatically as the local
2511
+ * identity appears and disappears. Defaults to true; set false to manage it
2512
+ * with startHeartbeat()/stopHeartbeat().
2513
+ */
2514
+ autoHeartbeat?: boolean;
2447
2515
  }
2448
2516
  interface AuthState {
2449
2517
  identity: UserIdentity | null;
@@ -2469,16 +2537,21 @@ declare class HestiaClient {
2469
2537
  readonly workflows: HestiaWorkflowStore;
2470
2538
  readonly operations: HestiaOperations;
2471
2539
  private tokenProvider;
2472
- private onAuthStateChanged?;
2540
+ private readonly apiKeyMode;
2541
+ private readonly autoHeartbeat;
2542
+ private authChannel?;
2543
+ private applyingRemoteAuth;
2473
2544
  constructor(config: HestiaConfig);
2474
- onAuthStateChange(callback: () => void): void;
2545
+ private setupAuthChannel;
2546
+ private applyRemoteAuthChange;
2547
+ onAuthStateChange(callback: (identity: UserIdentity | null) => void): () => void;
2475
2548
  authenticated(): Promise<boolean>;
2476
2549
  private heartbeatTimer?;
2477
2550
  private defaultHeartbeatInterval;
2478
2551
  startHeartbeat(intervalMs?: number): void;
2479
2552
  stopHeartbeat(): void;
2480
- collection<T extends Record<string, any>>(name: string): HestiaCollection<T>;
2481
- view<T extends Record<string, any>>(name: string): HestiaDataView<T>;
2553
+ collection<T extends Record<string, any>>(name: string): import_dist.HestiaCollection<T>;
2554
+ view<T extends Record<string, any>>(name: string): import_dist.HestiaDataView<T>;
2482
2555
  ready(): Promise<void>;
2483
2556
  }
2484
2557
  //#endregion
@@ -2499,4 +2572,4 @@ interface ArrayPagerOptions<T extends Record<string, any>, F = any> {
2499
2572
  }
2500
2573
  declare function createArrayPager<T extends Record<string, any>, F = any>(options: ArrayPagerOptions<T, F>): PagedData<T>;
2501
2574
  //#endregion
2502
- 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 };
2575
+ export { APIKey, APIKeyWithSecret, AccessLogFields, AimdController, ArrayPagerOptions, AsyncStreamController, AsyncStreamStatus, 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, createAsyncStream, createPagedController, getCachedHandles, getMissingRanges, internalError, notFound, parseErrorBody, permissionDenied, proxiedDocument, proxiedPage, toSystemError };