@astrale-domains/services 0.3.1 → 0.3.3

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 (28) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +44 -7
  3. package/dist/schema/index.d.ts +1 -1
  4. package/dist/schema/index.js +1 -1
  5. package/dist/schema/modules/service/classes/cloudflare-worker.d.ts +516 -506
  6. package/dist/schema/modules/service/classes/cloudflare-worker.js +2 -0
  7. package/dist/schema/modules/service/classes/service-owned-by.js +3 -4
  8. package/dist/schema/modules/service/classes/service.js +0 -2
  9. package/dist/schema/modules/service/functions/delete-service-secret.d.ts +2 -2
  10. package/dist/schema/modules/service/functions/deploy-cloudflare-worker.d.ts +5 -160
  11. package/dist/schema/modules/service/functions/deploy-cloudflare-worker.js +1 -46
  12. package/dist/schema/modules/service/functions/index.d.ts +1 -2
  13. package/dist/schema/modules/service/functions/index.js +1 -1
  14. package/dist/schema/modules/service/index.d.ts +3 -5
  15. package/dist/schema/modules/service/index.js +2 -3
  16. package/dist/schema/modules/service/types/deploy-cloudflare-worker.d.ts +176 -0
  17. package/dist/schema/modules/service/types/deploy-cloudflare-worker.js +49 -0
  18. package/dist/schema/modules/service/types/index.d.ts +3 -0
  19. package/dist/schema/modules/service/types/index.js +2 -0
  20. package/dist/schema/modules/service/types/service-readiness.d.ts +6 -0
  21. package/dist/schema/modules/service/types/service-readiness.js +6 -0
  22. package/dist/schema/schema.d.ts +529 -521
  23. package/dist/schema/schema.js +1 -2
  24. package/package.json +6 -5
  25. package/dist/schema/modules/service/dependencies/index.d.ts +0 -1
  26. package/dist/schema/modules/service/dependencies/index.js +0 -1
  27. package/dist/schema/modules/service/dependencies/shell.d.ts +0 -4
  28. package/dist/schema/modules/service/dependencies/shell.js +0 -4
@@ -2,6 +2,7 @@ import { classIcon, nodeClass, property } from '@astrale-os/sdk/schema';
2
2
  import { CloudCog } from '@astrale-os/sdk/schema/icons';
3
3
  import { z } from 'zod';
4
4
  import { deployCloudflareWorker } from '../functions/deploy-cloudflare-worker.js';
5
+ import { OwnService } from '../policies/own-service.js';
5
6
  import { Service } from './service.js';
