@asaidimu/hestia 1.6.2 → 1.8.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.mts CHANGED
@@ -714,6 +714,106 @@ declare const ROUTE_TABLE: {
714
714
  readonly route: "/system/users/user/update/{user_id}";
715
715
  readonly arguments: readonly ["user_id"];
716
716
  };
717
+ readonly "system:workflows:definition:compile": {
718
+ readonly method: "POST";
719
+ readonly route: "/system/workflows/definition/compile";
720
+ readonly arguments: readonly [];
721
+ };
722
+ readonly "system:workflows:definition:create": {
723
+ readonly method: "POST";
724
+ readonly route: "/system/workflows/definition/create";
725
+ readonly arguments: readonly [];
726
+ };
727
+ readonly "system:workflows:definition:delete": {
728
+ readonly method: "DELETE";
729
+ readonly route: "/system/workflows/definition/delete/{id}";
730
+ readonly arguments: readonly ["id"];
731
+ };
732
+ readonly "system:workflows:definition:get": {
733
+ readonly method: "GET";
734
+ readonly route: "/system/workflows/definition/get/{id}";
735
+ readonly arguments: readonly ["id"];
736
+ };
737
+ readonly "system:workflows:definition:list": {
738
+ readonly method: "GET";
739
+ readonly route: "/system/workflows/definition/list";
740
+ readonly arguments: readonly [];
741
+ };
742
+ readonly "system:workflows:registry:get": {
743
+ readonly method: "GET";
744
+ readonly route: "/system/workflows/registry/get/{kind}";
745
+ readonly arguments: readonly ["kind"];
746
+ };
747
+ readonly "system:workflows:registry:handles": {
748
+ readonly method: "GET";
749
+ readonly route: "/system/workflows/registry/handles";
750
+ readonly arguments: readonly [];
751
+ };
752
+ readonly "system:workflows:registry:list": {
753
+ readonly method: "GET";
754
+ readonly route: "/system/workflows/registry/list";
755
+ readonly arguments: readonly [];
756
+ };
757
+ readonly "system:workflows:run:events": {
758
+ readonly method: "GET";
759
+ readonly route: "/system/workflows/run/events/{run_id}";
760
+ readonly arguments: readonly ["run_id"];
761
+ };
762
+ readonly "system:workflows:run:get": {
763
+ readonly method: "GET";
764
+ readonly route: "/system/workflows/run/get/{run_id}";
765
+ readonly arguments: readonly ["run_id"];
766
+ };
767
+ readonly "system:workflows:run:list": {
768
+ readonly method: "GET";
769
+ readonly route: "/system/workflows/run/list";
770
+ readonly arguments: readonly [];
771
+ };
772
+ readonly "system:workflows:run:outcome": {
773
+ readonly method: "GET";
774
+ readonly route: "/system/workflows/run/outcome/{run_id}";
775
+ readonly arguments: readonly ["run_id"];
776
+ };
777
+ readonly "system:workflows:run:store": {
778
+ readonly method: "GET";
779
+ readonly route: "/system/workflows/run/store/{run_id}";
780
+ readonly arguments: readonly ["run_id"];
781
+ };
782
+ readonly "system:workflows:runtime:abort": {
783
+ readonly method: "DELETE";
784
+ readonly route: "/system/workflows/runtime/abort/{run_id}";
785
+ readonly arguments: readonly ["run_id"];
786
+ };
787
+ readonly "system:workflows:runtime:events": {
788
+ readonly method: "POST";
789
+ readonly route: "/system/workflows/runtime/events";
790
+ readonly arguments: readonly [];
791
+ };
792
+ readonly "system:workflows:runtime:has": {
793
+ readonly method: "GET";
794
+ readonly route: "/system/workflows/runtime/has/{id}";
795
+ readonly arguments: readonly ["id"];
796
+ };
797
+ readonly "system:workflows:runtime:invoke": {
798
+ readonly method: "POST";
799
+ readonly route: "/system/workflows/runtime/invoke";
800
+ readonly arguments: readonly [];
801
+ };
802
+ readonly "system:workflows:runtime:list": {
803
+ readonly method: "GET";
804
+ readonly route: "/system/workflows/runtime/list";
805
+ readonly arguments: readonly [];
806
+ };
807
+ readonly "system:workflows:runtime:resume": {
808
+ readonly method: "POST";
809
+ readonly route: "/system/workflows/runtime/resume";
810
+ readonly arguments: readonly [];
811
+ };
812
+ readonly "system:workflows:runtime:run": {
813
+ readonly method: "POST";
814
+ readonly route: "/system/workflows/runtime/run";
815
+ readonly arguments: readonly [];
816
+ };
717
817
  };
