@astrale-domains/services 0.2.4 → 0.2.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 (58) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +9 -8
  3. package/dist/schema/index.d.ts +2 -2
  4. package/dist/schema/index.js +2 -2
  5. package/dist/schema/modules/service/classes/cloudflare-worker.d.ts +2171 -4010
  6. package/dist/schema/modules/service/classes/cloudflare-worker.js +1 -1
  7. package/dist/schema/modules/service/classes/service-owned-by.d.ts +4 -4
  8. package/dist/schema/modules/service/classes/service-owned-by.js +5 -4
  9. package/dist/schema/modules/service/classes/service.d.ts +56 -35
  10. package/dist/schema/modules/service/classes/service.js +12 -21
  11. package/dist/schema/modules/service/dependencies/index.d.ts +1 -0
  12. package/dist/schema/modules/service/dependencies/index.js +1 -0
  13. package/dist/schema/modules/service/dependencies/shell.d.ts +4 -0
  14. package/dist/schema/modules/service/dependencies/shell.js +4 -0
  15. package/dist/schema/modules/service/functions/delete-service-secret.d.ts +3 -3
  16. package/dist/schema/modules/service/functions/delete-service-secret.js +3 -1
  17. package/dist/schema/modules/service/functions/delete-service.d.ts +1 -1
  18. package/dist/schema/modules/service/functions/delete-service.js +3 -1
  19. package/dist/schema/modules/service/functions/deploy-cloudflare-worker.d.ts +161 -14
  20. package/dist/schema/modules/service/functions/deploy-cloudflare-worker.js +47 -2
  21. package/dist/schema/modules/service/functions/index.d.ts +2 -1
  22. package/dist/schema/modules/service/functions/index.js +1 -1
  23. package/dist/schema/modules/service/functions/list-service-logs.d.ts +1 -1
  24. package/dist/schema/modules/service/functions/list-service-logs.js +3 -1
  25. package/dist/schema/modules/service/functions/list-service-schedules.d.ts +1 -1
  26. package/dist/schema/modules/service/functions/list-service-schedules.js +3 -1
  27. package/dist/schema/modules/service/functions/list-service-secret-names.d.ts +1 -1
  28. package/dist/schema/modules/service/functions/list-service-secret-names.js +3 -1
  29. package/dist/schema/modules/service/functions/replace-service-schedules.d.ts +1 -1
  30. package/dist/schema/modules/service/functions/replace-service-schedules.js +3 -1
  31. package/dist/schema/modules/service/functions/set-service-secret.d.ts +1 -1
  32. package/dist/schema/modules/service/functions/set-service-secret.js +3 -1
  33. package/dist/schema/modules/service/index.d.ts +8 -4
  34. package/dist/schema/modules/service/index.js +5 -3
  35. package/dist/schema/modules/service/policies/index.d.ts +1 -1
  36. package/dist/schema/modules/service/policies/index.js +1 -1
  37. package/dist/schema/modules/service/policies/own-service.d.ts +2 -0
  38. package/dist/schema/modules/service/policies/own-service.js +7 -0
  39. package/dist/schema/modules/service/policies/traverse-owned-service.js +2 -2
  40. package/dist/schema/modules/service/states/index.d.ts +2 -0
  41. package/dist/schema/modules/service/states/index.js +1 -0
  42. package/dist/schema/modules/service/states/service-lifecycle.d.ts +25 -0
  43. package/dist/schema/modules/service/states/service-lifecycle.js +26 -0
  44. package/dist/schema/modules/service/types/index.d.ts +0 -7
  45. package/dist/schema/modules/service/types/index.js +0 -4
  46. package/dist/schema/schema.d.ts +6419 -8229
  47. package/dist/schema/schema.js +21 -13
  48. package/package.json +5 -4
  49. package/dist/schema/modules/service/policies/observe-service.d.ts +0 -2
  50. package/dist/schema/modules/service/policies/observe-service.js +0 -7
  51. package/dist/schema/modules/service/types/deploy-service-input.d.ts +0 -130
  52. package/dist/schema/modules/service/types/deploy-service-input.js +0 -40
  53. package/dist/schema/modules/service/types/deploy-service-output.d.ts +0 -74
  54. package/dist/schema/modules/service/types/deploy-service-output.js +0 -24
  55. package/dist/schema/modules/service/types/service-deployment-rejection.d.ts +0 -11
  56. package/dist/schema/modules/service/types/service-deployment-rejection.js +0 -6
  57. package/dist/schema/modules/service/types/service-lifecycle.d.ts +0 -8
  58. package/dist/schema/modules/service/types/service-lifecycle.js +0 -2
