@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.
Files changed (76) hide show
  1. package/README.md +595 -43
  2. package/dist/schema/index.d.ts +2 -2
  3. package/dist/schema/index.js +1 -1
  4. package/dist/schema/modules/deployment/classes/cloudflare-deployment.d.ts +366 -0
  5. package/dist/schema/modules/deployment/classes/cloudflare-deployment.js +20 -0
  6. package/dist/schema/modules/deployment/classes/deployment.d.ts +93 -2
  7. package/dist/schema/modules/deployment/classes/deployment.js +27 -3
  8. package/dist/schema/modules/deployment/errors/deployment-hosting-unavailable.d.ts +7 -0
  9. package/dist/schema/modules/deployment/errors/deployment-hosting-unavailable.js +8 -0
  10. package/dist/schema/modules/deployment/errors/deployment-label-not-found.d.ts +12 -0
  11. package/dist/schema/modules/deployment/errors/deployment-label-not-found.js +11 -0
  12. package/dist/schema/modules/deployment/errors/deployment-not-found.d.ts +10 -0
  13. package/dist/schema/modules/deployment/errors/deployment-not-found.js +11 -0
  14. package/dist/schema/modules/deployment/errors/deployment-registry-only.d.ts +11 -0
  15. package/dist/schema/modules/deployment/errors/deployment-registry-only.js +12 -0
  16. package/dist/schema/modules/deployment/errors/index.d.ts +4 -0
  17. package/dist/schema/modules/deployment/errors/index.js +4 -0
  18. package/dist/schema/modules/deployment/functions/deploy-cloudflare-deployment.d.ts +170 -0
  19. package/dist/schema/modules/deployment/functions/deploy-cloudflare-deployment.js +14 -0
  20. package/dist/schema/modules/deployment/functions/describe-deployment-hosting.d.ts +8 -0
  21. package/dist/schema/modules/deployment/functions/describe-deployment-hosting.js +11 -0
  22. package/dist/schema/modules/deployment/functions/expire-deployment-previews.d.ts +16 -0
  23. package/dist/schema/modules/deployment/functions/expire-deployment-previews.js +14 -0
  24. package/dist/schema/modules/deployment/functions/index.d.ts +11 -0
  25. package/dist/schema/modules/deployment/functions/index.js +11 -0
  26. package/dist/schema/modules/deployment/functions/list-cloudflare-deployment-secret-names.d.ts +5 -0
  27. package/dist/schema/modules/deployment/functions/list-cloudflare-deployment-secret-names.js +4 -0
  28. package/dist/schema/modules/deployment/functions/list-cloudflare-deployments.d.ts +58 -0
  29. package/dist/schema/modules/deployment/functions/list-cloudflare-deployments.js +10 -0
  30. package/dist/schema/modules/deployment/functions/list-deployment-secret-names.d.ts +4 -0
  31. package/dist/schema/modules/deployment/functions/list-deployment-secret-names.js +6 -0
  32. package/dist/schema/modules/deployment/functions/read-deployment-last-calls.d.ts +10 -0
  33. package/dist/schema/modules/deployment/functions/read-deployment-last-calls.js +13 -0
  34. package/dist/schema/modules/deployment/functions/retain-deployment.d.ts +12 -0
  35. package/dist/schema/modules/deployment/functions/retain-deployment.js +13 -0
  36. package/dist/schema/modules/deployment/functions/retire-deployment.d.ts +23 -0
  37. package/dist/schema/modules/deployment/functions/retire-deployment.js +17 -0
  38. package/dist/schema/modules/deployment/functions/set-cloudflare-deployment-secret.d.ts +18 -0
  39. package/dist/schema/modules/deployment/functions/set-cloudflare-deployment-secret.js +7 -0
  40. package/dist/schema/modules/deployment/functions/set-deployment-secret.d.ts +14 -0
  41. package/dist/schema/modules/deployment/functions/set-deployment-secret.js +3 -0
  42. package/dist/schema/modules/deployment/index.d.ts +5 -3
  43. package/dist/schema/modules/deployment/index.js +4 -2
  44. package/dist/schema/modules/deployment/policies/act-for-organization.d.ts +6 -0
  45. package/dist/schema/modules/deployment/policies/act-for-organization.js +10 -0
  46. package/dist/schema/modules/deployment/policies/index.d.ts +1 -0
  47. package/dist/schema/modules/deployment/policies/index.js +1 -0
  48. package/dist/schema/modules/deployment/states/deployment-lifecycle.d.ts +6 -3
  49. package/dist/schema/modules/deployment/states/deployment-lifecycle.js +6 -4
  50. package/dist/schema/modules/deployment/types/deployment-hosting.d.ts +94 -0
  51. package/dist/schema/modules/deployment/types/deployment-hosting.js +19 -0
  52. package/dist/schema/modules/deployment/types/deployment-request.d.ts +161 -0
  53. package/dist/schema/modules/deployment/types/deployment-request.js +40 -0
  54. package/dist/schema/modules/deployment/types/deployment-response.d.ts +109 -0
  55. package/dist/schema/modules/deployment/types/deployment-response.js +36 -0
  56. package/dist/schema/modules/deployment/types/deployment-retention.d.ts +37 -1
  57. package/dist/schema/modules/deployment/types/deployment-retention.js +41 -1
  58. package/dist/schema/modules/deployment/types/deployment-retire.d.ts +30 -0
  59. package/dist/schema/modules/deployment/types/deployment-retire.js +18 -0
  60. package/dist/schema/modules/deployment/types/deployment-secret-digest.d.ts +17 -0
  61. package/dist/schema/modules/deployment/types/deployment-secret-digest.js +14 -0
  62. package/dist/schema/modules/deployment/types/deployment-secret.d.ts +59 -0
  63. package/dist/schema/modules/deployment/types/deployment-secret.js +52 -0
  64. package/dist/schema/modules/deployment/types/deployment-summary.d.ts +165 -0
  65. package/dist/schema/modules/deployment/types/deployment-summary.js +38 -0
  66. package/dist/schema/modules/deployment/types/frozen-configuration.d.ts +52 -0
  67. package/dist/schema/modules/deployment/types/frozen-configuration.js +55 -0
  68. package/dist/schema/modules/deployment/types/index.d.ts +18 -2
  69. package/dist/schema/modules/deployment/types/index.js +9 -1
  70. package/dist/schema/modules/service/classes/cloudflare-worker.d.ts +4 -4
  71. package/dist/schema/modules/service/classes/service.d.ts +2 -2
  72. package/dist/schema/modules/service/functions/set-worker-secret.d.ts +2 -2
  73. package/dist/schema/modules/service/types/legacy/service-deployment-content.js +8 -1
  74. package/dist/schema/schema.d.ts +456 -12
  75. package/dist/schema/schema.js +2 -1
  76. package/package.json +10 -6
