@astrale-os/adapter-astrale 0.4.0 → 0.5.0-beta.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/README.md +11 -0
- package/dist/astrale.d.ts +75 -5
- package/dist/astrale.d.ts.map +1 -1
- package/dist/astrale.js +232 -114
- package/dist/astrale.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/managed-service.d.ts +6 -13
- package/dist/managed-service.d.ts.map +1 -1
- package/dist/managed-service.js +26 -33
- package/dist/managed-service.js.map +1 -1
- package/dist/params.d.ts +10 -11
- package/dist/params.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/astrale.ts +310 -140
- package/src/index.ts +4 -4
- package/src/managed-service.ts +37 -52
- package/src/params.ts +10 -12
- package/template/astrale.config.ts +7 -7
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# `@astrale-os/adapter-astrale`
|
|
2
|
+
|
|
3
|
+
Managed Astrale platform deployment adapter for Astrale Domains.
|
|
4
|
+
|
|
5
|
+
During the SDK beta program, install the beta cohort explicitly:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @astrale-os/sdk@beta @astrale-os/adapter-astrale@beta
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Bare installs return to stable releases when the cohort is promoted and npm `latest` advances.
|
package/dist/astrale.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Ships the domain THROUGH the target instance's `services` domain instead of to
|
|
5
5
|
* the author's own cloud account. `deploy` builds the same single-module workerd
|
|
6
|
-
* bundle the Cloudflare adapter ships (shared codegen +
|
|
7
|
-
* --dry-run`), then:
|
|
6
|
+
* bundle and frontend artifact the Cloudflare adapter ships (shared codegen +
|
|
7
|
+
* `wrangler deploy --dry-run`), then:
|
|
8
8
|
*
|
|
9
9
|
* 1. hosts it on the instance's services domain — `CloudflareWorker.deploy
|
|
10
10
|
* { name, entry, modules, assets, vars }` → a public worker `url`;
|
|
11
11
|
* 2. (optional) pushes runtime secrets via the service's `setSecret`;
|
|
12
12
|
* 3. installs the domain on the instance from that `url`
|
|
13
13
|
* (`astrale domain install <url>` → the child kernel's `Domain.install`,
|
|
14
|
-
* which fetches
|
|
14
|
+
* which fetches, verifies, and reconciles the signed Publication).
|
|
15
15
|
*
|
|
16
16
|
* The admin control plane is NOT involved: hosting moved out of admin into the
|
|
17
17
|
* per-instance `services` domain (a separate bounded context). No Cloudflare
|
|
@@ -24,9 +24,62 @@
|
|
|
24
24
|
* `watch` is identical to the Cloudflare adapter's local dev (wrangler dev on
|
|
25
25
|
* localhost) — managed deploys change WHERE the worker runs, not how you iterate.
|
|
26
26
|
*/
|
|
27
|
-
import type { DomainAdapter } from '@astrale-os/sdk';
|
|
28
|
-
import
|
|
27
|
+
import type { CompiledFrontendArtifact, DomainAdapter } from '@astrale-os/sdk';
|
|
28
|
+
import { buildCloudflareWorker, buildFrontend, logTo, prepare, runWranglerBundle, runWranglerDev, runWranglerTypes, watchFrontend } from '@astrale-os/adapter-cloudflare/build';
|
|
29
|
+
import { loadDeclaredSecrets } from '@astrale-os/sdk/cli';
|
|
30
|
+
import type { AstraleParams } from './params.js';
|
|
31
|
+
import { ensureServicesDomainInstalled, waitForManagedServiceReady } from './managed-service.js';
|
|
29
32
|
export declare function astrale(envs: Record<string, AstraleParams>): DomainAdapter<AstraleParams>;
|
|
33
|
+
export interface AstraleAdapterDependencies {
|
|
34
|
+
readonly astraleBin: typeof astraleBin;
|
|
35
|
+
readonly astraleCall: typeof astraleCall;
|
|
36
|
+
readonly buildCloudflareWorker: typeof buildCloudflareWorker;
|
|
37
|
+
readonly buildFrontend: typeof buildFrontend;
|
|
38
|
+
readonly ensureServicesDomainInstalled: typeof ensureServicesDomainInstalled;
|
|
39
|
+
readonly loadDeclaredSecrets: typeof loadDeclaredSecrets;
|
|
40
|
+
readonly logTo: typeof logTo;
|
|
41
|
+
readonly prepare: typeof prepare;
|
|
42
|
+
readonly readBytes: (path: string) => Buffer;
|
|
43
|
+
readonly readText: (path: string) => string;
|
|
44
|
+
readonly runAstrale: typeof runAstrale;
|
|
45
|
+
readonly runWranglerBundle: typeof runWranglerBundle;
|
|
46
|
+
readonly runWranglerDev: typeof runWranglerDev;
|
|
47
|
+
readonly runWranglerTypes: typeof runWranglerTypes;
|
|
48
|
+
readonly watchFrontend: typeof watchFrontend;
|
|
49
|
+
readonly waitForManagedServiceReady: typeof waitForManagedServiceReady;
|
|
50
|
+
}
|
|
51
|
+
/** Exact orchestration seam used by adapter-level managed deployment qualification. */
|
|
52
|
+
export declare function astraleWithDependencies(envs: Record<string, AstraleParams>, dependencies: AstraleAdapterDependencies): DomainAdapter<AstraleParams>;
|
|
53
|
+
export interface ManagedDeploymentVersionInput {
|
|
54
|
+
readonly bundle: Uint8Array;
|
|
55
|
+
readonly frontend?: CompiledFrontendArtifact;
|
|
56
|
+
readonly compatibilityDate?: string;
|
|
57
|
+
readonly compatibilityFlags?: readonly string[];
|
|
58
|
+
readonly serviceBindings?: readonly {
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly service: string;
|
|
61
|
+
}[];
|
|
62
|
+
readonly vars?: Readonly<Record<string, string>>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Stable generation for the whole managed serving contract. The Worker bytes
|
|
66
|
+
* alone are insufficient: frontend files/routes, compatibility settings,
|
|
67
|
+
* bindings, and vars can all change without producing a different bundle.
|
|
68
|
+
*/
|
|
69
|
+
export declare function managedDeploymentVersion(input: ManagedDeploymentVersionInput): string;
|
|
70
|
+
/** Preserve author vars while reserving the generation value owned by the adapter. */
|
|
71
|
+
export declare function managedDeploymentVars(vars: Readonly<Record<string, string>> | undefined, deploymentVersion: string): Readonly<Record<string, string>>;
|
|
72
|
+
type AssetFile = {
|
|
73
|
+
path: string;
|
|
74
|
+
contentBase64: string;
|
|
75
|
+
contentType?: string;
|
|
76
|
+
};
|
|
77
|
+
/** Convert the materialized frontend into the services provider's immutable
|
|
78
|
+
* asset envelope. External frontends deliberately retain routes but no local
|
|
79
|
+
* files, so the callable worker and browser host remain independently swappable. */
|
|
80
|
+
export declare function managedFrontendAssets(frontend: CompiledFrontendArtifact | undefined): readonly AssetFile[];
|
|
81
|
+
/** Semantic method address; independent of the installed domain's tree placement. */
|
|
82
|
+
export declare function servicesDeployMethodFor(origin: string): string;
|
|
30
83
|
/** Service name from the origin: first DNS label (e.g. `my-notes.example.dev` → `my-notes`). */
|
|
31
84
|
export declare function serviceNameFor(origin: string): string;
|
|
32
85
|
/** Per-instance-unique graph slug from the FULL origin (dots → dashes), e.g.
|
|
@@ -34,4 +87,21 @@ export declare function serviceNameFor(origin: string): string;
|
|
|
34
87
|
* (serviceNameFor) can collide across domains (`app.foo.dev` / `app.bar.dev`),
|
|
35
88
|
* so the service NODE is placed by this; the display name stays the short label. */
|
|
36
89
|
export declare function serviceSlugFor(origin: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Invoke the user's `astrale` CLI for one platform call (against the target
|
|
92
|
+
* INSTANCE) and parse its JSON output. The CLI owns identity (IdP session,
|
|
93
|
+
* audience scoping, delegation minting) — reimplementing that here would fork
|
|
94
|
+
* the trust path.
|
|
95
|
+
*/
|
|
96
|
+
declare function astraleCall(projectDir: string, params: AstraleParams, call: {
|
|
97
|
+
instance: string;
|
|
98
|
+
path: string;
|
|
99
|
+
data: unknown;
|
|
100
|
+
viaStdin?: boolean;
|
|
101
|
+
}): Promise<unknown>;
|
|
102
|
+
/** Spawn the astrale CLI, feed optional stdin, and return stdout. Throws with bounded diagnostics. */
|
|
103
|
+
declare function runAstrale(bin: string, cwd: string, args: string[], stdin?: string): Promise<string>;
|
|
104
|
+
/** The user's astrale CLI: ~/.astrale/bin/astrale when present, else PATH. */
|
|
105
|
+
declare function astraleBin(_projectDir: string): string;
|
|
106
|
+
export {};
|
|
37
107
|
//# sourceMappingURL=astrale.d.ts.map
|
package/dist/astrale.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astrale.d.ts","sourceRoot":"","sources":["../src/astrale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"astrale.d.ts","sourceRoot":"","sources":["../src/astrale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAK9E,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,KAAK,EACL,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACd,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAMzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;AAMhG,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,CAmBzF;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,UAAU,EAAE,OAAO,UAAU,CAAA;IACtC,QAAQ,CAAC,WAAW,EAAE,OAAO,WAAW,CAAA;IACxC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,qBAAqB,CAAA;IAC5D,QAAQ,CAAC,aAAa,EAAE,OAAO,aAAa,CAAA;IAC5C,QAAQ,CAAC,6BAA6B,EAAE,OAAO,6BAA6B,CAAA;IAC5E,QAAQ,CAAC,mBAAmB,EAAE,OAAO,mBAAmB,CAAA;IACxD,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAA;IAC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