@astrale-os/sdk 0.5.0-beta.26 → 0.5.0-beta.27

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.
@@ -4,4 +4,6 @@ export interface DeployContext {
4
4
  readonly environment: string;
5
5
  readonly secrets: Readonly<Record<string, string>>;
6
6
  readonly artifact: PreparedArtifact;
7
+ /** Parent-owned lifecycle cancellation shared by every provider process/effect. */
8
+ readonly signal: AbortSignal;
7
9
  }
@@ -1,3 +1,4 @@
1
1
  export { preflight as verifyPreflight } from './preflight/index.js';
2
+ export { isPreparedArtifact } from './preflight/index.js';
2
3
  export type { PreflightInput } from './preflight/index.js';
3
4
  export { readiness as verifyReadiness, verifyDeployment } from './readiness/index.js';
@@ -1,2 +1,3 @@
1
1
  export { preflight as verifyPreflight } from './preflight/index.js';
2
+ export { isPreparedArtifact } from './preflight/index.js';
2
3
  export { readiness as verifyReadiness, verifyDeployment } from './readiness/index.js';
@@ -58,12 +58,21 @@ export async function run(argv) {
58
58
  if (parsed.command === 'dev' || parsed.watch) {
59
59
  return watch(adapter, parameters, artifact, secrets, parsed, projectDir);
60
60
  }
61
- const result = verifyDeployment(artifact, await adapter.deploy(parameters, {
62
- projectDir,
63
- environment: parsed.env,
64
- secrets,
65
- artifact,
66
- }));
61
+ const lifecycle = deploymentLifecycle();
62
+ let deployed;
63
+ try {
64
+ deployed = await adapter.deploy(parameters, {
65
+ projectDir,
66
+ environment: parsed.env,
67
+ secrets,
68
+ artifact,
69
+ signal: lifecycle.signal,
70
+ });
71
+ }
72
+ finally {
73
+ lifecycle.dispose();
74
+ }
75
+ const result = verifyDeployment(artifact, deployed);
67
76
  if (result.status === 'failed') {
68
77
  error(`Deployment failed during ${result.phase}: ${result.error.message}`);
69
78
  return 1;
@@ -169,6 +178,19 @@ function signals() {
169
178
  process.once('SIGTERM', stop);
170
179
  });
171
180
  }
181
+ function deploymentLifecycle() {
182
+ const controller = new AbortController();
183
+ const stop = () => controller.abort(new Error('Deployment interrupted.'));
184
+ process.once('SIGINT', stop);
185
+ process.once('SIGTERM', stop);
186
+ return Object.freeze({
187
+ signal: controller.signal,
188
+ dispose() {
189
+ process.off('SIGINT', stop);
190
+ process.off('SIGTERM', stop);
191
+ },
192
+ });
193
+ }
172
194
  function usage(message) {
173
195
  if (message !== undefined)
174
196
  error(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/sdk",
3
- "version": "0.5.0-beta.26",
3
+ "version": "0.5.0-beta.27",
4
4
  "description": "Schema-first SDK for defining, composing, and deploying Astrale domains",
5
5
  "keywords": [
6
6
  "astrale",