@@ -1,3 +1,4 @@
1
+ export { ActForOrganization } from './act-for-organization.js';
1
2
  export { OwnDeployment } from './own-deployment.js';
2
3
  export { OwnLine } from './own-line.js';
3
4
  export { TraverseOwnedLine } from './traverse-owned-line.js';
@@ -1,3 +1,4 @@
1
+ export { ActForOrganization } from './act-for-organization.js';
1
2
  export { OwnDeployment } from './own-deployment.js';
2
3
  export { OwnLine } from './own-line.js';
3
4
  export { TraverseOwnedLine } from './traverse-owned-line.js';
@@ -1,9 +1,11 @@
1
1
  import { type EventOf, type StateOf } from '@astrale-os/sdk/state';
2
2
  /**
3
3
  * Lifecycle of one immutable deployment. A deployment never changes code: it is created
4
- * `deploying`, becomes `active` once its script serves, and leaves only by retirement. A failed
5
- * creation can be retried on the same label; an expired retirement can be revived for the same
6
- * owner and artifact.
4
+ * `deploying`, becomes `active` once its script serves, and leaves only by retirement, in two
5
+ * phases: `retiring` once its tombstone is written, `retired` once its script and key are deleted.
6
+ * A failed creation can be retried on the same label, or retired, since it may have left a
7
+ * script. An expired retirement can be revived for the same line holder and artifact; a withdrawn
8
+ * one never.
7
9
  */