@@ -1,6 +1,6 @@
1
1
  import { nodeClass, property } from '@astrale-os/sdk/schema';
2
2
  import { z } from 'zod';
3
- import { deployCloudflareWorker } from '../functions/index.js';
3
+ import { deployCloudflareWorker } from '../functions/deploy-cloudflare-worker.js';
4
4
  import { Service } from './service.js';
5
5
  export const CloudflareWorker = nodeClass({
6
6
  description: 'One Service placed in a Cloudflare Workers dispatch namespace.',
@@ -4,12 +4,12 @@ export declare const service_owned_by: import("@astrale-os/sdk/schema").Directed
4
4
  readonly extends: readonly [];
5
5
  readonly properties: never;
6
6
  readonly source: {
7
- readonly as: "owner";
8
- readonly outgoing: "0..*";
7
+ readonly as: "service";
8
+ readonly outgoing: "1";
9
9
  };
10
10
  readonly target: {
11
- readonly as: "service";
12
- readonly incoming: "1";
11
+ readonly as: "owner";
12
+ readonly incoming: "0..*";
13
13
  };
14
14
  readonly constraints: Record<never, never>;
15
15
  readonly effectiveProperties: never;
@@ -1,9 +1,10 @@
1
- import { K, edgeClass } from '@astrale-os/sdk/schema';
1
+ import { edgeClass } from '@astrale-os/sdk/schema';
2
+ import { ServicesShell } from '../dependencies/index.js';
2
3
  import { TraverseOwnedService } from '../policies/index.js';
3
4
  import { Service } from './service.js';
4
5
  export const service_owned_by = edgeClass.directed({
5
- description: 'The Identity that owns and may manage one Service.',
6
- source: { as: 'owner', accepts: [K.classes.Identity], outgoing: '0..*' },
7
- target: { as: 'service', accepts: [() => Service], incoming: '1' },
6
+ description: 'The Shell user that owns and may manage one Service.',
7
+ source: { as: 'service', accepts: [() => Service], outgoing: '1' },
8
+ target: { as: 'owner', accepts: [ServicesShell.classes.User], incoming: '0..*' },
8
9
  policies: { traverse: () => TraverseOwnedService },
9
10
  });
@@ -52,26 +52,33 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
52
52
  readonly origin: "kernel.astrale.ai";
53
53
  }, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "createdAt", "kernel.astrale.ai:class.Timestamped.property.createdAt", undefined> | import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "updatedAt", "kernel.astrale.ai:class.Timestamped.property.updatedAt", undefined>, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "createdAt", "kernel.astrale.ai:class.Timestamped.property.createdAt", undefined> | import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "updatedAt", "kernel.astrale.ai:class.Timestamped.property.updatedAt", undefined>, never, never>];
