@astrale-os/adapter-astrale 0.5.0-beta.157 → 0.5.0-beta.159
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 +1 -1
- package/dist/adapter.d.ts +3 -3
- package/dist/adapter.js +3 -1
- package/dist/deploy/deploy.d.ts +2 -2
- package/dist/deploy/deploy.js +6 -3
- package/dist/deploy/progress.d.ts +2 -2
- package/dist/deploy/readiness.d.ts +2 -2
- package/dist/deploy/service/content.d.ts +7 -0
- package/dist/deploy/service/content.js +13 -0
- package/dist/deploy/service/request.d.ts +6 -4
- package/dist/deploy/service/request.js +7 -5
- package/dist/params.d.ts +11 -3
- package/dist/prepare/parameters.d.ts +1 -0
- package/dist/prepare/parameters.js +1 -0
- package/package.json +3 -3
- package/template/astrale.config.ts +2 -2
package/README.md
CHANGED
package/dist/adapter.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Deployment } from '@astrale-os/sdk/deployment';
|
|
2
|
-
import type { ArtifactSource, PrepareContext } from '@astrale-os/sdk/deployment/adapter';
|
|
2
|
+
import type { ArtifactSource, LegacyAdapter, PrepareContext } from '@astrale-os/sdk/deployment/adapter';
|
|
3
3
|
import type { AstraleDeployDependencies } from './deploy/deploy.js';
|
|
4
4
|
import type { AstraleParams } from './params.js';
|
|
5
5
|
export interface AstraleDependencies extends AstraleDeployDependencies {
|
|
6
6
|
prepare(parameters: AstraleParams, context: PrepareContext): Promise<ArtifactSource>;
|
|
7
7
|
}
|
|
8
|
-
export declare function astrale(parameters?: AstraleParams): Deployment<AstraleParams
|
|
9
|
-
export declare function astraleWithDependencies(parameters: AstraleParams, dependencies: AstraleDependencies): Deployment<AstraleParams
|
|
8
|
+
export declare function astrale(parameters?: AstraleParams): Deployment<AstraleParams, LegacyAdapter<AstraleParams>>;
|
|
9
|
+
export declare function astraleWithDependencies(parameters: AstraleParams, dependencies: AstraleDependencies): Deployment<AstraleParams, LegacyAdapter<AstraleParams>>;
|
package/dist/adapter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { verifyWorkerFrontend } from '@astrale-os/adapter-cloudflare/build';
|
|
1
|
+
import { cloudflareWorkerBundler, verifyWorkerFrontend } from '@astrale-os/adapter-cloudflare/build';
|
|
2
2
|
import { signingIdentity } from '@astrale-os/adapter-cloudflare/identity';
|
|
3
3
|
import { defineAdapter, defineDeployment } from '@astrale-os/sdk/deployment/adapter';
|
|
4
4
|
import { verifyReadiness } from '@astrale-os/sdk/deployment/verify';
|
|
@@ -34,6 +34,8 @@ export function astraleWithDependencies(parameters, dependencies) {
|
|
|
34
34
|
const adapter = defineAdapter({
|
|
35
35
|
name: 'astrale',
|
|
36
36
|
version: packageVersion,
|
|
37
|
+
// Services hosts the same generated Worker: both adapters share one build.
|
|
38
|
+
bundler: cloudflareWorkerBundler,
|
|
37
39
|
admit(parameters, context) {
|
|
38
40
|
const deploymentInstance = parameters.instance;
|
|
39
41
|
const installationInstance = context.installation?.instance;
|
package/dist/deploy/deploy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkerArtifact } from '@astrale-os/adapter-cloudflare/build';
|
|
2
2
|
import type { signingIdentity } from '@astrale-os/adapter-cloudflare/identity';
|
|
3
3
|
import type { DeployContext, DeployResult } from '@astrale-os/sdk/deployment/adapter';
|
|
4
|
-
import
|
|
4
|
+
import { legacy } from '@astrale-os/sdk/deployment/release';
|
|
5
5
|
import type { callAstrale } from '../cli/commands/call.js';
|
|
6
6
|
import type { installDomain } from '../cli/commands/install-domain.js';
|
|
7
7
|
import type { introspectDomain } from '../cli/commands/introspect.js';
|
|
@@ -16,7 +16,7 @@ export interface AstraleDeployDependencies {
|
|
|
16
16
|
installDomain: typeof installDomain;
|
|
17
17
|
requireCliVersion: typeof requireCliVersion;
|
|
18
18
|
resolveCliExecutable: typeof resolveCliExecutable;
|
|
19
|
-
waitForReadiness(release: Release, signal: AbortSignal, worker: WorkerArtifact): Promise<void>;
|
|
19
|
+
waitForReadiness(release: legacy.Release, signal: AbortSignal, worker: WorkerArtifact): Promise<void>;
|
|
20
20
|
signingIdentity: typeof signingIdentity;
|
|
21
21
|
}
|
|
22
22
|
export declare function deployAstrale(parameters: AstraleParams, context: DeployContext, dependencies: AstraleDeployDependencies): Promise<DeployResult>;
|
package/dist/deploy/deploy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { loadWorkerArtifact } from '@astrale-os/adapter-cloudflare/build';
|
|
1
|
+
import { loadWorkerArtifact, uploadBuildEvidence } from '@astrale-os/adapter-cloudflare/build';
|
|
2
2
|
import { signingIdentitySecrets } from '@astrale-os/adapter-cloudflare/identity';
|
|
3
|
-
import { addressing,
|
|
3
|
+
import { addressing, legacy } from '@astrale-os/sdk/deployment/release';
|
|
4
4
|
import { authorityArguments } from '../cli/identity.js';
|
|
5
5
|
import { ServicesPrerequisiteError } from './ensure-services.js';
|
|
6
6
|
import { failed, NONE, progress } from './progress.js';
|
|
@@ -65,8 +65,10 @@ export async function deployAstrale(parameters, context, dependencies) {
|
|
|
65
65
|
const serviceKey = parameters.serviceKey ?? serviceKeyFromOrigin(origin, context.environment);
|
|
66
66
|
const secretNames = Object.keys(secrets).sort();
|
|
67
67
|
let payload;
|
|
68
|
+
let build;
|
|
68
69
|
try {
|
|
69
70
|
payload = deploymentRequest(context.artifact, { origin, serviceKey, name, secrets });
|
|
71
|
+
build = uploadBuildEvidence(context.artifact, loadWorkerArtifact(context.artifact));
|
|
70
72
|
}
|
|
71
73
|
catch (cause) {
|
|
72
74
|
return failed('provider', progress(), cause);
|
|
@@ -135,6 +137,7 @@ export async function deployAstrale(parameters, context, dependencies) {
|
|
|
135
137
|
provider: 'astrale',
|
|
136
138
|
deployment: observation.digest,
|
|
137
139
|
artifact: context.artifact.digest,
|
|
140
|
+
...build,
|
|
138
141
|
...(observation.preflight === undefined ? {} : { preflight: observation.preflight }),
|
|
139
142
|
}),
|
|
140
143
|
});
|
|
@@ -160,7 +163,7 @@ export async function deployAstrale(parameters, context, dependencies) {
|
|
|
160
163
|
});
|
|
161
164
|
let release;
|
|
162
165
|
try {
|
|
163
|
-
release = assemble(context.artifact.build, selected);
|
|
166
|
+
release = legacy.assemble(context.artifact.build, selected);
|
|
164
167
|
}
|
|
165
168
|
catch (cause) {
|
|
166
169
|
return failed('release', progress({ prerequisite, provider, configuration }), cause);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DeployResult, DeploymentProgress } from '@astrale-os/sdk/deployment/adapter';
|
|
2
|
-
import type {
|
|
2
|
+
import type { legacy } from '@astrale-os/sdk/deployment/release';
|
|
3
3
|
export declare const NONE: Readonly<{
|
|
4
4
|
kind: 'none';
|
|
5
5
|
}>;
|
|
6
6
|
export declare function progress(input?: Partial<DeploymentProgress>): DeploymentProgress;
|
|
7
|
-
export declare function failed(phase: 'prerequisite' | 'provider' | 'addressing' | 'release' | 'configuration' | 'installation' | 'readiness', deploymentProgress: DeploymentProgress, cause: unknown, release?: Release): DeployResult;
|
|
7
|
+
export declare function failed(phase: 'prerequisite' | 'provider' | 'addressing' | 'release' | 'configuration' | 'installation' | 'readiness', deploymentProgress: DeploymentProgress, cause: unknown, release?: legacy.Release): DeployResult;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { legacy } from '@astrale-os/sdk/deployment/release';
|
|
2
2
|
import { verifyReadiness } from '@astrale-os/sdk/deployment/verify';
|
|
3
|
-
export declare function waitForReadiness(release: Release, signal: AbortSignal, verify?: typeof verifyReadiness): Promise<void>;
|
|
3
|
+
export declare function waitForReadiness(release: legacy.Release, signal: AbortSignal, verify?: typeof verifyReadiness): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PortableBase64 } from './base64.js';
|
|
2
|
+
export type DeploymentContent = {
|
|
3
|
+
readonly encoding: 'identity' | 'gzip';
|
|
4
|
+
readonly decodedSize: number;
|
|
5
|
+
} & PortableBase64;
|
|
6
|
+
/** Compression is transport-only and must never expand the request or change release identity. */
|
|
7
|
+
export declare function deploymentContent(bytes: Uint8Array): DeploymentContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { gzipSync } from 'node:zlib';
|
|
2
|
+
import { portableBase64 } from './base64.js';
|
|
3
|
+
/** Compression is transport-only and must never expand the request or change release identity. */
|
|
4
|
+
export function deploymentContent(bytes) {
|
|
5
|
+
// A gzip header/trailer costs twenty bytes; tiny files cannot justify compression work.
|
|
6
|
+
const compressed = bytes.byteLength < 64 ? undefined : gzipSync(bytes, { level: 9 });
|
|
7
|
+
const gzip = compressed !== undefined && compressed.byteLength < bytes.byteLength;
|
|
8
|
+
return Object.freeze({
|
|
9
|
+
encoding: gzip ? 'gzip' : 'identity',
|
|
10
|
+
decodedSize: bytes.byteLength,
|
|
11
|
+
...portableBase64(gzip ? compressed : bytes),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PreparedArtifact } from '@astrale-os/sdk/deployment/adapter';
|
|
2
|
-
import { type
|
|
2
|
+
import { type DeploymentContent } from './content.js';
|
|
3
3
|
export interface DeploymentRequestInput {
|
|
4
4
|
readonly origin: string;
|
|
5
5
|
readonly serviceKey: string;
|
|
@@ -9,7 +9,8 @@ export interface DeploymentRequestInput {
|
|
|
9
9
|
type EncodedModule = {
|
|
10
10
|
readonly name: string;
|
|
11
11
|
readonly kind: 'esm' | 'wasm' | 'text' | 'data';
|
|
12
|
-
|
|
12
|
+
readonly content: DeploymentContent;
|
|
13
|
+
};
|
|
13
14
|
interface EncodedArtifact {
|
|
14
15
|
readonly entry: string;
|
|
15
16
|
readonly modules: readonly EncodedModule[];
|
|
@@ -34,10 +35,11 @@ export interface DeploymentRequest {
|
|
|
34
35
|
readonly vars?: Readonly<Record<string, string>>;
|
|
35
36
|
readonly secrets: Readonly<Record<string, string>>;
|
|
36
37
|
readonly assets?: {
|
|
37
|
-
readonly files: readonly
|
|
38
|
+
readonly files: readonly {
|
|
38
39
|
readonly path: string;
|
|
39
40
|
readonly contentType?: string;
|
|
40
|
-
|
|
41
|
+
readonly content: DeploymentContent;
|
|
42
|
+
}[];
|
|
41
43
|
readonly notFound: 'none' | '404-page' | 'single-page-application';
|
|
42
44
|
readonly runWorkerFirst: boolean;
|
|
43
45
|
readonly htmlHandling?: 'none';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadWorkerArtifact } from '@astrale-os/adapter-cloudflare/build';
|
|
2
|
-
import {
|
|
1
|
+
import { isAdapterVar, loadWorkerArtifact, } from '@astrale-os/adapter-cloudflare/build';
|
|
2
|
+
import { deploymentContent } from './content.js';
|
|
3
3
|
export function deploymentRequest(artifact, input) {
|
|
4
4
|
const worker = loadWorkerArtifact(artifact);
|
|
5
5
|
if (worker.origin !== input.origin) {
|
|
@@ -10,7 +10,9 @@ export function deploymentRequest(artifact, input) {
|
|
|
10
10
|
...worker.bindings.services.map((binding) => binding.name),
|
|
11
11
|
]);
|
|
12
12
|
for (const name of Object.keys(input.secrets)) {
|
|
13
|
-
if (!/^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/u.test(name) ||
|
|
13
|
+
if (!/^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/u.test(name) ||
|
|
14
|
+
occupied.has(name) ||
|
|
15
|
+
isAdapterVar(name)) {
|
|
14
16
|
throw new TypeError(`Managed Worker secret ${name} is invalid or collides with a binding.`);
|
|
15
17
|
}
|
|
16
18
|
occupied.add(name);
|
|
@@ -41,7 +43,7 @@ export function deploymentRequest(artifact, input) {
|
|
|
41
43
|
assets: Object.freeze({
|
|
42
44
|
files: Object.freeze(worker.assets.files.map((file) => Object.freeze({
|
|
43
45
|
path: file.path,
|
|
44
|
-
|
|
46
|
+
content: deploymentContent(file.bytes()),
|
|
45
47
|
...(file.contentType === undefined ? {} : { contentType: file.contentType }),
|
|
46
48
|
}))),
|
|
47
49
|
notFound: worker.assets.notFound,
|
|
@@ -59,7 +61,7 @@ function executable(executable) {
|
|
|
59
61
|
modules: Object.freeze(executable.modules.map((module) => Object.freeze({
|
|
60
62
|
name: module.path,
|
|
61
63
|
kind: module.kind,
|
|
62
|
-
|
|
64
|
+
content: deploymentContent(module.bytes()),
|
|
63
65
|
}))),
|
|
64
66
|
});
|
|
65
67
|
}
|
package/dist/params.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { DurableWorkerOptions } from '@astrale-os/adapter-cloudflare';
|
|
1
2
|
import type { ExchangeOptions } from '@astrale-os/sdk/execution';
|
|
2
3
|
/**
|
|
3
4
|
* `AstraleParams` — the provider-typed config for the Astrale-managed adapter.
|
|
4
5
|
*
|
|
5
6
|
* One value configures one Project Environment. `deploy` ships the bundle through
|
|
6
7
|
* the Services Domain of `instance`, or through the matching installation instance.
|
|
7
|
-
* Frontend source, routes, and build ownership live on the authored
|
|
8
|
+
* Frontend source, routes, and build ownership live on the authored Domain;
|
|
8
9
|
* adapter environments select delivery only.
|
|
9
10
|
*/
|
|
10
11
|
export interface AstraleParams {
|
|
@@ -13,9 +14,9 @@ export interface AstraleParams {
|
|
|
13
14
|
* Environment declares installation; that matching instance is inferred.
|
|
14
15
|
*/
|
|
15
16
|
readonly instance?: string;
|
|
16
|
-
/** Stable owner-scoped Service key. Default: derived from
|
|
17
|
+
/** Stable owner-scoped Service key. Default: derived from Domain and Environment identity. */
|
|
17
18
|
readonly serviceKey?: string;
|
|
18
|
-
/** Service display name. Default: derived from the
|
|
19
|
+
/** Service display name. Default: derived from the Domain origin. */
|
|
19
20
|
readonly name?: string;
|
|
20
21
|
/** Gitignored secrets file loaded by SDK tooling and applied through the provider boundary. */
|
|
21
22
|
readonly secrets?: string;
|
|
@@ -33,4 +34,11 @@ export interface AstraleParams {
|
|
|
33
34
|
* The default maximum is 30 minutes; production and CI environments may select a shorter bound.
|
|
34
35
|
*/
|
|
35
36
|
readonly tokenExchange?: ExchangeOptions | false;
|
|
37
|
+
/**
|
|
38
|
+
* What a Worker serving durable Workflows declares to the workflow engine: run retention, retry
|
|
39
|
+
* before pausing and the deadline of each Step. Canonical callbacks discover engine keys from
|
|
40
|
+
* their Kernel. The deprecated `ASTRALE_RESTATE_IDENTITY_KEYS` var admits retained legacy
|
|
41
|
+
* callbacks only.
|
|
42
|
+
*/
|
|
43
|
+
readonly durable?: DurableWorkerOptions;
|
|
36
44
|
}
|
|
@@ -3,5 +3,6 @@ export declare function cloudflareParameters(parameters: AstraleParams): Readonl
|
|
|
3
3
|
vars?: Readonly<Record<string, string>> | undefined;
|
|
4
4
|
maximumRequestBytes?: number | undefined;
|
|
5
5
|
tokenExchange?: false | import("../../../src/execution/index.js").ExchangeOptions | undefined;
|
|
6
|
+
durable?: import("@astrale-os/adapter-cloudflare").DurableWorkerOptions | undefined;
|
|
6
7
|
signingIdentity?: string | undefined;
|
|
7
8
|
}>;
|
|
@@ -5,6 +5,7 @@ export function cloudflareParameters(parameters) {
|
|
|
5
5
|
? {}
|
|
6
6
|
: { maximumRequestBytes: parameters.maximumRequestBytes }),
|
|
7
7
|
...(parameters.tokenExchange === undefined ? {} : { tokenExchange: parameters.tokenExchange }),
|
|
8
|
+
...(parameters.durable === undefined ? {} : { durable: parameters.durable }),
|
|
8
9
|
...(parameters.signingIdentity === undefined
|
|
9
10
|
? {}
|
|
10
11
|
: { signingIdentity: parameters.signingIdentity }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/adapter-astrale",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.159",
|
|
4
4
|
"description": "Deploy an Astrale domain as a managed service through the Astrale platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@astrale-os/adapter-cloudflare": "0.5.0-beta.
|
|
41
|
-
"@astrale-os/sdk": "0.6.0-beta.
|
|
40
|
+
"@astrale-os/adapter-cloudflare": "0.5.0-beta.166",
|
|
41
|
+
"@astrale-os/sdk": "0.6.0-beta.11"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@astrale-os/ox": "0.1.4",
|
|
@@ -9,12 +9,12 @@ import { astrale } from '@astrale-os/adapter-astrale'
|
|
|
9
9
|
import { defineProject } from '@astrale-os/sdk/project'
|
|
10
10
|
import { dataset, tests } from '@astrale-os/sdk/testing'
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { domain } from './domain.js'
|
|
13
13
|
|
|
14
14
|
const targetInstance = 'astrale-instance'
|
|
15
15
|
|
|
16
16
|
export default defineProject({
|
|
17
|
-
|
|
17
|
+
domain,
|
|
18
18
|
|
|
19
19
|
environments: {
|
|
20
20
|
development: {
|