@astrale-domains/services 0.4.6 → 0.4.8
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 +595 -43
- 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 -6
|
@@ -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]);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The `FrozenConfigurationV1` (`@astrale-os/sdk/deployment/address`) one deployment freezes beside
|
|
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<{
|
|
12
|
+
format: z.ZodLiteral<"astrale.deployment.configuration">;
|
|
13
|
+
version: z.ZodLiteral<1>;
|
|
14
|
+
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
15
|
+
settings: z.ZodObject<{
|
|
16
|
+
maximumRequestBytes: z.ZodNumber;
|
|
17
|
+
invocationTimeoutMs: z.ZodNumber;
|
|
18
|
+
tokenExchange: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
19
|
+
maximumLifetimeSeconds: z.ZodNumber;
|
|
20
|
+
}, z.core.$strict>]>;
|
|
21
|
+
durableOptions: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
retentionMs: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
initialIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
maxIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
stepTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strict>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
runtime: z.ZodObject<{
|
|
32
|
+
compatibilityDate: z.ZodString;
|
|
33
|
+
compatibilityFlags: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
bindings: z.ZodObject<{
|
|
36
|
+
services: z.ZodArray<z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
service: z.ZodString;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
dispatchNamespaces: z.ZodArray<z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
namespace: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
secrets: z.ZodArray<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
router: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
47
|
+
service: z.ZodString;
|
|
48
|
+
hostSuffix: z.ZodString;
|
|
49
|
+
minLabels: z.ZodNumber;
|
|
50
|
+
}, z.core.$strict>]>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
export type FrozenConfiguration = z.output<typeof frozenConfiguration>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const name = z.string().min(1).max(128);
|
|
3
|
+
const positive = z.number().int().min(1);
|
|
4
|
+
/**
|
|
5
|
+
* The `FrozenConfigurationV1` (`@astrale-os/sdk/deployment/address`) one deployment freezes beside
|
|
6
|
+
* its build: the author's plain variables, the execution settings and the durable Workflow options
|
|
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({
|
|
14
|
+
format: z.literal('astrale.deployment.configuration'),
|
|
15
|
+
version: z.literal(1),
|
|
16
|
+
vars: z.record(name, z.string().max(64 * 1024)),
|
|
17
|
+
settings: z.strictObject({
|
|
18
|
+
maximumRequestBytes: z.number().int().min(1),
|
|
19
|
+
invocationTimeoutMs: z.number().int().min(1),
|
|
20
|
+
tokenExchange: z.union([
|
|
21
|
+
z.literal(false),
|
|
22
|
+
z.strictObject({ maximumLifetimeSeconds: z.number().int().min(1) }),
|
|
23
|
+
]),
|
|
24
|
+
durableOptions: z
|
|
25
|
+
.strictObject({
|
|
26
|
+
retentionMs: positive.optional(),
|
|
27
|
+
retry: z
|
|
28
|
+
.strictObject({
|
|
29
|
+
initialIntervalMs: positive.optional(),
|
|
30
|
+
maxAttempts: positive.optional(),
|
|
31
|
+
maxIntervalMs: positive.optional(),
|
|
32
|
+
})
|
|
33
|
+
.optional(),
|
|
34
|
+
stepTimeoutMs: positive.optional(),
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
37
|
+
}),
|
|
38
|
+
runtime: z.strictObject({
|
|
39
|
+
compatibilityDate: z.string().min(1).max(32),
|
|
40
|
+
compatibilityFlags: z.array(name).max(64),
|
|
41
|
+
}),
|
|
42
|
+
bindings: z.strictObject({
|
|
43
|
+
services: z.array(z.strictObject({ name, service: name })).max(32),
|
|
44
|
+
dispatchNamespaces: z.array(z.strictObject({ name, namespace: name })).max(32),
|
|
45
|
+
secrets: z.array(name).max(64),
|
|
46
|
+
}),
|
|
47
|
+
router: z.union([
|
|
48
|
+
z.literal(false),
|
|
49
|
+
z.strictObject({
|
|
50
|
+
service: name,
|
|
51
|
+
hostSuffix: z.string().max(253),
|
|
52
|
+
minLabels: z.number().int().min(0).max(127),
|
|
53
|
+
}),
|
|
54
|
+
]),
|
|
55
|
+
});
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
export { deploymentHosting, listDeploymentsInput, listDeploymentsOutput, } from './deployment-hosting.js';
|
|
2
|
+
export type { DeploymentHosting } from './deployment-hosting.js';
|
|
1
3
|
export { deploymentCommit, deploymentRecord } from './deployment-record.js';
|
|
2
4
|
export type { DeploymentRecord } from './deployment-record.js';
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
+
export { deploymentRequest } from './deployment-request.js';
|
|
6
|
+
export type { DeploymentRequest } from './deployment-request.js';
|
|
7
|
+
export { deploymentRejection, deploymentRejectionReason, deploymentResponse, } from './deployment-response.js';
|
|
8
|
+
export type { DeploymentRejection, DeploymentRejectionReason, DeploymentResponse, } from './deployment-response.js';
|
|
9
|
+
export { deploymentLabel, deploymentRetention, deploymentRetirement, expirePreviewsInput, expirePreviewsOutput, lastCallsInput, lastCallsOutput, MAXIMUM_LAST_CALL_LABELS, MAXIMUM_PREVIEW_EXPIRY_WRITES, retainInput, retainOutput, } from './deployment-retention.js';
|
|
10
|
+
export type { DeploymentRetention, DeploymentRetirement, ExpirePreviewsResult, } from './deployment-retention.js';
|
|
11
|
+
export { retireDeploymentInput, retireDeploymentOutput } from './deployment-retire.js';
|
|
12
|
+
export type { RetireDeploymentResult } from './deployment-retire.js';
|
|
13
|
+
export { deploymentSecretRejection, listDeploymentSecretNamesContract, setDeploymentSecretContract, } from './deployment-secret.js';
|
|
14
|
+
export type { DeploymentSecretRejection } from './deployment-secret.js';
|
|
15
|
+
export { deploymentSecretDigest, deploymentSecretDigests } from './deployment-secret-digest.js';
|
|
16
|
+
export type { DeploymentSecretDigest } from './deployment-secret-digest.js';
|
|
17
|
+
export { deploymentSummary, listedDeploymentSummary, unadmittedDeploymentSummary, } from './deployment-summary.js';
|
|
18
|
+
export type { DeploymentSummary, ListedDeploymentSummary, UnadmittedDeploymentSummary, } from './deployment-summary.js';
|
|
19
|
+
export { frozenConfiguration } from './frozen-configuration.js';
|
|
20
|
+
export type { FrozenConfiguration } from './frozen-configuration.js';
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
export { deploymentHosting, listDeploymentsInput, listDeploymentsOutput, } from './deployment-hosting.js';
|
|
1
2
|
export { deploymentCommit, deploymentRecord } from './deployment-record.js';
|
|
2
|
-
export {
|
|
3
|
+
export { deploymentRequest } from './deployment-request.js';
|
|
4
|
+
export { deploymentRejection, deploymentRejectionReason, deploymentResponse, } from './deployment-response.js';
|
|
5
|
+
export { deploymentLabel, deploymentRetention, deploymentRetirement, expirePreviewsInput, expirePreviewsOutput, lastCallsInput, lastCallsOutput, MAXIMUM_LAST_CALL_LABELS, MAXIMUM_PREVIEW_EXPIRY_WRITES, retainInput, retainOutput, } from './deployment-retention.js';
|
|
6
|
+
export { retireDeploymentInput, retireDeploymentOutput } from './deployment-retire.js';
|
|
7
|
+
export { deploymentSecretRejection, listDeploymentSecretNamesContract, setDeploymentSecretContract, } from './deployment-secret.js';
|
|
8
|
+
export { deploymentSecretDigest, deploymentSecretDigests } from './deployment-secret-digest.js';
|
|
9
|
+
export { deploymentSummary, listedDeploymentSummary, unadmittedDeploymentSummary, } from './deployment-summary.js';
|
|
10
|
+
export { frozenConfiguration } from './frozen-configuration.js';
|
|
@@ -61,10 +61,10 @@ export declare const CloudflareWorker: import("@astrale-os/sdk/schema").Authored
|
|
|
61
61
|
}, {
|
|
62
62
|
readonly mode: 'value';
|
|
63
63
|
readonly value: {
|
|
64
|
+
name: string;
|
|
65
|
+
} | {
|
|
64
66
|
kind: "rejected";
|
|
65
67
|
reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
|
|
66
|
-
} | {
|
|
67
|
-
name: string;
|
|
68
68
|
};
|
|
69
69
|
}, "authorized", false, true, undefined>>;
|
|
70
70
|
deleteSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
@@ -288,10 +288,10 @@ export declare const CloudflareWorker: import("@astrale-os/sdk/schema").Authored
|
|
|
288
288
|
}, {
|
|
289
289
|
readonly mode: 'value';
|
|
290
290
|
readonly value: {
|
|
291
|
+
name: string;
|
|
292
|
+
} | {
|
|
291
293
|
kind: "rejected";
|
|
292
294
|
reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
|
|
293
|
-
} | {
|
|
294
|
-
name: string;
|
|
295
295
|
};
|
|
296
296
|
}, "authorized", false, false, undefined>>;
|
|
297
297
|
deleteSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
@@ -59,10 +59,10 @@ export declare const Service: import("@astrale-os/sdk/schema").AuthoredNodeClass
|
|
|
59
59
|
}, {
|
|
60
60
|
readonly mode: 'value';
|
|
61
61
|
readonly value: {
|
|
62
|
-
name: string;
|
|
63
|
-
} | {
|
|
64
62
|
kind: "rejected";
|
|
65
63
|
reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
|
|
64
|
+
} | {
|
|
65
|
+
name: string;
|
|
66
66
|
};
|
|
67
67
|
}, "authorized", false, true, undefined>>;
|
|
68
68
|
deleteSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
@@ -4,9 +4,9 @@ export declare const setWorkerSecret: import("@astrale-os/sdk/schema").Method<im
|
|
|
4
4
|
}, {
|
|
5
5
|
readonly mode: 'value';
|
|
6
6
|
readonly value: {
|
|
7
|
-
name: string;
|
|
8
|
-
} | {
|
|
9
7
|
kind: "rejected";
|
|
10
8
|
reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
11
|
};
|
|
12
12
|
}, "authorized", false, false, undefined>>;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PORTABLE_BASE64_CHUNK_SIZE } from '../content/index.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Flat portable Base64 module and asset content, the form adapter-astrale ≤ 0.5.0-beta.157 sends.
|
|
5
|
+
* The `DeploymentContent` envelope (`identity` or `gzip`) is the canonical form; every deploy
|
|
6
|
+
* request, the Admin-hosted `CloudflareDeployment.deploy` included, decodes both to the same bytes
|
|
7
|
+
* (AM-176). Remove when no supported adapter-astrale is older than 0.5.0-beta.158.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Send the content envelope instead.
|
|
10
|
+
*/
|
|
4
11
|
export function legacyEncodedContent(maximumSize) {
|
|
5
12
|
return Object.freeze({
|
|
6
13
|
inline: { contentBase64: z.string().max(maximumSize).meta({ deprecated: true }) },
|