8
10
  export declare const deploymentLifecycle: import("@astrale-os/sdk/schema").StateMachine<{
9
11
  readonly deploying: {
@@ -21,6 +23,7 @@ export declare const deploymentLifecycle: import("@astrale-os/sdk/schema").State
21
23
  };
22
24
  readonly failed: {
23
25
  readonly retry: "deploying";
26
+ readonly retire: "retiring";
24
27
  };
25
28
  }, "deploying">;
26
29
  export type DeploymentLifecycle = StateOf<typeof deploymentLifecycle>;
@@ -1,9 +1,11 @@
1
1
  import { stateMachine } from '@astrale-os/sdk/state';
2
2
  /**
3
3
  * Lifecycle of one immutable deployment. A deployment never changes code: it is created
4
- * `deploying`, becomes `active` once its script serves, and leaves only by retirement. A failed
5
- * creation can be retried on the same label; an expired retirement can be revived for the same
6
- * owner and artifact.
4
+ * `deploying`, becomes `active` once its script serves, and leaves only by retirement, in two
5
+ * phases: `retiring` once its tombstone is written, `retired` once its script and key are deleted.
6
+ * A failed creation can be retried on the same label, or retired, since it may have left a
7
+ * script. An expired retirement can be revived for the same line holder and artifact; a withdrawn
8
+ * one never.
7
9
  */
