@astrale-domains/services 0.4.6 → 0.4.7
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 +163 -6
- 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 +366 -0
- package/dist/schema/modules/deployment/classes/cloudflare-deployment.js +20 -0
- package/dist/schema/modules/deployment/classes/deployment.d.ts +93 -2
- package/dist/schema/modules/deployment/classes/deployment.js +27 -3
- package/dist/schema/modules/deployment/errors/deployment-hosting-unavailable.d.ts +7 -0
- package/dist/schema/modules/deployment/errors/deployment-hosting-unavailable.js +8 -0
- package/dist/schema/modules/deployment/errors/deployment-label-not-found.d.ts +12 -0
- package/dist/schema/modules/deployment/errors/deployment-label-not-found.js +11 -0
- package/dist/schema/modules/deployment/errors/deployment-not-found.d.ts +10 -0
- package/dist/schema/modules/deployment/errors/deployment-not-found.js +11 -0
- package/dist/schema/modules/deployment/errors/deployment-registry-only.d.ts +11 -0
- package/dist/schema/modules/deployment/errors/deployment-registry-only.js +12 -0
- package/dist/schema/modules/deployment/errors/index.d.ts +4 -0
- package/dist/schema/modules/deployment/errors/index.js +4 -0
- package/dist/schema/modules/deployment/functions/deploy-cloudflare-deployment.d.ts +170 -0
- package/dist/schema/modules/deployment/functions/deploy-cloudflare-deployment.js +14 -0
- package/dist/schema/modules/deployment/functions/describe-deployment-hosting.d.ts +8 -0
- package/dist/schema/modules/deployment/functions/describe-deployment-hosting.js +11 -0
- package/dist/schema/modules/deployment/functions/expire-deployment-previews.d.ts +16 -0
- package/dist/schema/modules/deployment/functions/expire-deployment-previews.js +14 -0
- package/dist/schema/modules/deployment/functions/index.d.ts +11 -0
- package/dist/schema/modules/deployment/functions/index.js +11 -0
- package/dist/schema/modules/deployment/functions/list-cloudflare-deployment-secret-names.d.ts +5 -0
- package/dist/schema/modules/deployment/functions/list-cloudflare-deployment-secret-names.js +4 -0
- package/dist/schema/modules/deployment/functions/list-cloudflare-deployments.d.ts +58 -0
- package/dist/schema/modules/deployment/functions/list-cloudflare-deployments.js +10 -0
- package/dist/schema/modules/deployment/functions/list-deployment-secret-names.d.ts +4 -0
- package/dist/schema/modules/deployment/functions/list-deployment-secret-names.js +6 -0
- package/dist/schema/modules/deployment/functions/read-deployment-last-calls.d.ts +10 -0
- package/dist/schema/modules/deployment/functions/read-deployment-last-calls.js +13 -0
- package/dist/schema/modules/deployment/functions/retain-deployment.d.ts +12 -0
- package/dist/schema/modules/deployment/functions/retain-deployment.js +13 -0
- package/dist/schema/modules/deployment/functions/retire-deployment.d.ts +23 -0
- package/dist/schema/modules/deployment/functions/retire-deployment.js +17 -0
- package/dist/schema/modules/deployment/functions/set-cloudflare-deployment-secret.d.ts +18 -0
- package/dist/schema/modules/deployment/functions/set-cloudflare-deployment-secret.js +7 -0
- package/dist/schema/modules/deployment/functions/set-deployment-secret.d.ts +14 -0
- package/dist/schema/modules/deployment/functions/set-deployment-secret.js +3 -0
- package/dist/schema/modules/deployment/index.d.ts +5 -3
- package/dist/schema/modules/deployment/index.js +4 -2
- package/dist/schema/modules/deployment/policies/act-for-organization.d.ts +6 -0
- package/dist/schema/modules/deployment/policies/act-for-organization.js +10 -0
- package/dist/schema/modules/deployment/policies/index.d.ts +1 -0
- package/dist/schema/modules/deployment/policies/index.js +1 -0
- package/dist/schema/modules/deployment/states/deployment-lifecycle.d.ts +6 -3
- package/dist/schema/modules/deployment/states/deployment-lifecycle.js +6 -4
- package/dist/schema/modules/deployment/types/deployment-hosting.d.ts +94 -0
- package/dist/schema/modules/deployment/types/deployment-hosting.js +19 -0
- package/dist/schema/modules/deployment/types/deployment-request.d.ts +161 -0
- package/dist/schema/modules/deployment/types/deployment-request.js +40 -0
- package/dist/schema/modules/deployment/types/deployment-response.d.ts +109 -0
- package/dist/schema/modules/deployment/types/deployment-response.js +36 -0
- package/dist/schema/modules/deployment/types/deployment-retention.d.ts +37 -1
- package/dist/schema/modules/deployment/types/deployment-retention.js +41 -1
- package/dist/schema/modules/deployment/types/deployment-retire.d.ts +30 -0
- package/dist/schema/modules/deployment/types/deployment-retire.js +18 -0
- package/dist/schema/modules/deployment/types/deployment-secret-digest.d.ts +17 -0
- package/dist/schema/modules/deployment/types/deployment-secret-digest.js +14 -0
- package/dist/schema/modules/deployment/types/deployment-secret.d.ts +59 -0
- package/dist/schema/modules/deployment/types/deployment-secret.js +52 -0
- package/dist/schema/modules/deployment/types/deployment-summary.d.ts +165 -0
- package/dist/schema/modules/deployment/types/deployment-summary.js +38 -0
- package/dist/schema/modules/deployment/types/frozen-configuration.d.ts +52 -0
- package/dist/schema/modules/deployment/types/frozen-configuration.js +55 -0
- package/dist/schema/modules/deployment/types/index.d.ts +18 -2
- package/dist/schema/modules/deployment/types/index.js +9 -1
- package/dist/schema/modules/service/classes/cloudflare-worker.d.ts +4 -4
- package/dist/schema/modules/service/classes/service.d.ts +2 -2
- package/dist/schema/modules/service/functions/set-worker-secret.d.ts +2 -2
- package/dist/schema/modules/service/types/legacy/service-deployment-content.js +8 -1
- package/dist/schema/schema.d.ts +456 -12
- package/dist/schema/schema.js +2 -1
- package/package.json +10 -5
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Why Services refused to host one release; nothing was changed for a refused request. */
|
|
3
|
+
export declare const deploymentRejectionReason: z.ZodEnum<{
|
|
4
|
+
"address-mismatch": "address-mismatch";
|
|
5
|
+
"build-mismatch": "build-mismatch";
|
|
6
|
+
"deployment-conflict": "deployment-conflict";
|
|
7
|
+
"deployment-retired": "deployment-retired";
|
|
8
|
+
"hosting-unavailable": "hosting-unavailable";
|
|
9
|
+
"invalid-deployment": "invalid-deployment";
|
|
10
|
+
"line-owned-elsewhere": "line-owned-elsewhere";
|
|
11
|
+
"service-unavailable": "service-unavailable";
|
|
12
|
+
}>;
|
|
13
|
+
export declare const deploymentRejection: z.ZodObject<{
|
|
14
|
+
kind: z.ZodLiteral<"rejected">;
|
|
15
|
+
reason: z.ZodEnum<{
|
|
16
|
+
"address-mismatch": "address-mismatch";
|
|
17
|
+
"build-mismatch": "build-mismatch";
|
|
18
|
+
"deployment-conflict": "deployment-conflict";
|
|
19
|
+
"deployment-retired": "deployment-retired";
|
|
20
|
+
"hosting-unavailable": "hosting-unavailable";
|
|
21
|
+
"invalid-deployment": "invalid-deployment";
|
|
22
|
+
"line-owned-elsewhere": "line-owned-elsewhere";
|
|
23
|
+
"service-unavailable": "service-unavailable";
|
|
24
|
+
}>;
|
|
25
|
+
message: z.ZodString;
|
|
26
|
+
retryAfter: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
/**
|
|
29
|
+
* `DeploymentResponseV1`. A created deployment binds the request's secrets at its create-only
|
|
30
|
+
* upload (`bound`); a reused one compares them with its keyed digest (`unchanged`) or rewrites them
|
|
31
|
+
* in place on that deployment only (`updated`).
|
|
32
|
+
*/
|
|
33
|
+
export declare const deploymentResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
34
|
+
kind: z.ZodLiteral<"deployed">;
|
|
35
|
+
state: z.ZodEnum<{
|
|
36
|
+
created: "created";
|
|
37
|
+
reused: "reused";
|
|
38
|
+
}>;
|
|
39
|
+
secrets: z.ZodObject<{
|
|
40
|
+
state: z.ZodEnum<{
|
|
41
|
+
bound: "bound";
|
|
42
|
+
unchanged: "unchanged";
|
|
43
|
+
updated: "updated";
|
|
44
|
+
}>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
deployment: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
url: z.ZodString;
|
|
49
|
+
label: z.ZodString;
|
|
50
|
+
line: z.ZodString;
|
|
51
|
+
owner: z.ZodString;
|
|
52
|
+
state: z.ZodEnum<{
|
|
53
|
+
active: "active";
|
|
54
|
+
deploying: "deploying";
|
|
55
|
+
failed: "failed";
|
|
56
|
+
retired: "retired";
|
|
57
|
+
retiring: "retiring";
|
|
58
|
+
}>;
|
|
59
|
+
retention: z.ZodEnum<{
|
|
60
|
+
preview: "preview";
|
|
61
|
+
published: "published";
|
|
62
|
+
}>;
|
|
63
|
+
createdAt: z.ZodString;
|
|
64
|
+
lastCallAt: z.ZodOptional<z.ZodString>;
|
|
65
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
66
|
+
retiredAt: z.ZodOptional<z.ZodString>;
|
|
67
|
+
retirement: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
expired: "expired";
|
|
69
|
+
withdrawn: "withdrawn";
|
|
70
|
+
}>>;
|
|
71
|
+
signingKeyId: z.ZodString;
|
|
72
|
+
record: z.ZodObject<{
|
|
73
|
+
format: z.ZodLiteral<"astrale.deployment-record">;
|
|
74
|
+
version: z.ZodLiteral<1>;
|
|
75
|
+
origin: z.ZodString;
|
|
76
|
+
environment: z.ZodString;
|
|
77
|
+
releaseDigest: z.ZodString;
|
|
78
|
+
buildDigest: z.ZodString;
|
|
79
|
+
schemaRevision: z.ZodString;
|
|
80
|
+
configuration: z.ZodString;
|
|
81
|
+
providerScript: z.ZodString;
|
|
82
|
+
commit: z.ZodNullable<z.ZodObject<{
|
|
83
|
+
sha: z.ZodString;
|
|
84
|
+
dirty: z.ZodBoolean;
|
|
85
|
+
base: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
version: z.ZodString;
|
|
87
|
+
distance: z.ZodNumber;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"rejected">;
|
|
94
|
+
reason: z.ZodEnum<{
|
|
95
|
+
"address-mismatch": "address-mismatch";
|
|
96
|
+
"build-mismatch": "build-mismatch";
|
|
97
|
+
"deployment-conflict": "deployment-conflict";
|
|
98
|
+
"deployment-retired": "deployment-retired";
|
|
99
|
+
"hosting-unavailable": "hosting-unavailable";
|
|
100
|
+
"invalid-deployment": "invalid-deployment";
|
|
101
|
+
"line-owned-elsewhere": "line-owned-elsewhere";
|
|
102
|
+
"service-unavailable": "service-unavailable";
|
|
103
|
+
}>;
|
|
104
|
+
message: z.ZodString;
|
|
105
|
+
retryAfter: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strict>]>;
|
|
107
|
+
export type DeploymentRejection = z.output<typeof deploymentRejection>;
|
|
108
|
+
export type DeploymentRejectionReason = z.output<typeof deploymentRejectionReason>;
|
|
109
|
+
export type DeploymentResponse = z.output<typeof deploymentResponse>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { deploymentSummary } from './deployment-summary.js';
|
|
3
|
+
/** An ISO 8601 instant, as the graph's instant values read. */
|
|
4
|
+
const instant = z.string().min(1).max(64);
|
|
5
|
+
/** Why Services refused to host one release; nothing was changed for a refused request. */
|
|
6
|
+
export const deploymentRejectionReason = z.enum([
|
|
7
|
+
'invalid-deployment',
|
|
8
|
+
'address-mismatch',
|
|
9
|
+
'build-mismatch',
|
|
10
|
+
'line-owned-elsewhere',
|
|
11
|
+
'deployment-conflict',
|
|
12
|
+
'deployment-retired',
|
|
13
|
+
'hosting-unavailable',
|
|
14
|
+
'service-unavailable',
|
|
15
|
+
]);
|
|
16
|
+
export const deploymentRejection = z.strictObject({
|
|
17
|
+
kind: z.literal('rejected'),
|
|
18
|
+
reason: deploymentRejectionReason,
|
|
19
|
+
message: z.string().min(1).max(500),
|
|
20
|
+
/** When a retry may succeed, for a refusal that only waits on another operation. */
|
|
21
|
+
retryAfter: instant.optional(),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* `DeploymentResponseV1`. A created deployment binds the request's secrets at its create-only
|
|
25
|
+
* upload (`bound`); a reused one compares them with its keyed digest (`unchanged`) or rewrites them
|
|
26
|
+
* in place on that deployment only (`updated`).
|
|
27
|
+
*/
|
|
28
|
+
export const deploymentResponse = z.union([
|
|
29
|
+
z.strictObject({
|
|
30
|
+
kind: z.literal('deployed'),
|
|
31
|
+
state: z.enum(['created', 'reused']),
|
|
32
|
+
secrets: z.strictObject({ state: z.enum(['bound', 'updated', 'unchanged']) }),
|
|
33
|
+
deployment: deploymentSummary,
|
|
34
|
+
}),
|
|
35
|
+
deploymentRejection,
|
|
36
|
+
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/** A preview expires
|
|
2
|
+
/** A preview expires 30 days after its last call; a published deployment is retained. */
|
|
3
3
|
export declare const deploymentRetention: z.ZodEnum<{
|
|
4
4
|
preview: "preview";
|
|
5
5
|
published: "published";
|
|
@@ -9,5 +9,41 @@ export declare const deploymentRetirement: z.ZodEnum<{
|
|
|
9
9
|
expired: "expired";
|
|
10
10
|
withdrawn: "withdrawn";
|
|
11
11
|
}>;
|
|
12
|
+
/**
|
|
13
|
+
* One deployment label, `<line>-<content16>`, as `deploymentLabel` produces it: lower-case, at
|
|
14
|
+
* most 57 characters. Handlers admit it again with `parseDeploymentLabel`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const deploymentLabel: z.ZodString;
|
|
17
|
+
/** The most labels one `lastCalls` reads. */
|
|
18
|
+
export declare const MAXIMUM_LAST_CALL_LABELS = 100;
|
|
19
|
+
export declare const lastCallsInput: z.ZodObject<{
|
|
20
|
+
labels: z.ZodArray<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
/** The instant of each label's last call, or null when none was ever recorded. */
|
|
23
|
+
export declare const lastCallsOutput: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
24
|
+
/** The most deployment writes one `expirePreviews` makes; the rest waits for the next pass. */
|
|
25
|
+
export declare const MAXIMUM_PREVIEW_EXPIRY_WRITES = 256;
|
|
26
|
+
export declare const expirePreviewsInput: z.ZodObject<{
|
|
27
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
apply: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
/**
|
|
31
|
+
* One expiry pass. `planned`: previews past their expiry this pass did not retire. `retired`:
|
|
32
|
+
* previews this pass retired. `pending`: expired previews whose retirement started and waits for
|
|
33
|
+
* the dispatcher to answer `DEPLOYMENT_RETIRED` everywhere before their script is deleted.
|
|
34
|
+
*/
|
|
35
|
+
export declare const expirePreviewsOutput: z.ZodObject<{
|
|
36
|
+
planned: z.ZodArray<z.ZodString>;
|
|
37
|
+
retired: z.ZodArray<z.ZodString>;
|
|
38
|
+
pending: z.ZodArray<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export declare const retainInput: z.ZodObject<{
|
|
41
|
+
label: z.ZodString;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
/** A retained deployment is published: monotonic, it never becomes a preview again. */
|
|
44
|
+
export declare const retainOutput: z.ZodObject<{
|
|
45
|
+
retention: z.ZodLiteral<"published">;
|
|
46
|
+
}, z.core.$strict>;
|
|
12
47
|
export type DeploymentRetention = z.output<typeof deploymentRetention>;
|
|
13
48
|
export type DeploymentRetirement = z.output<typeof deploymentRetirement>;
|
|
49
|
+
export type ExpirePreviewsResult = z.output<typeof expirePreviewsOutput>;
|
|
@@ -1,5 +1,45 @@
|
|
|
1
|
+
import { fullMatch } from '@astrale-os/sdk/schema';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
/** A preview expires
|
|
3
|
+
/** A preview expires 30 days after its last call; a published deployment is retained. */
|
|
3
4
|
export const deploymentRetention = z.enum(['preview', 'published']);
|
|
4
5
|
/** Why a deployment left: an expired preview can be revived, a withdrawn one never. */
|
|
5
6
|
export const deploymentRetirement = z.enum(['expired', 'withdrawn']);
|
|
7
|
+
/** An ISO 8601 instant, as the graph's instant values read. */
|
|
8
|
+
const instant = z.string().min(1).max(64);
|
|
9
|
+
/**
|
|
10
|
+
* One deployment label, `<line>-<content16>`, as `deploymentLabel` produces it: lower-case, at
|
|
11
|
+
* most 57 characters. Handlers admit it again with `parseDeploymentLabel`.
|
|
12
|
+
*/
|
|
13
|
+
export const deploymentLabel = z
|
|
14
|
+
.string()
|
|
15
|
+
.min(33)
|
|
16
|
+
.max(57)
|
|
17
|
+
.check(fullMatch('([a-z0-9]+(-[a-z0-9]+)*-)?[a-z2-7]{16}-[a-z2-7]{16}'));
|
|
18
|
+
/** The most labels one `lastCalls` reads. */
|
|
19
|
+
export const MAXIMUM_LAST_CALL_LABELS = 100;
|
|
20
|
+
export const lastCallsInput = z.strictObject({
|
|
21
|
+
labels: z.array(deploymentLabel).min(1).max(MAXIMUM_LAST_CALL_LABELS),
|
|
22
|
+
});
|
|
23
|
+
/** The instant of each label's last call, or null when none was ever recorded. */
|
|
24
|
+
export const lastCallsOutput = z.record(z.string(), instant.nullable());
|
|
25
|
+
/** The most deployment writes one `expirePreviews` makes; the rest waits for the next pass. */
|
|
26
|
+
export const MAXIMUM_PREVIEW_EXPIRY_WRITES = 256;
|
|
27
|
+
export const expirePreviewsInput = z.strictObject({
|
|
28
|
+
/** Deployment writes this pass may make, retirements first; 64 when absent. */
|
|
29
|
+
limit: z.number().int().min(1).max(MAXIMUM_PREVIEW_EXPIRY_WRITES).optional(),
|
|
30
|
+
/** Retire what the plan lists; honoured only where `SERVICES_PREVIEW_EXPIRY` is `enforce`. */
|
|
31
|
+
apply: z.boolean().optional(),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* One expiry pass. `planned`: previews past their expiry this pass did not retire. `retired`:
|
|
35
|
+
* previews this pass retired. `pending`: expired previews whose retirement started and waits for
|
|
36
|
+
* the dispatcher to answer `DEPLOYMENT_RETIRED` everywhere before their script is deleted.
|
|
37
|
+
*/
|
|
38
|
+
export const expirePreviewsOutput = z.strictObject({
|
|
39
|
+
planned: z.array(z.string()),
|
|
40
|
+
retired: z.array(z.string()),
|
|
41
|
+
pending: z.array(z.string()),
|
|
42
|
+
});
|
|
43
|
+
export const retainInput = z.strictObject({ label: deploymentLabel });
|
|
44
|
+
/** A retained deployment is published: monotonic, it never becomes a preview again. */
|
|
45
|
+
export const retainOutput = z.strictObject({ retention: z.literal('published') });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const retireDeploymentInput: z.ZodObject<{}, z.core.$strict>;
|
|
3
|
+
/**
|
|
4
|
+
* Retiring a deployment is an emergency stop, in two phases. The first records the retirement and
|
|
5
|
+
* writes its tombstone: from then on the dispatcher answers `DEPLOYMENT_RETIRED`, and the answer is
|
|
6
|
+
* `retiring` with the delay after which a retry may finish. The second, once the dispatcher answers
|
|
7
|
+
* it everywhere, deletes the script and with it the deployment's key: the answer is `retired`. A
|
|
8
|
+
* withdrawn deployment is never served again, even by a redeploy of the same release.
|
|
9
|
+
*/
|
|
10
|
+
export declare const retireDeploymentOutput: z.ZodUnion<readonly [z.ZodObject<{
|
|
11
|
+
kind: z.ZodLiteral<"retired">;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"retiring">;
|
|
14
|
+
retryAfterMs: z.ZodNumber;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"rejected">;
|
|
17
|
+
reason: z.ZodEnum<{
|
|
18
|
+
"address-mismatch": "address-mismatch";
|
|
19
|
+
"build-mismatch": "build-mismatch";
|
|
20
|
+
"deployment-conflict": "deployment-conflict";
|
|
21
|
+
"deployment-retired": "deployment-retired";
|
|
22
|
+
"hosting-unavailable": "hosting-unavailable";
|
|
23
|
+
"invalid-deployment": "invalid-deployment";
|
|
24
|
+
"line-owned-elsewhere": "line-owned-elsewhere";
|
|
25
|
+
"service-unavailable": "service-unavailable";
|
|
26
|
+
}>;
|
|
27
|
+
message: z.ZodString;
|
|
28
|
+
retryAfter: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>]>;
|
|
30
|
+
export type RetireDeploymentResult = z.output<typeof retireDeploymentOutput>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { deploymentRejection } from './deployment-response.js';
|
|
3
|
+
export const retireDeploymentInput = z.strictObject({});
|
|
4
|
+
/**
|
|
5
|
+
* Retiring a deployment is an emergency stop, in two phases. The first records the retirement and
|
|
6
|
+
* writes its tombstone: from then on the dispatcher answers `DEPLOYMENT_RETIRED`, and the answer is
|
|
7
|
+
* `retiring` with the delay after which a retry may finish. The second, once the dispatcher answers
|
|
8
|
+
* it everywhere, deletes the script and with it the deployment's key: the answer is `retired`. A
|
|
9
|
+
* withdrawn deployment is never served again, even by a redeploy of the same release.
|
|
10
|
+
*/
|
|
11
|
+
export const retireDeploymentOutput = z.union([
|
|
12
|
+
z.strictObject({ kind: z.literal('retired') }),
|
|
13
|
+
z.strictObject({
|
|
14
|
+
kind: z.literal('retiring'),
|
|
15
|
+
retryAfterMs: z.number().int().min(0).max(3_600_000),
|
|
16
|
+
}),
|
|
17
|
+
deploymentRejection,
|
|
18
|
+
]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The keyed digest of one secret a deployment binds: HMAC-SHA256 under the Services runtime's
|
|
4
|
+
* `SERVICES_SECRET_DIGEST_KEY` of the deployment label, the name and the value. It tells whether a
|
|
5
|
+
* later request carries the same value without Services keeping the value, and the same value on
|
|
6
|
+
* two deployments gives two digests.
|
|
7
|
+
*/
|
|
8
|
+
export declare const deploymentSecretDigest: z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
digest: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
/** One digest per bound secret name, sorted by name. */
|
|
13
|
+
export declare const deploymentSecretDigests: z.ZodArray<z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
digest: z.ZodString;
|
|
16
|
+
}, z.core.$strict>>;
|
|
17
|
+
export type DeploymentSecretDigest = z.output<typeof deploymentSecretDigest>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { fullMatch } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The keyed digest of one secret a deployment binds: HMAC-SHA256 under the Services runtime's
|
|
5
|
+
* `SERVICES_SECRET_DIGEST_KEY` of the deployment label, the name and the value. It tells whether a
|
|
6
|
+
* later request carries the same value without Services keeping the value, and the same value on
|
|
7
|
+
* two deployments gives two digests.
|
|
8
|
+
*/
|
|
9
|
+
export const deploymentSecretDigest = z.strictObject({
|
|
10
|
+
name: z.string().min(1).max(128),
|
|
11
|
+
digest: z.string().check(fullMatch('hmac-sha256:[0-9a-f]{64}')),
|
|
12
|
+
});
|
|
13
|
+
/** One digest per bound secret name, sorted by name. */
|
|
14
|
+
export const deploymentSecretDigests = z.array(deploymentSecretDigest).max(64);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Why a deployment's secret was not rewritten. `secret-undeclared`: the name is not one the
|
|
4
|
+
* deployment's frozen configuration binds, and adding or removing a name is a new release; nothing
|
|
5
|
+
* was written. `service-unavailable`: the deployment is being created, another operation holds it
|
|
6
|
+
* or took it over, or the provider failed, and `retryAfter` is when a retry may succeed and then
|
|
7
|
+
* converges; or, without `retryAfter`, the deployment cannot be rotated in place at all (its
|
|
8
|
+
* creation failed, it is retiring or retired, or the script under its label is not the recorded
|
|
9
|
+
* one) and `message` says what can.
|
|
10
|
+
*/
|
|
11
|
+
export declare const deploymentSecretRejection: z.ZodObject<{
|
|
12
|
+
kind: z.ZodLiteral<"rejected">;
|
|
13
|
+
reason: z.ZodEnum<{
|
|
14
|
+
"secret-undeclared": "secret-undeclared";
|
|
15
|
+
"service-unavailable": "service-unavailable";
|
|
16
|
+
}>;
|
|
17
|
+
message: z.ZodString;
|
|
18
|
+
retryAfter: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
/**
|
|
21
|
+
* Rewrite one secret of one deployment in place: the same script, URL, issuer and key, with no
|
|
22
|
+
* new release. The provider serves the new value once it has propagated, a few seconds later.
|
|
23
|
+
*
|
|
24
|
+
* `authenticated`, as `deploy`: a publisher's identities on the Admin instance hold no `can_use`
|
|
25
|
+
* on Services' Functions, which an `authorized` Method requires of every non-Root caller (Kernel
|
|
26
|
+
* law in `runtime/functions/.spec/laws/authentication.ts`), so `authorized` with the
|
|
27
|
+
* `OwnDeployment` Policy refuses a line holder (2004). The handler decides `OwnDeployment` on the
|
|
28
|
+
* caller's own session before anything is read or written, exactly as `deploy` decides
|
|
29
|
+
* `OwnLine`, and a caller who does not hold the line finds no such deployment
|
|
30
|
+
* (`DEPLOYMENT_NOT_FOUND`). The day the Admin instance grants publishers `can_use` on these
|
|
31
|
+
* Methods, they become `authorized` with that Policy and the handler check goes.
|
|
32
|
+
*/
|
|
33
|
+
export declare const setDeploymentSecretContract: {
|
|
34
|
+
readonly description: 'Rewrite one declared secret of this deployment in place; the new value is served once the provider propagates it.';
|
|
35
|
+
readonly auth: 'authenticated';
|
|
36
|
+
readonly input: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
value: z.ZodString;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
readonly output: z.ZodUnion<readonly [z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
43
|
+
kind: z.ZodLiteral<"rejected">;
|
|
44
|
+
reason: z.ZodEnum<{
|
|
45
|
+
"secret-undeclared": "secret-undeclared";
|
|
46
|
+
"service-unavailable": "service-unavailable";
|
|
47
|
+
}>;
|
|
48
|
+
message: z.ZodString;
|
|
49
|
+
retryAfter: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>]>;
|
|
51
|
+
};
|
|
52
|
+
/** The names of the secrets one deployment binds, never their values; decided as `setSecret`. */
|
|
53
|
+
export declare const listDeploymentSecretNamesContract: {
|
|
54
|
+
readonly description: 'List the names of the secrets this deployment binds, without their values.';
|
|
55
|
+
readonly auth: 'authenticated';
|
|
56
|
+
readonly input: z.ZodObject<{}, z.core.$strict>;
|
|
57
|
+
readonly output: z.ZodArray<z.ZodString>;
|
|
58
|
+
};
|
|
59
|
+
export type DeploymentSecretRejection = z.output<typeof deploymentSecretRejection>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** An ISO 8601 instant, as the graph's instant values read. */
|
|
3
|
+
const instant = z.string().min(1).max(64);
|
|
4
|
+
/** A secret name as a deployment's frozen configuration declares it. */
|
|
5
|
+
const secretName = z.string().min(1).max(128);
|
|
6
|
+
/**
|
|
7
|
+
* Why a deployment's secret was not rewritten. `secret-undeclared`: the name is not one the
|
|
8
|
+
* deployment's frozen configuration binds, and adding or removing a name is a new release; nothing
|
|
9
|
+
* was written. `service-unavailable`: the deployment is being created, another operation holds it
|
|
10
|
+
* or took it over, or the provider failed, and `retryAfter` is when a retry may succeed and then
|
|
11
|
+
* converges; or, without `retryAfter`, the deployment cannot be rotated in place at all (its
|
|
12
|
+
* creation failed, it is retiring or retired, or the script under its label is not the recorded
|
|
13
|
+
* one) and `message` says what can.
|
|
14
|
+
*/
|
|
15
|
+
export const deploymentSecretRejection = z.strictObject({
|
|
16
|
+
kind: z.literal('rejected'),
|
|
17
|
+
reason: z.enum(['secret-undeclared', 'service-unavailable']),
|
|
18
|
+
message: z.string().min(1).max(500),
|
|
19
|
+
retryAfter: instant.optional(),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Rewrite one secret of one deployment in place: the same script, URL, issuer and key, with no
|
|
23
|
+
* new release. The provider serves the new value once it has propagated, a few seconds later.
|
|
24
|
+
*
|
|
25
|
+
* `authenticated`, as `deploy`: a publisher's identities on the Admin instance hold no `can_use`
|
|
26
|
+
* on Services' Functions, which an `authorized` Method requires of every non-Root caller (Kernel
|
|
27
|
+
* law in `runtime/functions/.spec/laws/authentication.ts`), so `authorized` with the
|
|
28
|
+
* `OwnDeployment` Policy refuses a line holder (2004). The handler decides `OwnDeployment` on the
|
|
29
|
+
* caller's own session before anything is read or written, exactly as `deploy` decides
|
|
30
|
+
* `OwnLine`, and a caller who does not hold the line finds no such deployment
|
|
31
|
+
* (`DEPLOYMENT_NOT_FOUND`). The day the Admin instance grants publishers `can_use` on these
|
|
32
|
+
* Methods, they become `authorized` with that Policy and the handler check goes.
|
|
33
|
+
*/
|
|
34
|
+
export const setDeploymentSecretContract = {
|
|
35
|
+
description: 'Rewrite one declared secret of this deployment in place; the new value is served once the provider propagates it.',
|
|
36
|
+
auth: 'authenticated',
|
|
37
|
+
input: z.strictObject({
|
|
38
|
+
name: secretName,
|
|
39
|
+
value: z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1)
|
|
42
|
+
.max(64 * 1024),
|
|
43
|
+
}),
|
|
44
|
+
output: z.union([z.strictObject({ name: secretName }), deploymentSecretRejection]),
|
|
45
|
+
};
|
|
46
|
+
/** The names of the secrets one deployment binds, never their values; decided as `setSecret`. */
|
|
47
|
+
export const listDeploymentSecretNamesContract = {
|
|
48
|
+
description: 'List the names of the secrets this deployment binds, without their values.',
|
|
49
|
+
auth: 'authenticated',
|
|
50
|
+
input: z.strictObject({}),
|
|
51
|
+
output: z.array(secretName),
|
|
52
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* `DeploymentSummaryV1`: what Services knows of one deployment beside the record its deployer
|
|
4
|
+
* declared. It names a deployment by its label and URL, never by a provider version.
|
|
5
|
+
*/
|
|
6
|
+
export declare const deploymentSummary: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
label: z.ZodString;
|
|
10
|
+
line: z.ZodString;
|
|
11
|
+
owner: z.ZodString;
|
|
12
|
+
state: z.ZodEnum<{
|
|
13
|
+
active: "active";
|
|
14
|
+
deploying: "deploying";
|
|
15
|
+
failed: "failed";
|
|
16
|
+
retired: "retired";
|
|
17
|
+
retiring: "retiring";
|
|
18
|
+
}>;
|
|
19
|
+
retention: z.ZodEnum<{
|
|
20
|
+
preview: "preview";
|
|
21
|
+
published: "published";
|
|
22
|
+
}>;
|
|
23
|
+
createdAt: z.ZodString;
|
|
24
|
+
lastCallAt: z.ZodOptional<z.ZodString>;
|
|
25
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
26
|
+
retiredAt: z.ZodOptional<z.ZodString>;
|
|
27
|
+
retirement: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
expired: "expired";
|
|
29
|
+
withdrawn: "withdrawn";
|
|
30
|
+
}>>;
|
|
31
|
+
signingKeyId: z.ZodString;
|
|
32
|
+
record: z.ZodObject<{
|
|
33
|
+
format: z.ZodLiteral<"astrale.deployment-record">;
|
|
34
|
+
version: z.ZodLiteral<1>;
|
|
35
|
+
origin: z.ZodString;
|
|
36
|
+
environment: z.ZodString;
|
|
37
|
+
releaseDigest: z.ZodString;
|
|
38
|
+
buildDigest: z.ZodString;
|
|
39
|
+
schemaRevision: z.ZodString;
|
|
40
|
+
configuration: z.ZodString;
|
|
41
|
+
providerScript: z.ZodString;
|
|
42
|
+
commit: z.ZodNullable<z.ZodObject<{
|
|
43
|
+
sha: z.ZodString;
|
|
44
|
+
dirty: z.ZodBoolean;
|
|
45
|
+
base: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
version: z.ZodString;
|
|
47
|
+
distance: z.ZodNumber;
|
|
48
|
+
}, z.core.$strict>>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
/**
|
|
53
|
+
* A deployment Services lists although this Services SDK no longer admits the record or the
|
|
54
|
+
* configuration it stores, for instance after a stricter decoder: the facts Services owns, and the
|
|
55
|
+
* record exactly as stored, any JSON value. Its consumer admits that record itself; Services never
|
|
56
|
+
* acts on such a deployment.
|
|
57
|
+
*/
|
|
58
|
+
export declare const unadmittedDeploymentSummary: z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
url: z.ZodString;
|
|
61
|
+
label: z.ZodString;
|
|
62
|
+
line: z.ZodString;
|
|
63
|
+
owner: z.ZodString;
|
|
64
|
+
state: z.ZodEnum<{
|
|
65
|
+
active: "active";
|
|
66
|
+
deploying: "deploying";
|
|
67
|
+
failed: "failed";
|
|
68
|
+
retired: "retired";
|
|
69
|
+
retiring: "retiring";
|
|
70
|
+
}>;
|
|
71
|
+
retention: z.ZodEnum<{
|
|
72
|
+
preview: "preview";
|
|
73
|
+
published: "published";
|
|
74
|
+
}>;
|
|
75
|
+
createdAt: z.ZodString;
|
|
76
|
+
lastCallAt: z.ZodOptional<z.ZodString>;
|
|
77
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
78
|
+
retiredAt: z.ZodOptional<z.ZodString>;
|
|
79
|
+
retirement: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
expired: "expired";
|
|
81
|
+
withdrawn: "withdrawn";
|
|
82
|
+
}>>;
|
|
83
|
+
signingKeyId: z.ZodString;
|
|
84
|
+
record: z.ZodUnknown;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
/**
|
|
87
|
+
* One listed deployment: a `DeploymentSummaryV1` whose record Services admits, or an unadmitted one
|
|
88
|
+
* whose record is typed as JSON.
|
|
89
|
+
*/
|
|
90
|
+
export declare const listedDeploymentSummary: z.ZodUnion<readonly [z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
url: z.ZodString;
|
|
93
|
+
label: z.ZodString;
|
|
94
|
+
line: z.ZodString;
|
|
95
|
+
owner: z.ZodString;
|
|
96
|
+
state: z.ZodEnum<{
|
|
97
|
+
active: "active";
|
|
98
|
+
deploying: "deploying";
|
|
99
|
+
failed: "failed";
|
|
100
|
+
retired: "retired";
|
|
101
|
+
retiring: "retiring";
|
|
102
|
+
}>;
|
|
103
|
+
retention: z.ZodEnum<{
|
|
104
|
+
preview: "preview";
|
|
105
|
+
published: "published";
|
|
106
|
+
}>;
|
|
107
|
+
createdAt: z.ZodString;
|
|
108
|
+
lastCallAt: z.ZodOptional<z.ZodString>;
|
|
109
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
110
|
+
retiredAt: z.ZodOptional<z.ZodString>;
|
|
111
|
+
retirement: z.ZodOptional<z.ZodEnum<{
|
|
112
|
+
expired: "expired";
|
|
113
|
+
withdrawn: "withdrawn";
|
|
114
|
+
}>>;
|
|
115
|
+
signingKeyId: z.ZodString;
|
|
116
|
+
record: z.ZodObject<{
|
|
117
|
+
format: z.ZodLiteral<"astrale.deployment-record">;
|
|
118
|
+
version: z.ZodLiteral<1>;
|
|
119
|
+
origin: z.ZodString;
|
|
120
|
+
environment: z.ZodString;
|
|
121
|
+
releaseDigest: z.ZodString;
|
|
122
|
+
buildDigest: z.ZodString;
|
|
123
|
+
schemaRevision: z.ZodString;
|
|
124
|
+
configuration: z.ZodString;
|
|
125
|
+
providerScript: z.ZodString;
|
|
126
|
+
commit: z.ZodNullable<z.ZodObject<{
|
|
127
|
+
sha: z.ZodString;
|
|
128
|
+
dirty: z.ZodBoolean;
|
|
129
|
+
base: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
version: z.ZodString;
|
|
131
|
+
distance: z.ZodNumber;
|
|
132
|
+
}, z.core.$strict>>;
|
|
133
|
+
}, z.core.$strict>>;
|
|
134
|
+
}, z.core.$strict>;
|
|
135
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
url: z.ZodString;
|
|
138
|
+
label: z.ZodString;
|
|
139
|
+
line: z.ZodString;
|
|
140
|
+
owner: z.ZodString;
|
|
141
|
+
state: z.ZodEnum<{
|
|
142
|
+
active: "active";
|
|
143
|
+
deploying: "deploying";
|
|
144
|
+
failed: "failed";
|
|
145
|
+
retired: "retired";
|
|
146
|
+
retiring: "retiring";
|
|
147
|
+
}>;
|
|
148
|
+
retention: z.ZodEnum<{
|
|
149
|
+
preview: "preview";
|
|
150
|
+
published: "published";
|
|
151
|
+
}>;
|
|
152
|
+
createdAt: z.ZodString;
|
|
153
|
+
lastCallAt: z.ZodOptional<z.ZodString>;
|
|
154
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
155
|
+
retiredAt: z.ZodOptional<z.ZodString>;
|
|
156
|
+
retirement: z.ZodOptional<z.ZodEnum<{
|
|
157
|
+
expired: "expired";
|
|
158
|
+
withdrawn: "withdrawn";
|
|
159
|
+
}>>;
|
|
160
|
+
signingKeyId: z.ZodString;
|
|
161
|
+
record: z.ZodUnknown;
|
|
162
|
+
}, z.core.$strict>]>;
|
|
163
|
+
export type DeploymentSummary = z.output<typeof deploymentSummary>;
|
|
164
|
+
export type UnadmittedDeploymentSummary = z.output<typeof unadmittedDeploymentSummary>;
|
|
165
|
+
export type ListedDeploymentSummary = z.output<typeof listedDeploymentSummary>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { deploymentRecord } from './deployment-record.js';
|
|
3
|
+
import { deploymentRetention, deploymentRetirement } from './deployment-retention.js';
|
|
4
|
+
/** An ISO 8601 instant, as the graph's instant values read. */
|
|
5
|
+
const instant = z.string().min(1).max(64);
|
|
6
|
+
/**
|
|
7
|
+
* `DeploymentSummaryV1`: what Services knows of one deployment beside the record its deployer
|
|
8
|
+
* declared. It names a deployment by its label and URL, never by a provider version.
|
|
9
|
+
*/
|
|
10
|
+
export const deploymentSummary = z.strictObject({
|
|
11
|
+
id: z.string().min(1),
|
|
12
|
+
url: z.string().min(1).max(2_048),
|
|
13
|
+
label: z.string().min(1).max(63),
|
|
14
|
+
line: z.string().min(1).max(40),
|
|
15
|
+
/** The Identity path of the organisation holding the line. */
|
|
16
|
+
owner: z.string().min(1),
|
|
17
|
+
state: z.enum(['deploying', 'active', 'retiring', 'retired', 'failed']),
|
|
18
|
+
retention: deploymentRetention,
|
|
19
|
+
createdAt: instant,
|
|
20
|
+
lastCallAt: instant.optional(),
|
|
21
|
+
expiresAt: instant.optional(),
|
|
22
|
+
retiredAt: instant.optional(),
|
|
23
|
+
retirement: deploymentRetirement.optional(),
|
|
24
|
+
signingKeyId: z.string().min(1).max(128),
|
|
25
|
+
record: deploymentRecord,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* A deployment Services lists although this Services SDK no longer admits the record or the
|
|
29
|
+
* configuration it stores, for instance after a stricter decoder: the facts Services owns, and the
|
|
30
|
+
* record exactly as stored, any JSON value. Its consumer admits that record itself; Services never
|
|
31
|
+
* acts on such a deployment.
|
|
32
|
+
*/
|
|
33
|
+
export const unadmittedDeploymentSummary = deploymentSummary.extend({ record: z.unknown() });
|
|
34
|
+
/**
|
|
35
|
+
* One listed deployment: a `DeploymentSummaryV1` whose record Services admits, or an unadmitted one
|
|
36
|
+
* whose record is typed as JSON.
|
|
37
|
+
*/
|
|
38
|
+
export const listedDeploymentSummary = z.union([deploymentSummary, unadmittedDeploymentSummary]);
|