54
54
  readonly properties: {
55
- readonly providerKey: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "providerKey", "self", undefined>;
56
55
  readonly providerName: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "providerName", "self", undefined>;
57
56
  readonly serviceKey: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "serviceKey", "self", undefined>;
58
57
  readonly url: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "url", "self", never>;
59
- readonly state: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<"deleting" | "deploying" | "failed" | "ready" | "reconciling", "deleting" | "deploying" | "failed" | "ready" | "reconciling", true, "state", "self", undefined>;
58
+ readonly state: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<unknown, "deleting" | "deploying" | "failed" | "ready" | "reconciling", true, "state", "self", import("@astrale-os/sdk/state").StateTopology<{
59
+ readonly deploying: {
60
+ readonly recordProviderDeployment: "reconciling";
61
+ readonly failDeployment: "failed";
62
+ readonly deleteService: "deleting";
63
+ };
64
+ readonly reconciling: {
65
+ readonly retryDeployment: "deploying";
66
+ readonly completeDeployment: "ready";
67
+ readonly deleteService: "deleting";
68
+ };
69
+ readonly ready: {
70
+ readonly redeploy: "deploying";
71
+ readonly deleteService: "deleting";
72
+ };
73
+ readonly failed: {
74
+ readonly retryDeployment: "deploying";
75
+ readonly deleteService: "deleting";
76
+ };
77
+ readonly deleting: {};
78
+ }, "deploying">>;
60
79
  readonly digest: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "digest", "self", never>;
61
- readonly revision: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "revision", "self", never>;
62
80
  readonly deploymentReceipt: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "deploymentReceipt", "self", never>;
63
81
  readonly operationExpiresAt: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<import("@astrale-os/sdk/schema").Value, import("@astrale-os/sdk/schema").Value, false, "operationExpiresAt", "self", never>;
64
- readonly hostedIssuer: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedIssuer", "self", never>;
65
- readonly hostedOrigin: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedOrigin", "self", never>;
66
- readonly hostedRevision: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedRevision", "self", never>;
67
- readonly hostedPublicationEtag: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedPublicationEtag", "self", never>;
68
- readonly hostedFunctions: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
69
- ref: string;
70
- path: string;
71
- }[], {
72
- ref: string;
73
- path: string;
74
- }[], false, "hostedFunctions", "self", never>;
75
82
  readonly error: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "error", "self", never>;
76
83
  };
77
84
  readonly methods: {
@@ -86,7 +93,7 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
86
93
  kind: "rejected";
87
94
  reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
88
95
  };
89
- }, "authenticated", false, "default">>;
96
+ }, "authorized", false, "default">>;
90
97
  readonly deleteSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
91
98
  name: string;
92
99
  }, {
@@ -97,11 +104,11 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
97
104
  } | {
98
105
  ok: true;
99
106
  };
100
- }, "authenticated", false, "default">>;
107
+ }, "authorized", false, "default">>;
101
108
  readonly secrets: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
102
109
  readonly mode: 'value';
103
110
  readonly value: string[];
104
- }, "authenticated", false, "default">>;
111
+ }, "authorized", false, "default">>;
105
112
  readonly setSchedule: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
106
113
  crons: string[];
107
114
  }, {
@@ -112,11 +119,11 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
112
119
  kind: "rejected";
113
120
  reason: "invalid-schedule" | "service-unavailable";
114
121
  };
115
- }, "authenticated", false, "default">>;
122
+ }, "authorized", false, "default">>;
116
123
  readonly schedules: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
117
124
  readonly mode: 'value';
118
125
  readonly value: string[];
119
- }, "authenticated", false, "default">>;
126
+ }, "authorized", false, "default">>;
120
127
  readonly logs: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
121
128
  tail?: number | undefined;
122
129
  since?: number | undefined;
@@ -128,7 +135,7 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
128
135
  level: string;
129
136
  line: string;
130
137
  }[];
131
- }, "authenticated", false, "default">>;
138
+ }, "authorized", false, "default">>;
132
139
  readonly delete: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
133
140
  readonly mode: 'value';
134
141
  readonly value: {
@@ -137,15 +144,29 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
137
144
  kind: "deleting";
138
145
  retryAfterMs: number;
139
146
  };
140
- }, "authenticated", false, "default">>;
147
+ }, "authorized", false, "default">>;
141
148
  };
