@astrale-domains/services 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +163 -6
  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 -5
@@ -0,0 +1,6 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { listDeploymentSecretNamesContract } from '../types/deployment-secret.js';
3
+ export const listDeploymentSecretNames = method({
4
+ ...listDeploymentSecretNamesContract,
5
+ abstract: true,
6
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The last call of each deployment named, as the dispatcher counted it. The caller must hold
3
+ * every label's line; the registry Domain may read any label.
4
+ */
5
+ export declare const readDeploymentLastCalls: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
6
+ labels: string[];
7
+ }, {
8
+ readonly mode: 'value';
9
+ readonly value: Record<string, string | null>;
10
+ }, "authenticated", true, false, undefined>>;
@@ -0,0 +1,13 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { lastCallsInput, lastCallsOutput } from '../types/deployment-retention.js';
3
+ /**
4
+ * The last call of each deployment named, as the dispatcher counted it. The caller must hold
5
+ * every label's line; the registry Domain may read any label.
6
+ */
7
+ export const readDeploymentLastCalls = method({
8
+ description: 'Read the instant of the last call of each named deployment.',
9
+ auth: 'authenticated',
10
+ static: true,
11
+ input: lastCallsInput,
12
+ output: lastCallsOutput,
13
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Mark one deployment published, so it is served as long as it exists. Only the registry Domain
3
+ * marks, after the Publication that names the release; a line holder cannot keep its own preview.
4
+ */
5
+ export declare const retainDeployment: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
6
+ label: string;
7
+ }, {
8
+ readonly mode: 'value';
9
+ readonly value: {
10
+ retention: "published";
11
+ };
12
+ }, "authenticated", true, false, undefined>>;
@@ -0,0 +1,13 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { retainInput, retainOutput } from '../types/deployment-retention.js';
3
+ /**
4
+ * Mark one deployment published, so it is served as long as it exists. Only the registry Domain
5
+ * marks, after the Publication that names the release; a line holder cannot keep its own preview.
6
+ */
7
+ export const retainDeployment = method({
8
+ description: 'Mark one deployment published so that it never expires.',
9
+ auth: 'authenticated',
10
+ static: true,
11
+ input: retainInput,
12
+ output: retainOutput,
13
+ });
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Withdraw one deployment for good: the emergency stop of its line holder. Its URL then answers
3
+ * `DEPLOYMENT_RETIRED`, its script and key are deleted, and no redeploy serves it again.
4
+ *
5
+ * Only the holder of the deployment's line, or an Identity acting for it, withdraws it: the
6
+ * handler asks the Kernel `OwnDeployment` for the caller before it reads the deployment, as
7
+ * `setSecret` does. An `authorized` Method would also require the caller's principal to hold
8
+ * `can_use` on this Function, which no publisher identity holds on the Admin instance.
9
+ */
10
+ export declare const retireDeployment: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
11
+ readonly mode: 'value';
12
+ readonly value: {
13
+ kind: "retired";
14
+ } | {
15
+ kind: "retiring";
16
+ retryAfterMs: number;
17
+ } | {
18
+ kind: "rejected";
19
+ reason: "address-mismatch" | "build-mismatch" | "deployment-conflict" | "deployment-retired" | "hosting-unavailable" | "invalid-deployment" | "line-owned-elsewhere" | "service-unavailable";
20
+ message: string;
21
+ retryAfter?: string | undefined;
22
+ };
23
+ }, "authenticated", false, false, undefined>>;
@@ -0,0 +1,17 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { retireDeploymentInput, retireDeploymentOutput } from '../types/deployment-retire.js';
3
+ /**
4
+ * Withdraw one deployment for good: the emergency stop of its line holder. Its URL then answers
5
+ * `DEPLOYMENT_RETIRED`, its script and key are deleted, and no redeploy serves it again.
6
+ *
7
+ * Only the holder of the deployment's line, or an Identity acting for it, withdraws it: the
8
+ * handler asks the Kernel `OwnDeployment` for the caller before it reads the deployment, as
9
+ * `setSecret` does. An `authorized` Method would also require the caller's principal to hold
10
+ * `can_use` on this Function, which no publisher identity holds on the Admin instance.
11
+ */
12
+ export const retireDeployment = method({
13
+ description: 'Withdraw this deployment for good: an emergency stop.',
14
+ auth: 'authenticated',
15
+ input: retireDeploymentInput,
16
+ output: retireDeploymentOutput,
17
+ });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Only the holder of the deployment's line, or an Identity acting for it, rewrites its secrets:
3
+ * the handler asks the Kernel `OwnDeployment` for the caller before it reads the deployment.
4
+ */
5
+ export declare const setCloudflareDeploymentSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
6
+ name: string;
7
+ value: string;
8
+ }, {
9
+ readonly mode: 'value';
10
+ readonly value: {
11
+ name: string;
12
+ } | {
13
+ kind: "rejected";
14
+ reason: "secret-undeclared" | "service-unavailable";
15
+ message: string;
16
+ retryAfter?: string | undefined;
17
+ };
18
+ }, "authenticated", false, false, undefined>>;
@@ -0,0 +1,7 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { setDeploymentSecretContract } from '../types/deployment-secret.js';
3
+ /**
4
+ * Only the holder of the deployment's line, or an Identity acting for it, rewrites its secrets:
5
+ * the handler asks the Kernel `OwnDeployment` for the caller before it reads the deployment.
6
+ */
7
+ export const setCloudflareDeploymentSecret = method(setDeploymentSecretContract);
@@ -0,0 +1,14 @@
1
+ export declare const setDeploymentSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
2
+ name: string;
3
+ value: string;
4
+ }, {
5
+ readonly mode: 'value';
6
+ readonly value: {
7
+ name: string;
8
+ } | {
9
+ kind: "rejected";
10
+ reason: "secret-undeclared" | "service-unavailable";
11
+ message: string;
12
+ retryAfter?: string | undefined;
13
+ };
14
+ }, "authenticated", false, true, undefined>>;
@@ -0,0 +1,3 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { setDeploymentSecretContract } from '../types/deployment-secret.js';
3
+ export const setDeploymentSecret = method({ ...setDeploymentSecretContract, abstract: true });
@@ -1,6 +1,8 @@
1
1
  export { CloudflareDeployment, Deployment, DeploymentLine, deployment_on_line, line_owned_by, } from './classes/index.js';