8
10
  export const deploymentLifecycle = stateMachine({
9
11
  initial: 'deploying',
@@ -12,6 +14,6 @@ export const deploymentLifecycle = stateMachine({
12
14
  active: { retire: 'retiring' },
13
15
  retiring: { completeRetirement: 'retired' },
14
16
  retired: { revive: 'deploying' },
15
- failed: { retry: 'deploying' },
17
+ failed: { retry: 'deploying', retire: 'retiring' },
16
18
  },
17
19
  });
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ /** Where this Services runtime addresses deployments, and how the caller's own lines read. */
3
+ export declare const deploymentHosting: z.ZodObject<{
4
+ routingDomain: z.ZodString;
5
+ addressing: z.ZodEnum<{
6
+ opaque: "opaque";
7
+ readable: "readable";
8
+ }>;
9
+ }, z.core.$strict>;
10
+ export declare const listDeploymentsInput: z.ZodObject<{
11
+ origin: z.ZodOptional<z.ZodString>;
12
+ environment: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strict>;
14
+ /**
15
+ * The deployments of the caller's lines. A deployment whose stored record or configuration this
16
+ * Services SDK no longer admits is listed from its facts with its record as stored, never dropped,
17
+ * and never fails the listing.
18
+ */
19
+ export declare const listDeploymentsOutput: z.ZodObject<{
20
+ deployments: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
21
+ id: z.ZodString;
22
+ url: z.ZodString;
23
+ label: z.ZodString;
24
+ line: z.ZodString;
25
+ owner: z.ZodString;
26
+ state: z.ZodEnum<{
27
+ active: "active";
28
+ deploying: "deploying";
29
+ failed: "failed";
30
+ retired: "retired";
31
+ retiring: "retiring";
32
+ }>;
33
+ retention: z.ZodEnum<{
34
+ preview: "preview";
35
+ published: "published";
36
+ }>;
37
+ createdAt: z.ZodString;
38
+ lastCallAt: z.ZodOptional<z.ZodString>;
39
+ expiresAt: z.ZodOptional<z.ZodString>;
40
+ retiredAt: z.ZodOptional<z.ZodString>;
41
+ retirement: z.ZodOptional<z.ZodEnum<{
42
+ expired: "expired";
43
+ withdrawn: "withdrawn";
44
+ }>>;
45
+ signingKeyId: z.ZodString;
46
+ record: z.ZodObject<{
47
+ format: z.ZodLiteral<"astrale.deployment-record">;
48
+ version: z.ZodLiteral<1>;
49
+ origin: z.ZodString;
50
+ environment: z.ZodString;
51
+ releaseDigest: z.ZodString;
52
+ buildDigest: z.ZodString;
53
+ schemaRevision: z.ZodString;
54
+ configuration: z.ZodString;
55
+ providerScript: z.ZodString;
56
+ commit: z.ZodNullable<z.ZodObject<{
57
+ sha: z.ZodString;
58
+ dirty: z.ZodBoolean;
59
+ base: z.ZodOptional<z.ZodObject<{
60
+ version: z.ZodString;
61
+ distance: z.ZodNumber;
62
+ }, z.core.$strict>>;
63
+ }, z.core.$strict>>;
64
+ }, z.core.$strict>;
65
+ }, z.core.$strict>, z.ZodObject<{
66
+ id: z.ZodString;
67
+ url: z.ZodString;
68
+ label: z.ZodString;
69
+ line: z.ZodString;
70
+ owner: z.ZodString;
71
+ state: z.ZodEnum<{
72
+ active: "active";
73
+ deploying: "deploying";
74
+ failed: "failed";
75
+ retired: "retired";
76
+ retiring: "retiring";
77
+ }>;
78
+ retention: z.ZodEnum<{
79
+ preview: "preview";
80
+ published: "published";
81
+ }>;
82
+ createdAt: z.ZodString;
83
+ lastCallAt: z.ZodOptional<z.ZodString>;
84
+ expiresAt: z.ZodOptional<z.ZodString>;
85
+ retiredAt: z.ZodOptional<z.ZodString>;
86
+ retirement: z.ZodOptional<z.ZodEnum<{
87
+ expired: "expired";
88
+ withdrawn: "withdrawn";
89
+ }>>;
90
+ signingKeyId: z.ZodString;
91
+ record: z.ZodUnknown;
92
+ }, z.core.$strict>]>>;
93
+ }, z.core.$strict>;
94
+ export type DeploymentHosting = z.output<typeof deploymentHosting>;
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { listedDeploymentSummary } from './deployment-summary.js';
3
+ /** Where this Services runtime addresses deployments, and how the caller's own lines read. */
4
+ export const deploymentHosting = z.strictObject({
5
+ routingDomain: z.string().min(1).max(253),
6
+ addressing: z.enum(['readable', 'opaque']),
7
+ });
8
+ export const listDeploymentsInput = z.strictObject({
9
+ origin: z.string().min(1).max(253).optional(),
10
+ environment: z.string().min(1).max(63).optional(),
11
+ });
12
+ /**
13
+ * The deployments of the caller's lines. A deployment whose stored record or configuration this
14
+ * Services SDK no longer admits is listed from its facts with its record as stored, never dropped,
15
+ * and never fails the listing.
16
+ */
17
+ export const listDeploymentsOutput = z.strictObject({
18
+ deployments: z.array(listedDeploymentSummary),
19
+ });
@@ -0,0 +1,161 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `DeploymentRequestV1`: one release to host on the line of its origin and environment. Services
4
+ * recomputes the build digest from the uploaded bytes and the label from the line, the build and
5
+ * the configuration; the request states both so a deployer that computed another address is
6
+ * refused rather than served elsewhere. The secrets are the environment's current values, bound to
7
+ * the new deployment only.
8
+ */
9
+ export declare const deploymentRequest: z.ZodObject<{
10
+ format: z.ZodLiteral<"astrale.services.deployment-request">;
11
+ version: z.ZodLiteral<1>;
12
+ organization: z.ZodOptional<z.ZodString>;
13
+ origin: z.ZodString;
14
+ environment: z.ZodString;
15
+ addressing: z.ZodEnum<{
16
+ opaque: "opaque";
17
+ readable: "readable";
18
+ }>;
19
+ label: z.ZodString;
20
+ buildDigest: z.ZodString;
21
+ configuration: z.ZodObject<{
22
+ format: z.ZodLiteral<"astrale.deployment.configuration">;
23
+ version: z.ZodLiteral<1>;
24
+ vars: z.ZodRecord<z.ZodString, z.ZodString>;
25
+ settings: z.ZodObject<{
26
+ maximumRequestBytes: z.ZodNumber;
27
+ invocationTimeoutMs: z.ZodNumber;
28
+ tokenExchange: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
29
+ maximumLifetimeSeconds: z.ZodNumber;
30
+ }, z.core.$strict>]>;
31
+ durableOptions: z.ZodOptional<z.ZodObject<{
32
+ retentionMs: z.ZodOptional<z.ZodNumber>;
33
+ retry: z.ZodOptional<z.ZodObject<{
34
+ initialIntervalMs: z.ZodOptional<z.ZodNumber>;
35
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
36
+ maxIntervalMs: z.ZodOptional<z.ZodNumber>;
37
+ }, z.core.$strict>>;
38
+ stepTimeoutMs: z.ZodOptional<z.ZodNumber>;
39
+ }, z.core.$strict>>;
40
+ }, z.core.$strict>;
41
+ runtime: z.ZodObject<{
42
+ compatibilityDate: z.ZodString;
43
+ compatibilityFlags: z.ZodArray<z.ZodString>;
44
+ }, z.core.$strict>;
45
+ bindings: z.ZodObject<{
46
+ services: z.ZodArray<z.ZodObject<{
47
+ name: z.ZodString;
48
+ service: z.ZodString;
49
+ }, z.core.$strict>>;
50
+ dispatchNamespaces: z.ZodArray<z.ZodObject<{
51
+ name: z.ZodString;
52
+ namespace: z.ZodString;
53
+ }, z.core.$strict>>;
54
+ secrets: z.ZodArray<z.ZodString>;
55
+ }, z.core.$strict>;
56
+ router: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
57
+ service: z.ZodString;
58
+ hostSuffix: z.ZodString;
59
+ minLabels: z.ZodNumber;
60
+ }, z.core.$strict>]>;
61
+ }, z.core.$strict>;
62
+ record: z.ZodObject<{
63
+ releaseDigest: z.ZodString;
64
+ schemaRevision: z.ZodString;
65
+ schemaBundle: z.ZodString;
66
+ commit: z.ZodNullable<z.ZodObject<{
67
+ sha: z.ZodString;
68
+ dirty: z.ZodBoolean;
69
+ base: z.ZodOptional<z.ZodObject<{
70
+ version: z.ZodString;
71
+ distance: z.ZodNumber;
72
+ }, z.core.$strict>>;
73
+ }, z.core.$strict>>;
74
+ }, z.core.$strict>;
75
+ bundle: z.ZodObject<{
76
+ entrypoint: z.ZodString;
77
+ modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
78
+ name: z.ZodString;
79
+ kind: z.ZodOptional<z.ZodEnum<{
80
+ data: "data";
81
+ esm: "esm";
82
+ text: "text";
83
+ wasm: "wasm";
84
+ }>>;
85
+ content: z.ZodUnion<readonly [z.ZodObject<{
86
+ encoding: z.ZodEnum<{
87
+ gzip: "gzip";
88
+ identity: "identity";
89
+ }>;
90
+ decodedSize: z.ZodNumber;
91
+ contentBase64: z.ZodString;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ encoding: z.ZodEnum<{
94
+ gzip: "gzip";
95
+ identity: "identity";
96
+ }>;
97
+ decodedSize: z.ZodNumber;
98
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
99
+ }, z.core.$strict>]>;
100
+ }, z.core.$strict>, z.ZodObject<{
101
+ contentBase64: z.ZodString;
102
+ name: z.ZodString;
103
+ kind: z.ZodOptional<z.ZodEnum<{
104
+ data: "data";
105
+ esm: "esm";
106
+ text: "text";
107
+ wasm: "wasm";
108
+ }>>;
109
+ }, z.core.$strict>, z.ZodObject<{
110
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
111
+ name: z.ZodString;
112
+ kind: z.ZodOptional<z.ZodEnum<{
113
+ data: "data";
114
+ esm: "esm";
115
+ text: "text";
116
+ wasm: "wasm";
117
+ }>>;
118
+ }, z.core.$strict>]>>;
119
+ assets: z.ZodOptional<z.ZodObject<{
120
+ files: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
121
+ path: z.ZodString;
122
+ contentType: z.ZodOptional<z.ZodString>;
123
+ content: z.ZodUnion<readonly [z.ZodObject<{
124
+ encoding: z.ZodEnum<{
125
+ gzip: "gzip";
126
+ identity: "identity";
127
+ }>;
128
+ decodedSize: z.ZodNumber;
129
+ contentBase64: z.ZodString;
130
+ }, z.core.$strict>, z.ZodObject<{
131
+ encoding: z.ZodEnum<{
132
+ gzip: "gzip";
133
+ identity: "identity";
134
+ }>;
135
+ decodedSize: z.ZodNumber;
136
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
137
+ }, z.core.$strict>]>;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ contentBase64: z.ZodString;
140
+ path: z.ZodString;
141
+ contentType: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
144
+ path: z.ZodString;
145
+ contentType: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>]>>;
147
+ notFound: z.ZodOptional<z.ZodEnum<{
148
+ "404-page": "404-page";
149
+ none: "none";
150
+ "single-page-application": "single-page-application";
151
+ }>>;
152
+ runWorkerFirst: z.ZodOptional<z.ZodBoolean>;
153
+ htmlHandling: z.ZodOptional<z.ZodLiteral<"none">>;
154
+ }, z.core.$strict>>;
155
+ }, z.core.$strict>;
156
+ secrets: z.ZodRecord<z.ZodString, z.ZodString>;
157
+ readiness: z.ZodOptional<z.ZodObject<{
158
+ paths: z.ZodArray<z.ZodString>;
159
+ }, z.core.$strict>>;
160
+ }, z.core.$strict>;
161
+ export type DeploymentRequest = z.output<typeof deploymentRequest>;
@@ -0,0 +1,40 @@
1
+ import { fullMatch } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { artifactModule, assetBundle } from '../../service/index.js';
4
+ import { deploymentCommit } from './deployment-record.js';
5
+ import { frozenConfiguration } from './frozen-configuration.js';
6
+ const digest = z.string().check(fullMatch('sha256:[0-9a-f]{64}'));
7
+ /**
8
+ * `DeploymentRequestV1`: one release to host on the line of its origin and environment. Services
9
+ * recomputes the build digest from the uploaded bytes and the label from the line, the build and
10
+ * the configuration; the request states both so a deployer that computed another address is
11
+ * refused rather than served elsewhere. The secrets are the environment's current values, bound to
12
+ * the new deployment only.
13
+ */
14
+ export const deploymentRequest = z.strictObject({
15
+ format: z.literal('astrale.services.deployment-request'),
16
+ version: z.literal(1),
17
+ /** The Identity of the Admin instance the deploy acts for; the exact caller when absent. */
18
+ organization: z.string().min(1).max(256).optional(),
19
+ origin: z.string().min(1).max(253),
20
+ environment: z.string().min(1).max(63),
21
+ addressing: z.enum(['readable', 'opaque']),
22
+ label: z.string().min(1).max(63),
23
+ buildDigest: digest,
24
+ configuration: frozenConfiguration,
25
+ record: z.strictObject({
26
+ releaseDigest: digest,
27
+ schemaRevision: digest,
28
+ schemaBundle: digest,
29
+ commit: deploymentCommit.nullable(),
30
+ }),
31
+ bundle: z.strictObject({
32
+ entrypoint: z.string().min(1).max(256),
33
+ modules: z.array(artifactModule).min(1).max(40),
34
+ assets: assetBundle.optional(),
35
+ }),
36
+ secrets: z.record(z.string().min(1).max(128), z.string().max(64 * 1024)),
37
+ readiness: z
38
+ .strictObject({ paths: z.array(z.string().min(1).max(1_024)).min(1).max(8) })
39
+ .optional(),
40
+ });
@@ -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 after 30 days without a call; a published deployment is retained. */
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 after 30 days without a call; a published deployment is retained. */
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>;