142
- readonly effectiveProperties: (import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "deploymentReceipt", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "digest", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "error", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
143
- ref: string;
144
- path: string;
145
- }[], {
146
- ref: string;
147
- path: string;
148
- }[], false, "hostedFunctions", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedIssuer", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedOrigin", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedPublicationEtag", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "hostedRevision", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<import("@astrale-os/sdk/schema").Value, import("@astrale-os/sdk/schema").Value, false, "operationExpiresAt", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "providerKey", "self", undefined> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "providerName", "self", undefined> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "revision", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "serviceKey", "self", undefined> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<"deleting" | "deploying" | "failed" | "ready" | "reconciling", "deleting" | "deploying" | "failed" | "ready" | "reconciling", true, "state", "self", undefined> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "url", "self", never>) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, false, never> & {
149
+ readonly effectiveProperties: (import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "deploymentReceipt", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "digest", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "error", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<import("@astrale-os/sdk/schema").Value, import("@astrale-os/sdk/schema").Value, false, "operationExpiresAt", "self", never> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "providerName", "self", undefined> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "serviceKey", "self", undefined> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<unknown, "deleting" | "deploying" | "failed" | "ready" | "reconciling", true, "state", "self", import("@astrale-os/sdk/state").StateTopology<{
150
+ readonly deploying: {
151
+ readonly recordProviderDeployment: "reconciling";
152
+ readonly failDeployment: "failed";
153
+ readonly deleteService: "deleting";
154
+ };
155
+ readonly reconciling: {
156
+ readonly retryDeployment: "deploying";
157
+ readonly completeDeployment: "ready";
158
+ readonly deleteService: "deleting";
159
+ };
160
+ readonly ready: {
161
+ readonly redeploy: "deploying";
162
+ readonly deleteService: "deleting";
163
+ };
164
+ readonly failed: {
165
+ readonly retryDeployment: "deploying";
166
+ readonly deleteService: "deleting";
167
+ };
168
+ readonly deleting: {};
169
+ }, "deploying">> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, false, "url", "self", never>) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, false, never> & {
149
170
  readonly name: "description";
150
171
  readonly key: "kernel.astrale.ai:class.Descriptable.property.description";
151
172
  }) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true, undefined> & {
@@ -161,10 +182,10 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
161
182
  readonly effectiveInstanceMethods: import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
162
183
  readonly mode: 'value';
163
184
  readonly value: string[];
164
- }, "authenticated", false, "default">>, "schedules", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
185
+ }, "authorized", false, "default">>, "schedules", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
165
186
  readonly mode: 'value';
166
187
  readonly value: string[];
167
- }, "authenticated", false, "default">>, "secrets", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
188
+ }, "authorized", false, "default">>, "secrets", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
168
189
  readonly mode: 'value';
169
190
  readonly value: {
170
191
  kind: "deleted";
@@ -172,7 +193,7 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
172
193
  kind: "deleting";
173
194
  retryAfterMs: number;
174
195
  };
175
- }, "authenticated", false, "default">>, "delete", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
196
+ }, "authorized", false, "default">>, "delete", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
176
197
  name: string;
177
198
  value: string;
178
199
  }, {
@@ -183,7 +204,7 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
183
204
  kind: "rejected";
184
205
  reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
185
206
  };
186
- }, "authenticated", false, "default">>, "setSecret", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
207
+ }, "authorized", false, "default">>, "setSecret", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
187
208
  name: string;
188
209
  }, {
189
210
  readonly mode: 'value';
@@ -193,7 +214,7 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
193
214
  } | {
194
215
  ok: true;
195
216
  };
196
- }, "authenticated", false, "default">>, "deleteSecret", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
217
+ }, "authorized", false, "default">>, "deleteSecret", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
197
218
  crons: string[];
198
219
  }, {
199
220
  readonly mode: 'value';
@@ -203,7 +224,7 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
203
224
  kind: "rejected";
204
225
  reason: "invalid-schedule" | "service-unavailable";
205
226
  };
206
- }, "authenticated", false, "default">>, "setSchedule", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
227
+ }, "authorized", false, "default">>, "setSchedule", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
207
228
  tail?: number | undefined;
208
229
  since?: number | undefined;
209
230
  }, {
@@ -214,6 +235,6 @@ export declare const Service: import("@astrale-os/sdk/schema").NodeClass<{
214
235
  level: string;
215
236
  line: string;
216
237
  }[];
217
- }, "authenticated", false, "default">>, "logs", "self">;
238
+ }, "authorized", false, "default">>, "logs", "self">;
218
239
  readonly effectiveStaticMethods: never;
219
240
  }>;
@@ -1,36 +1,27 @@
1
- import { K, nodeClass, property, schema as valueSchema } from '@astrale-os/sdk/schema';
1
+ import { K, nodeClass, property, schema as valueSchema, stateProperty, } from '@astrale-os/sdk/schema';
2
2
  import { z } from 'zod';