2
- export { OwnDeployment, OwnLine, TraverseOwnedLine, TraverseOwnedLineDeployment, } from './policies/index.js';
2
+ export { deploymentHostingUnavailable, deploymentLabelNotFound, deploymentNotFound, deploymentRegistryOnly, } from './errors/index.js';
3
+ export { deployCloudflareDeployment, describeDeploymentHosting, expireDeploymentPreviews, listCloudflareDeploymentSecretNames, listCloudflareDeployments, listDeploymentSecretNames, readDeploymentLastCalls, retainDeployment, retireDeployment, setCloudflareDeploymentSecret, setDeploymentSecret, } from './functions/index.js';
4
+ export { ActForOrganization, OwnDeployment, OwnLine, TraverseOwnedLine, TraverseOwnedLineDeployment, } from './policies/index.js';
3
5
  export { deploymentLifecycle } from './states/index.js';
4
6
  export type { DeploymentLifecycle, DeploymentLifecycleEvent } from './states/index.js';
5
- export { deploymentCommit, deploymentRecord, deploymentRetention, deploymentRetirement, } from './types/index.js';
6
- export type { DeploymentRecord, DeploymentRetention, DeploymentRetirement } from './types/index.js';
7
+ export { deploymentCommit, deploymentHosting, deploymentLabel, deploymentRecord, deploymentRejection, deploymentRejectionReason, deploymentRequest, deploymentResponse, deploymentRetention, deploymentRetirement, deploymentSecretDigest, deploymentSecretDigests, deploymentSecretRejection, deploymentSummary, expirePreviewsInput, expirePreviewsOutput, frozenConfiguration, lastCallsInput, lastCallsOutput, listDeploymentSecretNamesContract, listedDeploymentSummary, listDeploymentsInput, listDeploymentsOutput, MAXIMUM_LAST_CALL_LABELS, MAXIMUM_PREVIEW_EXPIRY_WRITES, retainInput, retainOutput, retireDeploymentInput, retireDeploymentOutput, setDeploymentSecretContract, unadmittedDeploymentSummary, } from './types/index.js';
8
+ export type { DeploymentHosting, DeploymentRecord, DeploymentRejection, DeploymentRejectionReason, DeploymentRequest, DeploymentResponse, DeploymentRetention, DeploymentRetirement, DeploymentSecretDigest, DeploymentSecretRejection, DeploymentSummary, ExpirePreviewsResult, FrozenConfiguration, ListedDeploymentSummary, RetireDeploymentResult, UnadmittedDeploymentSummary, } from './types/index.js';
@@ -1,4 +1,6 @@
1
1
  export { CloudflareDeployment, Deployment, DeploymentLine, deployment_on_line, line_owned_by, } from './classes/index.js';