718
818
  type RouteName = keyof typeof ROUTE_TABLE;
719
819
  //#endregion
@@ -1240,7 +1340,7 @@ interface LogFilter {
1240
1340
  }
1241
1341
  //#endregion
1242
1342
  //#region system/audit/store.d.ts
1243
- declare class HestiaLogs implements DocumentStore<AuditEntry, QueryDSL<AuditEntry>, string, QueryDSL<AuditEntry>, Record<string, unknown>, string, string, Record<string, unknown>> {
1343
+ declare class HestiaAuditLogs implements DocumentStore<AuditEntry, QueryDSL<AuditEntry>, string, QueryDSL<AuditEntry>, Record<string, unknown>, string, string, Record<string, unknown>> {
1244
1344
  private client;
1245
1345
  private baseUrl;
1246
1346
  private pagerOptions;
@@ -1272,10 +1372,66 @@ declare class HestiaLogs implements DocumentStore<AuditEntry, QueryDSL<AuditEntr
1272
1372
  getStreamUrl(): string;
1273
1373
  }
1274
1374
  //#endregion
1375
+ //#region system/logs/types.d.ts
1376
+ interface LogEntry {
1377
+ level: string;
1378
+ ts: number;
1379
+ caller: string;
1380
+ msg: string;
1381
+ fields?: Record<string, unknown>;
1382
+ /** All other top-level keys: operation, duration, request_id, client_ip, user_id, email, error, stacktrace, etc. */
1383
+ extra?: Record<string, unknown>;
1384
+ }
1385
+ interface LogQuery {
1386
+ level?: string;
1387
+ from?: string;
1388
+ to?: string;
1389
+ search?: string;
1390
+ limit?: number;
1391
+ offset?: number;
1392
+ }
1393
+ interface LogListResult {
1394
+ entries: LogEntry[];
1395
+ total: number;
1396
+ has_more: boolean;
1397
+ }
1398
+ interface AccessLogFields {
1399
+ method?: string;
1400
+ path?: string;
1401
+ operation?: string;
1402
+ duration?: string;
1403
+ request_id?: string;
1404
+ client_ip?: string;
1405
+ user_agent?: string;
1406
+ user_id?: string;
1407
+ email?: string;
1408
+ tenant_id?: string;
1409
+ status?: number;
1410
+ code?: string;
1411
+ }
1412
+ //#endregion
1413
+ //#region system/logs/store.d.ts
1414
+ declare class HestiaAppLogs {
1415
+ private client;
1416
+ private baseUrl;
1417
+ private apiPrefix;
1418
+ constructor(client: Transport, baseUrl: string, apiPrefix?: string);
1419
+ query(options?: LogQuery): Promise<LogListResult>;
1420
+ stream(options?: {
1421
+ level?: string;
1422
+ }): {
1423
+ stream: () => AsyncIterable<LogEntry>;
1424
+ cancel: () => void;
1425
+ status: () => "active" | "cancelled" | "completed";
1426
+ };
1427
+ private getStreamUrl;
1428
+ }
1429
+ //#endregion
1275
1430
  //#region system/blobs/types.d.ts
1276
1431
  interface NamespaceInfo {
1277
1432
  id: string;
1278
1433
  display_name: string;
1434
+ custom?: Record<string, string>;
1279
1435
  }
1280
1436
  interface NamespaceStats {
1281
1437
  namespace_id: string;
@@ -1310,6 +1466,7 @@ interface ListBlobsRequest {
1310
1466
  interface CreateNamespaceRequest {
1311
1467
  display_name?: string;
1312
1468
  ns: string;
1469
+ custom?: Record<string, string>;
1313
1470
  }
1314
1471
  interface UploadBeginResult {
1315
1472
  session_id: string;
@@ -1906,6 +2063,206 @@ declare class HestiaUpdates {
1906
2063
  apply(): Promise<UpdateApplyResult>;
1907
2064
  }
1908
2065
  //#endregion
2066
+ //#region system/workflows/types.d.ts
2067
+ /** A workflow definition stored in the system. */
2068
+ interface WorkflowDefinition {
2069
+ _id_: string;
2070
+ /** Human-readable name for the workflow. */
2071
+ name: string;
2072
+ /** Optional description. */
2073
+ description?: string;
2074
+ /** Workflow graph nodes (serialized JSON). */
2075
+ nodes: WorkflowNode[];
2076
+ /** Workflow graph edges (serialized JSON). */
2077
+ edges: WorkflowEdge[];
2078
+ tenant_id?: string;
2079
+ created_at: number;
2080
+ updated_at: number;
2081
+ _metadata_: Record<string, unknown>;
2082
+ }
2083
+ /** Payload for `definition:create` — register and store a workflow. */
2084
+ interface RegisterWorkflowPayload {
2085
+ /** Human-readable name. */
2086
+ name: string;
2087
+ /** Optional description. */
2088
+ description?: string;
2089
+ /** Workflow graph nodes. */
2090
+ nodes: WorkflowNode[];
2091
+ /** Workflow graph edges. */
2092
+ edges: WorkflowEdge[];
2093
+ }
2094
+ /** Payload for `runtime:run` — compile and execute ad-hoc. */
2095
+ interface RunWorkflowPayload {
2096
+ /** Workflow graph nodes. */
2097
+ nodes: WorkflowNode[];
2098
+ /** Workflow graph edges. */
2099
+ edges: WorkflowEdge[];
2100
+ }
2101
+ /** Payload for `runtime:events` — emit a trigger event. */
2102
+ interface EmitEventPayload {
2103
+ /** Event type name (must match a registered trigger). */
2104
+ type: string;
2105
+ /** Event payload. */
2106
+ payload?: Record<string, unknown>;
2107
+ }
2108
+ type HandleType = "source" | "target";
2109
+ type HandleKind = "executable" | "resource";
2110
+ type NodeType = "executable" | "resource";
2111
+ type EdgeRole = "flow" | "dependency" | "placeholder";
2112
+ interface HandleSpec {
2113
+ type: HandleType;
2114
+ id: string;
2115
+ label?: string;
2116
+ kind?: HandleKind;
2117
+ }
2118
+ interface WorkflowNode {
2119
+ id: string;
2120
+ type?: NodeType;
2121
+ data: Record<string, any>;
2122
+ parentId?: string;
2123
+ position: {
2124
+ x: number;
2125
+ y: number;
2126
+ };
2127
+ }
2128
+ interface WorkflowEdge {
2129
+ id: string;
2130
+ source: string;
2131
+ sourceHandle?: string;
2132
+ target: string;
2133
+ targetHandle?: string;
2134
+ data?: {
2135
+ role: EdgeRole;
2136
+ };
2137
+ }
2138
+ type RunStatus = "recording" | "complete" | "failed" | "paused";
2139
+ /** Metadata for a workflow execution run. */
2140
+ interface RunMeta {
2141
+ run_id: string;
2142
+ pipeline_id: string;
2143
+ start_time: number;
2144
+ end_time?: number;
2145
+ event_count: number;
2146
+ status: RunStatus;
2147
+ metadata?: Record<string, unknown>;
2148
+ }
2149
+ /** Settlement status of a run. */
2150
+ interface RunOutcome {
2151
+ ok: boolean;
2152
+ run_id: string;
2153
+ status: string;
2154
+ final_state?: Record<string, unknown>;
2155
+ error?: string;
2156
+ }
2157
+ /** A single timeline event. */
2158
+ interface TimelineEvent {
2159
+ run_id: string;
2160
+ seq: number;
2161
+ timestamp: number;
2162
+ source: string;
2163
+ type: string;
2164
+ payload: Record<string, unknown>;
2165
+ delta?: Record<string, unknown>;
2166
+ }
2167
+ /** Compiled workflow view. */
2168
+ interface CompiledWorkflow {
2169
+ workflow_id: string;
2170
+ label: string;
2171
+ triggers: number;
2172
+ pipelines: number;
2173
+ }
2174
+ /** A single node kind definition from the workflow node registry. */
2175
+ interface NodeDefinition {
2176
+ kind: string;
2177
+ label: string;
2178
+ description?: string;
2179
+ icon?: string;
2180
+ config_schema?: Record<string, unknown>;
2181
+ requirements?: Record<string, unknown>[];
2182
+ scope?: string;
2183
+ type?: string;
2184
+ body_handle?: string;
2185
+ }
2186
+ /** Payload for `runtime:invoke` — invoke a workflow trigger directly. */
2187
+ interface InvokeWorkflowPayload {
2188
+ workflow_id: string;
2189
+ trigger_id: string;
2190
+ payload?: Record<string, unknown>;
2191
+ }
2192
+ /** Payload for `runtime:resume` — resume a paused run. */
2193
+ interface ResumeWorkflowPayload {
2194
+ run_id: string;
2195
+ payload?: Record<string, unknown>;
2196
+ }
2197
+ /** Result of invoking a workflow trigger. */
2198
+ interface InvokeWorkflowResult {
2199
+ run_id: string;
2200
+ status: string;
2201
+ ok: boolean;
2202
+ error?: string;
2203
+ }
2204
+ /** Result of resuming a paused run. */
2205
+ interface ResumeWorkflowResult {
2206
+ run_id: string;
2207
+ status: string;
2208
+ ok: boolean;
2209
+ error?: string;
2210
+ }
2211
+ //#endregion
2212
+ //#region system/workflows/store.d.ts
2213
+ type HandlesMap = Record<string, (config: any) => HandleSpec[]>;
2214
+ /** Synchronous access to the cached handles map. Returns null until fetchHandles() completes. */
2215
+ declare function getCachedHandles(): HandlesMap | null;
2216
+ /** Client store for the hermes workflow engine exposed via hestia. */
2217
+ declare class HestiaWorkflowStore {
2218
+ private client;
2219
+ constructor(client: Transport);
2220
+ /** Compile a workflow graph into a pipeline definition without executing. */
2221
+ compile(nodes: Record<string, any>[], edges: Record<string, any>[]): Promise<CompiledWorkflow>;
2222
+ /** Store and register a workflow definition. Returns the stored definition ID. */
2223
+ create(payload: RegisterWorkflowPayload): Promise<string>;
2224
+ /** Delete (deregister) a workflow definition. */
2225
+ delete(id: string): Promise<void>;
2226
+ /** List all stored workflow definitions. */
2227
+ list(): Promise<Document<WorkflowDefinition>[]>;
2228
+ /** Get a single workflow definition by ID. Returns null if not found. */
2229
+ get(id: string): Promise<Document<WorkflowDefinition> | null>;
2230
+ /** Compile and execute a workflow graph ad-hoc. Returns the run ID. */
2231
+ run(payload: RunWorkflowPayload): Promise<string>;
2232
+ /** Emit a trigger event to the workflow runtime bus. */
2233
+ emitEvent(payload: EmitEventPayload): Promise<void>;
2234
+ /** Abort a running workflow. */
2235
+ abort(runId: string): Promise<void>;
2236
+ /** List all execution runs. */
2237
+ listRuns(): Promise<RunMeta[]>;
2238
+ /** Get metadata for a single run. Returns null if not found. */
2239
+ getRun(runId: string): Promise<RunMeta | null>;
2240
+ /** Get the settlement outcome of a run. Returns null if not found. */
2241
+ getOutcome(runId: string): Promise<RunOutcome | null>;
2242
+ /** Get timeline events for a run. */
2243
+ getEvents(runId: string): Promise<TimelineEvent[]>;
2244
+ /** Get the live state of a run. Returns null if not found. */
2245
+ getStore(runId: string): Promise<Record<string, unknown> | null>;
2246
+ /** List all registered workflow node kind definitions. */
2247
+ getRegistry(): Promise<NodeDefinition[]>;
2248
+ /** Get a single node definition by kind. */
2249
+ getNodeDefinition(kind: string): Promise<NodeDefinition | null>;
2250
+ /**
2251
+ * Fetch the raw JS handle computation functions from the server,
2252
+ * evaluate them, and cache the resulting map.
2253
+ * After this call, use getCachedHandles() for synchronous access.
2254
+ */
2255
+ fetchHandles(): Promise<HandlesMap>;
2256
+ /** Check if a workflow is registered in the runtime. */
2257
+ hasWorkflow(id: string): Promise<boolean>;
2258
+ /** List IDs of all registered (active) workflows. */
2259
+ listWorkflows(): Promise<string[]>;
2260
+ /** Invoke a registered workflow's trigger directly. */
2261
+ invokeWorkflow(payload: InvokeWorkflowPayload): Promise<InvokeWorkflowResult>;
2262
+ /** Resume a paused workflow run. */
2263
+ resumeWorkflow(payload: ResumeWorkflowPayload): Promise<ResumeWorkflowResult>;
2264
+ }
2265
+ //#endregion
1909
2266
  //#region system/core/store.d.ts
1910
2267
  declare class HestiaCore implements DocumentStore<any, Record<string, unknown>, string, Record<string, unknown>, Record<string, unknown>, string, string, Record<string, unknown>> {
1911
2268
  private client;
@@ -1954,7 +2311,8 @@ declare class HestiaClient {
1954
2311
  readonly keys: HestiaKeyStore;
1955
2312
  readonly policies: HestiaPolicies;
1956
2313
  readonly rules: HestiaRules;
1957
- readonly logs: HestiaLogs;
2314
+ readonly auditLogs: HestiaAuditLogs;
2315
+ readonly appLogs: HestiaAppLogs;
1958
2316
  readonly collections: HestiaCollections;
1959
2317
  readonly blobs: HestiaBlobClient;
1960
2318
  readonly core: HestiaCore;
@@ -1962,6 +2320,7 @@ declare class HestiaClient {
1962
2320
  readonly schedules: HestiaScheduleStore;
1963
2321
  readonly settings: HestiaSettingStore;
1964
2322
  readonly updates: HestiaUpdates;
2323
+ readonly workflows: HestiaWorkflowStore;
1965
2324
  private tokenProvider;
1966
2325
  private onAuthStateChanged?;
1967
2326
  constructor(config: HestiaConfig);
@@ -1992,4 +2351,4 @@ interface ArrayPagerOptions<T extends Record<string, any>, F = any> {
1992
2351
  }
1993
2352
  declare function createArrayPager<T extends Record<string, any>, F = any>(options: ArrayPagerOptions<T, F>): PagedData<T>;
1994
2353
  //#endregion
1995
- export { APIKey, APIKeyWithSecret, AimdController, ArrayPagerOptions, AuditEntry, Binding, BlobDocument, BlobMeta, BlobNamespace, BootstrapPasswordRequest, ChangePasswordRequest, CollectionDocument, CollectionMeta, CompactResult, CreateKeyRequest, CreateNamespaceRequest, CreateNotificationInput, CreatePolicyRequest, CreateRuleRequest, CreateSchedulePayload, CreateUserRequest, DispatchInput, Document, DocumentStore, FetchResult, HestiaAuth, HestiaBlobClient, HestiaClient, HestiaCollection, HestiaCollections, HestiaCore, HestiaKeyStore, HestiaLogs, HestiaNetworkClient, HestiaNotificationStore, HestiaOperations, HestiaPolicies, HestiaResponse, HestiaRules, HestiaScheduleStore, HestiaSettingStore, HestiaUpdates, HestiaUsers, HttpTransport, IdentityProvider, ListBlobsRequest, LogFilter, LoginRequest, LoginResult, NamespaceInfo, NamespaceStats, Notification, NotificationAction, Page, PagedData, PagerRefreshOptions, PaginationInfo, Policy, PolicyRule, RateLimitConfig, RegisterRequest, ReloadResult, RequestLogEntry, RequestOptions, ResumableUpload, RuleNode, Schedule, ServerHealth, SetPolicyEnabledRequest, SettingDocument, StoreEvent, StreamHandlers, StreamOptions, ThrottleAction, ThrottleConfig, 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, createArrayPager, createPagedController, getMissingRanges, internalError, notFound, parseErrorBody, permissionDenied, toSystemError };
2354
+ 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 };