@astrale-domains/services 0.5.1 → 0.6.0
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 +149 -51
- package/dist/scaffold/create-service.mjs +94 -0
- package/dist/scaffold/template/.env.example +4 -0
- package/dist/scaffold/template/README.md +75 -0
- package/dist/scaffold/template/gitignore +6 -0
- package/dist/scaffold/template/scripts/build.mjs +20 -0
- package/dist/scaffold/template/scripts/deploy.mjs +65 -0
- package/dist/scaffold/template/scripts/service.mjs +69 -0
- package/dist/scaffold/template/src/account.js +31 -0
- package/dist/scaffold/template/src/index.js +50 -0
- package/dist/scaffold/template/src/job.js +22 -0
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/modules/deployment/classes/cloudflare-deployment.d.ts +41 -20
- package/dist/schema/modules/deployment/classes/deployment.d.ts +54 -25
- package/dist/schema/modules/deployment/classes/deployment.js +20 -9
- package/dist/schema/modules/deployment/functions/retire-deployment.d.ts +5 -5
- package/dist/schema/modules/deployment/index.d.ts +2 -2
- package/dist/schema/modules/deployment/index.js +1 -1
- package/dist/schema/modules/deployment/types/deployment-hosting.d.ts +19 -49
- package/dist/schema/modules/deployment/types/deployment-hosting.js +10 -10
- package/dist/schema/modules/deployment/types/deployment-request.d.ts +45 -93
- package/dist/schema/modules/deployment/types/deployment-request.js +60 -30
- package/dist/schema/modules/deployment/types/deployment-response.d.ts +14 -22
- package/dist/schema/modules/deployment/types/deployment-response.js +5 -2
- package/dist/schema/modules/deployment/types/deployment-secret.d.ts +2 -2
- package/dist/schema/modules/deployment/types/deployment-secret.js +2 -2
- package/dist/schema/modules/deployment/types/deployment-summary.d.ts +13 -112
- package/dist/schema/modules/deployment/types/deployment-summary.js +16 -18
- package/dist/schema/modules/deployment/types/index.d.ts +10 -12
- package/dist/schema/modules/deployment/types/index.js +5 -6
- package/dist/schema/modules/deployment/types/{frozen-configuration.d.ts → legacy-deployment.d.ts} +24 -11
- package/dist/schema/modules/deployment/types/{frozen-configuration.js → legacy-deployment.js} +34 -10
- package/dist/schema/modules/deployment/types/legacy-migration.d.ts +17 -0
- package/dist/schema/modules/deployment/types/legacy-migration.js +17 -0
- package/dist/schema/modules/deployment/types/worker-configuration.d.ts +21 -0
- package/dist/schema/modules/deployment/types/worker-configuration.js +21 -0
- package/dist/schema/modules/deployment/types/worker-record.d.ts +12 -0
- package/dist/schema/modules/deployment/types/worker-record.js +15 -0
- package/dist/schema/modules/service/classes/cloudflare-service.d.ts +72 -135
- package/dist/schema/modules/service/classes/cloudflare-service.js +6 -1
- package/dist/schema/modules/service/classes/service.d.ts +17 -7
- package/dist/schema/modules/service/classes/service.js +14 -8
- package/dist/schema/modules/service/functions/deploy-service.d.ts +44 -100
- package/dist/schema/modules/service/functions/deploy-service.js +6 -5
- package/dist/schema/modules/service/functions/describe-hosting.d.ts +0 -1
- package/dist/schema/modules/service/functions/index.d.ts +1 -0
- package/dist/schema/modules/service/functions/index.js +1 -0
- package/dist/schema/modules/service/functions/list-service-deployments.d.ts +12 -36
- package/dist/schema/modules/service/functions/migrate-legacy-deployments.d.ts +17 -0
- package/dist/schema/modules/service/functions/migrate-legacy-deployments.js +15 -0
- package/dist/schema/modules/service/functions/promote-service.d.ts +2 -2
- package/dist/schema/modules/service/functions/set-service-secret.d.ts +2 -2
- package/dist/schema/modules/service/functions/transfer-service.d.ts +2 -2
- package/dist/schema/modules/service/index.d.ts +1 -1
- package/dist/schema/modules/service/index.js +1 -1
- package/dist/schema/schema.d.ts +158 -177
- package/package.json +11 -7
- package/dist/schema/modules/deployment/types/content/index.d.ts +0 -1
- package/dist/schema/modules/deployment/types/content/index.js +0 -1
- package/dist/schema/modules/deployment/types/content/limits.d.ts +0 -7
- package/dist/schema/modules/deployment/types/content/limits.js +0 -7
- package/dist/schema/modules/deployment/types/deployment-record.d.ts +0 -35
- package/dist/schema/modules/deployment/types/deployment-record.js +0 -31
- package/dist/schema/modules/deployment/types/service-deployment-artifact-module.d.ts +0 -26
- package/dist/schema/modules/deployment/types/service-deployment-artifact-module.js +0 -10
- package/dist/schema/modules/deployment/types/service-deployment-assets.d.ts +0 -49
- package/dist/schema/modules/deployment/types/service-deployment-assets.js +0 -16
- package/dist/schema/modules/deployment/types/service-deployment-content.d.ts +0 -19
- package/dist/schema/modules/deployment/types/service-deployment-content.js +0 -24
package/dist/schema/modules/deployment/types/{frozen-configuration.d.ts → legacy-deployment.d.ts}
RENAMED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
* its build: the author's plain variables, the execution settings and the durable Workflow options
|
|
5
|
-
* it declares, the runtime, the services and dispatch namespaces it binds and the names of the
|
|
6
|
-
* secrets it binds, never their values. Its digest and the build digest make the deployment's
|
|
7
|
-
* address. This shape only bounds what a request and the graph carry; the SDK's
|
|
8
|
-
* `configurationDigest` admits its canonical form, and a hosted deployment's admission decides
|
|
9
|
-
* which bindings Services hosts (`acceptDeploymentRequest`).
|
|
10
|
-
*/
|
|
11
|
-
export declare const frozenConfiguration: z.ZodObject<{
|
|
2
|
+
/** The `FrozenConfigurationV1` a legacy deployment stores. */
|
|
3
|
+
export declare const legacyFrozenConfiguration: z.ZodObject<{
|
|
12
4
|
format: z.ZodLiteral<"astrale.deployment.configuration">;
|
|
13
5
|
version: z.ZodLiteral<1>;
|
|
14
6
|
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
@@ -49,4 +41,25 @@ export declare const frozenConfiguration: z.ZodObject<{
|
|
|
49
41
|
minLabels: z.ZodNumber;
|
|
50
42
|
}, z.core.$strict>]>;
|
|
51
43
|
}, z.core.$strict>;
|
|
52
|
-
|
|
44
|
+
/** The `DeploymentRecordV1` a legacy deployment stores, as its deployer declared it. */
|
|
45
|
+
export declare const legacyDeploymentRecord: z.ZodObject<{
|
|
46
|
+
format: z.ZodLiteral<"astrale.deployment-record">;
|
|
47
|
+
version: z.ZodLiteral<1>;
|
|
48
|
+
origin: z.ZodString;
|
|
49
|
+
environment: z.ZodString;
|
|
50
|
+
releaseDigest: z.ZodString;
|
|
51
|
+
buildDigest: z.ZodString;
|
|
52
|
+
schemaRevision: z.ZodString;
|
|
53
|
+
configuration: z.ZodString;
|
|
54
|
+
providerScript: z.ZodString;
|
|
55
|
+
commit: z.ZodNullable<z.ZodObject<{
|
|
56
|
+
sha: z.ZodString;
|
|
57
|
+
dirty: z.ZodBoolean;
|
|
58
|
+
base: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
version: z.ZodString;
|
|
60
|
+
distance: z.ZodNumber;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
}, z.core.$strict>>;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
export type LegacyFrozenConfiguration = z.output<typeof legacyFrozenConfiguration>;
|
|
65
|
+
export type LegacyDeploymentRecord = z.output<typeof legacyDeploymentRecord>;
|
package/dist/schema/modules/deployment/types/{frozen-configuration.js → legacy-deployment.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { fullMatch } from '@astrale-os/sdk/schema';
|
|
1
2
|
import { z } from 'zod';
|
|
3
|
+
/*
|
|
4
|
+
* LEGACY — what a deployment created before Services hosted any Worker stores: the Domain's
|
|
5
|
+
* `FrozenConfigurationV1` in `configuration` and its `DeploymentRecordV1` in `record`. Nothing
|
|
6
|
+
* writes them any more: `CloudflareService.migrate` rewrites each one as a Worker deployment, and
|
|
7
|
+
* the next Schema revision drops these shapes.
|
|
8
|
+
*/
|
|
2
9
|
const name = z.string().min(1).max(128);
|
|
3
10
|
const positive = z.number().int().min(1);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* it declares, the runtime, the services and dispatch namespaces it binds and the names of the
|
|
8
|
-
* secrets it binds, never their values. Its digest and the build digest make the deployment's
|
|
9
|
-
* address. This shape only bounds what a request and the graph carry; the SDK's
|
|
10
|
-
* `configurationDigest` admits its canonical form, and a hosted deployment's admission decides
|
|
11
|
-
* which bindings Services hosts (`acceptDeploymentRequest`).
|
|
12
|
-
*/
|
|
13
|
-
export const frozenConfiguration = z.strictObject({
|
|
11
|
+
const digest = z.string().check(fullMatch('sha256:[0-9a-f]{64}'));
|
|
12
|
+
/** The `FrozenConfigurationV1` a legacy deployment stores. */
|
|
13
|
+
export const legacyFrozenConfiguration = z.strictObject({
|
|
14
14
|
format: z.literal('astrale.deployment.configuration'),
|
|
15
15
|
version: z.literal(1),
|
|
16
16
|
vars: z.record(name, z.string().max(64 * 1024)),
|
|
@@ -53,3 +53,27 @@ export const frozenConfiguration = z.strictObject({
|
|
|
53
53
|
}),
|
|
54
54
|
]),
|
|
55
55
|
});
|
|
56
|
+
/** The `DeploymentRecordV1` a legacy deployment stores, as its deployer declared it. */
|
|
57
|
+
export const legacyDeploymentRecord = z.strictObject({
|
|
58
|
+
format: z.literal('astrale.deployment-record'),
|
|
59
|
+
version: z.literal(1),
|
|
60
|
+
origin: z.string().min(1).max(253),
|
|
61
|
+
environment: z.string().min(1).max(63),
|
|
62
|
+
releaseDigest: digest,
|
|
63
|
+
buildDigest: digest,
|
|
64
|
+
schemaRevision: digest,
|
|
65
|
+
configuration: digest,
|
|
66
|
+
providerScript: z.string().min(1).max(57),
|
|
67
|
+
commit: z
|
|
68
|
+
.strictObject({
|
|
69
|
+
sha: z.string().check(fullMatch('[0-9a-fA-F]{40}')),
|
|
70
|
+
dirty: z.boolean(),
|
|
71
|
+
base: z
|
|
72
|
+
.strictObject({
|
|
73
|
+
version: z.string().min(1).max(256),
|
|
74
|
+
distance: z.number().int().min(0),
|
|
75
|
+
})
|
|
76
|
+
.optional(),
|
|
77
|
+
})
|
|
78
|
+
.nullable(),
|
|
79
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const migrateLegacyInput: z.ZodObject<{}, z.core.$strict>;
|
|
3
|
+
/**
|
|
4
|
+
* What one migration rewrote: the Services whose `origin` became their `project`, and the
|
|
5
|
+
* deployments whose Domain configuration and record became a Worker configuration and an opaque
|
|
6
|
+
* record. A rerun rewrites nothing more. `unconverted` names the deployments it could not rewrite,
|
|
7
|
+
* which stay as they are for the operator to inspect.
|
|
8
|
+
*/
|
|
9
|
+
export declare const migrateLegacyOutput: z.ZodObject<{
|
|
10
|
+
services: z.ZodNumber;
|
|
11
|
+
deployments: z.ZodNumber;
|
|
12
|
+
unconverted: z.ZodArray<z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
reason: z.ZodString;
|
|
15
|
+
}, z.core.$strict>>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export type MigrateLegacyResult = z.output<typeof migrateLegacyOutput>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/*
|
|
3
|
+
* LEGACY — the transition of the deployments created before Services hosted any Worker. Removed
|
|
4
|
+
* with the legacy shapes once every node is migrated.
|
|
5
|
+
*/
|
|
6
|
+
export const migrateLegacyInput = z.strictObject({});
|
|
7
|
+
/**
|
|
8
|
+
* What one migration rewrote: the Services whose `origin` became their `project`, and the
|
|
9
|
+
* deployments whose Domain configuration and record became a Worker configuration and an opaque
|
|
10
|
+
* record. A rerun rewrites nothing more. `unconverted` names the deployments it could not rewrite,
|
|
11
|
+
* which stay as they are for the operator to inspect.
|
|
12
|
+
*/
|
|
13
|
+
export const migrateLegacyOutput = z.strictObject({
|
|
14
|
+
services: z.number().int().min(0),
|
|
15
|
+
deployments: z.number().int().min(0),
|
|
16
|
+
unconverted: z.array(z.strictObject({ id: z.string().min(1), reason: z.string().max(500) })),
|
|
17
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The `WorkerConfigurationV1` (`@astrale-os/sdk/deployment/worker`) one deployment freezes beside
|
|
4
|
+
* its build: the Workers runtime it runs on, its plain variables, the names of its secrets (never
|
|
5
|
+
* their values) and what it asks of its host: the record it publishes, a signing identity of its
|
|
6
|
+
* own, the router. Its digest and the build digest make the deployment's label. This shape only
|
|
7
|
+
* bounds what a request and the graph carry; the SDK's `acceptWorkerConfiguration` admits its
|
|
8
|
+
* exact canonical form.
|
|
9
|
+
*/
|
|
10
|
+
export declare const workerConfiguration: z.ZodObject<{
|
|
11
|
+
format: z.ZodLiteral<"astrale.worker.configuration">;
|
|
12
|
+
version: z.ZodLiteral<1>;
|
|
13
|
+
compatibilityDate: z.ZodString;
|
|
14
|
+
compatibilityFlags: z.ZodArray<z.ZodString>;
|
|
15
|
+
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
16
|
+
secrets: z.ZodArray<z.ZodString>;
|
|
17
|
+
record: z.ZodBoolean;
|
|
18
|
+
signingIdentity: z.ZodBoolean;
|
|
19
|
+
router: z.ZodBoolean;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type WorkerConfiguration = z.output<typeof workerConfiguration>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const name = z.string().min(1).max(128);
|
|
3
|
+
/**
|
|
4
|
+
* The `WorkerConfigurationV1` (`@astrale-os/sdk/deployment/worker`) one deployment freezes beside
|
|
5
|
+
* its build: the Workers runtime it runs on, its plain variables, the names of its secrets (never
|
|
6
|
+
* their values) and what it asks of its host: the record it publishes, a signing identity of its
|
|
7
|
+
* own, the router. Its digest and the build digest make the deployment's label. This shape only
|
|
8
|
+
* bounds what a request and the graph carry; the SDK's `acceptWorkerConfiguration` admits its
|
|
9
|
+
* exact canonical form.
|
|
10
|
+
*/
|
|
11
|
+
export const workerConfiguration = z.strictObject({
|
|
12
|
+
format: z.literal('astrale.worker.configuration'),
|
|
13
|
+
version: z.literal(1),
|
|
14
|
+
compatibilityDate: z.string().min(10).max(10),
|
|
15
|
+
compatibilityFlags: z.array(name).max(64),
|
|
16
|
+
vars: z.record(name, z.string().max(64 * 1024)),
|
|
17
|
+
secrets: z.array(name).max(64),
|
|
18
|
+
record: z.boolean(),
|
|
19
|
+
signingIdentity: z.boolean(),
|
|
20
|
+
router: z.boolean(),
|
|
21
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The record one deployment publishes (`WorkerRecordWireV1`): opaque bytes, as canonical Base64,
|
|
4
|
+
* and the media type the dispatcher serves them with at `/.well-known/astrale/deployment.json`.
|
|
5
|
+
* Services never reads it: it is the deployer's, and a deployment keeps the record it was created
|
|
6
|
+
* with. The SDK's `decodeWorkerRecord` admits it exactly.
|
|
7
|
+
*/
|
|
8
|
+
export declare const workerRecord: z.ZodObject<{
|
|
9
|
+
contentType: z.ZodString;
|
|
10
|
+
contentBase64: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type WorkerRecordWire = z.output<typeof workerRecord>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WORKER_DEPLOYMENT_LIMITS } from '@astrale-os/sdk/deployment/worker';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The record one deployment publishes (`WorkerRecordWireV1`): opaque bytes, as canonical Base64,
|
|
5
|
+
* and the media type the dispatcher serves them with at `/.well-known/astrale/deployment.json`.
|
|
6
|
+
* Services never reads it: it is the deployer's, and a deployment keeps the record it was created
|
|
7
|
+
* with. The SDK's `decodeWorkerRecord` admits it exactly.
|
|
8
|
+
*/
|
|
9
|
+
export const workerRecord = z.strictObject({
|
|
10
|
+
contentType: z.string().min(3).max(256),
|
|
11
|
+
contentBase64: z
|
|
12
|
+
.string()
|
|
13
|
+
.min(4)
|
|
14
|
+
.max(Math.ceil(WORKER_DEPLOYMENT_LIMITS.recordSize / 3) * 4),
|
|
15
|
+
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* One Service whose deployments are Cloudflare Workers for Platforms scripts: any Cloudflare
|
|
3
|
+
* Worker, an Astrale Domain release or a generic Worker (an API, a cron job) alike.
|
|
4
|
+
*/
|
|
2
5
|
export declare const CloudflareService: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
3
6
|
readonly description: "One Service whose deployments are Cloudflare Workers for Platforms scripts.";
|
|
4
7
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
@@ -8,7 +11,12 @@ export declare const CloudflareService: import("@astrale-os/sdk/schema").Authore
|
|
|
8
11
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
9
12
|
readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Named">, import("@astrale-os/sdk/schema").KernelClass<"Timestamped">];
|
|
10
13
|
readonly properties: {
|
|
11
|
-
|
|
14
|
+
project: import("@astrale-os/sdk/schema").AuthoredProperty<import("zod").ZodString, {
|
|
15
|
+
readonly required: false;
|
|
16
|
+
}>;
|
|
17
|
+
origin: import("@astrale-os/sdk/schema").AuthoredProperty<import("zod").ZodString, {
|
|
18
|
+
readonly required: false;
|
|
19
|
+
}>;
|
|
12
20
|
environment: import("zod").ZodString;
|
|
13
21
|
fingerprint: import("zod").ZodString;
|
|
14
22
|
url: import("zod").ZodString;
|
|
@@ -25,73 +33,30 @@ export declare const CloudflareService: import("@astrale-os/sdk/schema").Authore
|
|
|
25
33
|
}>];
|
|
26
34
|
readonly methods: {
|
|
27
35
|
deploy: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
28
|
-
format: "astrale.
|
|
36
|
+
format: "astrale.worker.deployment-request";
|
|
29
37
|
version: 1;
|
|
30
38
|
owner?: string | undefined;
|
|
31
|
-
|
|
39
|
+
project: string;
|
|
32
40
|
environment: string;
|
|
33
|
-
addressing: "opaque";
|
|
34
41
|
label: string;
|
|
35
42
|
buildDigest: string;
|
|
36
43
|
configuration: {
|
|
37
|
-
format: "astrale.
|
|
44
|
+
format: "astrale.worker.configuration";
|
|
38
45
|
version: 1;
|
|
46
|
+
compatibilityDate: string;
|
|
47
|
+
compatibilityFlags: string[];
|
|
39
48
|
vars: Record<string, string>;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
maximumLifetimeSeconds: number;
|
|
45
|
-
};
|
|
46
|
-
durableOptions?: {
|
|
47
|
-
retentionMs?: number | undefined;
|
|
48
|
-
retry?: {
|
|
49
|
-
initialIntervalMs?: number | undefined;
|
|
50
|
-
maxAttempts?: number | undefined;
|
|
51
|
-
maxIntervalMs?: number | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
stepTimeoutMs?: number | undefined;
|
|
54
|
-
} | undefined;
|
|
55
|
-
};
|
|
56
|
-
runtime: {
|
|
57
|
-
compatibilityDate: string;
|
|
58
|
-
compatibilityFlags: string[];
|
|
59
|
-
};
|
|
60
|
-
bindings: {
|
|
61
|
-
services: {
|
|
62
|
-
name: string;
|
|
63
|
-
service: string;
|
|
64
|
-
}[];
|
|
65
|
-
dispatchNamespaces: {
|
|
66
|
-
name: string;
|
|
67
|
-
namespace: string;
|
|
68
|
-
}[];
|
|
69
|
-
secrets: string[];
|
|
70
|
-
};
|
|
71
|
-
router: false | {
|
|
72
|
-
service: string;
|
|
73
|
-
hostSuffix: string;
|
|
74
|
-
minLabels: number;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
record: {
|
|
78
|
-
releaseDigest: string;
|
|
79
|
-
schemaRevision: string;
|
|
80
|
-
schemaBundle: string;
|
|
81
|
-
commit: {
|
|
82
|
-
sha: string;
|
|
83
|
-
dirty: boolean;
|
|
84
|
-
base?: {
|
|
85
|
-
version: string;
|
|
86
|
-
distance: number;
|
|
87
|
-
} | undefined;
|
|
88
|
-
} | null;
|
|
49
|
+
secrets: string[];
|
|
50
|
+
record: boolean;
|
|
51
|
+
signingIdentity: boolean;
|
|
52
|
+
router: boolean;
|
|
89
53
|
};
|
|
90
|
-
|
|
91
|
-
|
|
54
|
+
worker: {
|
|
55
|
+
manifest: Record<string, unknown>;
|
|
56
|
+
mainModule: string;
|
|
92
57
|
modules: {
|
|
93
58
|
name: string;
|
|
94
|
-
kind
|
|
59
|
+
kind: "data" | "esm" | "text" | "wasm";
|
|
95
60
|
content: {
|
|
96
61
|
encoding: "gzip" | "identity";
|
|
97
62
|
decodedSize: number;
|
|
@@ -103,29 +68,26 @@ export declare const CloudflareService: import("@astrale-os/sdk/schema").Authore
|
|
|
103
68
|
};
|
|
104
69
|
}[];
|
|
105
70
|
assets?: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}[];
|
|
119
|
-
notFound?: "404-page" | "none" | "single-page-application" | undefined;
|
|
120
|
-
runWorkerFirst?: boolean | undefined;
|
|
121
|
-
htmlHandling?: "none" | undefined;
|
|
122
|
-
} | undefined;
|
|
71
|
+
path: string;
|
|
72
|
+
contentType?: string | undefined;
|
|
73
|
+
content: {
|
|
74
|
+
encoding: "gzip" | "identity";
|
|
75
|
+
decodedSize: number;
|
|
76
|
+
contentBase64: string;
|
|
77
|
+
} | {
|
|
78
|
+
encoding: "gzip" | "identity";
|
|
79
|
+
decodedSize: number;
|
|
80
|
+
contentBase64Chunks: string[];
|
|
81
|
+
};
|
|
82
|
+
}[] | undefined;
|
|
123
83
|
};
|
|
84
|
+
record?: {
|
|
85
|
+
contentType: string;
|
|
86
|
+
contentBase64: string;
|
|
87
|
+
} | undefined;
|
|
88
|
+
readiness?: string[] | undefined;
|
|
124
89
|
secrets: Record<string, string>;
|
|
125
90
|
promote?: boolean | undefined;
|
|
126
|
-
readiness?: {
|
|
127
|
-
paths: string[];
|
|
128
|
-
} | undefined;
|
|
129
91
|
}, {
|
|
130
92
|
readonly mode: 'value';
|
|
131
93
|
readonly value: {
|
|
@@ -145,31 +107,20 @@ export declare const CloudflareService: import("@astrale-os/sdk/schema").Authore
|
|
|
145
107
|
label: string;
|
|
146
108
|
serviceId: string;
|
|
147
109
|
service: string;
|
|
110
|
+
project: string;
|
|
111
|
+
environment: string;
|
|
148
112
|
owner: string;
|
|
149
113
|
state: "active" | "deploying" | "failed" | "retired" | "retiring";
|
|
150
114
|
current: boolean;
|
|
151
115
|
createdAt: string;
|
|
152
116
|
retiredAt?: string | undefined;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
buildDigest: string;
|
|
161
|
-
schemaRevision: string;
|
|
162
|
-
configuration: string;
|
|
163
|
-
providerScript: string;
|
|
164
|
-
commit: {
|
|
165
|
-
sha: string;
|
|
166
|
-
dirty: boolean;
|
|
167
|
-
base?: {
|
|
168
|
-
version: string;
|
|
169
|
-
distance: number;
|
|
170
|
-
} | undefined;
|
|
171
|
-
} | null;
|
|
172
|
-
};
|
|
117
|
+
buildDigest: string;
|
|
118
|
+
configuration: string;
|
|
119
|
+
signingKeyId?: string | undefined;
|
|
120
|
+
record?: {
|
|
121
|
+
contentType: string;
|
|
122
|
+
contentBase64: string;
|
|
123
|
+
} | undefined;
|
|
173
124
|
};
|
|
174
125
|
};
|
|
175
126
|
}, "authenticated", true, false, undefined>>;
|
|
@@ -177,60 +128,35 @@ export declare const CloudflareService: import("@astrale-os/sdk/schema").Authore
|
|
|
177
128
|
readonly mode: 'value';
|
|
178
129
|
readonly value: {
|
|
179
130
|
routingDomain: string;
|
|
180
|
-
addressing: "opaque";
|
|
181
131
|
};
|
|
182
132
|
}, "authenticated", true, false, undefined>>;
|
|
183
133
|
list: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
184
|
-
|
|
134
|
+
project?: string | undefined;
|
|
185
135
|
environment?: string | undefined;
|
|
186
136
|
}, {
|
|
187
137
|
readonly mode: 'value';
|
|
188
138
|
readonly value: {
|
|
189
|
-
deployments:
|
|
190
|
-
id: string;
|
|
191
|
-
url: string;
|
|
192
|
-
label: string;
|
|
193
|
-
serviceId: string;
|
|
194
|
-
service: string;
|
|
195
|
-
owner: string;
|
|
196
|
-
state: "active" | "deploying" | "failed" | "retired" | "retiring";
|
|
197
|
-
current: boolean;
|
|
198
|
-
createdAt: string;
|
|
199
|
-
retiredAt?: string | undefined;
|
|
200
|
-
signingKeyId: string;
|
|
201
|
-
record: {
|
|
202
|
-
format: "astrale.deployment-record";
|
|
203
|
-
version: 1;
|
|
204
|
-
origin: string;
|
|
205
|
-
environment: string;
|
|
206
|
-
releaseDigest: string;
|
|
207
|
-
buildDigest: string;
|
|
208
|
-
schemaRevision: string;
|
|
209
|
-
configuration: string;
|
|
210
|
-
providerScript: string;
|
|
211
|
-
commit: {
|
|
212
|
-
sha: string;
|
|
213
|
-
dirty: boolean;
|
|
214
|
-
base?: {
|
|
215
|
-
version: string;
|
|
216
|
-
distance: number;
|
|
217
|
-
} | undefined;
|
|
218
|
-
} | null;
|
|
219
|
-
};
|
|
220
|
-
} | {
|
|
139
|
+
deployments: {
|
|
221
140
|
id: string;
|
|
222
141
|
url: string;
|
|
223
142
|
label: string;
|
|
224
143
|
serviceId: string;
|
|
225
144
|
service: string;
|
|
145
|
+
project: string;
|
|
146
|
+
environment: string;
|
|
226
147
|
owner: string;
|
|
227
148
|
state: "active" | "deploying" | "failed" | "retired" | "retiring";
|
|
228
149
|
current: boolean;
|
|
229
150
|
createdAt: string;
|
|
230
151
|
retiredAt?: string | undefined;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
152
|
+
buildDigest: string;
|
|
153
|
+
configuration: string;
|
|
154
|
+
signingKeyId?: string | undefined;
|
|
155
|
+
record?: {
|
|
156
|
+
contentType: string;
|
|
157
|
+
contentBase64: string;
|
|
158
|
+
} | undefined;
|
|
159
|
+
}[];
|
|
234
160
|
};
|
|
235
161
|
}, "authenticated", true, false, undefined>>;
|
|
236
162
|
promote: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
@@ -314,6 +240,17 @@ export declare const CloudflareService: import("@astrale-os/sdk/schema").Authore
|
|
|
314
240
|
retryAfterMs: number;
|
|
315
241
|
};
|
|
316
242
|
}, "authenticated", false, false, undefined>>;
|
|
243
|
+
migrate: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
244
|
+
readonly mode: 'value';
|
|
245
|
+
readonly value: {
|
|
246
|
+
services: number;
|
|
247
|
+
deployments: number;
|
|
248
|
+
unconverted: {
|
|
249
|
+
id: string;
|
|
250
|
+
reason: string;
|
|
251
|
+
}[];
|
|
252
|
+
};
|
|
253
|
+
}, "authorized", true, false, undefined>>;
|
|
317
254
|
};
|
|
318
255
|
readonly policies: {
|
|
319
256
|
read: () => import("@astrale-os/sdk/schema").Policy;
|
|
@@ -7,13 +7,17 @@ import { listServiceDeployments } from '../functions/list-service-deployments.js
|
|
|
7
7
|
import { listServiceLogs } from '../functions/list-service-logs.js';
|
|
8
8
|
import { listServiceSchedules } from '../functions/list-service-schedules.js';
|
|
9
9
|
import { listServiceSecretNames } from '../functions/list-service-secret-names.js';
|
|
10
|
+
import { migrateLegacyDeployments } from '../functions/migrate-legacy-deployments.js';
|
|
10
11
|
import { promoteService } from '../functions/promote-service.js';
|
|
11
12
|
import { replaceServiceSchedules } from '../functions/replace-service-schedules.js';
|
|
12
13
|
import { setServiceSecret } from '../functions/set-service-secret.js';
|
|
13
14
|
import { transferService } from '../functions/transfer-service.js';
|
|
14
15
|
import { OwnService } from '../policies/own-service.js';
|
|
15
16
|
import { Service } from './service.js';
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* One Service whose deployments are Cloudflare Workers for Platforms scripts: any Cloudflare
|
|
19
|
+
* Worker, an Astrale Domain release or a generic Worker (an API, a cron job) alike.
|
|
20
|
+
*/
|
|
17
21
|
export const CloudflareService = nodeClass({
|
|
18
22
|
description: 'One Service whose deployments are Cloudflare Workers for Platforms scripts.',
|
|
19
23
|
icon: classIcon.lucide(CloudCog),
|
|
@@ -30,6 +34,7 @@ export const CloudflareService = nodeClass({
|
|
|
30
34
|
schedules: listServiceSchedules,
|
|
31
35
|
logs: listServiceLogs,
|
|
32
36
|
delete: deleteService,
|
|
37
|
+
migrate: migrateLegacyDeployments,
|
|
33
38
|
},
|
|
34
39
|
policies: { read: () => OwnService },
|
|
35
40
|
});
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
* One
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* of the Service and the prefix of each
|
|
7
|
-
* once the Service is deleted.
|
|
3
|
+
* One Service: the stable identity of one project in one environment, owned by one Identity,
|
|
4
|
+
* whatever its Worker serves (an Astrale Domain release, an API, a cron job). Every deploy adds an
|
|
5
|
+
* immutable Deployment of it, and its URL serves the one it currently points at. Its `name` is the
|
|
6
|
+
* SDK's `serviceName(project, environment)`: the DNS label of the Service and the prefix of each
|
|
7
|
+
* deployment's label, unique among Services, and free again once the Service is deleted.
|
|
8
|
+
*
|
|
9
|
+
* LEGACY: a Service created before Services hosted any Worker names its project `origin` until
|
|
10
|
+
* `CloudflareService.migrate` renames it; the next Schema revision requires `project`.
|
|
8
11
|
*/
|
|
9
12
|
export declare const Service: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
|
|
10
13
|
readonly abstract: true;
|
|
@@ -12,9 +15,16 @@ export declare const Service: import("@astrale-os/sdk/schema").AuthoredNodeClass
|
|
|
12
15
|
readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
|
|
13
16
|
readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Named">, import("@astrale-os/sdk/schema").KernelClass<"Timestamped">];
|
|
14
17
|
readonly properties: {
|
|
15
|
-
origin
|
|
18
|
+
/** Any project name; a Domain deployer names its Domain's origin. */
|
|
19
|
+
project: import("@astrale-os/sdk/schema").AuthoredProperty<z.ZodString, {
|
|
20
|
+
readonly required: false;
|
|
21
|
+
}>;
|
|
22
|
+
/** LEGACY: the project of a Service created before Services hosted any Worker. */
|
|
23
|
+
origin: import("@astrale-os/sdk/schema").AuthoredProperty<z.ZodString, {
|
|
24
|
+
readonly required: false;
|
|
25
|
+
}>;
|
|
16
26
|
environment: z.ZodString;
|
|
17
|
-
/**
|
|
27
|
+
/** `serviceName(project, environment)`, 16 characters; it alone identifies the Service. */
|
|
18
28
|
fingerprint: z.ZodString;
|
|
19
29
|
/** `https://<name>.<routing domain>`: always serves the current deployment. */
|
|
20
30
|
url: z.ZodString;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { classIcon, fullMatch, K, nodeClass, stateProperty } from '@astrale-os/sdk/schema';
|
|
1
|
+
import { classIcon, fullMatch, K, nodeClass, property, stateProperty } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { Server } from '@astrale-os/sdk/schema/icons';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { serviceLifecycle } from '../states/index.js';
|
|
5
5
|
/**
|
|
6
|
-
* One
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* of the Service and the prefix of each
|
|
10
|
-
* once the Service is deleted.
|
|
6
|
+
* One Service: the stable identity of one project in one environment, owned by one Identity,
|
|
7
|
+
* whatever its Worker serves (an Astrale Domain release, an API, a cron job). Every deploy adds an
|
|
8
|
+
* immutable Deployment of it, and its URL serves the one it currently points at. Its `name` is the
|
|
9
|
+
* SDK's `serviceName(project, environment)`: the DNS label of the Service and the prefix of each
|
|
10
|
+
* deployment's label, unique among Services, and free again once the Service is deleted.
|
|
11
|
+
*
|
|
12
|
+
* LEGACY: a Service created before Services hosted any Worker names its project `origin` until
|
|
13
|
+
* `CloudflareService.migrate` renames it; the next Schema revision requires `project`.
|
|
11
14
|
*/
|
|
12
15
|
export const Service = nodeClass({
|
|
13
16
|
abstract: true,
|
|
@@ -15,9 +18,12 @@ export const Service = nodeClass({
|
|
|
15
18
|
icon: classIcon.lucide(Server),
|
|
16
19
|
extends: [K.classes.Named, K.classes.Timestamped],
|
|
17
20
|
properties: {
|
|
18
|
-
origin
|
|
21
|
+
/** Any project name; a Domain deployer names its Domain's origin. */
|
|
22
|
+
project: property(z.string().min(1).max(253), { required: false }),
|
|
23
|
+
/** LEGACY: the project of a Service created before Services hosted any Worker. */
|
|
24
|
+
origin: property(z.string().min(1).max(253), { required: false }),
|
|
19
25
|
environment: z.string().min(1).max(63),
|
|
20
|
-
/**
|
|
26
|
+
/** `serviceName(project, environment)`, 16 characters; it alone identifies the Service. */
|
|
21
27
|
fingerprint: z.string().check(fullMatch('[a-z2-7]{16}')),
|
|
22
28
|
/** `https://<name>.<routing domain>`: always serves the current deployment. */
|
|
23
29
|
url: z.string().min(1).max(2_048),
|