@astrale-domains/services 0.5.0 → 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
|
@@ -1,84 +1,43 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
* `
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* `WorkerDeploymentRequestV1` (`@astrale-os/sdk/deployment/worker`): one Cloudflare Worker release
|
|
4
|
+
* to host as a deployment of the Service of its project and environment, whatever it serves. This
|
|
5
|
+
* shape only bounds what the request carries: Services decodes it with the SDK's
|
|
6
|
+
* `decodeWorkerDeploymentRequest`, which recomputes the build digest from the uploaded bytes and
|
|
7
|
+
* the label from the Service name, the build and the configuration, and refuses a request that
|
|
8
|
+
* states another. The secrets are bound to a new deployment only, or rewritten in place on the one
|
|
9
|
+
* the label already names; Services never keeps a value.
|
|
8
10
|
*/
|
|
9
11
|
export declare const deploymentRequest: z.ZodObject<{
|
|
10
|
-
format: z.ZodLiteral<"astrale.
|
|
12
|
+
format: z.ZodLiteral<"astrale.worker.deployment-request">;
|
|
11
13
|
version: z.ZodLiteral<1>;
|
|
12
14
|
owner: z.ZodOptional<z.ZodString>;
|
|
13
|
-
|
|
15
|
+
project: z.ZodString;
|
|
14
16
|
environment: z.ZodString;
|
|
15
|
-
addressing: z.ZodLiteral<"opaque">;
|
|
16
17
|
label: z.ZodString;
|
|
17
18
|
buildDigest: z.ZodString;
|
|
18
19
|
configuration: z.ZodObject<{
|
|
19
|
-
format: z.ZodLiteral<"astrale.
|
|
20
|
+
format: z.ZodLiteral<"astrale.worker.configuration">;
|
|
20
21
|
version: z.ZodLiteral<1>;
|
|
22
|
+
compatibilityDate: z.ZodString;
|
|
23
|
+
compatibilityFlags: z.ZodArray<z.ZodString>;
|
|
21
24
|
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
maximumLifetimeSeconds: z.ZodNumber;
|
|
27
|
-
}, z.core.$strict>]>;
|
|
28
|
-
durableOptions: z.ZodOptional<z.ZodObject<{
|
|
29
|
-
retentionMs: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
retry: z.ZodOptional<z.ZodObject<{
|
|
31
|
-
initialIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
33
|
-
maxIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
34
|
-
}, z.core.$strict>>;
|
|
35
|
-
stepTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
36
|
-
}, z.core.$strict>>;
|
|
37
|
-
}, z.core.$strict>;
|
|
38
|
-
runtime: z.ZodObject<{
|
|
39
|
-
compatibilityDate: z.ZodString;
|
|
40
|
-
compatibilityFlags: z.ZodArray<z.ZodString>;
|
|
41
|
-
}, z.core.$strict>;
|
|
42
|
-
bindings: z.ZodObject<{
|
|
43
|
-
services: z.ZodArray<z.ZodObject<{
|
|
44
|
-
name: z.ZodString;
|
|
45
|
-
service: z.ZodString;
|
|
46
|
-
}, z.core.$strict>>;
|
|
47
|
-
dispatchNamespaces: z.ZodArray<z.ZodObject<{
|
|
48
|
-
name: z.ZodString;
|
|
49
|
-
namespace: z.ZodString;
|
|
50
|
-
}, z.core.$strict>>;
|
|
51
|
-
secrets: z.ZodArray<z.ZodString>;
|
|
52
|
-
}, z.core.$strict>;
|
|
53
|
-
router: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
54
|
-
service: z.ZodString;
|
|
55
|
-
hostSuffix: z.ZodString;
|
|
56
|
-
minLabels: z.ZodNumber;
|
|
57
|
-
}, z.core.$strict>]>;
|
|
58
|
-
}, z.core.$strict>;
|
|
59
|
-
record: z.ZodObject<{
|
|
60
|
-
releaseDigest: z.ZodString;
|
|
61
|
-
schemaRevision: z.ZodString;
|
|
62
|
-
schemaBundle: z.ZodString;
|
|
63
|
-
commit: z.ZodNullable<z.ZodObject<{
|
|
64
|
-
sha: z.ZodString;
|
|
65
|
-
dirty: z.ZodBoolean;
|
|
66
|
-
base: z.ZodOptional<z.ZodObject<{
|
|
67
|
-
version: z.ZodString;
|
|
68
|
-
distance: z.ZodNumber;
|
|
69
|
-
}, z.core.$strict>>;
|
|
70
|
-
}, z.core.$strict>>;
|
|
25
|
+
secrets: z.ZodArray<z.ZodString>;
|
|
26
|
+
record: z.ZodBoolean;
|
|
27
|
+
signingIdentity: z.ZodBoolean;
|
|
28
|
+
router: z.ZodBoolean;
|
|
71
29
|
}, z.core.$strict>;
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
worker: z.ZodObject<{
|
|
31
|
+
manifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
+
mainModule: z.ZodString;
|
|
74
33
|
modules: z.ZodArray<z.ZodObject<{
|
|
75
34
|
name: z.ZodString;
|
|
76
|
-
kind: z.
|
|
35
|
+
kind: z.ZodEnum<{
|
|
77
36
|
data: "data";
|
|
78
37
|
esm: "esm";
|
|
79
38
|
text: "text";
|
|
80
39
|
wasm: "wasm";
|
|
81
|
-
}
|
|
40
|
+
}>;
|
|
82
41
|
content: z.ZodUnion<readonly [z.ZodObject<{
|
|
83
42
|
encoding: z.ZodEnum<{
|
|
84
43
|
gzip: "gzip";
|
|
@@ -95,39 +54,32 @@ export declare const deploymentRequest: z.ZodObject<{
|
|
|
95
54
|
contentBase64Chunks: z.ZodArray<z.ZodString>;
|
|
96
55
|
}, z.core.$strict>]>;
|
|
97
56
|
}, z.core.$strict>>;
|
|
98
|
-
assets: z.ZodOptional<z.ZodObject<{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}, z.core.$strict>>;
|
|
118
|
-
notFound: z.ZodOptional<z.ZodEnum<{
|
|
119
|
-
"404-page": "404-page";
|
|
120
|
-
none: "none";
|
|
121
|
-
"single-page-application": "single-page-application";
|
|
122
|
-
}>>;
|
|
123
|
-
runWorkerFirst: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
-
htmlHandling: z.ZodOptional<z.ZodLiteral<"none">>;
|
|
125
|
-
}, z.core.$strict>>;
|
|
57
|
+
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
path: z.ZodString;
|
|
59
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
60
|
+
content: z.ZodUnion<readonly [z.ZodObject<{
|
|
61
|
+
encoding: z.ZodEnum<{
|
|
62
|
+
gzip: "gzip";
|
|
63
|
+
identity: "identity";
|
|
64
|
+
}>;
|
|
65
|
+
decodedSize: z.ZodNumber;
|
|
66
|
+
contentBase64: z.ZodString;
|
|
67
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
68
|
+
encoding: z.ZodEnum<{
|
|
69
|
+
gzip: "gzip";
|
|
70
|
+
identity: "identity";
|
|
71
|
+
}>;
|
|
72
|
+
decodedSize: z.ZodNumber;
|
|
73
|
+
contentBase64Chunks: z.ZodArray<z.ZodString>;
|
|
74
|
+
}, z.core.$strict>]>;
|
|
75
|
+
}, z.core.$strict>>>;
|
|
126
76
|
}, z.core.$strict>;
|
|
77
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
contentType: z.ZodString;
|
|
79
|
+
contentBase64: z.ZodString;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
readiness: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
82
|
secrets: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
128
83
|
promote: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
-
readiness: z.ZodOptional<z.ZodObject<{
|
|
130
|
-
paths: z.ZodArray<z.ZodString>;
|
|
131
|
-
}, z.core.$strict>>;
|
|
132
84
|
}, z.core.$strict>;
|
|
133
85
|
export type DeploymentRequest = z.output<typeof deploymentRequest>;
|
|
@@ -1,19 +1,39 @@
|
|
|
1
|
+
import { WORKER_DEPLOYMENT_LIMITS as LIMITS } from '@astrale-os/sdk/deployment/worker';
|
|
1
2
|
import { fullMatch } from '@astrale-os/sdk/schema';
|
|
2
3
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { artifactModule } from './service-deployment-artifact-module.js';
|
|
6
|
-
import { assetBundle } from './service-deployment-assets.js';
|
|
7
|
-
const digest = z.string().check(fullMatch('sha256:[0-9a-f]{64}'));
|
|
4
|
+
import { workerConfiguration } from './worker-configuration.js';
|
|
5
|
+
import { workerRecord } from './worker-record.js';
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
* One file on the wire (`WorkerContentV1`): its bytes as canonical Base64, gzip-compressed or not,
|
|
8
|
+
* in one string or in chunks of one portable Value string each, and their decoded size.
|
|
9
|
+
*/
|
|
10
|
+
function workerContent(base64Size, decodedSize) {
|
|
11
|
+
const envelope = {
|
|
12
|
+
encoding: z.enum(['identity', 'gzip']),
|
|
13
|
+
decodedSize: z.number().int().min(0).max(decodedSize),
|
|
14
|
+
};
|
|
15
|
+
return z.union([
|
|
16
|
+
z.strictObject({ ...envelope, contentBase64: z.string().max(base64Size) }),
|
|
17
|
+
z.strictObject({
|
|
18
|
+
...envelope,
|
|
19
|
+
contentBase64Chunks: z
|
|
20
|
+
.array(z.string().min(1).max(LIMITS.base64ChunkSize))
|
|
21
|
+
.min(1)
|
|
22
|
+
.max(Math.ceil(base64Size / LIMITS.base64ChunkSize)),
|
|
23
|
+
}),
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* `WorkerDeploymentRequestV1` (`@astrale-os/sdk/deployment/worker`): one Cloudflare Worker release
|
|
28
|
+
* to host as a deployment of the Service of its project and environment, whatever it serves. This
|
|
29
|
+
* shape only bounds what the request carries: Services decodes it with the SDK's
|
|
30
|
+
* `decodeWorkerDeploymentRequest`, which recomputes the build digest from the uploaded bytes and
|
|
31
|
+
* the label from the Service name, the build and the configuration, and refuses a request that
|
|
32
|
+
* states another. The secrets are bound to a new deployment only, or rewritten in place on the one
|
|
33
|
+
* the label already names; Services never keeps a value.
|
|
14
34
|
*/
|
|
15
35
|
export const deploymentRequest = z.strictObject({
|
|
16
|
-
format: z.literal('astrale.
|
|
36
|
+
format: z.literal('astrale.worker.deployment-request'),
|
|
17
37
|
version: z.literal(1),
|
|
18
38
|
/**
|
|
19
39
|
* The Identity that owns the Service when this deploy creates it: the caller, or an Identity the
|
|
@@ -21,28 +41,38 @@ export const deploymentRequest = z.strictObject({
|
|
|
21
41
|
* Service, which keeps its owner.
|
|
22
42
|
*/
|
|
23
43
|
owner: z.string().min(1).max(256).optional(),
|
|
24
|
-
origin
|
|
44
|
+
/** Any project name; a Domain deployer names its Domain's origin. */
|
|
45
|
+
project: z.string().min(1).max(253),
|
|
25
46
|
environment: z.string().min(1).max(63),
|
|
26
|
-
/** Services are named by their fingerprint alone. */
|
|
27
|
-
addressing: z.literal('opaque'),
|
|
28
47
|
label: z.string().min(1).max(63),
|
|
29
|
-
buildDigest:
|
|
30
|
-
configuration:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
buildDigest: z.string().check(fullMatch('sha256:[0-9a-f]{64}')),
|
|
49
|
+
configuration: workerConfiguration,
|
|
50
|
+
worker: z.strictObject({
|
|
51
|
+
/** The build manifest members its deployer declares (`format`, `version`, provenance). */
|
|
52
|
+
manifest: z.record(z.string().min(1).max(64), z.unknown()),
|
|
53
|
+
mainModule: z.string().min(1).max(256),
|
|
54
|
+
modules: z
|
|
55
|
+
.array(z.strictObject({
|
|
56
|
+
name: z.string().min(1).max(256),
|
|
57
|
+
kind: z.enum(['esm', 'wasm', 'text', 'data']),
|
|
58
|
+
content: workerContent(LIMITS.moduleBase64Size, LIMITS.moduleSize),
|
|
59
|
+
}))
|
|
60
|
+
.min(1)
|
|
61
|
+
.max(LIMITS.modules),
|
|
62
|
+
assets: z
|
|
63
|
+
.array(z.strictObject({
|
|
64
|
+
path: z.string().min(1).max(2_048),
|
|
65
|
+
contentType: z.string().min(1).max(256).optional(),
|
|
66
|
+
content: workerContent(LIMITS.assetBase64Size, LIMITS.assetSize),
|
|
67
|
+
}))
|
|
68
|
+
.max(LIMITS.assets)
|
|
69
|
+
.optional(),
|
|
41
70
|
}),
|
|
42
|
-
|
|
71
|
+
/** Exactly when the configuration asks for one: the record the deployment serves. */
|
|
72
|
+
record: workerRecord.optional(),
|
|
73
|
+
/** Local paths that must answer 200 from the uploaded version before it is activated. */
|
|
74
|
+
readiness: z.array(z.string().min(1).max(1_024)).max(LIMITS.readinessPaths).optional(),
|
|
75
|
+
secrets: z.record(z.string().min(1).max(128), z.string().max(LIMITS.valueLength)),
|
|
43
76
|
/** Make the deployment the one the Service serves once it is active; `true` when absent. */
|
|
44
77
|
promote: z.boolean().optional(),
|
|
45
|
-
readiness: z
|
|
46
|
-
.strictObject({ paths: z.array(z.string().min(1).max(1_024)).min(1).max(8) })
|
|
47
|
-
.optional(),
|
|
48
78
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Why Services refused to host one Worker release (`WORKER_DEPLOYMENT_REJECTIONS`). A refusal
|
|
4
|
+
* changed nothing, except that a `service-unavailable` may follow effects that a rerun converges.
|
|
5
|
+
*/
|
|
3
6
|
export declare const deploymentRejectionReason: z.ZodEnum<{
|
|
4
7
|
"address-mismatch": "address-mismatch";
|
|
5
8
|
"build-mismatch": "build-mismatch";
|
|
@@ -26,7 +29,7 @@ export declare const deploymentRejection: z.ZodObject<{
|
|
|
26
29
|
retryAfter: z.ZodOptional<z.ZodString>;
|
|
27
30
|
}, z.core.$strict>;
|
|
28
31
|
/**
|
|
29
|
-
* `
|
|
32
|
+
* `WorkerDeploymentResponseV1`. A created deployment binds the request's secrets at its create-only
|
|
30
33
|
* upload (`bound`); a reused one compares them with its keyed digest (`unchanged`) or rewrites them
|
|
31
34
|
* in place on that deployment only (`updated`). The summary says whether the Service now serves it.
|
|
32
35
|
*/
|
|
@@ -49,6 +52,8 @@ export declare const deploymentResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
49
52
|
label: z.ZodString;
|
|
50
53
|
serviceId: z.ZodString;
|
|
51
54
|
service: z.ZodString;
|
|
55
|
+
project: z.ZodString;
|
|
56
|
+
environment: z.ZodString;
|
|
52
57
|
owner: z.ZodString;
|
|
53
58
|
state: z.ZodEnum<{
|
|
54
59
|
active: "active";
|
|
@@ -60,26 +65,13 @@ export declare const deploymentResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
60
65
|
current: z.ZodBoolean;
|
|
61
66
|
createdAt: z.ZodString;
|
|
62
67
|
retiredAt: z.ZodOptional<z.ZodString>;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
buildDigest: z.ZodString;
|
|
71
|
-
schemaRevision: z.ZodString;
|
|
72
|
-
configuration: z.ZodString;
|
|
73
|
-
providerScript: z.ZodString;
|
|
74
|
-
commit: z.ZodNullable<z.ZodObject<{
|
|
75
|
-
sha: z.ZodString;
|
|
76
|
-
dirty: z.ZodBoolean;
|
|
77
|
-
base: z.ZodOptional<z.ZodObject<{
|
|
78
|
-
version: z.ZodString;
|
|
79
|
-
distance: z.ZodNumber;
|
|
80
|
-
}, z.core.$strict>>;
|
|
81
|
-
}, z.core.$strict>>;
|
|
82
|
-
}, z.core.$strict>;
|
|
68
|
+
buildDigest: z.ZodString;
|
|
69
|
+
configuration: z.ZodString;
|
|
70
|
+
signingKeyId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
contentType: z.ZodString;
|
|
73
|
+
contentBase64: z.ZodString;
|
|
74
|
+
}, z.core.$strict>>;
|
|
83
75
|
}, z.core.$strict>;
|
|
84
76
|
}, z.core.$strict>, z.ZodObject<{
|
|
85
77
|
kind: z.ZodLiteral<"rejected">;
|
|
@@ -2,7 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
import { deploymentSummary } from './deployment-summary.js';
|
|
3
3
|
/** An ISO 8601 instant, as the graph's instant values read. */
|
|
4
4
|
const instant = z.string().min(1).max(64);
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Why Services refused to host one Worker release (`WORKER_DEPLOYMENT_REJECTIONS`). A refusal
|
|
7
|
+
* changed nothing, except that a `service-unavailable` may follow effects that a rerun converges.
|
|
8
|
+
*/
|
|
6
9
|
export const deploymentRejectionReason = z.enum([
|
|
7
10
|
'invalid-deployment',
|
|
8
11
|
'address-mismatch',
|
|
@@ -21,7 +24,7 @@ export const deploymentRejection = z.strictObject({
|
|
|
21
24
|
retryAfter: instant.optional(),
|
|
22
25
|
});
|
|
23
26
|
/**
|
|
24
|
-
* `
|
|
27
|
+
* `WorkerDeploymentResponseV1`. A created deployment binds the request's secrets at its create-only
|
|
25
28
|
* upload (`bound`); a reused one compares them with its keyed digest (`unchanged`) or rewrites them
|
|
26
29
|
* in place on that deployment only (`updated`). The summary says whether the Service now serves it.
|
|
27
30
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Why a deployment's secret was not rewritten. `secret-undeclared`: the name is not one the
|
|
4
|
-
* deployment's
|
|
5
|
-
*
|
|
4
|
+
* deployment's configuration declares, and adding or removing a name is a new release; nothing was
|
|
5
|
+
* written. `service-unavailable`: the deployment is being created, another operation holds it
|
|
6
6
|
* or took it over, or the provider failed, and `retryAfter` is when a retry may succeed and then
|
|
7
7
|
* converges; or, without `retryAfter`, the deployment cannot be rotated in place at all (its
|
|
8
8
|
* creation failed, it is retiring or retired, or the script under its label is not the recorded
|
|
@@ -3,8 +3,8 @@ import { z } from 'zod';
|
|
|
3
3
|
const instant = z.string().min(1).max(64);
|
|
4
4
|
/**
|
|
5
5
|
* Why a deployment's secret was not rewritten. `secret-undeclared`: the name is not one the
|
|
6
|
-
* deployment's
|
|
7
|
-
*
|
|
6
|
+
* deployment's configuration declares, and adding or removing a name is a new release; nothing was
|
|
7
|
+
* written. `service-unavailable`: the deployment is being created, another operation holds it
|
|
8
8
|
* or took it over, or the provider failed, and `retryAfter` is when a retry may succeed and then
|
|
9
9
|
* converges; or, without `retryAfter`, the deployment cannot be rotated in place at all (its
|
|
10
10
|
* creation failed, it is retiring or retired, or the script under its label is not the recorded
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
* `
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* `WorkerDeploymentSummaryV1` (`@astrale-os/sdk/deployment/worker`): what Services knows of one
|
|
4
|
+
* deployment. It names a deployment by its label and URL, never by a provider version, says whether
|
|
5
|
+
* it is the one its Service currently serves, and carries the record it publishes, if any, as
|
|
6
|
+
* published.
|
|
6
7
|
*/
|
|
7
8
|
export declare const deploymentSummary: z.ZodObject<{
|
|
8
9
|
id: z.ZodString;
|
|
@@ -10,6 +11,8 @@ export declare const deploymentSummary: z.ZodObject<{
|
|
|
10
11
|
label: z.ZodString;
|
|
11
12
|
serviceId: z.ZodString;
|
|
12
13
|
service: z.ZodString;
|
|
14
|
+
project: z.ZodString;
|
|
15
|
+
environment: z.ZodString;
|
|
13
16
|
owner: z.ZodString;
|
|
14
17
|
state: z.ZodEnum<{
|
|
15
18
|
active: "active";
|
|
@@ -21,114 +24,12 @@ export declare const deploymentSummary: z.ZodObject<{
|
|
|
21
24
|
current: z.ZodBoolean;
|
|
22
25
|
createdAt: z.ZodString;
|
|
23
26
|
retiredAt: z.ZodOptional<z.ZodString>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
buildDigest: z.ZodString;
|
|
32
|
-
schemaRevision: z.ZodString;
|
|
33
|
-
configuration: z.ZodString;
|
|
34
|
-
providerScript: z.ZodString;
|
|
35
|
-
commit: z.ZodNullable<z.ZodObject<{
|
|
36
|
-
sha: z.ZodString;
|
|
37
|
-
dirty: z.ZodBoolean;
|
|
38
|
-
base: z.ZodOptional<z.ZodObject<{
|
|
39
|
-
version: z.ZodString;
|
|
40
|
-
distance: z.ZodNumber;
|
|
41
|
-
}, z.core.$strict>>;
|
|
42
|
-
}, z.core.$strict>>;
|
|
43
|
-
}, z.core.$strict>;
|
|
27
|
+
buildDigest: z.ZodString;
|
|
28
|
+
configuration: z.ZodString;
|
|
29
|
+
signingKeyId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
contentType: z.ZodString;
|
|
32
|
+
contentBase64: z.ZodString;
|
|
33
|
+
}, z.core.$strict>>;
|
|
44
34
|
}, z.core.$strict>;
|
|
45
|
-
/**
|
|
46
|
-
* A deployment Services lists although this Services SDK no longer admits the record or the
|
|
47
|
-
* configuration it stores, for instance after a stricter decoder: the facts Services owns, and the
|
|
48
|
-
* record exactly as stored, any JSON value. Its consumer admits that record itself; Services never
|
|
49
|
-
* acts on such a deployment.
|
|
50
|
-
*/
|
|
51
|
-
export declare const unadmittedDeploymentSummary: z.ZodObject<{
|
|
52
|
-
id: z.ZodString;
|
|
53
|
-
url: z.ZodString;
|
|
54
|
-
label: z.ZodString;
|
|
55
|
-
serviceId: z.ZodString;
|
|
56
|
-
service: z.ZodString;
|
|
57
|
-
owner: z.ZodString;
|
|
58
|
-
state: z.ZodEnum<{
|
|
59
|
-
active: "active";
|
|
60
|
-
deploying: "deploying";
|
|
61
|
-
failed: "failed";
|
|
62
|
-
retired: "retired";
|
|
63
|
-
retiring: "retiring";
|
|
64
|
-
}>;
|
|
65
|
-
current: z.ZodBoolean;
|
|
66
|
-
createdAt: z.ZodString;
|
|
67
|
-
retiredAt: z.ZodOptional<z.ZodString>;
|
|
68
|
-
signingKeyId: z.ZodString;
|
|
69
|
-
record: z.ZodUnknown;
|
|
70
|
-
}, z.core.$strict>;
|
|
71
|
-
/**
|
|
72
|
-
* One listed deployment: a `DeploymentSummaryV1` whose record Services admits, or an unadmitted one
|
|
73
|
-
* whose record is typed as JSON.
|
|
74
|
-
*/
|
|
75
|
-
export declare const listedDeploymentSummary: z.ZodUnion<readonly [z.ZodObject<{
|
|
76
|
-
id: z.ZodString;
|
|
77
|
-
url: z.ZodString;
|
|
78
|
-
label: z.ZodString;
|
|
79
|
-
serviceId: z.ZodString;
|
|
80
|
-
service: z.ZodString;
|
|
81
|
-
owner: z.ZodString;
|
|
82
|
-
state: z.ZodEnum<{
|
|
83
|
-
active: "active";
|
|
84
|
-
deploying: "deploying";
|
|
85
|
-
failed: "failed";
|
|
86
|
-
retired: "retired";
|
|
87
|
-
retiring: "retiring";
|
|
88
|
-
}>;
|
|
89
|
-
current: z.ZodBoolean;
|
|
90
|
-
createdAt: z.ZodString;
|
|
91
|
-
retiredAt: z.ZodOptional<z.ZodString>;
|
|
92
|
-
signingKeyId: z.ZodString;
|
|
93
|
-
record: z.ZodObject<{
|
|
94
|
-
format: z.ZodLiteral<"astrale.deployment-record">;
|
|
95
|
-
version: z.ZodLiteral<1>;
|
|
96
|
-
origin: z.ZodString;
|
|
97
|
-
environment: z.ZodString;
|
|
98
|
-
releaseDigest: z.ZodString;
|
|
99
|
-
buildDigest: z.ZodString;
|
|
100
|
-
schemaRevision: z.ZodString;
|
|
101
|
-
configuration: z.ZodString;
|
|
102
|
-
providerScript: z.ZodString;
|
|
103
|
-
commit: z.ZodNullable<z.ZodObject<{
|
|
104
|
-
sha: z.ZodString;
|
|
105
|
-
dirty: z.ZodBoolean;
|
|
106
|
-
base: z.ZodOptional<z.ZodObject<{
|
|
107
|
-
version: z.ZodString;
|
|
108
|
-
distance: z.ZodNumber;
|
|
109
|
-
}, z.core.$strict>>;
|
|
110
|
-
}, z.core.$strict>>;
|
|
111
|
-
}, z.core.$strict>;
|
|
112
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
113
|
-
id: z.ZodString;
|
|
114
|
-
url: z.ZodString;
|
|
115
|
-
label: z.ZodString;
|
|
116
|
-
serviceId: z.ZodString;
|
|
117
|
-
service: z.ZodString;
|
|
118
|
-
owner: z.ZodString;
|
|
119
|
-
state: z.ZodEnum<{
|
|
120
|
-
active: "active";
|
|
121
|
-
deploying: "deploying";
|
|
122
|
-
failed: "failed";
|
|
123
|
-
retired: "retired";
|
|
124
|
-
retiring: "retiring";
|
|
125
|
-
}>;
|
|
126
|
-
current: z.ZodBoolean;
|
|
127
|
-
createdAt: z.ZodString;
|
|
128
|
-
retiredAt: z.ZodOptional<z.ZodString>;
|
|
129
|
-
signingKeyId: z.ZodString;
|
|
130
|
-
record: z.ZodUnknown;
|
|
131
|
-
}, z.core.$strict>]>;
|
|
132
35
|
export type DeploymentSummary = z.output<typeof deploymentSummary>;
|
|
133
|
-
export type UnadmittedDeploymentSummary = z.output<typeof unadmittedDeploymentSummary>;
|
|
134
|
-
export type ListedDeploymentSummary = z.output<typeof listedDeploymentSummary>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { fullMatch } from '@astrale-os/sdk/schema';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
+
import { workerRecord } from './worker-record.js';
|
|
3
4
|
/** An ISO 8601 instant, as the graph's instant values read. */
|
|
4
5
|
const instant = z.string().min(1).max(64);
|
|
6
|
+
const digest = z.string().check(fullMatch('sha256:[0-9a-f]{64}'));
|
|
5
7
|
/**
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* `WorkerDeploymentSummaryV1` (`@astrale-os/sdk/deployment/worker`): what Services knows of one
|
|
9
|
+
* deployment. It names a deployment by its label and URL, never by a provider version, says whether
|
|
10
|
+
* it is the one its Service currently serves, and carries the record it publishes, if any, as
|
|
11
|
+
* published.
|
|
9
12
|
*/
|
|
10
13
|
export const deploymentSummary = z.strictObject({
|
|
11
14
|
id: z.string().min(1),
|
|
@@ -15,6 +18,8 @@ export const deploymentSummary = z.strictObject({
|
|
|
15
18
|
serviceId: z.string().min(1),
|
|
16
19
|
/** The name of that Service, the prefix of the label. */
|
|
17
20
|
service: z.string().min(16).max(40),
|
|
21
|
+
project: z.string().min(1).max(253),
|
|
22
|
+
environment: z.string().min(1).max(63),
|
|
18
23
|
/** The Identity path of the Service's owner. */
|
|
19
24
|
owner: z.string().min(1),
|
|
20
25
|
state: z.enum(['deploying', 'active', 'retiring', 'retired', 'failed']),
|
|
@@ -22,18 +27,11 @@ export const deploymentSummary = z.strictObject({
|
|
|
22
27
|
current: z.boolean(),
|
|
23
28
|
createdAt: instant,
|
|
24
29
|
retiredAt: instant.optional(),
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
buildDigest: digest,
|
|
31
|
+
/** The digest of its `WorkerConfigurationV1`. */
|
|
32
|
+
configuration: digest,
|
|
33
|
+
/** The thumbprint of its key, when its configuration asked for a signing identity. */
|
|
34
|
+
signingKeyId: z.string().min(1).max(128).optional(),
|
|
35
|
+
/** The record it publishes, when its configuration asked for one. */
|
|
36
|
+
record: workerRecord.optional(),
|
|
27
37
|
});
|
|
28
|
-
/**
|
|
29
|
-
* A deployment Services lists although this Services SDK no longer admits the record or the
|
|
30
|
-
* configuration it stores, for instance after a stricter decoder: the facts Services owns, and the
|
|
31
|
-
* record exactly as stored, any JSON value. Its consumer admits that record itself; Services never
|
|
32
|
-
* acts on such a deployment.
|
|
33
|
-
*/
|
|
34
|
-
export const unadmittedDeploymentSummary = deploymentSummary.extend({ record: z.unknown() });
|
|
35
|
-
/**
|
|
36
|
-
* One listed deployment: a `DeploymentSummaryV1` whose record Services admits, or an unadmitted one
|
|
37
|
-
* whose record is typed as JSON.
|
|
38
|
-
*/
|
|
39
|
-
export const listedDeploymentSummary = z.union([deploymentSummary, unadmittedDeploymentSummary]);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { deploymentHosting, listDeploymentsInput, listDeploymentsOutput, } from './deployment-hosting.js';
|
|
2
2
|
export type { DeploymentHosting } from './deployment-hosting.js';
|
|
3
|
-
export { deploymentCommit, deploymentRecord } from './deployment-record.js';
|
|
4
|
-
export type { DeploymentRecord } from './deployment-record.js';
|
|
5
3
|
export { deploymentRequest } from './deployment-request.js';
|
|
6
4
|
export type { DeploymentRequest } from './deployment-request.js';
|
|
7
5
|
export { deploymentRejection, deploymentRejectionReason, deploymentResponse, } from './deployment-response.js';
|
|
@@ -12,13 +10,13 @@ export { deploymentSecretRejection } from './deployment-secret.js';
|
|
|
12
10
|
export type { DeploymentSecretRejection } from './deployment-secret.js';
|
|
13
11
|
export { deploymentSecretDigest, deploymentSecretDigests } from './deployment-secret-digest.js';
|
|
14
12
|
export type { DeploymentSecretDigest } from './deployment-secret-digest.js';
|
|
15
|
-
export { deploymentSummary
|
|
16
|
-
export type { DeploymentSummary
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
21
|
-
export {
|
|
22
|
-
export type {
|
|
23
|
-
export {
|
|
24
|
-
export type {
|
|
13
|
+
export { deploymentSummary } from './deployment-summary.js';
|
|
14
|
+
export type { DeploymentSummary } from './deployment-summary.js';
|
|
15
|
+
export { legacyDeploymentRecord, legacyFrozenConfiguration } from './legacy-deployment.js';
|
|
16
|
+
export type { LegacyDeploymentRecord, LegacyFrozenConfiguration } from './legacy-deployment.js';
|
|
17
|
+
export { migrateLegacyInput, migrateLegacyOutput } from './legacy-migration.js';
|
|
18
|
+
export type { MigrateLegacyResult } from './legacy-migration.js';
|
|
19
|
+
export { workerConfiguration } from './worker-configuration.js';
|
|
20
|
+
export type { WorkerConfiguration } from './worker-configuration.js';
|
|
21
|
+
export { workerRecord } from './worker-record.js';
|
|
22
|
+
export type { WorkerRecordWire } from './worker-record.js';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { deploymentHosting, listDeploymentsInput, listDeploymentsOutput, } from './deployment-hosting.js';
|
|
2
|
-
export { deploymentCommit, deploymentRecord } from './deployment-record.js';
|
|
3
2
|
export { deploymentRequest } from './deployment-request.js';
|
|
4
3
|
export { deploymentRejection, deploymentRejectionReason, deploymentResponse, } from './deployment-response.js';
|
|
5
4
|
export { retireDeploymentInput, retireDeploymentOutput } from './deployment-retire.js';
|
|
6
5
|
export { deploymentSecretRejection } from './deployment-secret.js';
|
|
7
6
|
export { deploymentSecretDigest, deploymentSecretDigests } from './deployment-secret-digest.js';
|
|
8
|
-
export { deploymentSummary
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
7
|
+
export { deploymentSummary } from './deployment-summary.js';
|
|
8
|
+
export { legacyDeploymentRecord, legacyFrozenConfiguration } from './legacy-deployment.js';
|
|
9
|
+
export { migrateLegacyInput, migrateLegacyOutput } from './legacy-migration.js';
|
|
10
|
+
export { workerConfiguration } from './worker-configuration.js';
|
|
11
|
+
export { workerRecord } from './worker-record.js';
|