@astrale-domains/services 0.4.4 → 0.4.6

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 (87) hide show
  1. package/README.md +199 -7
  2. package/dist/scaffold/create-service.mjs +77 -0
  3. package/dist/scaffold/template/.env.example +2 -0
  4. package/dist/scaffold/template/README.md +37 -0
  5. package/dist/scaffold/template/gitignore +6 -0
  6. package/dist/scaffold/template/scripts/build.mjs +10 -0
  7. package/dist/scaffold/template/scripts/deploy.mjs +50 -0
  8. package/dist/scaffold/template/src/account.js +26 -0
  9. package/dist/scaffold/template/src/index.js +32 -0
  10. package/dist/scaffold/template/src/job.js +19 -0
  11. package/dist/schema/index.d.ts +2 -0
  12. package/dist/schema/index.js +1 -0
  13. package/dist/schema/modules/deployment/classes/cloudflare-deployment.d.ts +97 -0
  14. package/dist/schema/modules/deployment/classes/cloudflare-deployment.js +10 -0
  15. package/dist/schema/modules/deployment/classes/deployment-line.d.ts +23 -0
  16. package/dist/schema/modules/deployment/classes/deployment-line.js +24 -0
  17. package/dist/schema/modules/deployment/classes/deployment-on-line.d.ts +17 -0
  18. package/dist/schema/modules/deployment/classes/deployment-on-line.js +11 -0
  19. package/dist/schema/modules/deployment/classes/deployment.d.ts +98 -0
  20. package/dist/schema/modules/deployment/classes/deployment.js +32 -0
  21. package/dist/schema/modules/deployment/classes/index.d.ts +5 -0
  22. package/dist/schema/modules/deployment/classes/index.js +5 -0
  23. package/dist/schema/modules/deployment/classes/line-owned-by.d.ts +26 -0
  24. package/dist/schema/modules/deployment/classes/line-owned-by.js +19 -0
  25. package/dist/schema/modules/deployment/index.d.ts +6 -0
  26. package/dist/schema/modules/deployment/index.js +4 -0
  27. package/dist/schema/modules/deployment/policies/index.d.ts +4 -0
  28. package/dist/schema/modules/deployment/policies/index.js +4 -0
  29. package/dist/schema/modules/deployment/policies/own-deployment.d.ts +2 -0
  30. package/dist/schema/modules/deployment/policies/own-deployment.js +12 -0
  31. package/dist/schema/modules/deployment/policies/own-line.d.ts +5 -0
  32. package/dist/schema/modules/deployment/policies/own-line.js +10 -0
  33. package/dist/schema/modules/deployment/policies/traverse-owned-line-deployment.d.ts +2 -0
  34. package/dist/schema/modules/deployment/policies/traverse-owned-line-deployment.js +7 -0
  35. package/dist/schema/modules/deployment/policies/traverse-owned-line.d.ts +2 -0
  36. package/dist/schema/modules/deployment/policies/traverse-owned-line.js +7 -0
  37. package/dist/schema/modules/deployment/states/deployment-lifecycle.d.ts +27 -0
  38. package/dist/schema/modules/deployment/states/deployment-lifecycle.js +17 -0
  39. package/dist/schema/modules/deployment/states/index.d.ts +2 -0
  40. package/dist/schema/modules/deployment/states/index.js +1 -0
  41. package/dist/schema/modules/deployment/types/deployment-record.d.ts +35 -0
  42. package/dist/schema/modules/deployment/types/deployment-record.js +31 -0
  43. package/dist/schema/modules/deployment/types/deployment-retention.d.ts +13 -0
  44. package/dist/schema/modules/deployment/types/deployment-retention.js +5 -0
  45. package/dist/schema/modules/deployment/types/index.d.ts +4 -0
  46. package/dist/schema/modules/deployment/types/index.js +2 -0
  47. package/dist/schema/modules/service/classes/cloudflare-worker.d.ts +103 -37
  48. package/dist/schema/modules/service/classes/cloudflare-worker.js +4 -1
  49. package/dist/schema/modules/service/classes/service.d.ts +19 -19
  50. package/dist/schema/modules/service/functions/delete-service-secret.d.ts +1 -1
  51. package/dist/schema/modules/service/functions/delete-service.d.ts +1 -1
  52. package/dist/schema/modules/service/functions/delete-worker-secret.d.ts +1 -1
  53. package/dist/schema/modules/service/functions/delete-worker.d.ts +1 -1
  54. package/dist/schema/modules/service/functions/deploy-cloudflare-worker.d.ts +37 -1
  55. package/dist/schema/modules/service/functions/index.d.ts +1 -0
  56. package/dist/schema/modules/service/functions/index.js +1 -0
  57. package/dist/schema/modules/service/functions/list-service-logs.d.ts +1 -1
  58. package/dist/schema/modules/service/functions/list-service-schedules.d.ts +1 -1
  59. package/dist/schema/modules/service/functions/list-service-secret-names.d.ts +1 -1
  60. package/dist/schema/modules/service/functions/list-worker-logs.d.ts +1 -1
  61. package/dist/schema/modules/service/functions/list-worker-schedules.d.ts +1 -1
  62. package/dist/schema/modules/service/functions/list-worker-secret-names.d.ts +1 -1
  63. package/dist/schema/modules/service/functions/migrate-worker-ingress.d.ts +24 -0
  64. package/dist/schema/modules/service/functions/migrate-worker-ingress.js +26 -0
  65. package/dist/schema/modules/service/functions/replace-service-schedules.d.ts +1 -1
  66. package/dist/schema/modules/service/functions/replace-worker-schedules.d.ts +1 -1
  67. package/dist/schema/modules/service/functions/set-service-secret.d.ts +1 -1
  68. package/dist/schema/modules/service/functions/set-worker-secret.d.ts +3 -3
  69. package/dist/schema/modules/service/index.d.ts +2 -2
  70. package/dist/schema/modules/service/index.js +1 -1
  71. package/dist/schema/modules/service/types/content/index.d.ts +1 -0
  72. package/dist/schema/modules/service/types/content/index.js +1 -0
  73. package/dist/schema/modules/service/types/content/limits.d.ts +7 -0
  74. package/dist/schema/modules/service/types/content/limits.js +7 -0
  75. package/dist/schema/modules/service/types/deploy-cloudflare-worker.d.ts +110 -0
  76. package/dist/schema/modules/service/types/index.d.ts +2 -1
  77. package/dist/schema/modules/service/types/index.js +1 -1
  78. package/dist/schema/modules/service/types/legacy/service-deployment-content.js +15 -0
  79. package/dist/schema/modules/service/types/service-deployment-artifact-module.d.ts +23 -0
  80. package/dist/schema/modules/service/types/service-deployment-artifact-module.js +5 -3
  81. package/dist/schema/modules/service/types/service-deployment-assets.d.ts +36 -0
  82. package/dist/schema/modules/service/types/service-deployment-assets.js +5 -3
  83. package/dist/schema/modules/service/types/service-deployment-content.d.ts +18 -11
  84. package/dist/schema/modules/service/types/service-deployment-content.js +17 -8
  85. package/dist/schema/schema.d.ts +365 -62
  86. package/dist/schema/schema.js +10 -0
  87. package/package.json +14 -12
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The line every deployment of one origin in one environment shares. The first organisation that
4
+ * deploys on it holds it, and only an operator transfer gives it to another: it stays registered
5
+ * and refused to every other organisation after its organisation, that organisation's Services or
6
+ * every deployment on it are deleted.
7
+ */
8
+ export declare const DeploymentLine: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
9
+ readonly description: "The deployment line of one origin in one environment, held by one organisation.";
10
+ readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
11
+ readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Timestamped">];
12
+ readonly properties: {
13
+ origin: z.ZodString;
14
+ environment: z.ZodString;
15
+ /** The 16-character fingerprint of `(origin, environment)`; it alone identifies the line. */
16
+ fingerprint: z.ZodString;
17
+ /** How the line reads in its deployments' labels: readable, or the fingerprint alone. */
18
+ line: z.ZodString;
19
+ };
20
+ readonly policies: {
21
+ read: () => import("@astrale-os/sdk/schema").Policy;
22
+ };
23
+ }>;
@@ -0,0 +1,24 @@
1
+ import { classIcon, fullMatch, K, nodeClass } from '@astrale-os/sdk/schema';
2
+ import { GitBranch } from '@astrale-os/sdk/schema/icons';
3
+ import { z } from 'zod';
4
+ import { OwnLine } from '../policies/own-line.js';
5
+ /**
6
+ * The line every deployment of one origin in one environment shares. The first organisation that
7
+ * deploys on it holds it, and only an operator transfer gives it to another: it stays registered
8
+ * and refused to every other organisation after its organisation, that organisation's Services or
9
+ * every deployment on it are deleted.
10
+ */
11
+ export const DeploymentLine = nodeClass({
12
+ description: 'The deployment line of one origin in one environment, held by one organisation.',
13
+ icon: classIcon.lucide(GitBranch),
14
+ extends: [K.classes.Timestamped],
15
+ properties: {
16
+ origin: z.string().min(1).max(253),
17
+ environment: z.string().min(1).max(63),
18
+ /** The 16-character fingerprint of `(origin, environment)`; it alone identifies the line. */
19
+ fingerprint: z.string().check(fullMatch('[a-z2-7]{16}')),
20
+ /** How the line reads in its deployments' labels: readable, or the fingerprint alone. */
21
+ line: z.string().min(16).max(40),
22
+ },
23
+ policies: { read: () => OwnLine },
24
+ });
@@ -0,0 +1,17 @@
1
+ /** The line one deployment was made on; a deployment never moves to another line. */
2
+ export declare const deployment_on_line: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
3
+ readonly depth: 0;
4
+ readonly abstract: false;
5
+ readonly extends: readonly [];
6
+ readonly properties: never;
7
+ readonly source: {
8
+ readonly as: "deployment";
9
+ readonly outgoing: "1";
10
+ };
11
+ readonly target: {
12
+ readonly as: "line";
13
+ readonly incoming: "0..*";
14
+ };
15
+ readonly constraints: Record<never, never>;
16
+ readonly effectiveProperties: never;
17
+ }>;
@@ -0,0 +1,11 @@
1
+ import { edgeClass } from '@astrale-os/sdk/schema';
2
+ import { TraverseOwnedLineDeployment } from '../policies/traverse-owned-line-deployment.js';
3
+ import { DeploymentLine } from './deployment-line.js';
4
+ import { Deployment } from './deployment.js';
5
+ /** The line one deployment was made on; a deployment never moves to another line. */
6
+ export const deployment_on_line = edgeClass.directed({
7
+ description: 'The deployment line one Deployment belongs to.',
8
+ source: { as: 'deployment', accepts: [() => Deployment], outgoing: '1' },
9
+ target: { as: 'line', accepts: [() => DeploymentLine], incoming: '0..*' },
10
+ policies: { traverse: () => TraverseOwnedLineDeployment },
11
+ });
@@ -0,0 +1,98 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * One immutable deployment of a release: one build in one environment with its frozen
4
+ * configuration, served by one script at its own URL. It never changes code; a new release is a
5
+ * new deployment on the same line.
6
+ */
7
+ export declare const Deployment: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
8
+ readonly abstract: true;
9
+ readonly description: "One immutable deployment of a release on a publisher line.";
10
+ readonly icon: import("@astrale-os/sdk/schema").ClassIcon;
11
+ readonly extends: readonly [import("@astrale-os/sdk/schema").KernelClass<"Timestamped">];
12
+ readonly properties: {
13
+ /** `<line>-<content16>`, the DNS label and provider script name of this deployment. */
14
+ label: z.ZodString;
15
+ url: z.ZodString;
16
+ state: import("@astrale-os/sdk/schema").StateProperty<import("@astrale-os/sdk/schema").StateMachine<{
17
+ readonly deploying: {
18
+ readonly activate: "active";
19
+ readonly fail: "failed";
20
+ };
21
+ readonly active: {
22
+ readonly retire: "retiring";
23
+ };
24
+ readonly retiring: {
25
+ readonly completeRetirement: "retired";
26
+ };
27
+ readonly retired: {
28
+ readonly revive: "deploying";
29
+ };
30
+ readonly failed: {
31
+ readonly retry: "deploying";
32
+ };
33
+ }, "deploying">, {
34
+ required?: boolean;
35
+ description?: string;
36
+ }>;
37
+ retention: z.ZodEnum<{
38
+ preview: "preview";
39
+ published: "published";
40
+ }>;
41
+ record: z.ZodObject<{
42
+ format: z.ZodLiteral<"astrale.deployment-record">;
43
+ version: z.ZodLiteral<1>;
44
+ origin: z.ZodString;
45
+ environment: z.ZodString;
46
+ releaseDigest: z.ZodString;
47
+ buildDigest: z.ZodString;
48
+ schemaRevision: z.ZodString;
49
+ configuration: z.ZodString;
50
+ providerScript: z.ZodString;
51
+ commit: z.ZodNullable<z.ZodObject<{
52
+ sha: z.ZodString;
53
+ dirty: z.ZodBoolean;
54
+ base: z.ZodOptional<z.ZodObject<{
55
+ version: z.ZodString;
56
+ distance: z.ZodNumber;
57
+ }, z.core.$strict>>;
58
+ }, z.core.$strict>>;
59
+ }, z.core.$strict>;
60
+ signingKeyId: import("@astrale-os/sdk/schema").AuthoredProperty<z.ZodString, {
61
+ readonly required: false;
62
+ }>;
63
+ lastCallAt: import("@astrale-os/sdk/schema").AuthoredProperty<Readonly<{
64
+ readonly type: 'string';
65
+ readonly 'x-astrale-value-kind': 'instant';
66
+ }>, {
67
+ readonly required: false;
68
+ }>;
69
+ expiresAt: import("@astrale-os/sdk/schema").AuthoredProperty<Readonly<{
70
+ readonly type: 'string';
71
+ readonly 'x-astrale-value-kind': 'instant';
72
+ }>, {
73
+ readonly required: false;
74
+ }>;
75
+ retiredAt: import("@astrale-os/sdk/schema").AuthoredProperty<Readonly<{
76
+ readonly type: 'string';
77
+ readonly 'x-astrale-value-kind': 'instant';
78
+ }>, {
79
+ readonly required: false;
80
+ }>;
81
+ retirement: import("@astrale-os/sdk/schema").AuthoredProperty<z.ZodEnum<{
82
+ expired: "expired";
83
+ withdrawn: "withdrawn";
84
+ }>, {
85
+ readonly required: false;
86
+ }>;
87
+ /** The graph lease of the provider operation in flight on this deployment. */
88
+ operationReceipt: import("@astrale-os/sdk/schema").AuthoredProperty<z.ZodString, {
89
+ readonly required: false;
90
+ }>;
91
+ operationExpiresAt: import("@astrale-os/sdk/schema").AuthoredProperty<Readonly<{
92
+ readonly type: 'string';
93
+ readonly 'x-astrale-value-kind': 'instant';
94
+ }>, {
95
+ readonly required: false;
96
+ }>;
97
+ };
98
+ }>;
@@ -0,0 +1,32 @@
1
+ import { classIcon, K, nodeClass, property, schema as valueSchema, stateProperty, } from '@astrale-os/sdk/schema';
2
+ import { Rocket } from '@astrale-os/sdk/schema/icons';
3
+ import { z } from 'zod';
4
+ import { deploymentLifecycle } from '../states/index.js';
5
+ import { deploymentRecord, deploymentRetention, deploymentRetirement } from '../types/index.js';
6
+ /**
7
+ * One immutable deployment of a release: one build in one environment with its frozen
8
+ * configuration, served by one script at its own URL. It never changes code; a new release is a
9
+ * new deployment on the same line.
10
+ */
11
+ export const Deployment = nodeClass({
12
+ abstract: true,
13
+ description: 'One immutable deployment of a release on a publisher line.',
14
+ icon: classIcon.lucide(Rocket),
15
+ extends: [K.classes.Timestamped],
16
+ properties: {
17
+ /** `<line>-<content16>`, the DNS label and provider script name of this deployment. */
18
+ label: z.string().min(33).max(57),
19
+ url: z.string().min(1).max(2_048),
20
+ state: stateProperty(deploymentLifecycle),
21
+ retention: deploymentRetention,
22
+ record: deploymentRecord,
23
+ signingKeyId: property(z.string().min(1).max(128), { required: false }),
24
+ lastCallAt: property(valueSchema.values.instant, { required: false }),
25
+ expiresAt: property(valueSchema.values.instant, { required: false }),
26
+ retiredAt: property(valueSchema.values.instant, { required: false }),
27
+ retirement: property(deploymentRetirement, { required: false }),
28
+ /** The graph lease of the provider operation in flight on this deployment. */
29
+ operationReceipt: property(z.string().min(1).max(128), { required: false }),
30
+ operationExpiresAt: property(valueSchema.values.instant, { required: false }),
31
+ },
32
+ });
@@ -0,0 +1,5 @@
1
+ export { CloudflareDeployment } from './cloudflare-deployment.js';
2
+ export { Deployment } from './deployment.js';
3
+ export { DeploymentLine } from './deployment-line.js';
4
+ export { deployment_on_line } from './deployment-on-line.js';
5
+ export { line_owned_by } from './line-owned-by.js';
@@ -0,0 +1,5 @@
1
+ export { CloudflareDeployment } from './cloudflare-deployment.js';
2
+ export { Deployment } from './deployment.js';
3
+ export { DeploymentLine } from './deployment-line.js';
4
+ export { deployment_on_line } from './deployment-on-line.js';
5
+ export { line_owned_by } from './line-owned-by.js';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The organisation holding one deployment line: an Identity of the Admin instance, a Shell User
3
+ * or Group, whose members and CI identities act for it through `extends_with`. A line outlives
4
+ * this Edge: deleting its organisation removes the Edge and leaves the line held by nobody until
5
+ * an operator transfer.
6
+ *
7
+ * Hence at most one holder, not exactly one: the Kernel deletes a Node only together with every
8
+ * incident Edge, so a required holder would make the organisation undeletable unless its lines
9
+ * went with it, and a deleted line would free its fingerprint for another organisation.
10
+ */
11
+ export declare const line_owned_by: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
12
+ readonly depth: 0;
13
+ readonly abstract: false;
14
+ readonly extends: readonly [];
15
+ readonly properties: never;
16
+ readonly source: {
17
+ readonly as: "line";
18
+ readonly outgoing: "0..1";
19
+ };
20
+ readonly target: {
21
+ readonly as: "owner";
22
+ readonly incoming: "0..*";
23
+ };
24
+ readonly constraints: Record<never, never>;
25
+ readonly effectiveProperties: never;
26
+ }>;
@@ -0,0 +1,19 @@
1
+ import { edgeClass, K } from '@astrale-os/sdk/schema';
2
+ import { TraverseOwnedLine } from '../policies/traverse-owned-line.js';
3
+ import { DeploymentLine } from './deployment-line.js';
4
+ /**
5
+ * The organisation holding one deployment line: an Identity of the Admin instance, a Shell User
6
+ * or Group, whose members and CI identities act for it through `extends_with`. A line outlives
7
+ * this Edge: deleting its organisation removes the Edge and leaves the line held by nobody until
8
+ * an operator transfer.
9
+ *
10
+ * Hence at most one holder, not exactly one: the Kernel deletes a Node only together with every
11
+ * incident Edge, so a required holder would make the organisation undeletable unless its lines
12
+ * went with it, and a deleted line would free its fingerprint for another organisation.
13
+ */
14
+ export const line_owned_by = edgeClass.directed({
15
+ description: 'The organisation that holds one deployment line.',
16
+ source: { as: 'line', accepts: [() => DeploymentLine], outgoing: '0..1' },
17
+ target: { as: 'owner', accepts: [K.classes.Identity], incoming: '0..*' },
18
+ policies: { traverse: () => TraverseOwnedLine },
19
+ });
@@ -0,0 +1,6 @@
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';
3
+ export { deploymentLifecycle } from './states/index.js';
4
+ 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';
@@ -0,0 +1,4 @@
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';
3
+ export { deploymentLifecycle } from './states/index.js';
4
+ export { deploymentCommit, deploymentRecord, deploymentRetention, deploymentRetirement, } from './types/index.js';
@@ -0,0 +1,4 @@
1
+ export { OwnDeployment } from './own-deployment.js';
2
+ export { OwnLine } from './own-line.js';
3
+ export { TraverseOwnedLine } from './traverse-owned-line.js';
4
+ export { TraverseOwnedLineDeployment } from './traverse-owned-line-deployment.js';
@@ -0,0 +1,4 @@
1
+ export { OwnDeployment } from './own-deployment.js';
2
+ export { OwnLine } from './own-line.js';
3
+ export { TraverseOwnedLine } from './traverse-owned-line.js';
4
+ export { TraverseOwnedLineDeployment } from './traverse-owned-line-deployment.js';
@@ -0,0 +1,2 @@
1
+ /** A deployment belongs to whoever holds its line; it carries no owner of its own. */
2
+ export declare const OwnDeployment: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,12 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { DeploymentLine } from '../classes/deployment-line.js';
3
+ import { deployment_on_line } from '../classes/deployment-on-line.js';
4
+ import { line_owned_by } from '../classes/line-owned-by.js';
5
+ /** A deployment belongs to whoever holds its line; it carries no owner of its own. */
6
+ export const OwnDeployment = policy({
7
+ description: 'The subject holds the deployment line this Deployment was made on.',
8
+ match: ({ allOf, edge, exists, object, subject }) => exists(({ node }) => {
9
+ const line = node(() => DeploymentLine);
10
+ return allOf(edge({ source: object, class: () => deployment_on_line, target: line }), edge({ source: line, class: () => line_owned_by, target: subject }));
11
+ }),
12
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The organisation holding a line, and every Identity that acts for it: a member or a CI identity
3
+ * reaches it through its `extends_with` composition, never through a second rule here.
4
+ */
5
+ export declare const OwnLine: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,10 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { line_owned_by } from '../classes/line-owned-by.js';
3
+ /**
4
+ * The organisation holding a line, and every Identity that acts for it: a member or a CI identity
5
+ * reaches it through its `extends_with` composition, never through a second rule here.
6
+ */
7
+ export const OwnLine = policy({
8
+ description: 'The subject holds this deployment line.',
9
+ match: ({ edge, object, subject }) => edge({ source: object, class: () => line_owned_by, target: subject }),
10
+ });
@@ -0,0 +1,2 @@
1
+ /** A deployment's line relationship is visible only to the holder of that line. */
2
+ export declare const TraverseOwnedLineDeployment: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,7 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { line_owned_by } from '../classes/line-owned-by.js';
3
+ /** A deployment's line relationship is visible only to the holder of that line. */
4
+ export const TraverseOwnedLineDeployment = policy({
5
+ description: 'The subject holds the deployment line at the target of this relationship.',
6
+ match: ({ edge, subject, target }) => edge({ source: target, class: () => line_owned_by, target: subject }),
7
+ });
@@ -0,0 +1,2 @@
1
+ /** A line's holder relationship is visible only to the holder of that line. */
2
+ export declare const TraverseOwnedLine: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,7 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { line_owned_by } from '../classes/line-owned-by.js';
3
+ /** A line's holder relationship is visible only to the holder of that line. */
4
+ export const TraverseOwnedLine = policy({
5
+ description: 'The subject holds the deployment line at the source of this relationship.',
6
+ match: ({ edge, source, subject }) => edge({ source, class: () => line_owned_by, target: subject }),
7
+ });
@@ -0,0 +1,27 @@
1
+ import { type EventOf, type StateOf } from '@astrale-os/sdk/state';
2
+ /**
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.
7
+ */
8
+ export declare const deploymentLifecycle: import("@astrale-os/sdk/schema").StateMachine<{
9
+ readonly deploying: {
10
+ readonly activate: "active";
11
+ readonly fail: "failed";
12
+ };
13
+ readonly active: {
14
+ readonly retire: "retiring";
15
+ };
16
+ readonly retiring: {
17
+ readonly completeRetirement: "retired";
18
+ };
19
+ readonly retired: {
20
+ readonly revive: "deploying";
21
+ };
22
+ readonly failed: {
23
+ readonly retry: "deploying";
24
+ };
25
+ }, "deploying">;
26
+ export type DeploymentLifecycle = StateOf<typeof deploymentLifecycle>;
27
+ export type DeploymentLifecycleEvent = EventOf<typeof deploymentLifecycle>;
@@ -0,0 +1,17 @@
1
+ import { stateMachine } from '@astrale-os/sdk/state';
2
+ /**
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.
7
+ */
8
+ export const deploymentLifecycle = stateMachine({
9
+ initial: 'deploying',
10
+ transitions: {
11
+ deploying: { activate: 'active', fail: 'failed' },
12
+ active: { retire: 'retiring' },
13
+ retiring: { completeRetirement: 'retired' },
14
+ retired: { revive: 'deploying' },
15
+ failed: { retry: 'deploying' },
16
+ },
17
+ });
@@ -0,0 +1,2 @@
1
+ export { deploymentLifecycle } from './deployment-lifecycle.js';
2
+ export type { DeploymentLifecycle, DeploymentLifecycleEvent } from './deployment-lifecycle.js';
@@ -0,0 +1 @@
1
+ export { deploymentLifecycle } from './deployment-lifecycle.js';
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ /** The commit a deployment was built from, as its deployer declared it. */
3
+ export declare const deploymentCommit: z.ZodObject<{
4
+ sha: z.ZodString;
5
+ dirty: z.ZodBoolean;
6
+ base: z.ZodOptional<z.ZodObject<{
7
+ version: z.ZodString;
8
+ distance: z.ZodNumber;
9
+ }, z.core.$strict>>;
10
+ }, z.core.$strict>;
11
+ /**
12
+ * The `DeploymentRecordV1` one deploy declares, stored as declared beside the facts Services
13
+ * knows itself. Services admits it with the SDK's `acceptDeploymentRecord` before storing it, so
14
+ * this shape only bounds what the graph holds; any extension is a new record version.
15
+ */
16
+ export declare const deploymentRecord: z.ZodObject<{
17
+ format: z.ZodLiteral<"astrale.deployment-record">;
18
+ version: z.ZodLiteral<1>;
19
+ origin: z.ZodString;
20
+ environment: z.ZodString;
21
+ releaseDigest: z.ZodString;
22
+ buildDigest: z.ZodString;
23
+ schemaRevision: z.ZodString;
24
+ configuration: z.ZodString;
25
+ providerScript: z.ZodString;
26
+ commit: z.ZodNullable<z.ZodObject<{
27
+ sha: z.ZodString;
28
+ dirty: z.ZodBoolean;
29
+ base: z.ZodOptional<z.ZodObject<{
30
+ version: z.ZodString;
31
+ distance: z.ZodNumber;
32
+ }, z.core.$strict>>;
33
+ }, z.core.$strict>>;
34
+ }, z.core.$strict>;
35
+ export type DeploymentRecord = z.output<typeof deploymentRecord>;
@@ -0,0 +1,31 @@
1
+ import { fullMatch } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ const digest = z.string().check(fullMatch('sha256:[0-9a-f]{64}'));
4
+ /** The commit a deployment was built from, as its deployer declared it. */
5
+ export const deploymentCommit = z.strictObject({
6
+ sha: z.string().check(fullMatch('[0-9a-fA-F]{40}')),
7
+ dirty: z.boolean(),
8
+ base: z
9
+ .strictObject({
10
+ version: z.string().min(1).max(256),
11
+ distance: z.number().int().min(0),
12
+ })
13
+ .optional(),
14
+ });
15
+ /**
16
+ * The `DeploymentRecordV1` one deploy declares, stored as declared beside the facts Services
17
+ * knows itself. Services admits it with the SDK's `acceptDeploymentRecord` before storing it, so
18
+ * this shape only bounds what the graph holds; any extension is a new record version.
19
+ */
20
+ export const deploymentRecord = z.strictObject({
21
+ format: z.literal('astrale.deployment-record'),
22
+ version: z.literal(1),
23
+ origin: z.string().min(1).max(253),
24
+ environment: z.string().min(1).max(63),
25
+ releaseDigest: digest,
26
+ buildDigest: digest,
27
+ schemaRevision: digest,
28
+ configuration: digest,
29
+ providerScript: z.string().min(1).max(57),
30
+ commit: deploymentCommit.nullable(),
31
+ });
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ /** A preview expires after 30 days without a 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
+ export type DeploymentRetention = z.output<typeof deploymentRetention>;
13
+ export type DeploymentRetirement = z.output<typeof deploymentRetirement>;
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ /** A preview expires after 30 days without a call; a published deployment is retained. */
3
+ export const deploymentRetention = z.enum(['preview', 'published']);
4
+ /** Why a deployment left: an expired preview can be revived, a withdrawn one never. */
5
+ export const deploymentRetirement = z.enum(['expired', 'withdrawn']);
@@ -0,0 +1,4 @@
1
+ export { deploymentCommit, deploymentRecord } from './deployment-record.js';
2
+ export type { DeploymentRecord } from './deployment-record.js';
3
+ export { deploymentRetention, deploymentRetirement } from './deployment-retention.js';
4
+ export type { DeploymentRetention, DeploymentRetirement } from './deployment-retention.js';
@@ -0,0 +1,2 @@
1
+ export { deploymentCommit, deploymentRecord } from './deployment-record.js';
2
+ export { deploymentRetention, deploymentRetirement } from './deployment-retention.js';