@astrale-domains/services 0.5.1 → 0.7.0

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