@highstate/backend 0.6.2 → 0.7.1
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/dist/index.d.ts +45 -6
- package/dist/index.mjs +377 -152
- package/dist/runner/source-resolution-worker.mjs +22 -0
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.mjs +2 -2
- package/dist/{terminal-NNJYvGqi.d.ts → terminal-Cm2WqcyB.d.ts} +192 -28
- package/dist/{terminal-C4MfopTF.mjs → terminal-CqIsctlZ.mjs} +92 -11
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
2
2
|
import { WhoAmIResult, Stack, ConfigMap } from '@pulumi/pulumi/automation';
|
3
3
|
import { Logger } from 'pino';
|
4
4
|
import { ComponentModel, Entity, InstanceModel, CompositeInstance, UnitSource } from '@highstate/contract';
|
5
|
-
import { H as HubModel, I as InstanceModelPatch, a as HubModelPatch, P as ProjectOperation, b as InstanceState, T as TerminalSession, c as InstanceStatus, d as InstanceStatePatch, e as InstancePageBlock, f as InstanceTerminal, g as ProjectOperationRequest } from './terminal-
|
5
|
+
import { H as HubModel, I as InstanceModelPatch, a as HubModelPatch, P as ProjectOperation, b as InstanceState, T as TerminalSession, c as InstanceStatus, d as InstanceStatePatch, e as InstancePageBlock, f as InstanceTerminal, g as ProjectOperationRequest } from './terminal-Cm2WqcyB.js';
|
6
6
|
import { BetterLock } from 'better-lock/dist/better_lock';
|
7
7
|
import { Stream, Writable } from 'node:stream';
|
8
8
|
|
@@ -51,14 +51,23 @@ interface SecretBackend {
|
|
51
51
|
set(projectId: string, instanceId: string, values: Record<string, unknown>): Promise<void>;
|
52
52
|
}
|
53
53
|
|
54
|
+
type RunOptions = {
|
55
|
+
projectId: string;
|
56
|
+
pulumiProjectName: string;
|
57
|
+
pulumiStackName: string;
|
58
|
+
envVars?: Record<string, string>;
|
59
|
+
};
|
60
|
+
type RunLocalOptions = RunOptions & {
|
61
|
+
projectPath: string;
|
62
|
+
stackConfig?: ConfigMap;
|
63
|
+
};
|
54
64
|
declare class LocalPulumiHost {
|
55
65
|
private readonly logger;
|
56
66
|
private lock;
|
57
67
|
private constructor();
|
58
68
|
getCurrentUser(): Promise<WhoAmIResult | null>;
|
59
|
-
|
60
|
-
|
61
|
-
runLocal<T>(projectId: string, pulumiProjectName: string, pulumiStackName: string, programPathResolver: () => Promise<string> | string, fn: (stack: Stack) => Promise<T>, stackConfig?: ConfigMap): Promise<T>;
|
69
|
+
runEmpty<T>(options: RunOptions, fn: (stack: Stack) => Promise<T>): Promise<T>;
|
70
|
+
runLocal<T>(options: RunLocalOptions, fn: (stack: Stack) => Promise<T>): Promise<T>;
|
62
71
|
private sharedPassword;
|
63
72
|
private passwords;
|
64
73
|
hasPassword(projectId: string): boolean;
|
@@ -137,6 +146,7 @@ declare const configSchema: z.ZodObject<{
|
|
137
146
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK: z.ZodDefault<z.ZodBoolean>;
|
138
147
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT: z.ZodDefault<z.ZodBoolean>;
|
139
148
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH: z.ZodOptional<z.ZodString>;
|
149
|
+
HIGHSTATE_BACKEND_RUNNER_LOCAL_CACHE_DIR: z.ZodOptional<z.ZodString>;
|
140
150
|
HIGHSTATE_BACKEND_RUNNER_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
|
141
151
|
HIGHSTATE_BACKEND_STATE_LOCAL_DIR: z.ZodOptional<z.ZodString>;
|
142
152
|
HIGHSTATE_BACKEND_STATE_TYPE: z.ZodDefault<z.ZodEnum<["local"]>>;
|
@@ -167,6 +177,7 @@ declare const configSchema: z.ZodObject<{
|
|
167
177
|
HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR?: string | undefined;
|
168
178
|
HIGHSTATE_BACKEND_STATE_LOCAL_DIR?: string | undefined;
|
169
179
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH?: string | undefined;
|
180
|
+
HIGHSTATE_BACKEND_RUNNER_LOCAL_CACHE_DIR?: string | undefined;
|
170
181
|
HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST?: string | undefined;
|
171
182
|
HIGHSTATE_BACKEND_WORKSPACE_LOCAL_DIR?: string | undefined;
|
172
183
|
}, {
|
@@ -183,6 +194,7 @@ declare const configSchema: z.ZodObject<{
|
|
183
194
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_SKIP_STATE_CHECK?: boolean | undefined;
|
184
195
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_PRINT_OUTPUT?: boolean | undefined;
|
185
196
|
HIGHSTATE_BACKEND_RUNNER_LOCAL_SOURCE_BASE_PATH?: string | undefined;
|
197
|
+
HIGHSTATE_BACKEND_RUNNER_LOCAL_CACHE_DIR?: string | undefined;
|
186
198
|
HIGHSTATE_BACKEND_RUNNER_TYPE?: "local" | undefined;
|
187
199
|
HIGHSTATE_BACKEND_TERMINAL_DOCKER_BINARY?: string | undefined;
|
188
200
|
HIGHSTATE_BACKEND_TERMINAL_DOCKER_HOST?: string | undefined;
|
@@ -272,6 +284,7 @@ declare class ProjectLock {
|
|
272
284
|
private readonly lock;
|
273
285
|
private readonly projectId;
|
274
286
|
constructor(lock: BetterLock, projectId: string);
|
287
|
+
canImmediatelyAcquireLock(instanceId: string): boolean;
|
275
288
|
lockInstance<T>(instanceId: string, fn: () => Promise<T>): Promise<T>;
|
276
289
|
lockInstances<T>(instanceIds: string[], fn: () => Promise<T>): Promise<T>;
|
277
290
|
}
|
@@ -474,6 +487,24 @@ type InstanceUpdateOptions = RunnerBaseOptions & {
|
|
474
487
|
* The values of the secrets.
|
475
488
|
*/
|
476
489
|
secrets: Record<string, string>;
|
490
|
+
/**
|
491
|
+
* Whether to refresh the state before updating.
|
492
|
+
*/
|
493
|
+
refresh?: boolean;
|
494
|
+
};
|
495
|
+
type InstanceDestroyOptions = RunnerBaseOptions & {
|
496
|
+
/**
|
497
|
+
* The source of the unit.
|
498
|
+
*/
|
499
|
+
source: UnitSource;
|
500
|
+
/**
|
501
|
+
* Whether to refresh the state before updating.
|
502
|
+
*/
|
503
|
+
refresh?: boolean;
|
504
|
+
/**
|
505
|
+
* Whether to delete the unreachable resources (e.g. k8s resources in unreachable clusters).
|
506
|
+
*/
|
507
|
+
deleteUnreachable?: boolean;
|
477
508
|
};
|
478
509
|
type InstanceWatchOptions = RunnerBaseOptions & {
|
479
510
|
/**
|
@@ -514,6 +545,14 @@ interface RunnerBackend {
|
|
514
545
|
* If the instance is running another operation, it should throw an error.
|
515
546
|
*/
|
516
547
|
update(options: InstanceUpdateOptions): Promise<void>;
|
548
|
+
/**
|
549
|
+
* Previews the instance update without actually applying the changes.
|
550
|
+
*
|
551
|
+
* The operation must only be aborted by the signal, not even when the connection is closed.
|
552
|
+
* If the instance is already updating, it should exit immediately.
|
553
|
+
* If the instance is running another operation, it should throw an error.
|
554
|
+
*/
|
555
|
+
preview(options: InstanceUpdateOptions): Promise<void>;
|
517
556
|
/**
|
518
557
|
* Destroys the instance.
|
519
558
|
*
|
@@ -521,7 +560,7 @@ interface RunnerBackend {
|
|
521
560
|
* If the instance is not created, it should exit immediately.
|
522
561
|
* If the instance is running another operation, it should throw an error.
|
523
562
|
*/
|
524
|
-
destroy(options:
|
563
|
+
destroy(options: InstanceDestroyOptions): Promise<void>;
|
525
564
|
/**
|
526
565
|
* Refreshes the instance.
|
527
566
|
*
|
@@ -586,7 +625,7 @@ declare class OperationManager {
|
|
586
625
|
*
|
587
626
|
* @param request The operation request to launch.
|
588
627
|
*/
|
589
|
-
launch(request: ProjectOperationRequest): Promise<
|
628
|
+
launch(request: ProjectOperationRequest): Promise<ProjectOperation>;
|
590
629
|
/**
|
591
630
|
* Cancels the current operation.
|
592
631
|
* Does nothing if no operation is running.
|