3
- import { deleteService, deleteServiceSecret, listServiceLogs, listServiceSchedules, listServiceSecretNames, replaceServiceSchedules, setServiceSecret, } from '../functions/index.js';
4
- import { ObserveService } from '../policies/index.js';
5
- import { serviceLifecycle } from '../types/index.js';
6
- const digest = z
7
- .string()
8
- .length(71)
9
- .regex(/sha256:[0-9a-f]{64}/);
10
- const publishedFunction = z.strictObject({
11
- ref: z.string().min(1).max(512),
12
- path: z.string().min(1).max(2_048),
13
- });
3
+ import { deleteServiceSecret } from '../functions/delete-service-secret.js';
4
+ import { deleteService } from '../functions/delete-service.js';
5
+ import { listServiceLogs } from '../functions/list-service-logs.js';
6
+ import { listServiceSchedules } from '../functions/list-service-schedules.js';
7
+ import { listServiceSecretNames } from '../functions/list-service-secret-names.js';
8
+ import { replaceServiceSchedules } from '../functions/replace-service-schedules.js';
9
+ import { setServiceSecret } from '../functions/set-service-secret.js';
10
+ import { OwnService } from '../policies/own-service.js';
11
+ import { serviceLifecycle } from '../states/index.js';
14
12
  /** Provider-neutral deployed resource. Provider implementation versions are deliberately external. */
15
13
  export const Service = nodeClass({
16
14
  abstract: true,
17
15
  description: 'One caller-owned provider-neutral deployed Service.',
18
16
  extends: [K.classes.Named, K.classes.Descriptable, K.classes.Timestamped],
19
17
  properties: {
20
- providerKey: z.string().min(1).max(80),
21
18
  providerName: z.string().min(1).max(120),
22
19
  serviceKey: z.string().min(1).max(63),
23
20
  url: property(z.string().min(1).max(2_048), { required: false }),
24
- state: serviceLifecycle,
21
+ state: stateProperty(serviceLifecycle),
25
22
  digest: property(z.string().min(1).max(256), { required: false }),
26
- revision: property(digest, { required: false }),
27
23
  deploymentReceipt: property(z.string().min(1).max(128), { required: false }),
28
24
  operationExpiresAt: property(valueSchema.values.instant, { required: false }),
29
- hostedIssuer: property(z.string().min(1).max(2_048), { required: false }),
30
- hostedOrigin: property(z.string().min(1).max(512), { required: false }),
31
- hostedRevision: property(digest, { required: false }),
32
- hostedPublicationEtag: property(digest, { required: false }),
33
- hostedFunctions: property(z.array(publishedFunction).max(1_024), { required: false }),
34
25
  error: property(z.string().max(5_000), { required: false }),
35
26
  },
36
27
  methods: {
@@ -42,5 +33,5 @@ export const Service = nodeClass({
42
33
  logs: listServiceLogs,
43
34
  delete: deleteService,
44
35
  },
45
- policies: { read: () => ObserveService },
36
+ policies: { read: () => OwnService },
46
37
  });
@@ -0,0 +1 @@
1
+ export { ServicesShell } from './shell.js';
@@ -0,0 +1 @@
1
+ export { ServicesShell } from './shell.js';
@@ -0,0 +1,4 @@
1
+ import { ShellSchema } from '@astrale-domains/shell';
2
+ import { schema as language } from '@astrale-os/sdk/schema';
3
+ /** The exact Shell vocabulary Services uses for human ownership. */
4
+ export declare const ServicesShell: language.ResolvedDomainOf<typeof ShellSchema>;
@@ -0,0 +1,4 @@
1
+ import { ShellSchema } from '@astrale-domains/shell';
2
+ import { schema as language } from '@astrale-os/sdk/schema';
3
+ /** The exact Shell vocabulary Services uses for human ownership. */
4
+ export const ServicesShell = language.resolve(ShellSchema);
@@ -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
- } | {
8
6
  kind: "rejected";
9
7
  reason: "binding-unavailable" | "invalid-secret-name" | "service-unavailable";
8
+ } | {
9
+ ok: true;
10
10
  };
11
- }, "authenticated", false, "default">>;
11
+ }, "authorized", false, "default">>;
@@ -1,9 +1,11 @@
1
1
  import { method } from '@astrale-os/sdk/schema';
2
2
  import { z } from 'zod';
3
+ import { OwnService } from '../policies/own-service.js';
3
4
  import { secretName, secretOperationRejection } from '../types/index.js';