6
7
  export const CloudflareWorker = nodeClass({
7
8
  description: 'One Service placed in a Cloudflare Workers dispatch namespace.',
@@ -17,4 +18,5 @@ export const CloudflareWorker = nodeClass({
17
18
  tenantZoneId: property(z.string().min(1).max(128), { required: false }),
18
19
  },
19
20
  methods: { deploy: deployCloudflareWorker },
21
+ policies: { read: OwnService },
20
22
  });
@@ -1,10 +1,9 @@
1
- import { edgeClass } from '@astrale-os/sdk/schema';
2
- import { ServicesShell } from '../dependencies/index.js';
1
+ import { edgeClass, K } from '@astrale-os/sdk/schema';
3
2
  import { TraverseOwnedService } from '../policies/index.js';
4
3
  import { Service } from './service.js';
5
4
  export const service_owned_by = edgeClass.directed({
6
- description: 'The Shell user that owns and may manage one Service.',
5
+ description: 'The authenticated Identity that owns and may manage one Service.',
7
6
  source: { as: 'service', accepts: [() => Service], outgoing: '1' },
8
- target: { as: 'owner', accepts: [ServicesShell.classes.User], incoming: '0..*' },
7
+ target: { as: 'owner', accepts: [K.classes.Identity], incoming: '0..*' },
9
8
  policies: { traverse: () => TraverseOwnedService },
10
9
  });
@@ -8,7 +8,6 @@ import { listServiceSchedules } from '../functions/list-service-schedules.js';
8
8
  import { listServiceSecretNames } from '../functions/list-service-secret-names.js';
9
9
  import { replaceServiceSchedules } from '../functions/replace-service-schedules.js';
10
10
  import { setServiceSecret } from '../functions/set-service-secret.js';
11
- import { OwnService } from '../policies/own-service.js';
12
11
  import { serviceLifecycle } from '../states/index.js';
13
12
  /** Provider-neutral deployed resource. Provider implementation versions are deliberately external. */
14
13
  export const Service = nodeClass({
@@ -35,5 +34,4 @@ export const Service = nodeClass({
35
34
  logs: listServiceLogs,
36
35
  delete: deleteService,
37
36
  },
38
- policies: { read: () => OwnService },
39
37
  });
@@ -3,9 +3,9 @@ export declare const deleteServiceSecret: import("@astrale-os/sdk/schema").Metho
3
3
  }, {
4
4
  readonly mode: 'value';
5
5
  readonly value: {
6
+ ok: true;
7
+ } | {
6
8
  kind: "rejected";
7
9
  reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
8
- } | {
9
- ok: true;
10
10
  };
11
11
  }, "authorized", false, "default">>;
@@ -1,163 +1,3 @@
1
- import { z } from 'zod';
2
- export declare const artifact: z.ZodObject<{
3
- entry: z.ZodString;
4
- modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
5
- contentBase64: z.ZodString;
6
- name: z.ZodString;
7
- kind: z.ZodOptional<z.ZodEnum<{
8
- data: "data";
9
- esm: "esm";
10
- text: "text";
11
- wasm: "wasm";
12
- }>>;
13
- }, z.core.$strict>, z.ZodObject<{
14
- contentBase64Chunks: z.ZodArray<z.ZodString>;
15
- name: z.ZodString;
16
- kind: z.ZodOptional<z.ZodEnum<{
17
- data: "data";
18
- esm: "esm";
19
- text: "text";
20
- wasm: "wasm";
21
- }>>;
22
- }, z.core.$strict>]>>;
23
- }, z.core.$strict>;
24
- export declare const revisionedDeployment: z.ZodObject<{
25
- requiredSecrets: z.ZodArray<z.ZodString>;
26
- release: z.ZodObject<{
27
- entry: z.ZodString;
28
- modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
29
- contentBase64: z.ZodString;
30
- name: z.ZodString;
31
- kind: z.ZodOptional<z.ZodEnum<{
32
- data: "data";
33
- esm: "esm";
34
- text: "text";
35
- wasm: "wasm";
36
- }>>;
37
- }, z.core.$strict>, z.ZodObject<{
38
- contentBase64Chunks: z.ZodArray<z.ZodString>;
39
- name: z.ZodString;
40
- kind: z.ZodOptional<z.ZodEnum<{
41
- data: "data";
42
- esm: "esm";
43
- text: "text";
44
- wasm: "wasm";
45
- }>>;
46
- }, z.core.$strict>]>>;
47
- }, z.core.$strict>;
48
- }, z.core.$strict>;
49
- export declare const deployServiceInput: z.ZodObject<{
50
- name: z.ZodOptional<z.ZodString>;
51
- entry: z.ZodOptional<z.ZodString>;
52
- modules: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
53
- contentBase64: z.ZodString;
54
- name: z.ZodString;
55
- kind: z.ZodOptional<z.ZodEnum<{
56
- data: "data";
57
- esm: "esm";
58
- text: "text";
59
- wasm: "wasm";
60
- }>>;
61
- }, z.core.$strict>, z.ZodObject<{
62
- contentBase64Chunks: z.ZodArray<z.ZodString>;
63
- name: z.ZodString;
64
- kind: z.ZodOptional<z.ZodEnum<{
65
- data: "data";
66
- esm: "esm";
67
- text: "text";
68
- wasm: "wasm";
69
- }>>;
70
- }, z.core.$strict>]>>>;
71
- revisioned: z.ZodOptional<z.ZodObject<{
72
- requiredSecrets: z.ZodArray<z.ZodString>;
73
- release: z.ZodObject<{
74
- entry: z.ZodString;
75
- modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
76
- contentBase64: z.ZodString;
77
- name: z.ZodString;
78
- kind: z.ZodOptional<z.ZodEnum<{
79
- data: "data";
80
- esm: "esm";
81
- text: "text";
82
- wasm: "wasm";
83
- }>>;
84
- }, z.core.$strict>, z.ZodObject<{
85
- contentBase64Chunks: z.ZodArray<z.ZodString>;
86
- name: z.ZodString;
87
- kind: z.ZodOptional<z.ZodEnum<{
88
- data: "data";
89
- esm: "esm";
90
- text: "text";
91
- wasm: "wasm";
92
- }>>;
93
- }, z.core.$strict>]>>;
94
- }, z.core.$strict>;
95
- }, z.core.$strict>>;
96
- compatibilityDate: z.ZodOptional<z.ZodString>;
97
- compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
- serviceBindings: z.ZodOptional<z.ZodArray<z.ZodObject<{
99
- name: z.ZodString;
100
- service: z.ZodString;
101
- }, z.core.$strict>>>;
102
- vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
103
- secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
- assets: z.ZodOptional<z.ZodObject<{
105
- files: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
106
- contentBase64: z.ZodString;
107
- path: z.ZodString;
108
- contentType: z.ZodOptional<z.ZodString>;
109
- }, z.core.$strict>, z.ZodObject<{
110
- contentBase64Chunks: z.ZodArray<z.ZodString>;
111
- path: z.ZodString;
112
- contentType: z.ZodOptional<z.ZodString>;
113
- }, z.core.$strict>]>>;
114
- notFound: z.ZodOptional<z.ZodEnum<{
115
- "404-page": "404-page";
116
- none: "none";
117
- "single-page-application": "single-page-application";
118
- }>>;
119
- runWorkerFirst: z.ZodOptional<z.ZodBoolean>;
120
- htmlHandling: z.ZodOptional<z.ZodLiteral<"none">>;
121
- }, z.core.$strict>>;
122
- limits: z.ZodOptional<z.ZodObject<{
123
- cpuMs: z.ZodOptional<z.ZodNumber>;
124
- subrequests: z.ZodOptional<z.ZodNumber>;
125
- }, z.core.$strict>>;
126
- serviceKey: z.ZodString;
127
- }, z.core.$strict>;
128
- export type DeployServiceInput = z.infer<typeof deployServiceInput>;
129
- export declare const deployedService: z.ZodObject<{
130
- id: z.ZodString;
131
- serviceKey: z.ZodString;
132
- url: z.ZodString;
133
- digest: z.ZodString;
134
- state: z.ZodLiteral<"ready">;
135
- }, z.core.$strict>;
136
- export declare const deploymentRejection: z.ZodObject<{
137
- kind: z.ZodLiteral<"rejected">;
138
- reason: z.ZodEnum<{
139
- "artifact-mode-conflict": "artifact-mode-conflict";
140
- "invalid-deployment": "invalid-deployment";
141
- "service-unavailable": "service-unavailable";
142
- }>;
143
- message: z.ZodString;
144
- }, z.core.$strict>;
145
- export declare const deployServiceOutput: z.ZodUnion<readonly [z.ZodObject<{
146
- id: z.ZodString;
147
- serviceKey: z.ZodString;
148
- url: z.ZodString;
149
- digest: z.ZodString;
150
- state: z.ZodLiteral<"ready">;
151
- }, z.core.$strict>, z.ZodObject<{
152
- kind: z.ZodLiteral<"rejected">;
153
- reason: z.ZodEnum<{
154
- "artifact-mode-conflict": "artifact-mode-conflict";
155
- "invalid-deployment": "invalid-deployment";
156
- "service-unavailable": "service-unavailable";
157
- }>;
158
- message: z.ZodString;
159
- }, z.core.$strict>]>;
160
- export type DeployServiceOutput = z.infer<typeof deployServiceOutput>;
161
1
  export declare const deployCloudflareWorker: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
