@astrale-os/sdk 0.6.0-beta.13 → 0.6.0-beta.14
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/README.md +4 -0
- package/dist/deployment/adapter/adapter.d.ts +1 -6
- package/dist/deployment/adapter/legacy/adapter.d.ts +0 -10
- package/dist/deployment/adapter/legacy/deploy/context.d.ts +0 -2
- package/dist/deployment/adapter/legacy/deploy/result.d.ts +2 -3
- package/dist/deployment/adapter/legacy/index.d.ts +10 -8
- package/dist/deployment/adapter/legacy/prepare/context.d.ts +0 -2
- package/dist/deployment/adapter/release/context.d.ts +16 -2
- package/dist/deployment/address/index.d.ts +1 -1
- package/dist/deployment/address/index.js +1 -0
- package/dist/deployment/address/summary.d.ts +30 -0
- package/dist/deployment/address/summary.js +117 -1
- package/dist/deployment/build/index.d.ts +1 -1
- package/dist/deployment/build/index.js +1 -1
- package/dist/deployment/build/manifest.d.ts +5 -0
- package/dist/deployment/build/manifest.js +10 -0
- package/dist/deployment/index.d.ts +1 -1
- package/dist/deployment/release/legacy/index.d.ts +15 -10
- package/dist/deployment/release/legacy/index.js +15 -10
- package/dist/deployment/verify/readiness/deployment.js +3 -13
- package/dist/deployment/verify/readiness/fetch.d.ts +13 -0
- package/dist/deployment/verify/readiness/fetch.js +26 -0
- package/dist/deployment/verify/readiness/identity.d.ts +3 -6
- package/dist/deployment/verify/readiness/identity.js +3 -3
- package/dist/deployment/verify/readiness/index.d.ts +12 -8
- package/dist/deployment/verify/readiness/index.js +15 -4
- package/dist/deployment/verify/readiness/legacy/index.d.ts +2 -0
- package/dist/deployment/verify/readiness/legacy/index.js +2 -0
- package/dist/deployment/verify/readiness/legacy/publication.d.ts +12 -0
- package/dist/deployment/verify/readiness/legacy/publication.js +23 -0
- package/dist/deployment/verify/readiness/release.d.ts +8 -0
- package/dist/deployment/verify/readiness/release.js +22 -0
- package/dist/execution/identity/authentication.d.ts +7 -0
- package/dist/execution/identity/authentication.js +7 -1
- package/dist/execution/identity/delivery.d.ts +11 -4
- package/dist/execution/identity/delivery.js +47 -20
- package/dist/execution/identity/identity.d.ts +7 -3
- package/dist/execution/identity/identity.js +2 -2
- package/dist/execution/invocation/admission/authentication.d.ts +1 -2
- package/dist/execution/invocation/admission/authentication.js +1 -2
- package/dist/execution/invocation/admission/authority.d.ts +10 -4
- package/dist/execution/invocation/admission/authority.js +5 -1
- package/dist/execution/invocation/invocation.js +51 -14
- package/dist/execution/runtime/index.d.ts +1 -0
- package/dist/execution/runtime/index.js +1 -0
- package/dist/execution/runtime/load.d.ts +3 -3
- package/dist/execution/runtime/load.js +3 -2
- package/dist/execution/runtime/release.d.ts +22 -0
- package/dist/execution/runtime/release.js +14 -0
- package/dist/execution/serve.d.ts +2 -2
- package/dist/execution/service/create.js +9 -7
- package/dist/execution/service/release.d.ts +2 -2
- package/dist/execution/service/release.js +3 -2
- package/dist/execution/service/service.d.ts +9 -5
- package/dist/execution/service/serving/delivery.d.ts +6 -0
- package/dist/execution/service/{publication → serving}/delivery.js +5 -1
- package/dist/execution/service/{publication → serving}/index.d.ts +1 -1
- package/dist/execution/service/serving/installation.d.ts +4 -0
- package/dist/execution/service/serving/installation.js +9 -0
- package/dist/execution/service/serving/legacy/index.d.ts +15 -0
- package/dist/execution/service/serving/legacy/index.js +19 -0
- package/dist/execution/service/serving/source.d.ts +18 -0
- package/dist/execution/service/serving/source.js +19 -0
- package/dist/project/define.js +57 -28
- package/dist/project/install-command.d.ts +10 -0
- package/dist/project/install-command.js +13 -0
- package/dist/project/project.d.ts +4 -2
- package/dist/tooling/cli/arguments.d.ts +0 -2
- package/dist/tooling/cli/arguments.js +22 -15
- package/dist/tooling/cli/commit.d.ts +23 -0
- package/dist/tooling/cli/commit.js +216 -0
- package/dist/tooling/cli/deploy-mode.d.ts +19 -12
- package/dist/tooling/cli/deploy-mode.js +14 -32
- package/dist/tooling/cli/deploy-result.d.ts +10 -7
- package/dist/tooling/cli/deploy-result.js +4 -3
- package/dist/tooling/cli/development/candidate.d.ts +2 -3
- package/dist/tooling/cli/development/candidate.js +2 -9
- package/dist/tooling/cli/development/deployment.d.ts +2 -8
- package/dist/tooling/cli/development/deployment.js +2 -21
- package/dist/tooling/cli/development/develop.d.ts +4 -3
- package/dist/tooling/cli/development/develop.js +8 -112
- package/dist/tooling/cli/development/report.d.ts +1 -3
- package/dist/tooling/cli/development/report.js +1 -4
- package/dist/tooling/cli/help.js +28 -26
- package/dist/tooling/cli/immutable-deployment.d.ts +27 -0
- package/dist/tooling/cli/immutable-deployment.js +95 -0
- package/dist/tooling/cli/index.d.ts +2 -4
- package/dist/tooling/cli/index.js +2 -3
- package/dist/tooling/cli/legacy/deploy-result.d.ts +5 -3
- package/dist/tooling/cli/legacy/deploy-result.js +5 -3
- package/dist/tooling/cli/legacy/stable-target-adapter.d.ts +5 -3
- package/dist/tooling/cli/legacy/stable-target-deploy.d.ts +42 -0
- package/dist/tooling/cli/legacy/stable-target-deploy.js +104 -0
- package/dist/tooling/cli/orchestrate.js +46 -97
- package/dist/tooling/cli/secrets.d.ts +9 -0
- package/dist/tooling/cli/secrets.js +19 -0
- package/package.json +1 -1
- package/dist/deployment/verify/readiness/publication.d.ts +0 -11
- package/dist/deployment/verify/readiness/publication.js +0 -41
- package/dist/execution/service/publication/delivery.d.ts +0 -2
- package/dist/execution/service/publication/installation.d.ts +0 -3
- package/dist/execution/service/publication/installation.js +0 -8
- package/dist/execution/service/publication/source.d.ts +0 -3
- package/dist/execution/service/publication/source.js +0 -11
- package/dist/tooling/cli/astrale/authority.d.ts +0 -5
- package/dist/tooling/cli/astrale/authority.js +0 -11
- package/dist/tooling/cli/astrale/executable.d.ts +0 -2
- package/dist/tooling/cli/astrale/executable.js +0 -47
- package/dist/tooling/cli/astrale/failure.d.ts +0 -6
- package/dist/tooling/cli/astrale/failure.js +0 -48
- package/dist/tooling/cli/astrale/instance.d.ts +0 -11
- package/dist/tooling/cli/astrale/instance.js +0 -52
- package/dist/tooling/cli/astrale/process.d.ts +0 -13
- package/dist/tooling/cli/astrale/process.js +0 -94
- package/dist/tooling/cli/astrale/version.d.ts +0 -18
- package/dist/tooling/cli/astrale/version.js +0 -55
- package/dist/tooling/cli/development/release-evidence.d.ts +0 -4
- package/dist/tooling/cli/development/release-evidence.js +0 -10
- package/dist/tooling/cli/development/session-file.d.ts +0 -53
- package/dist/tooling/cli/development/session-file.js +0 -337
- package/dist/tooling/cli/development/target-lock.d.ts +0 -16
- package/dist/tooling/cli/development/target-lock.js +0 -68
- package/dist/tooling/cli/development/view.d.ts +0 -28
- package/dist/tooling/cli/development/view.js +0 -151
- package/dist/tooling/cli/environment-release.d.ts +0 -24
- package/dist/tooling/cli/environment-release.js +0 -46
- package/dist/tooling/cli/evidence.d.ts +0 -14
- package/dist/tooling/cli/evidence.js +0 -53
- package/dist/tooling/cli/installation/index.d.ts +0 -2
- package/dist/tooling/cli/installation/index.js +0 -1
- package/dist/tooling/cli/installation/observation.d.ts +0 -10
- package/dist/tooling/cli/installation/observation.js +0 -44
- package/dist/tooling/cli/installation/reconcile.d.ts +0 -32
- package/dist/tooling/cli/installation/reconcile.js +0 -122
- /package/dist/execution/service/{publication → serving}/index.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Runtime } from '../../application/runtime/index.js';
|
|
2
2
|
import type { Build } from '../../deployment/build/build.js';
|
|
3
|
-
import type { Release } from '../../deployment/release/legacy/release.js';
|
|
4
3
|
import type { schema } from '../../platform/schema/index.js';
|
|
5
|
-
|
|
4
|
+
import type { ServedRelease } from '../runtime/index.js';
|
|
5
|
+
export type ReleaseForRuntime<RuntimeValue extends Runtime> = ServedRelease<Build<schema.DomainSchema, RuntimeValue>>;
|
|
6
6
|
export type ReleaseLoader<Environment, RuntimeValue extends Runtime = Runtime> = (environment: Environment) => ReleaseForRuntime<RuntimeValue> | Promise<ReleaseForRuntime<RuntimeValue>>;
|
|
7
7
|
export declare function loadRelease<Environment, RuntimeValue extends Runtime>(load: ReleaseLoader<Environment, RuntimeValue>, environment: Environment, runtime: RuntimeValue): Promise<ReleaseForRuntime<RuntimeValue>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isServedRelease } from '../runtime/index.js';
|
|
2
2
|
export async function loadRelease(load, environment, runtime) {
|
|
3
3
|
if (typeof load !== 'function')
|
|
4
4
|
throw new TypeError('Service Release loader is invalid.');
|
|
5
5
|
const release = await load(environment);
|
|
6
|
-
if (!
|
|
6
|
+
if (!isServedRelease(release)) {
|
|
7
7
|
throw new TypeError('Service loader returned an unadmitted Release.');
|
|
8
|
+
}
|
|
8
9
|
if (release.build.runtime !== runtime) {
|
|
9
10
|
throw new TypeError('Service Release Runtime differs from the generated entrypoint Runtime.');
|
|
10
11
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { ApplicationHost, ServerCloseOptions, ServerOptions } from '@astrale-os/kernel-server';
|
|
2
|
-
import type {
|
|
2
|
+
import type { release } from '@astrale-os/kernel-server';
|
|
3
3
|
import type { Runtime } from '../../application/runtime/index.js';
|
|
4
4
|
import type { WorkflowRunner } from '../../application/workflow/runner/index.js';
|
|
5
|
-
import type { Release } from '../../deployment/release/legacy/index.js';
|
|
6
5
|
import type { Identity } from '../identity/index.js';
|
|
6
|
+
import type { ServedRelease } from '../runtime/index.js';
|
|
7
7
|
import type { DurableServing, DurableServingProvider } from '../workflows/index.js';
|
|
8
8
|
import type { ReleaseLoader } from './release.js';
|
|
9
|
-
export type ServiceServerOptions = Omit<ServerOptions, 'path' | 'invocation' | 'issuer' | 'publicOrigin' | 'tokenExchange' | 'publication' | 'delivery'>;
|
|
9
|
+
export type ServiceServerOptions = Omit<ServerOptions, 'path' | 'invocation' | 'issuer' | 'publicOrigin' | 'tokenExchange' | 'release' | 'publication' | 'delivery'>;
|
|
10
10
|
export interface ServiceInput<Environment, RuntimeValue extends Runtime = Runtime> {
|
|
11
11
|
readonly runtime: RuntimeValue;
|
|
12
12
|
readonly environment: Environment;
|
|
13
13
|
readonly load: ReleaseLoader<Environment, RuntimeValue>;
|
|
14
14
|
readonly identity: Identity;
|
|
15
15
|
readonly server: ServiceServerOptions;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Answers Delivery in the request's version: v2 over an immutable deployment's release, v1 over
|
|
18
|
+
* the Publication (a release's frozen v3 projection). Defaults to the Identity's own.
|
|
19
|
+
*/
|
|
20
|
+
readonly delivery?: release.delivery.Provider;
|
|
17
21
|
readonly workflows?: WorkflowRunner;
|
|
18
22
|
/**
|
|
19
23
|
* Serve the Release's durable Workflows. A provider is resolved on the first engine request,
|
|
@@ -23,7 +27,7 @@ export interface ServiceInput<Environment, RuntimeValue extends Runtime = Runtim
|
|
|
23
27
|
}
|
|
24
28
|
export interface Service {
|
|
25
29
|
fetch(request: Request, host?: ApplicationHost): Promise<Response>;
|
|
26
|
-
release(): Promise<
|
|
30
|
+
release(): Promise<ServedRelease>;
|
|
27
31
|
drain(): void;
|
|
28
32
|
close(options: ServerCloseOptions): Promise<void>;
|
|
29
33
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { release } from '@astrale-os/kernel-server';
|
|
2
|
+
/**
|
|
3
|
+
* Capture an explicit Delivery Provider. It answers in the request's version: v2 over an immutable
|
|
4
|
+
* deployment's release, v1 over the Publication (a release's frozen v3 projection).
|
|
5
|
+
*/
|
|
6
|
+
export declare function delivery(input: release.delivery.Provider | undefined): release.delivery.Provider | undefined;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture an explicit Delivery Provider. It answers in the request's version: v2 over an immutable
|
|
3
|
+
* deployment's release, v1 over the Publication (a release's frozen v3 projection).
|
|
4
|
+
*/
|
|
1
5
|
export function delivery(input) {
|
|
2
6
|
if (input === undefined)
|
|
3
7
|
return undefined;
|
|
4
8
|
if (input === null || typeof input !== 'object' || typeof input.create !== 'function') {
|
|
5
|
-
throw new TypeError('
|
|
9
|
+
throw new TypeError('Delivery Provider is invalid.');
|
|
6
10
|
}
|
|
7
11
|
const create = input.create.bind(input);
|
|
8
12
|
return Object.freeze({ create });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { release } from '@astrale-os/kernel-server';
|
|
2
|
+
import type { Serving } from '../../runtime/index.js';
|
|
3
|
+
/** A served document advertises Delivery exactly when the Service has a Provider for it. */
|
|
4
|
+
export declare function installation(served: Serving['document'], provider: release.delivery.Provider | undefined): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A served document advertises Delivery exactly when the Service has a Provider for it. */
|
|
2
|
+
export function installation(served, provider) {
|
|
3
|
+
const advertised = served.delivery !== undefined;
|
|
4
|
+
if (advertised !== (provider !== undefined)) {
|
|
5
|
+
throw new TypeError(advertised
|
|
6
|
+
? 'Release advertises delivery without a Provider.'
|
|
7
|
+
: 'Delivery Provider has no Release endpoint.');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PublicationSource } from '@astrale-os/kernel-server';
|
|
2
|
+
import type * as legacy from '../../../../deployment/release/legacy/index.js';
|
|
3
|
+
import type { LoadedRuntime } from '../../../runtime/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serve a stable target's v3 Publication through the Kernel Server's v3-input source: `domain.json`
|
|
6
|
+
* only (404 at `release.json`), with the same-schema continuity of a stable Worker.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Replacement: the release source of `../source.ts`, which serves an immutable
|
|
9
|
+
* deployment's `DomainRelease` v4. Consumer: the stable Worker of the direct-mode path (the
|
|
10
|
+
* consumers of `deployment/release/legacy/index.ts`), whose host binds no build digest. Removal:
|
|
11
|
+
* D10, with `deployment/release/legacy/` and Kernel Server's `publication` source.
|
|
12
|
+
*/
|
|
13
|
+
export declare function publicationSource(runtime: LoadedRuntime, served: legacy.Release): {
|
|
14
|
+
readonly publication: PublicationSource;
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { preparePublicationSnapshot } from '@astrale-os/kernel-server';
|
|
2
|
+
/**
|
|
3
|
+
* Serve a stable target's v3 Publication through the Kernel Server's v3-input source: `domain.json`
|
|
4
|
+
* only (404 at `release.json`), with the same-schema continuity of a stable Worker.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Replacement: the release source of `../source.ts`, which serves an immutable
|
|
7
|
+
* deployment's `DomainRelease` v4. Consumer: the stable Worker of the direct-mode path (the
|
|
8
|
+
* consumers of `deployment/release/legacy/index.ts`), whose host binds no build digest. Removal:
|
|
9
|
+
* D10, with `deployment/release/legacy/` and Kernel Server's `publication` source.
|
|
10
|
+
*/
|
|
11
|
+
export function publicationSource(runtime, served) {
|
|
12
|
+
const snapshot = preparePublicationSnapshot({
|
|
13
|
+
publication: served.publication,
|
|
14
|
+
bundle: served.build.schema.bundle.bytes(),
|
|
15
|
+
table: served.routes,
|
|
16
|
+
domain: runtime.domain,
|
|
17
|
+
});
|
|
18
|
+
return Object.freeze({ publication: Object.freeze({ current: () => snapshot }) });
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PublicationSource, ReleaseSource } from '@astrale-os/kernel-server';
|
|
2
|
+
import type { LoadedRuntime } from '../../runtime/index.js';
|
|
3
|
+
/** The one source a Kernel Server serves, as `ServerOptions` takes it. */
|
|
4
|
+
export type ServingSource =
|
|
5
|
+
/** The release of an immutable deployment: `release.json` and its v3 projection. */
|
|
6
|
+
{
|
|
7
|
+
readonly release: ReleaseSource;
|
|
8
|
+
}
|
|
9
|
+
/** @deprecated A stable target's v3 Publication; see `legacy/index.ts`. */
|
|
10
|
+
| {
|
|
11
|
+
readonly publication: PublicationSource;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Prepare, once, the exact snapshot the loaded Release serves: an immutable deployment serves its
|
|
15
|
+
* `DomainRelease` through `prepareReleaseSnapshot`, which admits only routing naming that exact
|
|
16
|
+
* release or its exact v3 projection; a stable target keeps serving its v3 Publication.
|
|
17
|
+
*/
|
|
18
|
+
export declare function source(runtime: LoadedRuntime): ServingSource;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { prepareReleaseSnapshot } from '@astrale-os/kernel-server';
|
|
2
|
+
import { publicationSource } from './legacy/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Prepare, once, the exact snapshot the loaded Release serves: an immutable deployment serves its
|
|
5
|
+
* `DomainRelease` through `prepareReleaseSnapshot`, which admits only routing naming that exact
|
|
6
|
+
* release or its exact v3 projection; a stable target keeps serving its v3 Publication.
|
|
7
|
+
*/
|
|
8
|
+
export function source(runtime) {
|
|
9
|
+
const served = runtime.release;
|
|
10
|
+
if (served.kind !== 'release')
|
|
11
|
+
return publicationSource(runtime, served);
|
|
12
|
+
const snapshot = prepareReleaseSnapshot({
|
|
13
|
+
release: served.document,
|
|
14
|
+
bundle: served.build.schema.bundle.bytes(),
|
|
15
|
+
table: served.routes,
|
|
16
|
+
domain: runtime.domain,
|
|
17
|
+
});
|
|
18
|
+
return Object.freeze({ release: Object.freeze({ current: () => snapshot }) });
|
|
19
|
+
}
|
package/dist/project/define.js
CHANGED
|
@@ -2,7 +2,10 @@ import { isDomainDefinition } from '../application/index.js';
|
|
|
2
2
|
import { isDeployment } from '../deployment/deployment.js';
|
|
3
3
|
import { ENVIRONMENT_NAME } from '../deployment/environment.js';
|
|
4
4
|
import { isTests } from '../testing/index.js';
|
|
5
|
+
import { installCommand } from './install-command.js';
|
|
5
6
|
const admittedProjects = new WeakSet();
|
|
7
|
+
/** The adapter name of adapter-astrale, whose instance mode once read `installation`. */
|
|
8
|
+
const ASTRALE_ADAPTER = 'astrale';
|
|
6
9
|
/** Capture one inert Project definition without loading entrypoints or performing effects. */
|
|
7
10
|
export function defineProject(input) {
|
|
8
11
|
const value = record(input, 'Project definition');
|
|
@@ -19,27 +22,28 @@ export function defineProject(input) {
|
|
|
19
22
|
const names = Object.keys(environments);
|
|
20
23
|
if (names.length === 0)
|
|
21
24
|
throw new TypeError('Project must declare at least one Environment.');
|
|
22
|
-
const
|
|
23
|
-
for (const name of names) {
|
|
25
|
+
const declared = names.map((name) => {
|
|
24
26
|
if (!ENVIRONMENT_NAME.test(name)) {
|
|
25
27
|
throw new TypeError(`Project Environment name "${name}" is not normalized.`);
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
return [name, record(environments[name], `Project Environment ${name}`)];
|
|
30
|
+
});
|
|
31
|
+
// One refusal names every Environment that declares installation, each with its own commands.
|
|
32
|
+
const installations = declared
|
|
33
|
+
.filter(([, environment]) => Object.hasOwn(environment, 'installation'))
|
|
34
|
+
.map(([name, environment]) => installationRefusal(environment, name));
|
|
35
|
+
if (installations.length > 0)
|
|
36
|
+
throw new TypeError(installations.join('\n'));
|
|
37
|
+
const captured = Object.create(null);
|
|
38
|
+
for (const [name, environment] of declared) {
|
|
39
|
+
exact(environment, ['deployment'], [], () => invalidEnvironment(name));
|
|
29
40
|
if (!isDeployment(environment.deployment)) {
|
|
30
41
|
throw new TypeError(`Project Environment ${name} deployment is not admitted.`);
|
|
31
42
|
}
|
|
32
|
-
const installation = environment.installation === undefined
|
|
33
|
-
? undefined
|
|
34
|
-
: admitInstallation(environment.installation, name);
|
|
35
43
|
environment.deployment.adapter.admit?.(environment.deployment.parameters, {
|
|
36
44
|
environment: name,
|
|
37
|
-
...(installation === undefined ? {} : { installation }),
|
|
38
|
-
});
|
|
39
|
-
captured[name] = Object.freeze({
|
|
40
|
-
deployment: environment.deployment,
|
|
41
|
-
...(installation === undefined ? {} : { installation }),
|
|
42
45
|
});
|
|
46
|
+
captured[name] = Object.freeze({ deployment: environment.deployment });
|
|
43
47
|
}
|
|
44
48
|
const entrypoints = input.entrypoints === undefined ? undefined : admitEntrypoints(input.entrypoints);
|
|
45
49
|
if (input.tests !== undefined && !isTests(input.tests)) {
|
|
@@ -71,22 +75,47 @@ function admitEntrypoints(input) {
|
|
|
71
75
|
}
|
|
72
76
|
return Object.freeze({ runtime: input.runtime });
|
|
73
77
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
|
|
78
|
+
/**
|
|
79
|
+
* A deploy no longer installs (DX [.81399], AM-72): an Environment that still declares
|
|
80
|
+
* `installation` is refused before any effect, with the commands that replace it. Its only
|
|
81
|
+
* consumer pins an SDK older than this refusal.
|
|
82
|
+
*
|
|
83
|
+
* adapter-astrale took its Services instance, and the identity of its Services calls, from
|
|
84
|
+
* `installation` when `astrale({ instance })` named none. For such an Environment the guidance
|
|
85
|
+
* also moves the instance into the adapter and passes the identity to the deploy, so following
|
|
86
|
+
* it deploys exactly where and as the configuration did.
|
|
87
|
+
*/
|
|
88
|
+
function installationRefusal(environment, name) {
|
|
89
|
+
const declared = environment.installation;
|
|
90
|
+
if (declared === undefined) {
|
|
91
|
+
return (`Project Environment ${name} declares \`installation\`, which a deploy no longer reads: a ` +
|
|
92
|
+
'deploy never installs. Remove the key.');
|
|
88
93
|
}
|
|
89
|
-
|
|
94
|
+
const installation = declared !== null && typeof declared === 'object'
|
|
95
|
+
? declared
|
|
96
|
+
: {};
|
|
97
|
+
const instance = stable(installation.instance);
|
|
98
|
+
const identity = stable(installation.identity);
|
|
99
|
+
const deployment = environment.deployment;
|
|
100
|
+
const astrale = isDeployment(deployment) &&
|
|
101
|
+
deployment.adapter.name === ASTRALE_ADAPTER &&
|
|
102
|
+
deployment.parameters.instance === undefined;
|
|
103
|
+
const adapterInstance = astrale
|
|
104
|
+
? `, name its instance in \`astrale({ instance: '${instance ?? '<instance>'}' })\``
|
|
105
|
+
: '';
|
|
106
|
+
const deployIdentity = astrale && identity !== undefined ? ` --as ${identity}` : '';
|
|
107
|
+
return (`Project Environment ${name} declares installation, and a deploy no longer installs. ` +
|
|
108
|
+
`Remove \`installation\`${adapterInstance}, run \`astrale-domain deploy ${name}${deployIdentity}\`, ` +
|
|
109
|
+
`then install the URL it prints with \`${installCommand(instance, identity)}\`.`);
|
|
110
|
+
}
|
|
111
|
+
/** A declared coordinate worth repeating in guidance: a non-empty single-line trimmed string. */
|
|
112
|
+
function stable(input) {
|
|
113
|
+
return typeof input === 'string' &&
|
|
114
|
+
input.length > 0 &&
|
|
115
|
+
input.trim() === input &&
|
|
116
|
+
!/[\s`]/u.test(input)
|
|
117
|
+
? input
|
|
118
|
+
: undefined;
|
|
90
119
|
}
|
|
91
120
|
function record(input, label) {
|
|
92
121
|
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
@@ -105,5 +134,5 @@ function invalid() {
|
|
|
105
134
|
throw new TypeError('Project definition may contain only domain, environments, entrypoints, and tests.');
|
|
106
135
|
}
|
|
107
136
|
function invalidEnvironment(name) {
|
|
108
|
-
throw new TypeError(`Project Environment ${name} may contain only deployment
|
|
137
|
+
throw new TypeError(`Project Environment ${name} may contain only deployment.`);
|
|
109
138
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command that installs a deployed URL on an instance, as every SDK refusal and help text
|
|
3
|
+
* names it. A deploy never installs (DX [.81399], AM-72): `astrale-domain deploy <environment>`
|
|
4
|
+
* prints a URL, and this command installs it.
|
|
5
|
+
*
|
|
6
|
+
* `--direct` sends a URL install to the instance Kernel, which the astrale CLI requires today and
|
|
7
|
+
* accepts until D13. When the CLI retires it, this is the one SDK text to change; the adapter and
|
|
8
|
+
* scaffold READMEs and templates repeat it as prose.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installCommand(instance?: string, identity?: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command that installs a deployed URL on an instance, as every SDK refusal and help text
|
|
3
|
+
* names it. A deploy never installs (DX [.81399], AM-72): `astrale-domain deploy <environment>`
|
|
4
|
+
* prints a URL, and this command installs it.
|
|
5
|
+
*
|
|
6
|
+
* `--direct` sends a URL install to the instance Kernel, which the astrale CLI requires today and
|
|
7
|
+
* accepts until D13. When the CLI retires it, this is the one SDK text to change; the adapter and
|
|
8
|
+
* scaffold READMEs and templates repeat it as prose.
|
|
9
|
+
*/
|
|
10
|
+
export function installCommand(instance = '<instance>', identity) {
|
|
11
|
+
return (`astrale domain install <url> --direct -i ${instance}` +
|
|
12
|
+
(identity === undefined ? '' : ` --as ${identity}`));
|
|
13
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { DomainDefinitionIdentity } from '../application/index.js';
|
|
2
|
-
import type { InstallationTarget } from '../deployment/adapter/index.js';
|
|
3
2
|
import type { Tests } from '../testing/index.js';
|
|
4
3
|
export interface ProjectEntrypoints {
|
|
5
4
|
readonly runtime: string;
|
|
6
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* One Environment of a Project: where and how its deployments are made. It never names an
|
|
8
|
+
* instance: a deploy installs nothing, and `astrale domain install <url>` installs a deployment.
|
|
9
|
+
*/
|
|
7
10
|
export interface ProjectEnvironment<DeploymentValue = unknown> {
|
|
8
11
|
readonly deployment: DeploymentValue;
|
|
9
|
-
readonly installation?: InstallationTarget;
|
|
10
12
|
}
|
|
11
13
|
/** The complete independently executable software-product definition in astrale.config.ts. */
|
|
12
14
|
export interface Project<DomainDefinitionValue extends DomainDefinitionIdentity = DomainDefinitionIdentity, EnvironmentsValue extends Readonly<Record<string, ProjectEnvironment>> = Readonly<Record<string, ProjectEnvironment>>, TestsValue extends Tests | undefined = undefined> {
|
|
@@ -6,11 +6,9 @@ export interface ParsedArgs {
|
|
|
6
6
|
readonly env: string;
|
|
7
7
|
readonly fix?: boolean;
|
|
8
8
|
readonly format?: LintReportFormat;
|
|
9
|
-
readonly deployOnly?: boolean;
|
|
10
9
|
readonly identity?: string;
|
|
11
10
|
readonly credentialFile?: string;
|
|
12
11
|
readonly suite?: string;
|
|
13
|
-
readonly sessionFile?: string;
|
|
14
12
|
readonly secretsFile?: string;
|
|
15
13
|
readonly channel?: string;
|
|
16
14
|
readonly check?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isAbsolute, normalize } from 'node:path';
|
|
2
|
+
import { installCommand } from '../../project/install-command.js';
|
|
2
3
|
export const COMMANDS = ['dev', 'build', 'deploy', 'test', 'lint', 'package', 'upgrade'];
|
|
3
4
|
/** Parse the frozen `astrale-domain` command grammar without performing effects. */
|
|
4
5
|
export function parseArgs(argv) {
|
|
@@ -8,7 +9,6 @@ export function parseArgs(argv) {
|
|
|
8
9
|
const fix = rest.includes('--fix');
|
|
9
10
|
const deployOnly = rest.includes('--deploy-only');
|
|
10
11
|
const json = rest.includes('--json');
|
|
11
|
-
let sessionFile;
|
|
12
12
|
let secretsFile;
|
|
13
13
|
let credentialFile;
|
|
14
14
|
let identity;
|
|
@@ -18,13 +18,7 @@ export function parseArgs(argv) {
|
|
|
18
18
|
const cleaned = [];
|
|
19
19
|
for (let index = 0; index < rest.length; index += 1) {
|
|
20
20
|
const argument = rest[index];
|
|
21
|
-
if (argument === '--
|
|
22
|
-
sessionFile = absoluteFilePath('--session-file', rest[++index]);
|
|
23
|
-
}
|
|
24
|
-
else if (argument.startsWith('--session-file=')) {
|
|
25
|
-
sessionFile = absoluteFilePath('--session-file', argument.slice('--session-file='.length));
|
|
26
|
-
}
|
|
27
|
-
else if (argument === '--credential-file') {
|
|
21
|
+
if (argument === '--credential-file') {
|
|
28
22
|
credentialFile = absoluteFilePath('--credential-file', rest[++index]);
|
|
29
23
|
}
|
|
30
24
|
else if (argument.startsWith('--credential-file=')) {
|
|
@@ -78,15 +72,16 @@ export function parseArgs(argv) {
|
|
|
78
72
|
if (format !== undefined && command !== 'lint') {
|
|
79
73
|
throw new Error('`--format` is only valid for `lint`.');
|
|
80
74
|
}
|
|
81
|
-
if ((
|
|
82
|
-
|
|
83
|
-
throw new Error('`--session-file`, `--credential-file`, and `--secrets-file` are only valid for `dev`.');
|
|
75
|
+
if ((credentialFile !== undefined || secretsFile !== undefined) && command !== 'dev') {
|
|
76
|
+
throw new Error('`--credential-file` and `--secrets-file` are only valid for `dev`.');
|
|
84
77
|
}
|
|
85
78
|
if (identity !== undefined && credentialFile !== undefined) {
|
|
86
79
|
throw new Error('Choose either `--as` or `--credential-file`, not both.');
|
|
87
80
|
}
|
|
88
|
-
if (
|
|
89
|
-
|
|
81
|
+
if (deployOnly && command !== 'dev' && command !== 'deploy')
|
|
82
|
+
refuseDeployOnly(undefined);
|
|
83
|
+
if (identity !== undefined && command !== 'dev' && command !== 'deploy') {
|
|
84
|
+
throw new Error('`--as` is only valid for `dev` or `deploy`.');
|
|
90
85
|
}
|
|
91
86
|
if (environment !== undefined && command !== 'dev' && command !== 'deploy') {
|
|
92
87
|
if (command !== 'test') {
|
|
@@ -110,14 +105,14 @@ export function parseArgs(argv) {
|
|
|
110
105
|
if (!env) {
|
|
111
106
|
throw new Error(`\`${command}\` requires an Environment, e.g. \`${command} development\`.`);
|
|
112
107
|
}
|
|
108
|
+
if (deployOnly)
|
|
109
|
+
refuseDeployOnly(command, env);
|
|
113
110
|
return {
|
|
114
111
|
command,
|
|
115
112
|
env,
|
|
116
113
|
...(json ? { json: true } : {}),
|
|
117
|
-
...(deployOnly ? { deployOnly: true } : {}),
|
|
118
114
|
...(identity === undefined ? {} : { identity }),
|
|
119
115
|
...(credentialFile === undefined ? {} : { credentialFile }),
|
|
120
|
-
...(sessionFile === undefined ? {} : { sessionFile }),
|
|
121
116
|
...(secretsFile === undefined ? {} : { secretsFile }),
|
|
122
117
|
};
|
|
123
118
|
}
|
|
@@ -149,6 +144,18 @@ export function parseArgs(argv) {
|
|
|
149
144
|
throw new Error(command ? `Unknown command "${command}".` : 'Missing command.');
|
|
150
145
|
}
|
|
151
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* `--deploy-only` suppressed the installation a deploy used to make. A deploy never installs
|
|
149
|
+
* (DX [.81399], AM-72), so the flag is refused before any effect, naming the commands that
|
|
150
|
+
* replace it. Its only consumer pins an SDK older than this refusal.
|
|
151
|
+
*/
|
|
152
|
+
function refuseDeployOnly(command, environment) {
|
|
153
|
+
const refusal = '`--deploy-only` is no longer accepted: a deploy never installs.';
|
|
154
|
+
if (command === undefined || environment === undefined)
|
|
155
|
+
throw new Error(refusal);
|
|
156
|
+
throw new Error(`${refusal} Run \`astrale-domain ${command} ${environment}\` without it, then install the ` +
|
|
157
|
+
`URL it prints with \`${installCommand()}\`.`);
|
|
158
|
+
}
|
|
152
159
|
function parseUpgrade(args) {
|
|
153
160
|
let channel = 'beta';
|
|
154
161
|
let check = false;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DeploymentCommitV1 } from '../../deployment/address/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The commit provenance a canonical deploy declares in its deployment record (CT18 `commit`): the
|
|
4
|
+
* commit of the repository the Project lives in, whether the working tree holds changes that
|
|
5
|
+
* commit does not, and the last release of the Domain before it, as `git describe` finds it.
|
|
6
|
+
*
|
|
7
|
+
* - `dirty` covers tracked changes and untracked files, over the whole working tree; ignored files
|
|
8
|
+
* never count. Unlike `git describe --dirty`, an untracked file counts, since a build can import
|
|
9
|
+
* it.
|
|
10
|
+
* - `base` is the nearest release tag of the package the Domain is released from: the
|
|
11
|
+
* release-please package that holds the Domain's runtime module (see {@link releaseTagPrefixes}).
|
|
12
|
+
* The tag prefix is stripped, and a tag whose rest is not a canonical SemVer version is left
|
|
13
|
+
* out, so the record never carries a base a deployment name would refuse (AM-57). A Domain no
|
|
14
|
+
* release line holds declares no base: it is never given another package's version.
|
|
15
|
+
* - Outside a git repository, without git, or in a repository whose commits are not SHA-1, the
|
|
16
|
+
* deploy declares no commit (`null`); a deploy never fails for want of provenance.
|
|
17
|
+
*/
|
|
18
|
+
export declare function deploymentCommit(input: {
|
|
19
|
+
readonly projectDir: string;
|
|
20
|
+
/** The Domain's runtime module, as the Project's `entrypoints.runtime` resolves it. */
|
|
21
|
+
readonly runtimeModule: string;
|
|
22
|
+
readonly signal: AbortSignal;
|
|
23
|
+
}): Promise<DeploymentCommitV1 | null>;
|