4
5
  export const deleteServiceSecret = method({
5
6
  description: 'Delete one write-only Service secret.',
6
- auth: 'authenticated',
7
+ auth: 'authorized',
8
+ policy: ({ check, self }) => check(OwnService, self),
7
9
  input: z.strictObject({ name: secretName }),
8
10
  output: z.union([z.strictObject({ ok: z.literal(true) }), secretOperationRejection]),
9
11
  });
@@ -6,4 +6,4 @@ export declare const deleteService: import("@astrale-os/sdk/schema").Method<impo
6
6
  kind: "deleting";
7
7
  retryAfterMs: number;
8
8
  };
9
- }, "authenticated", false, "default">>;
9
+ }, "authorized", false, "default">>;
@@ -1,8 +1,10 @@
1
1
  import { method } from '@astrale-os/sdk/schema';
2
2
  import { z } from 'zod';
3
+ import { OwnService } from '../policies/own-service.js';
3
4
  export const deleteService = method({
4
5
  description: 'Convergently delete provider resources and the owned Service without uninstalling consumers.',
5
- auth: 'authenticated',
6
+ auth: 'authorized',
7
+ policy: ({ check, self }) => check(OwnService, self),
6
8
  input: z.strictObject({}),
7
9
  output: z.discriminatedUnion('kind', [
8
10
  z.strictObject({ kind: z.literal('deleted') }),
@@ -1,3 +1,163 @@
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>;
1
161
  export declare const deployCloudflareWorker: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
2
162
  name?: string | undefined;
3
163
  entry?: string | undefined;
@@ -11,7 +171,6 @@ export declare const deployCloudflareWorker: import("@astrale-os/sdk/schema").Me
11
171
  kind?: "data" | "esm" | "text" | "wasm" | undefined;
12
172
  })[] | undefined;
13
173
  revisioned?: {
14
- revision: string;
15
174
  requiredSecrets: string[];
16
175
  release: {
17
176
  entry: string;
@@ -60,19 +219,7 @@ export declare const deployCloudflareWorker: import("@astrale-os/sdk/schema").Me
60
219
  serviceKey: string;
61
220
  url: string;
62
221
  digest: string;
63
- revision?: string | undefined;
64
- state: "deleting" | "deploying" | "failed" | "ready" | "reconciling";
65
- error?: string | null | undefined;
66
- application?: {
67
- issuer: string;
68
- origin: string;
69
- revision: string;
70
- publicationEtag: string;
71
- functions: {
72
- path: string;
73
- ref: string;
74
- }[];
75
- } | undefined;
222
+ state: "ready";
76
223
  } | {
77
224
  kind: "rejected";
78
225
  reason: "artifact-mode-conflict" | "invalid-deployment" | "service-unavailable";
@@ -1,7 +1,52 @@
1
1
  import { method } from '@astrale-os/sdk/schema';
2
- import { deployServiceInput, deployServiceOutput } from '../types/index.js';
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]);
3
48
  export const deployCloudflareWorker = method({
4
- description: 'Create or converge one Cloudflare Worker Service and admit its optional Publication.',
49
+ description: 'Create or converge one Cloudflare Worker Service.',
5
50
  auth: 'authenticated',
6
51
  static: true,
7
52
  input: deployServiceInput,
@@ -1,6 +1,7 @@
1
1
  export { deleteServiceSecret } from './delete-service-secret.js';
2
2
  export { deleteService } from './delete-service.js';
3
- export { deployCloudflareWorker } from './deploy-cloudflare-worker.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';
4
5
  export { listServiceLogs } from './list-service-logs.js';
5
6
  export { listServiceSchedules } from './list-service-schedules.js';
6
7
  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 { deployCloudflareWorker } from './deploy-cloudflare-worker.js';
3
+ export { artifact, deployedService, deploymentRejection, deployCloudflareWorker, deployServiceInput, deployServiceOutput, revisionedDeployment, } 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';
@@ -9,4 +9,4 @@ export declare const listServiceLogs: import("@astrale-os/sdk/schema").Method<im
9
9
  level: string;
10
10
  line: string;
11
11
  }[];
12
- }, "authenticated", false, "default">>;
12
+ }, "authorized", false, "default">>;