162
2
  name?: string | undefined;
163
3
  entry?: string | undefined;
@@ -184,6 +24,10 @@ export declare const deployCloudflareWorker: import("@astrale-os/sdk/schema").Me
184
24
  kind?: "data" | "esm" | "text" | "wasm" | undefined;
185
25
  })[];
186
26
  };
27
+ readiness?: {
28
+ paths: string[];
29
+ required?: boolean | undefined;
30
+ } | undefined;
187
31
  } | undefined;
188
32
  compatibilityDate?: string | undefined;
189
33
  compatibilityFlags?: string[] | undefined;
@@ -220,6 +64,7 @@ export declare const deployCloudflareWorker: import("@astrale-os/sdk/schema").Me
220
64
  url: string;
221
65
  digest: string;
222
66
  state: "ready";
67
+ candidateReadiness?: "passed" | "unavailable-retained-secrets" | undefined;
223
68
  } | {
224
69
  kind: "rejected";
225
70
  reason: "artifact-mode-conflict" | "invalid-deployment" | "service-unavailable";
@@ -1,50 +1,5 @@
1
1
  import { method } from '@astrale-os/sdk/schema';
2
- import { z } from 'zod';
3
- import { artifactModule, assetBundle, resourceLimits } from '../types/index.js';
4
- export const artifact = z.strictObject({
5
- entry: z.string().min(1).max(256),
6
- modules: z.array(artifactModule).min(1).max(40),
7
- });
8
- export const revisionedDeployment = z.strictObject({
9
- requiredSecrets: z.array(z.string().min(1).max(128)).max(64),
10
- release: artifact,
11
- });
12
- const deployServiceFields = {
13
- name: z.string().min(1).max(256).optional(),
14
- entry: z.string().min(1).max(256).optional(),
15
- modules: z.array(artifactModule).min(1).max(40).optional(),
16
- revisioned: revisionedDeployment.optional(),
17
- compatibilityDate: z.string().min(1).max(32).optional(),
18
- compatibilityFlags: z.array(z.string().min(1).max(128)).max(64).optional(),
19
- serviceBindings: z
20
- .array(z.strictObject({
21
- name: z.string().min(1).max(64),
22
- service: z.string().min(1).max(128),
23
- }))
24
- .max(32)
25
- .optional(),
26
- vars: z.record(z.string().max(256), z.string().max(64 * 1024)).optional(),
27
- secrets: z.record(z.string().max(256), z.string().max(64 * 1024)).optional(),
28
- assets: assetBundle.optional(),
29
- limits: resourceLimits,
30
- };
31
- export const deployServiceInput = z.strictObject({
32
- serviceKey: z.string().min(1).max(63),
33
- ...deployServiceFields,
34
- });
35
- export const deployedService = z.strictObject({
36
- id: z.string().min(1),
37
- serviceKey: z.string().min(1),
38
- url: z.string(),
39
- digest: z.string(),
40
- state: z.literal('ready'),
41
- });
42
- export const deploymentRejection = z.strictObject({
43
- kind: z.literal('rejected'),
44
- reason: z.enum(['invalid-deployment', 'service-unavailable', 'artifact-mode-conflict']),
45
- message: z.string().min(1).max(500),
46
- });
47
- export const deployServiceOutput = z.union([deployedService, deploymentRejection]);
2
+ import { deployServiceInput, deployServiceOutput } from '../types/deploy-cloudflare-worker.js';
48
3
  export const deployCloudflareWorker = method({
49
4
  description: 'Create or converge one Cloudflare Worker Service.',
50
5
  auth: 'authenticated',
@@ -1,7 +1,6 @@
1
1
  export { deleteServiceSecret } from './delete-service-secret.js';
2
2
  export { deleteService } from './delete-service.js';
3
- export { artifact, deployedService, deploymentRejection, deployCloudflareWorker, deployServiceInput, deployServiceOutput, revisionedDeployment, } from './deploy-cloudflare-worker.js';
4
- export type { DeployServiceInput, DeployServiceOutput } from './deploy-cloudflare-worker.js';
3
+ export { deployCloudflareWorker } from './deploy-cloudflare-worker.js';
5
4
  export { listServiceLogs } from './list-service-logs.js';
6
5
  export { listServiceSchedules } from './list-service-schedules.js';
7
6
  export { listServiceSecretNames } from './list-service-secret-names.js';
@@ -1,6 +1,6 @@
1
1
  export { deleteServiceSecret } from './delete-service-secret.js';
2
2
  export { deleteService } from './delete-service.js';
3
- export { artifact, deployedService, deploymentRejection, deployCloudflareWorker, deployServiceInput, deployServiceOutput, revisionedDeployment, } from './deploy-cloudflare-worker.js';
3
+ export { deployCloudflareWorker } from './deploy-cloudflare-worker.js';
4
4
  export { listServiceLogs } from './list-service-logs.js';
5
5
  export { listServiceSchedules } from './list-service-schedules.js';
6
6
  export { listServiceSecretNames } from './list-service-secret-names.js';
@@ -1,9 +1,7 @@
1
1
  export { CloudflareWorker, Service, service_owned_by } from './classes/index.js';
2
- export { ServicesShell } from './dependencies/index.js';
3
- export { artifact, deleteService, deleteServiceSecret, deployedService, deploymentRejection, deployCloudflareWorker, deployServiceInput, deployServiceOutput, listServiceLogs, listServiceSchedules, listServiceSecretNames, replaceServiceSchedules, revisionedDeployment, setServiceSecret, } from './functions/index.js';
4
- export type { DeployServiceInput, DeployServiceOutput } from './functions/index.js';
2
+ export { deleteService, deleteServiceSecret, deployCloudflareWorker, listServiceLogs, listServiceSchedules, listServiceSecretNames, replaceServiceSchedules, setServiceSecret, } from './functions/index.js';
5
3
  export { OwnService, TraverseOwnedService } from './policies/index.js';
6
4
  export { serviceLifecycle } from './states/index.js';
7
5
  export type { ServiceLifecycle, ServiceLifecycleEvent } from './states/index.js';
8
- export { artifactModule, assetBundle, assetFile, resourceLimits, PORTABLE_BASE64_CHUNK_SIZE, } from './types/index.js';
9
- export type { ArtifactModule, AssetBundle, ResourceLimits } from './types/index.js';
6
+ export { artifact, artifactModule, assetBundle, assetFile, deployedService, deploymentRejection, deployServiceInput, deployServiceOutput, resourceLimits, revisionedDeployment, PORTABLE_BASE64_CHUNK_SIZE, } from './types/index.js';
7
+ export type { ArtifactModule, AssetBundle, DeployServiceInput, DeployServiceOutput, ResourceLimits, } from './types/index.js';
@@ -1,6 +1,5 @@
1
1
  export { CloudflareWorker, Service, service_owned_by } from './classes/index.js';
2
- export { ServicesShell } from './dependencies/index.js';
3
- export { artifact, deleteService, deleteServiceSecret, deployedService, deploymentRejection, deployCloudflareWorker, deployServiceInput, deployServiceOutput, listServiceLogs, listServiceSchedules, listServiceSecretNames, replaceServiceSchedules, revisionedDeployment, setServiceSecret, } from './functions/index.js';
2
+ export { deleteService, deleteServiceSecret, deployCloudflareWorker, listServiceLogs, listServiceSchedules, listServiceSecretNames, replaceServiceSchedules, setServiceSecret, } from './functions/index.js';
4
3
  export { OwnService, TraverseOwnedService } from './policies/index.js';
5
4
  export { serviceLifecycle } from './states/index.js';
6
- export { artifactModule, assetBundle, assetFile, resourceLimits, PORTABLE_BASE64_CHUNK_SIZE, } from './types/index.js';
5
+ export { artifact, artifactModule, assetBundle, assetFile, deployedService, deploymentRejection, deployServiceInput, deployServiceOutput, resourceLimits, revisionedDeployment, PORTABLE_BASE64_CHUNK_SIZE, } from './types/index.js';
@@ -0,0 +1,176 @@
1
+ import { z } from 'zod';
2
+ export declare const artifact: z.ZodObject<{
3
+ entry: z.ZodString;
4
+ modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
5
+ contentBase64: z.ZodString;
6
+ name: z.ZodString;
7
+ kind: z.ZodOptional<z.ZodEnum<{
8
+ data: "data";
9
+ esm: "esm";
10
+ text: "text";
11
+ wasm: "wasm";
12
+ }>>;
13
+ }, z.core.$strict>, z.ZodObject<{
14
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
15
+ name: z.ZodString;
16
+ kind: z.ZodOptional<z.ZodEnum<{
17
+ data: "data";
18
+ esm: "esm";
19
+ text: "text";
20
+ wasm: "wasm";
21
+ }>>;
22
+ }, z.core.$strict>]>>;
23
+ }, z.core.$strict>;
24
+ export declare const revisionedDeployment: z.ZodObject<{
25
+ requiredSecrets: z.ZodArray<z.ZodString>;
26
+ release: z.ZodObject<{
27
+ entry: z.ZodString;
28
+ modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
29
+ contentBase64: z.ZodString;
30
+ name: z.ZodString;
31
+ kind: z.ZodOptional<z.ZodEnum<{
32
+ data: "data";
33
+ esm: "esm";
34
+ text: "text";
35
+ wasm: "wasm";
36
+ }>>;
37
+ }, z.core.$strict>, z.ZodObject<{
38
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
39
+ name: z.ZodString;
40
+ kind: z.ZodOptional<z.ZodEnum<{
41
+ data: "data";
42
+ esm: "esm";
43
+ text: "text";
44
+ wasm: "wasm";
45
+ }>>;
46
+ }, z.core.$strict>]>>;
47
+ }, z.core.$strict>;
48
+ readiness: z.ZodOptional<z.ZodObject<{
49
+ paths: z.ZodArray<z.ZodString>;
50
+ required: z.ZodOptional<z.ZodBoolean>;
51
+ }, z.core.$strict>>;
52
+ }, z.core.$strict>;
53
+ export declare const deployServiceInput: z.ZodObject<{
54
+ name: z.ZodOptional<z.ZodString>;
55
+ entry: z.ZodOptional<z.ZodString>;
56
+ modules: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
57
+ contentBase64: z.ZodString;
58
+ name: z.ZodString;
59
+ kind: z.ZodOptional<z.ZodEnum<{
60
+ data: "data";
61
+ esm: "esm";
62
+ text: "text";
63
+ wasm: "wasm";
64
+ }>>;
65
+ }, z.core.$strict>, z.ZodObject<{
66
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
67
+ name: z.ZodString;
68
+ kind: z.ZodOptional<z.ZodEnum<{
69
+ data: "data";
70
+ esm: "esm";
71
+ text: "text";
72
+ wasm: "wasm";
73
+ }>>;
74
+ }, z.core.$strict>]>>>;
75
+ revisioned: z.ZodOptional<z.ZodObject<{
76
+ requiredSecrets: z.ZodArray<z.ZodString>;
77
+ release: z.ZodObject<{
78
+ entry: z.ZodString;
79
+ modules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
80
+ contentBase64: z.ZodString;
81
+ name: z.ZodString;
82
+ kind: z.ZodOptional<z.ZodEnum<{
83
+ data: "data";
84
+ esm: "esm";
85
+ text: "text";
86
+ wasm: "wasm";
87
+ }>>;
88
+ }, z.core.$strict>, z.ZodObject<{
89
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
90
+ name: z.ZodString;
91
+ kind: z.ZodOptional<z.ZodEnum<{
92
+ data: "data";
93
+ esm: "esm";
94
+ text: "text";
95
+ wasm: "wasm";
96
+ }>>;
97
+ }, z.core.$strict>]>>;
98
+ }, z.core.$strict>;
99
+ readiness: z.ZodOptional<z.ZodObject<{
100
+ paths: z.ZodArray<z.ZodString>;
101
+ required: z.ZodOptional<z.ZodBoolean>;
102
+ }, z.core.$strict>>;
103
+ }, z.core.$strict>>;
104
+ compatibilityDate: z.ZodOptional<z.ZodString>;
105
+ compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ serviceBindings: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
+ name: z.ZodString;
108
+ service: z.ZodString;
109
+ }, z.core.$strict>>>;
110
+ vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
111
+ secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
112
+ assets: z.ZodOptional<z.ZodObject<{
113
+ files: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
114
+ contentBase64: z.ZodString;
115
+ path: z.ZodString;
116
+ contentType: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ contentBase64Chunks: z.ZodArray<z.ZodString>;
119
+ path: z.ZodString;
120
+ contentType: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strict>]>>;
122
+ notFound: z.ZodOptional<z.ZodEnum<{
123
+ "404-page": "404-page";
124
+ none: "none";
125
+ "single-page-application": "single-page-application";
126
+ }>>;
127
+ runWorkerFirst: z.ZodOptional<z.ZodBoolean>;
128
+ htmlHandling: z.ZodOptional<z.ZodLiteral<"none">>;
129
+ }, z.core.$strict>>;
130
+ limits: z.ZodOptional<z.ZodObject<{
131
+ cpuMs: z.ZodOptional<z.ZodNumber>;
132
+ subrequests: z.ZodOptional<z.ZodNumber>;
133
+ }, z.core.$strict>>;
134
+ serviceKey: z.ZodString;
135
+ }, z.core.$strict>;
136
+ export type DeployServiceInput = z.infer<typeof deployServiceInput>;
137
+ export declare const deployedService: z.ZodObject<{
138
+ id: z.ZodString;
139
+ serviceKey: z.ZodString;
140
+ url: z.ZodString;
141
+ digest: z.ZodString;
142
+ state: z.ZodLiteral<"ready">;
143
+ candidateReadiness: z.ZodOptional<z.ZodEnum<{
144
+ passed: "passed";
145
+ "unavailable-retained-secrets": "unavailable-retained-secrets";
146
+ }>>;
147
+ }, z.core.$strict>;
148
+ export declare const deploymentRejection: z.ZodObject<{
149
+ kind: z.ZodLiteral<"rejected">;
150
+ reason: z.ZodEnum<{
151
+ "artifact-mode-conflict": "artifact-mode-conflict";
152
+ "invalid-deployment": "invalid-deployment";
153
+ "service-unavailable": "service-unavailable";
154
+ }>;
155
+ message: z.ZodString;
156
+ }, z.core.$strict>;
157
+ export declare const deployServiceOutput: z.ZodUnion<readonly [z.ZodObject<{
158
+ id: z.ZodString;
159
+ serviceKey: z.ZodString;
160
+ url: z.ZodString;
161
+ digest: z.ZodString;
162
+ state: z.ZodLiteral<"ready">;
163
+ candidateReadiness: z.ZodOptional<z.ZodEnum<{
164
+ passed: "passed";
165
+ "unavailable-retained-secrets": "unavailable-retained-secrets";
166
+ }>>;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ kind: z.ZodLiteral<"rejected">;
169
+ reason: z.ZodEnum<{
170
+ "artifact-mode-conflict": "artifact-mode-conflict";
171
+ "invalid-deployment": "invalid-deployment";
172
+ "service-unavailable": "service-unavailable";
173
+ }>;
174
+ message: z.ZodString;
175
+ }, z.core.$strict>]>;
176
+ export type DeployServiceOutput = z.infer<typeof deployServiceOutput>;
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { artifactModule, assetBundle, resourceLimits } from '../types/index.js';
3
+ import { serviceReadiness } from './service-readiness.js';
4
+ export const artifact = z.strictObject({
5
+ entry: z.string().min(1).max(256),
6
+ modules: z.array(artifactModule).min(1).max(40),
7
+ });
8
+ export const revisionedDeployment = z.strictObject({
9
+ requiredSecrets: z.array(z.string().min(1).max(128)).max(64),
10
+ release: artifact,
11
+ readiness: serviceReadiness.optional(),
12
+ });
13
+ const deployServiceFields = {
14
+ name: z.string().min(1).max(256).optional(),
15
+ entry: z.string().min(1).max(256).optional(),
16
+ modules: z.array(artifactModule).min(1).max(40).optional(),
17
+ revisioned: revisionedDeployment.optional(),
18
+ compatibilityDate: z.string().min(1).max(32).optional(),
19
+ compatibilityFlags: z.array(z.string().min(1).max(128)).max(64).optional(),
20
+ serviceBindings: z
21
+ .array(z.strictObject({
22
+ name: z.string().min(1).max(64),
23
+ service: z.string().min(1).max(128),
24
+ }))
25
+ .max(32)
26
+ .optional(),
27
+ vars: z.record(z.string().max(256), z.string().max(64 * 1024)).optional(),
28
+ secrets: z.record(z.string().max(256), z.string().max(64 * 1024)).optional(),
29
+ assets: assetBundle.optional(),
30
+ limits: resourceLimits,
31
+ };
32
+ export const deployServiceInput = z.strictObject({
33
+ serviceKey: z.string().min(1).max(63),
34
+ ...deployServiceFields,
35
+ });
36
+ export const deployedService = z.strictObject({
37
+ id: z.string().min(1),
38
+ serviceKey: z.string().min(1),
39
+ url: z.string(),
40
+ digest: z.string(),
41
+ state: z.literal('ready'),
42
+ candidateReadiness: z.enum(['passed', 'unavailable-retained-secrets']).optional(),
43
+ });
44
+ export const deploymentRejection = z.strictObject({
45
+ kind: z.literal('rejected'),
46
+ reason: z.enum(['invalid-deployment', 'service-unavailable', 'artifact-mode-conflict']),
47
+ message: z.string().min(1).max(500),
48
+ });
49
+ export const deployServiceOutput = z.union([deployedService, deploymentRejection]);
@@ -1,3 +1,5 @@
1
+ export { artifact, deployedService, deploymentRejection, deployServiceInput, deployServiceOutput, revisionedDeployment, } from './deploy-cloudflare-worker.js';
2
+ export type { DeployServiceInput, DeployServiceOutput } from './deploy-cloudflare-worker.js';
1
3
  export { artifactModule } from './service-deployment-artifact-module.js';