2
- export { OwnDeployment, OwnLine, TraverseOwnedLine, TraverseOwnedLineDeployment, } from './policies/index.js';
2
+ export { deploymentHostingUnavailable, deploymentLabelNotFound, deploymentNotFound, deploymentRegistryOnly, } from './errors/index.js';
3
+ export { deployCloudflareDeployment, describeDeploymentHosting, expireDeploymentPreviews, listCloudflareDeploymentSecretNames, listCloudflareDeployments, listDeploymentSecretNames, readDeploymentLastCalls, retainDeployment, retireDeployment, setCloudflareDeploymentSecret, setDeploymentSecret, } from './functions/index.js';
4
+ export { ActForOrganization, OwnDeployment, OwnLine, TraverseOwnedLine, TraverseOwnedLineDeployment, } from './policies/index.js';
3
5
  export { deploymentLifecycle } from './states/index.js';
4
- export { deploymentCommit, deploymentRecord, deploymentRetention, deploymentRetirement, } from './types/index.js';
6
+ export { deploymentCommit, deploymentHosting, deploymentLabel, deploymentRecord, deploymentRejection, deploymentRejectionReason, deploymentRequest, deploymentResponse, deploymentRetention, deploymentRetirement, deploymentSecretDigest, deploymentSecretDigests, deploymentSecretRejection, deploymentSummary, expirePreviewsInput, expirePreviewsOutput, frozenConfiguration, lastCallsInput, lastCallsOutput, listDeploymentSecretNamesContract, listedDeploymentSummary, listDeploymentsInput, listDeploymentsOutput, MAXIMUM_LAST_CALL_LABELS, MAXIMUM_PREVIEW_EXPIRY_WRITES, retainInput, retainOutput, retireDeploymentInput, retireDeploymentOutput, setDeploymentSecretContract, unadmittedDeploymentSummary, } from './types/index.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The subject is this organisation, or an Identity acting for it: a member or a CI identity
3
+ * reaches its organisation through `extends_with`, which the Kernel expands for the subject. Deploy
4
+ * asks it of the caller, on the organisation it names, before registering a line for it.
5
+ */
6
+ export declare const ActForOrganization: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,10 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ /**
3
+ * The subject is this organisation, or an Identity acting for it: a member or a CI identity
4
+ * reaches its organisation through `extends_with`, which the Kernel expands for the subject. Deploy
5
+ * asks it of the caller, on the organisation it names, before registering a line for it.
6
+ */
7
+ export const ActForOrganization = policy({
8
+ description: 'The subject is this organisation or acts for it through extends_with.',
9
+ match: ({ sameNode, subject, object }) => sameNode(subject, object),
10
+ });
@@ -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
+ });