@astrale-domains/services 0.4.5 → 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.
Files changed (126) hide show
  1. package/README.md +278 -12
  2. package/dist/schema/index.d.ts +2 -0
  3. package/dist/schema/index.js +1 -0
  4. package/dist/schema/modules/deployment/classes/cloudflare-deployment.d.ts +463 -0
  5. package/dist/schema/modules/deployment/classes/cloudflare-deployment.js +30 -0
  6. package/dist/schema/modules/deployment/classes/deployment-line.d.ts +23 -0
  7. package/dist/schema/modules/deployment/classes/deployment-line.js +24 -0
  8. package/dist/schema/modules/deployment/classes/deployment-on-line.d.ts +17 -0
  9. package/dist/schema/modules/deployment/classes/deployment-on-line.js +11 -0
  10. package/dist/schema/modules/deployment/classes/deployment.d.ts +189 -0
  11. package/dist/schema/modules/deployment/classes/deployment.js +56 -0
  12. package/dist/schema/modules/deployment/classes/index.d.ts +5 -0
  13. package/dist/schema/modules/deployment/classes/index.js +5 -0
  14. package/dist/schema/modules/deployment/classes/line-owned-by.d.ts +26 -0
  15. package/dist/schema/modules/deployment/classes/line-owned-by.js +19 -0
  16. package/dist/schema/modules/deployment/errors/deployment-hosting-unavailable.d.ts +7 -0
  17. package/dist/schema/modules/deployment/errors/deployment-hosting-unavailable.js +8 -0
  18. package/dist/schema/modules/deployment/errors/deployment-label-not-found.d.ts +12 -0
  19. package/dist/schema/modules/deployment/errors/deployment-label-not-found.js +11 -0
  20. package/dist/schema/modules/deployment/errors/deployment-not-found.d.ts +10 -0
  21. package/dist/schema/modules/deployment/errors/deployment-not-found.js +11 -0
  22. package/dist/schema/modules/deployment/errors/deployment-registry-only.d.ts +11 -0
  23. package/dist/schema/modules/deployment/errors/deployment-registry-only.js +12 -0
  24. package/dist/schema/modules/deployment/errors/index.d.ts +4 -0
  25. package/dist/schema/modules/deployment/errors/index.js +4 -0
  26. package/dist/schema/modules/deployment/functions/deploy-cloudflare-deployment.d.ts +170 -0
  27. package/dist/schema/modules/deployment/functions/deploy-cloudflare-deployment.js +14 -0
  28. package/dist/schema/modules/deployment/functions/describe-deployment-hosting.d.ts +8 -0
  29. package/dist/schema/modules/deployment/functions/describe-deployment-hosting.js +11 -0
  30. package/dist/schema/modules/deployment/functions/expire-deployment-previews.d.ts +16 -0
  31. package/dist/schema/modules/deployment/functions/expire-deployment-previews.js +14 -0
  32. package/dist/schema/modules/deployment/functions/index.d.ts +11 -0
  33. package/dist/schema/modules/deployment/functions/index.js +11 -0
  34. package/dist/schema/modules/deployment/functions/list-cloudflare-deployment-secret-names.d.ts +5 -0
  35. package/dist/schema/modules/deployment/functions/list-cloudflare-deployment-secret-names.js +4 -0
  36. package/dist/schema/modules/deployment/functions/list-cloudflare-deployments.d.ts +58 -0
  37. package/dist/schema/modules/deployment/functions/list-cloudflare-deployments.js +10 -0
  38. package/dist/schema/modules/deployment/functions/list-deployment-secret-names.d.ts +4 -0
  39. package/dist/schema/modules/deployment/functions/list-deployment-secret-names.js +6 -0
  40. package/dist/schema/modules/deployment/functions/read-deployment-last-calls.d.ts +10 -0
  41. package/dist/schema/modules/deployment/functions/read-deployment-last-calls.js +13 -0
  42. package/dist/schema/modules/deployment/functions/retain-deployment.d.ts +12 -0
  43. package/dist/schema/modules/deployment/functions/retain-deployment.js +13 -0
  44. package/dist/schema/modules/deployment/functions/retire-deployment.d.ts +23 -0
  45. package/dist/schema/modules/deployment/functions/retire-deployment.js +17 -0
  46. package/dist/schema/modules/deployment/functions/set-cloudflare-deployment-secret.d.ts +18 -0
  47. package/dist/schema/modules/deployment/functions/set-cloudflare-deployment-secret.js +7 -0
  48. package/dist/schema/modules/deployment/functions/set-deployment-secret.d.ts +14 -0
  49. package/dist/schema/modules/deployment/functions/set-deployment-secret.js +3 -0
  50. package/dist/schema/modules/deployment/index.d.ts +8 -0
  51. package/dist/schema/modules/deployment/index.js +6 -0
  52. package/dist/schema/modules/deployment/policies/act-for-organization.d.ts +6 -0
  53. package/dist/schema/modules/deployment/policies/act-for-organization.js +10 -0
  54. package/dist/schema/modules/deployment/policies/index.d.ts +5 -0
  55. package/dist/schema/modules/deployment/policies/index.js +5 -0
  56. package/dist/schema/modules/deployment/policies/own-deployment.d.ts +2 -0
  57. package/dist/schema/modules/deployment/policies/own-deployment.js +12 -0
  58. package/dist/schema/modules/deployment/policies/own-line.d.ts +5 -0
  59. package/dist/schema/modules/deployment/policies/own-line.js +10 -0
  60. package/dist/schema/modules/deployment/policies/traverse-owned-line-deployment.d.ts +2 -0
  61. package/dist/schema/modules/deployment/policies/traverse-owned-line-deployment.js +7 -0
  62. package/dist/schema/modules/deployment/policies/traverse-owned-line.d.ts +2 -0
  63. package/dist/schema/modules/deployment/policies/traverse-owned-line.js +7 -0
  64. package/dist/schema/modules/deployment/states/deployment-lifecycle.d.ts +30 -0
  65. package/dist/schema/modules/deployment/states/deployment-lifecycle.js +19 -0
  66. package/dist/schema/modules/deployment/states/index.d.ts +2 -0
  67. package/dist/schema/modules/deployment/states/index.js +1 -0
  68. package/dist/schema/modules/deployment/types/deployment-hosting.d.ts +94 -0
  69. package/dist/schema/modules/deployment/types/deployment-hosting.js +19 -0
  70. package/dist/schema/modules/deployment/types/deployment-record.d.ts +35 -0
  71. package/dist/schema/modules/deployment/types/deployment-record.js +31 -0
  72. package/dist/schema/modules/deployment/types/deployment-request.d.ts +161 -0
  73. package/dist/schema/modules/deployment/types/deployment-request.js +40 -0
  74. package/dist/schema/modules/deployment/types/deployment-response.d.ts +109 -0
  75. package/dist/schema/modules/deployment/types/deployment-response.js +36 -0
  76. package/dist/schema/modules/deployment/types/deployment-retention.d.ts +49 -0
  77. package/dist/schema/modules/deployment/types/deployment-retention.js +45 -0
  78. package/dist/schema/modules/deployment/types/deployment-retire.d.ts +30 -0
  79. package/dist/schema/modules/deployment/types/deployment-retire.js +18 -0
  80. package/dist/schema/modules/deployment/types/deployment-secret-digest.d.ts +17 -0
  81. package/dist/schema/modules/deployment/types/deployment-secret-digest.js +14 -0
  82. package/dist/schema/modules/deployment/types/deployment-secret.d.ts +59 -0
  83. package/dist/schema/modules/deployment/types/deployment-secret.js +52 -0
  84. package/dist/schema/modules/deployment/types/deployment-summary.d.ts +165 -0
  85. package/dist/schema/modules/deployment/types/deployment-summary.js +38 -0
  86. package/dist/schema/modules/deployment/types/frozen-configuration.d.ts +52 -0
  87. package/dist/schema/modules/deployment/types/frozen-configuration.js +55 -0
  88. package/dist/schema/modules/deployment/types/index.d.ts +20 -0
  89. package/dist/schema/modules/deployment/types/index.js +10 -0
  90. package/dist/schema/modules/service/classes/cloudflare-worker.d.ts +60 -24
  91. package/dist/schema/modules/service/classes/service.d.ts +7 -7
  92. package/dist/schema/modules/service/functions/delete-service-secret.d.ts +1 -1
  93. package/dist/schema/modules/service/functions/delete-service.d.ts +1 -1
  94. package/dist/schema/modules/service/functions/delete-worker-secret.d.ts +1 -1
  95. package/dist/schema/modules/service/functions/delete-worker.d.ts +1 -1
  96. package/dist/schema/modules/service/functions/deploy-cloudflare-worker.d.ts +37 -1
  97. package/dist/schema/modules/service/functions/list-service-logs.d.ts +1 -1
  98. package/dist/schema/modules/service/functions/list-service-schedules.d.ts +1 -1
  99. package/dist/schema/modules/service/functions/list-service-secret-names.d.ts +1 -1
  100. package/dist/schema/modules/service/functions/list-worker-logs.d.ts +1 -1
  101. package/dist/schema/modules/service/functions/list-worker-schedules.d.ts +1 -1
  102. package/dist/schema/modules/service/functions/list-worker-secret-names.d.ts +1 -1
  103. package/dist/schema/modules/service/functions/migrate-worker-ingress.d.ts +1 -1
  104. package/dist/schema/modules/service/functions/replace-service-schedules.d.ts +1 -1
  105. package/dist/schema/modules/service/functions/replace-worker-schedules.d.ts +1 -1
  106. package/dist/schema/modules/service/functions/set-service-secret.d.ts +1 -1
  107. package/dist/schema/modules/service/functions/set-worker-secret.d.ts +3 -3
  108. package/dist/schema/modules/service/index.d.ts +2 -2
  109. package/dist/schema/modules/service/index.js +1 -1
  110. package/dist/schema/modules/service/types/content/index.d.ts +1 -0
  111. package/dist/schema/modules/service/types/content/index.js +1 -0
  112. package/dist/schema/modules/service/types/content/limits.d.ts +7 -0
  113. package/dist/schema/modules/service/types/content/limits.js +7 -0
  114. package/dist/schema/modules/service/types/deploy-cloudflare-worker.d.ts +110 -0
  115. package/dist/schema/modules/service/types/index.d.ts +2 -1
  116. package/dist/schema/modules/service/types/index.js +1 -1
  117. package/dist/schema/modules/service/types/legacy/service-deployment-content.js +22 -0
  118. package/dist/schema/modules/service/types/service-deployment-artifact-module.d.ts +23 -0
  119. package/dist/schema/modules/service/types/service-deployment-artifact-module.js +5 -3
  120. package/dist/schema/modules/service/types/service-deployment-assets.d.ts +36 -0
  121. package/dist/schema/modules/service/types/service-deployment-assets.js +5 -3
  122. package/dist/schema/modules/service/types/service-deployment-content.d.ts +18 -11
  123. package/dist/schema/modules/service/types/service-deployment-content.js +17 -8
  124. package/dist/schema/schema.d.ts +740 -23
  125. package/dist/schema/schema.js +11 -0
  126. package/package.json +15 -11
@@ -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
+ ]);
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ /** A preview expires 30 days after its last call; a published deployment is retained. */
3
+ export declare const deploymentRetention: z.ZodEnum<{
4
+ preview: "preview";
5
+ published: "published";
6
+ }>;
7
+ /** Why a deployment left: an expired preview can be revived, a withdrawn one never. */
8
+ export declare const deploymentRetirement: z.ZodEnum<{
9
+ expired: "expired";
10
+ withdrawn: "withdrawn";
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>;
47
+ export type DeploymentRetention = z.output<typeof deploymentRetention>;
48
+ export type DeploymentRetirement = z.output<typeof deploymentRetirement>;
49
+ export type ExpirePreviewsResult = z.output<typeof expirePreviewsOutput>;
@@ -0,0 +1,45 @@
1
+ import { fullMatch } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ /** A preview expires 30 days after its last call; a published deployment is retained. */
4
+ export const deploymentRetention = z.enum(['preview', 'published']);
5
+ /** Why a deployment left: an expired preview can be revived, a withdrawn one never. */
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
+ };