@astrale-os/adapter-cloudflare 0.5.0-beta.22 → 0.5.0-beta.220
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 +246 -0
- package/dist/adapter.d.ts +9 -15
- package/dist/adapter.js +43 -129
- package/dist/build/bundle/admit.d.ts +3 -0
- package/dist/build/bundle/admit.js +47 -0
- package/dist/build/bundle/compiled-wasm-loader.d.ts +8 -0
- package/dist/build/bundle/compiled-wasm-loader.js +21 -0
- package/dist/build/bundler.d.ts +21 -0
- package/dist/build/bundler.js +96 -0
- package/dist/build/closure.d.ts +4 -1
- package/dist/build/closure.js +7 -1
- package/dist/build/codegen/execution.d.ts +3 -13
- package/dist/build/codegen/execution.js +2 -44
- package/dist/build/codegen/wrangler.d.ts +28 -10
- package/dist/build/codegen/wrangler.js +71 -21
- package/dist/build/configuration/invocation-timeout.d.ts +2 -0
- package/dist/build/configuration/invocation-timeout.js +9 -0
- package/dist/build/configuration/request-limit.d.ts +2 -0
- package/dist/build/configuration/request-limit.js +9 -0
- package/dist/build/configuration/router.d.ts +7 -0
- package/dist/build/configuration/router.js +17 -0
- package/dist/build/configuration/settings.d.ts +6 -0
- package/dist/build/configuration/settings.js +40 -0
- package/dist/build/configuration.d.ts +4 -9
- package/dist/build/configuration.js +4 -40
- package/dist/build/frontend/files.d.ts +19 -0
- package/dist/build/frontend/files.js +99 -0
- package/dist/build/frontend/readiness.d.ts +16 -0
- package/dist/build/frontend/readiness.js +21 -0
- package/dist/build/frontend/revision.d.ts +5 -0
- package/dist/build/frontend/revision.js +14 -0
- package/dist/build/frontend/vite.d.ts +14 -0
- package/dist/build/frontend/vite.js +42 -0
- package/dist/build/frontend/vite.process.d.ts +7 -0
- package/dist/build/frontend/vite.process.js +65 -0
- package/dist/build/frontend/vite.runner.d.ts +1 -0
- package/dist/build/frontend/vite.runner.js +155 -0
- package/dist/build/index.d.ts +10 -6
- package/dist/build/index.js +10 -6
- package/dist/build/material.d.ts +10 -0
- package/dist/build/material.js +25 -0
- package/dist/build/worker/codegen/entry.d.ts +9 -0
- package/dist/build/worker/codegen/entry.js +65 -0
- package/dist/build/worker/codegen/literal.d.ts +28 -0
- package/dist/build/worker/codegen/literal.js +136 -0
- package/dist/build/worker/codegen/service.d.ts +14 -0
- package/dist/build/worker/codegen/service.js +57 -0
- package/dist/build/worker/execution.prepare.d.ts +20 -0
- package/dist/build/worker/execution.prepare.js +129 -0
- package/dist/build/worker/media-type.d.ts +1 -0
- package/dist/build/worker/media-type.js +20 -0
- package/dist/build/worker/modules.d.ts +20 -0
- package/dist/build/worker/modules.js +32 -0
- package/dist/build/worker/specifier.d.ts +5 -0
- package/dist/build/worker/specifier.js +15 -0
- package/dist/build/worker/upload.d.ts +23 -0
- package/dist/build/worker/upload.js +42 -0
- package/dist/hosting/activation.d.ts +46 -0
- package/dist/hosting/activation.js +127 -0
- package/dist/hosting/assets.d.ts +14 -0
- package/dist/hosting/assets.js +53 -0
- package/dist/hosting/bounded.d.ts +10 -0
- package/dist/hosting/bounded.js +32 -0
- package/dist/hosting/bytes.d.ts +6 -0
- package/dist/hosting/bytes.js +25 -0
- package/dist/hosting/client.d.ts +144 -0
- package/dist/hosting/client.js +491 -0
- package/dist/hosting/dispatcher/cron.d.mts +10 -0
- package/dist/hosting/dispatcher/cron.mjs +135 -0
- package/dist/hosting/dispatcher/deployments.d.mts +26 -0
- package/dist/hosting/dispatcher/deployments.mjs +158 -0
- package/dist/hosting/dispatcher/dispatcher.d.mts +17 -0
- package/dist/hosting/dispatcher/dispatcher.mjs +76 -0
- package/dist/hosting/dispatcher/env.d.mts +51 -0
- package/dist/hosting/dispatcher/failure.d.mts +4 -0
- package/dist/hosting/dispatcher/failure.mjs +15 -0
- package/dist/hosting/dispatcher/index.d.mts +4 -0
- package/dist/hosting/dispatcher/index.mjs +8 -0
- package/dist/hosting/dispatcher/modules.d.ts +24 -0
- package/dist/hosting/dispatcher/modules.js +55 -0
- package/dist/hosting/dispatcher/services.d.mts +23 -0
- package/dist/hosting/dispatcher/services.mjs +202 -0
- package/dist/hosting/identity.d.ts +15 -0
- package/dist/hosting/identity.js +36 -0
- package/dist/hosting/index.d.ts +34 -0
- package/dist/hosting/index.js +32 -0
- package/dist/hosting/kv.d.ts +90 -0
- package/dist/hosting/kv.js +207 -0
- package/dist/hosting/listing.d.ts +34 -0
- package/dist/hosting/listing.js +49 -0
- package/dist/hosting/names.d.ts +16 -0
- package/dist/hosting/names.js +28 -0
- package/dist/hosting/provision/account.d.ts +11 -0
- package/dist/hosting/provision/account.js +86 -0
- package/dist/hosting/provision/dispatcher.d.ts +42 -0
- package/dist/hosting/provision/dispatcher.js +99 -0
- package/dist/hosting/provision/ingress.d.ts +12 -0
- package/dist/hosting/provision/ingress.js +31 -0
- package/dist/hosting/provision/plan.d.ts +143 -0
- package/dist/hosting/provision/plan.js +246 -0
- package/dist/hosting/provision/routing.d.ts +82 -0
- package/dist/hosting/provision/routing.js +226 -0
- package/dist/hosting/readiness.d.ts +53 -0
- package/dist/hosting/readiness.js +82 -0
- package/dist/hosting/refusal.d.ts +28 -0
- package/dist/hosting/refusal.js +13 -0
- package/dist/hosting/retirement.d.ts +68 -0
- package/dist/hosting/retirement.js +99 -0
- package/dist/hosting/retry-after.d.ts +6 -0
- package/dist/hosting/retry-after.js +55 -0
- package/dist/hosting/script.d.ts +186 -0
- package/dist/hosting/script.js +324 -0
- package/dist/hosting/testing/fake-cloudflare.d.ts +212 -0
- package/dist/hosting/testing/fake-cloudflare.js +757 -0
- package/dist/hosting/testing/index.d.ts +6 -0
- package/dist/hosting/testing/index.js +6 -0
- package/dist/hosting/time.d.ts +4 -0
- package/dist/hosting/time.js +20 -0
- package/dist/identity/binding.d.ts +1 -1
- package/dist/identity/binding.js +1 -1
- package/dist/identity/material.d.ts +1 -2
- package/dist/identity/material.js +5 -18
- package/dist/index.d.ts +14 -12
- package/dist/index.js +13 -11
- package/dist/namespace/configure.d.ts +22 -0
- package/dist/namespace/configure.js +199 -0
- package/dist/namespace/coordinates.d.ts +15 -0
- package/dist/namespace/coordinates.js +49 -0
- package/dist/namespace/deploy-release.d.ts +53 -0
- package/dist/namespace/deploy-release.js +386 -0
- package/dist/namespace/hosting.d.ts +29 -0
- package/dist/namespace/hosting.js +120 -0
- package/dist/namespace/index.d.ts +12 -0
- package/dist/namespace/index.js +12 -0
- package/dist/namespace/list.d.ts +18 -0
- package/dist/namespace/list.js +63 -0
- package/dist/namespace/readiness.d.ts +30 -0
- package/dist/namespace/readiness.js +31 -0
- package/dist/namespace/record.d.ts +21 -0
- package/dist/namespace/record.js +53 -0
- package/dist/params.d.ts +60 -76
- package/dist/release/build.d.ts +35 -0
- package/dist/release/build.js +44 -0
- package/dist/release/deployment.d.ts +44 -0
- package/dist/release/deployment.js +141 -0
- package/dist/release/index.d.ts +2 -2
- package/dist/release/index.js +2 -2
- package/dist/worker/binary.d.ts +21 -0
- package/dist/worker/binary.js +31 -0
- package/dist/worker/build-digest.d.ts +10 -0
- package/dist/worker/build-digest.js +22 -0
- package/dist/worker/cache.d.ts +28 -0
- package/dist/worker/cache.js +70 -0
- package/dist/worker/durable.d.ts +3 -0
- package/dist/worker/durable.js +5 -0
- package/dist/worker/entry.d.ts +38 -25
- package/dist/worker/entry.js +87 -109
- package/dist/worker/front.d.ts +56 -0
- package/dist/worker/front.js +59 -0
- package/dist/worker/frontend.d.ts +4 -0
- package/dist/worker/frontend.js +83 -0
- package/dist/worker/index.d.ts +4 -1
- package/dist/worker/index.js +4 -1
- package/dist/worker/restate.d.ts +6 -0
- package/dist/worker/restate.js +6 -0
- package/dist/worker/settings.d.ts +47 -0
- package/dist/worker/settings.js +163 -0
- package/dist/wrangler/bundle.d.ts +10 -0
- package/dist/wrangler/bundle.js +27 -0
- package/dist/wrangler/index.d.ts +3 -0
- package/dist/wrangler/index.js +3 -0
- package/dist/wrangler/process.d.ts +15 -0
- package/dist/wrangler/process.js +113 -0
- package/dist/wrangler/type-generation.d.ts +6 -0
- package/dist/wrangler/type-generation.js +19 -0
- package/package.json +36 -14
- package/template/astrale.config.ts +42 -36
- package/dist/build/artifact.d.ts +0 -8
- package/dist/build/artifact.js +0 -179
- package/dist/build/codegen/gateway.d.ts +0 -1
- package/dist/build/codegen/gateway.js +0 -7
- package/dist/build/frontend-v1.d.ts +0 -16
- package/dist/build/frontend-v1.js +0 -133
- package/dist/build/parse-output.d.ts +0 -26
- package/dist/build/parse-output.js +0 -57
- package/dist/build/wrangler-cli.d.ts +0 -105
- package/dist/build/wrangler-cli.js +0 -448
- package/dist/deploy/deploy.d.ts +0 -17
- package/dist/deploy/deploy.js +0 -207
- package/dist/deploy/index.d.ts +0 -1
- package/dist/deploy/index.js +0 -1
- package/dist/identity/secret.d.ts +0 -3
- package/dist/identity/secret.js +0 -7
- package/dist/identity/source.d.ts +0 -26
- package/dist/identity/source.js +0 -98
- package/dist/release/namespace.d.ts +0 -2
- package/dist/release/namespace.js +0 -6
- package/dist/release/target.d.ts +0 -2
- package/dist/release/target.js +0 -9
- package/dist/worker/gateway.d.ts +0 -15
- package/dist/worker/gateway.js +0 -26
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SIGNING_IDENTITY_BINDING } from './binding.js';
|
|
2
|
-
export interface SigningIdentitySource {
|
|
3
|
-
readonly binding: typeof SIGNING_IDENTITY_BINDING;
|
|
4
|
-
readonly path: string;
|
|
5
|
-
readonly secret: string;
|
|
6
|
-
readonly keyId: string;
|
|
7
|
-
}
|
|
8
|
-
export interface SigningIdentityInput {
|
|
9
|
-
readonly projectDir: string;
|
|
10
|
-
readonly origin: string;
|
|
11
|
-
readonly source?: string;
|
|
12
|
-
readonly mode: 'local' | 'deploy';
|
|
13
|
-
}
|
|
14
|
-
/** Resolve one admitted execution identity for local or remote provider custody. */
|
|
15
|
-
export declare function signingIdentity(input: SigningIdentityInput): Promise<SigningIdentitySource>;
|
|
16
|
-
/**
|
|
17
|
-
* Read an explicitly retained deployment identity. Deployment never generates
|
|
18
|
-
* one: a missing file is a pre-provider configuration failure, not an implicit
|
|
19
|
-
* key rotation.
|
|
20
|
-
*/
|
|
21
|
-
export declare function readSigningIdentity(projectDir: string, declaration: string | undefined): Promise<SigningIdentitySource>;
|
|
22
|
-
/**
|
|
23
|
-
* Resolve local development identity. The default is generated once inside
|
|
24
|
-
* `.astrale`; an explicit source is always read-only and must already exist.
|
|
25
|
-
*/
|
|
26
|
-
export declare function localSigningIdentity(projectDir: string, declaration: string | undefined, origin: string): Promise<SigningIdentitySource>;
|
package/dist/identity/source.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
4
|
-
import { SIGNING_IDENTITY_BINDING } from './binding.js';
|
|
5
|
-
import { admitSigningIdentity, createSigningIdentity } from './material.js';
|
|
6
|
-
const DEFAULT_IDENTITY = join('.astrale', 'identity.json');
|
|
7
|
-
/** Resolve one admitted execution identity for local or remote provider custody. */
|
|
8
|
-
export function signingIdentity(input) {
|
|
9
|
-
return input.mode === 'local'
|
|
10
|
-
? localSigningIdentity(input.projectDir, input.source, input.origin)
|
|
11
|
-
: readSigningIdentity(input.projectDir, input.source);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Read an explicitly retained deployment identity. Deployment never generates
|
|
15
|
-
* one: a missing file is a pre-provider configuration failure, not an implicit
|
|
16
|
-
* key rotation.
|
|
17
|
-
*/
|
|
18
|
-
export async function readSigningIdentity(projectDir, declaration) {
|
|
19
|
-
if (declaration === undefined || declaration.length === 0) {
|
|
20
|
-
throw new TypeError("Cloudflare deployment requires 'signingIdentity: <private-jwk-file>'. " +
|
|
21
|
-
'Run local development once to create .astrale/identity.json, then retain that file in managed secret storage.');
|
|
22
|
-
}
|
|
23
|
-
return readSource(pathOf(projectDir, declaration), declaration);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Resolve local development identity. The default is generated once inside
|
|
27
|
-
* `.astrale`; an explicit source is always read-only and must already exist.
|
|
28
|
-
*/
|
|
29
|
-
export async function localSigningIdentity(projectDir, declaration, origin) {
|
|
30
|
-
if (declaration !== undefined)
|
|
31
|
-
return readSource(pathOf(projectDir, declaration), declaration);
|
|
32
|
-
const path = join(projectDir, DEFAULT_IDENTITY);
|
|
33
|
-
if (!existsSync(path)) {
|
|
34
|
-
const legacy = join(projectDir, '.astrale', 'identity.ts');
|
|
35
|
-
if (existsSync(legacy))
|
|
36
|
-
await migrateLegacyIdentity(legacy, path, origin);
|
|
37
|
-
else
|
|
38
|
-
await generateIdentity(path);
|
|
39
|
-
}
|
|
40
|
-
return readSource(path, DEFAULT_IDENTITY);
|
|
41
|
-
}
|
|
42
|
-
async function generateIdentity(path) {
|
|
43
|
-
const value = await createSigningIdentity();
|
|
44
|
-
await mkdir(dirname(path), { recursive: true });
|
|
45
|
-
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
|
|
46
|
-
process.stderr.write(`\x1b[33m!\x1b[0m new signing identity generated at .astrale/identity.json (kid ${value.kid}).\n` +
|
|
47
|
-
` Retain it in managed secret storage before deploying; remote deploy fails closed without an explicit identity file.\n`);
|
|
48
|
-
}
|
|
49
|
-
async function migrateLegacyIdentity(legacy, destination, origin) {
|
|
50
|
-
const source = await readFile(legacy, 'utf8');
|
|
51
|
-
const match = /export const PRIVATE_JWK = (\{[\s\S]*\}) as const\n?$/u.exec(source);
|
|
52
|
-
if (match?.[1] === undefined)
|
|
53
|
-
throw invalidIdentity(legacy);
|
|
54
|
-
let decoded;
|
|
55
|
-
try {
|
|
56
|
-
decoded = JSON.parse(match[1]);
|
|
57
|
-
}
|
|
58
|
-
catch (cause) {
|
|
59
|
-
throw invalidIdentity(legacy, cause);
|
|
60
|
-
}
|
|
61
|
-
const value = await admitSigningIdentity(decoded, legacy, `${origin}-key`);
|
|
62
|
-
await mkdir(dirname(destination), { recursive: true });
|
|
63
|
-
await writeFile(destination, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
|
|
64
|
-
process.stderr.write(`\x1b[33m!\x1b[0m migrated .astrale/identity.ts to secret-backed .astrale/identity.json (kid ${value.kid}).\n`);
|
|
65
|
-
}
|
|
66
|
-
async function readSource(path, declaration) {
|
|
67
|
-
let source;
|
|
68
|
-
try {
|
|
69
|
-
source = await readFile(path, 'utf8');
|
|
70
|
-
}
|
|
71
|
-
catch (cause) {
|
|
72
|
-
if (!(cause instanceof Error && 'code' in cause && cause.code === 'ENOENT'))
|
|
73
|
-
throw cause;
|
|
74
|
-
throw new TypeError(`Cloudflare signing identity '${declaration}' is missing at ${path}.`, {
|
|
75
|
-
cause,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
let decoded;
|
|
79
|
-
try {
|
|
80
|
-
decoded = JSON.parse(source);
|
|
81
|
-
}
|
|
82
|
-
catch (cause) {
|
|
83
|
-
throw invalidIdentity(declaration, cause);
|
|
84
|
-
}
|
|
85
|
-
const value = await admitSigningIdentity(decoded, declaration);
|
|
86
|
-
return Object.freeze({
|
|
87
|
-
binding: SIGNING_IDENTITY_BINDING,
|
|
88
|
-
path,
|
|
89
|
-
secret: JSON.stringify(value),
|
|
90
|
-
keyId: value.kid,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function pathOf(projectDir, declaration) {
|
|
94
|
-
return isAbsolute(declaration) ? declaration : resolve(projectDir, declaration);
|
|
95
|
-
}
|
|
96
|
-
function invalidIdentity(owner, cause) {
|
|
97
|
-
return new TypeError(`Cloudflare signing identity '${owner}' is not a private Ed25519 JWK.`, cause === undefined ? undefined : { cause });
|
|
98
|
-
}
|
package/dist/release/target.d.ts
DELETED
package/dist/release/target.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const REVISION = /^sha256:([0-9a-f]{64})$/u;
|
|
2
|
-
/** Exact Schema revisions select stable Workers inside the private namespace. */
|
|
3
|
-
export function releaseWorkerName(revision) {
|
|
4
|
-
const digest = REVISION.exec(revision)?.[1];
|
|
5
|
-
if (digest === undefined)
|
|
6
|
-
throw new TypeError('Cloudflare Release revision is invalid.');
|
|
7
|
-
const encoded = BigInt(`0x${digest}`).toString(36).padStart(50, '0');
|
|
8
|
-
return `r-${encoded}`;
|
|
9
|
-
}
|
package/dist/worker/gateway.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Revision } from '@astrale-os/sdk/schema';
|
|
2
|
-
export interface DispatchNamespace {
|
|
3
|
-
get(name: string): {
|
|
4
|
-
fetch(request: Request): Response | Promise<Response>;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
export interface CloudflareGatewayBindings {
|
|
8
|
-
readonly RELEASES: DispatchNamespace;
|
|
9
|
-
}
|
|
10
|
-
/** Stable public Worker that selects one exact immutable Schema-revision Service. */
|
|
11
|
-
export declare function cloudflareGatewayEntry(config: {
|
|
12
|
-
readonly current: Revision;
|
|
13
|
-
}): {
|
|
14
|
-
fetch(request: Request, bindings: CloudflareGatewayBindings): Promise<Response>;
|
|
15
|
-
};
|
package/dist/worker/gateway.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { releaseUnavailable, requestedRevision } from '@astrale-os/sdk/deployment/release/runtime';
|
|
2
|
-
import { releaseWorkerName } from '../release/target.js';
|
|
3
|
-
/** Stable public Worker that selects one exact immutable Schema-revision Service. */
|
|
4
|
-
export function cloudflareGatewayEntry(config) {
|
|
5
|
-
const current = releaseWorkerName(config.current);
|
|
6
|
-
return Object.freeze({
|
|
7
|
-
async fetch(request, bindings) {
|
|
8
|
-
const revision = requestedRevision(new URL(request.url).pathname);
|
|
9
|
-
const target = revision === undefined ? current : releaseWorkerName(revision);
|
|
10
|
-
let worker;
|
|
11
|
-
try {
|
|
12
|
-
worker = bindings.RELEASES.get(target);
|
|
13
|
-
}
|
|
14
|
-
catch (cause) {
|
|
15
|
-
if (isMissingWorker(cause))
|
|
16
|
-
return releaseUnavailable();
|
|
17
|
-
throw cause;
|
|
18
|
-
}
|
|
19
|
-
return worker.fetch(request);
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/** Admit only Cloudflare's documented missing-script failure at the provider boundary. */
|
|
24
|
-
function isMissingWorker(cause) {
|
|
25
|
-
return cause instanceof Error && /^Worker not found(?:\b|:)/iu.test(cause.message);
|
|
26
|
-
}
|