2
4
  export type { ArtifactModule } from './service-deployment-artifact-module.js';
3
5
  export { assetBundle, assetFile } from './service-deployment-assets.js';
@@ -7,3 +9,4 @@ export { resourceLimits } from './service-deployment-resource-limits.js';
7
9
  export type { ResourceLimits } from './service-deployment-resource-limits.js';
8
10
  export { secretName } from './service-secret-name.js';
9
11
  export { secretOperationRejection } from './service-secret-operation-rejection.js';
12
+ export { serviceReadiness } from './service-readiness.js';
@@ -1,6 +1,8 @@
1
+ export { artifact, deployedService, deploymentRejection, deployServiceInput, deployServiceOutput, revisionedDeployment, } from './deploy-cloudflare-worker.js';
1
2
  export { artifactModule } from './service-deployment-artifact-module.js';
2
3
  export { assetBundle, assetFile } from './service-deployment-assets.js';
3
4
  export { MAX_ASSET_BASE64_SIZE, MAX_MODULE_BASE64_SIZE, PORTABLE_BASE64_CHUNK_SIZE, } from './service-deployment-content.js';
4
5
  export { resourceLimits } from './service-deployment-resource-limits.js';
5
6
  export { secretName } from './service-secret-name.js';
6
7
  export { secretOperationRejection } from './service-secret-operation-rejection.js';
8
+ export { serviceReadiness } from './service-readiness.js';
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ /** Opaque HTTP checks; Services does not interpret the application's response bodies. */
3
+ export declare const serviceReadiness: z.ZodObject<{
4
+ paths: z.ZodArray<z.ZodString>;
5
+ required: z.ZodOptional<z.ZodBoolean>;
6
+ }, z.core.$strict>;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ /** Opaque HTTP checks; Services does not interpret the application's response bodies. */
3
+ export const serviceReadiness = z.strictObject({
4
+ paths: z.array(z.string().min(1).max(1024)).min(1).max(8),
5
+ required: z.boolean().optional(),
6
+ });