@astrale-domains/services 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/schema/application/functions.js +20 -0
- package/dist/schema/application/index.d.ts +391 -0
- package/dist/schema/application/index.js +10 -0
- package/dist/schema/deployment/asset.d.ts +29 -0
- package/dist/schema/deployment/asset.js +17 -0
- package/dist/schema/deployment/content.d.ts +12 -0
- package/dist/schema/deployment/content.js +15 -0
- package/dist/schema/deployment/index.d.ts +11 -0
- package/dist/schema/deployment/index.js +6 -0
- package/dist/schema/deployment/limits.d.ts +6 -0
- package/dist/schema/deployment/limits.js +7 -0
- package/dist/schema/deployment/module.d.ts +21 -0
- package/dist/schema/deployment/module.js +11 -0
- package/dist/schema/deployment/request.d.ts +172 -0
- package/dist/schema/deployment/request.js +33 -0
- package/dist/schema/deployment/result.d.ts +24 -0
- package/dist/schema/deployment/result.js +15 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +3 -0
- package/dist/schema/service/class.d.ts +340 -0
- package/dist/schema/service/class.js +22 -0
- package/dist/schema/service/index.d.ts +4 -0
- package/dist/schema/service/index.js +4 -0
- package/dist/schema/service/methods.d.ts +135 -0
- package/dist/schema/service/methods.js +64 -0
- package/dist/schema/service/policies.d.ts +4 -0
- package/dist/schema/service/policies.js +12 -0
- package/dist/schema/service/relationships.d.ts +16 -0
- package/dist/schema/service/relationships.js +9 -0
- package/package.json +79 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export declare const serviceMethods: {
|
|
2
|
+
readonly deploy: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
3
|
+
path: string;
|
|
4
|
+
name?: string | undefined;
|
|
5
|
+
entry?: string | undefined;
|
|
6
|
+
modules?: ({
|
|
7
|
+
contentBase64: string;
|
|
8
|
+
name: string;
|
|
9
|
+
kind?: "data" | "esm" | "text" | "wasm" | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
contentBase64Chunks: string[];
|
|
12
|
+
name: string;
|
|
13
|
+
kind?: "data" | "esm" | "text" | "wasm" | undefined;
|
|
14
|
+
})[] | undefined;
|
|
15
|
+
revisioned?: {
|
|
16
|
+
revision: string;
|
|
17
|
+
release: {
|
|
18
|
+
entry: string;
|
|
19
|
+
modules: ({
|
|
20
|
+
contentBase64: string;
|
|
21
|
+
name: string;
|
|
22
|
+
kind?: "data" | "esm" | "text" | "wasm" | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
contentBase64Chunks: string[];
|
|
25
|
+
name: string;
|
|
26
|
+
kind?: "data" | "esm" | "text" | "wasm" | undefined;
|
|
27
|
+
})[];
|
|
28
|
+
};
|
|
29
|
+
gateway: {
|
|
30
|
+
entry: string;
|
|
31
|
+
modules: ({
|
|
32
|
+
contentBase64: string;
|
|
33
|
+
name: string;
|
|
34
|
+
kind?: "data" | "esm" | "text" | "wasm" | undefined;
|
|
35
|
+
} | {
|
|
36
|
+
contentBase64Chunks: string[];
|
|
37
|
+
name: string;
|
|
38
|
+
kind?: "data" | "esm" | "text" | "wasm" | undefined;
|
|
39
|
+
})[];
|
|
40
|
+
};
|
|
41
|
+
} | undefined;
|
|
42
|
+
compatibilityDate?: string | undefined;
|
|
43
|
+
compatibilityFlags?: string[] | undefined;
|
|
44
|
+
serviceBindings?: {
|
|
45
|
+
name: string;
|
|
46
|
+
service: string;
|
|
47
|
+
}[] | undefined;
|
|
48
|
+
vars?: Record<string, string> | undefined;
|
|
49
|
+
secrets?: Record<string, string> | undefined;
|
|
50
|
+
assets?: {
|
|
51
|
+
files: ({
|
|
52
|
+
contentBase64: string;
|
|
53
|
+
path: string;
|
|
54
|
+
contentType?: string | undefined;
|
|
55
|
+
} | {
|
|
56
|
+
contentBase64Chunks: string[];
|
|
57
|
+
path: string;
|
|
58
|
+
contentType?: string | undefined;
|
|
59
|
+
})[];
|
|
60
|
+
notFound?: "404-page" | "none" | "single-page-application" | undefined;
|
|
61
|
+
runWorkerFirst?: boolean | undefined;
|
|
62
|
+
htmlHandling?: "none" | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
limits?: {
|
|
65
|
+
cpuMs?: number | undefined;
|
|
66
|
+
subrequests?: number | undefined;
|
|
67
|
+
} | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
readonly mode: 'value';
|
|
70
|
+
readonly value: {
|
|
71
|
+
path: string;
|
|
72
|
+
url: string;
|
|
73
|
+
digest: string;
|
|
74
|
+
revision?: string | undefined;
|
|
75
|
+
state: "deploying" | "failed" | "ready";
|
|
76
|
+
error?: string | null | undefined;
|
|
77
|
+
functions: {
|
|
78
|
+
id: string;
|
|
79
|
+
path: string;
|
|
80
|
+
ref: string;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
}, "authenticated", true, "default">>;
|
|
84
|
+
readonly setSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
85
|
+
name: string;
|
|
86
|
+
value: string;
|
|
87
|
+
}, {
|
|
88
|
+
readonly mode: 'value';
|
|
89
|
+
readonly value: {
|
|
90
|
+
name: string;
|
|
91
|
+
};
|
|
92
|
+
}, "authenticated", false, "default">>;
|
|
93
|
+
readonly deleteSecret: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
94
|
+
name: string;
|
|
95
|
+
}, {
|
|
96
|
+
readonly mode: 'value';
|
|
97
|
+
readonly value: {
|
|
98
|
+
ok: true;
|
|
99
|
+
};
|
|
100
|
+
}, "authenticated", false, "default">>;
|
|
101
|
+
readonly secrets: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
102
|
+
readonly mode: 'value';
|
|
103
|
+
readonly value: string[];
|
|
104
|
+
}, "authenticated", false, "default">>;
|
|
105
|
+
readonly setSchedule: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
106
|
+
crons: string[];
|
|
107
|
+
}, {
|
|
108
|
+
readonly mode: 'value';
|
|
109
|
+
readonly value: {
|
|
110
|
+
crons: string[];
|
|
111
|
+
};
|
|
112
|
+
}, "authenticated", false, "default">>;
|
|
113
|
+
readonly schedules: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
114
|
+
readonly mode: 'value';
|
|
115
|
+
readonly value: string[];
|
|
116
|
+
}, "authenticated", false, "default">>;
|
|
117
|
+
readonly logs: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
118
|
+
tail?: number | undefined;
|
|
119
|
+
since?: number | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
readonly mode: 'value';
|
|
122
|
+
readonly value: {
|
|
123
|
+
id: string;
|
|
124
|
+
ts: number;
|
|
125
|
+
level: string;
|
|
126
|
+
line: string;
|
|
127
|
+
}[];
|
|
128
|
+
}, "authenticated", false, "default">>;
|
|
129
|
+
readonly delete: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
130
|
+
readonly mode: 'value';
|
|
131
|
+
readonly value: {
|
|
132
|
+
ok: true;
|
|
133
|
+
};
|
|
134
|
+
}, "authenticated", false, "default">>;
|
|
135
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { deployServiceInput, deployServiceOutput } from '#schema/deployment';
|
|
4
|
+
const secretName = z.string().min(1).max(256);
|
|
5
|
+
export const serviceMethods = {
|
|
6
|
+
deploy: method({
|
|
7
|
+
description: 'Create or replace one Cloudflare Worker placement.',
|
|
8
|
+
auth: 'authenticated',
|
|
9
|
+
static: true,
|
|
10
|
+
input: deployServiceInput,
|
|
11
|
+
output: deployServiceOutput,
|
|
12
|
+
}),
|
|
13
|
+
setSecret: method({
|
|
14
|
+
description: 'Set one write-only Service secret.',
|
|
15
|
+
auth: 'authenticated',
|
|
16
|
+
input: z.strictObject({
|
|
17
|
+
name: secretName,
|
|
18
|
+
value: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.max(64 * 1024),
|
|
22
|
+
}),
|
|
23
|
+
output: z.strictObject({ name: secretName }),
|
|
24
|
+
}),
|
|
25
|
+
deleteSecret: method({
|
|
26
|
+
description: 'Delete one write-only Service secret.',
|
|
27
|
+
auth: 'authenticated',
|
|
28
|
+
input: z.strictObject({ name: secretName }),
|
|
29
|
+
output: z.strictObject({ ok: z.literal(true) }),
|
|
30
|
+
}),
|
|
31
|
+
secrets: method({
|
|
32
|
+
description: 'List write-only secret names.',
|
|
33
|
+
auth: 'authenticated',
|
|
34
|
+
input: z.strictObject({}),
|
|
35
|
+
output: z.array(secretName),
|
|
36
|
+
}),
|
|
37
|
+
setSchedule: method({
|
|
38
|
+
description: 'Replace the complete Service cron set.',
|
|
39
|
+
auth: 'authenticated',
|
|
40
|
+
input: z.strictObject({ crons: z.array(z.string()).max(24) }),
|
|
41
|
+
output: z.strictObject({ crons: z.array(z.string()) }),
|
|
42
|
+
}),
|
|
43
|
+
schedules: method({
|
|
44
|
+
description: 'List active Service cron expressions.',
|
|
45
|
+
auth: 'authenticated',
|
|
46
|
+
input: z.strictObject({}),
|
|
47
|
+
output: z.array(z.string()),
|
|
48
|
+
}),
|
|
49
|
+
logs: method({
|
|
50
|
+
description: 'Read recent Service runtime logs.',
|
|
51
|
+
auth: 'authenticated',
|
|
52
|
+
input: z.strictObject({
|
|
53
|
+
tail: z.number().int().min(1).max(1_000).optional(),
|
|
54
|
+
since: z.number().int().min(0).optional(),
|
|
55
|
+
}),
|
|
56
|
+
output: z.array(z.strictObject({ id: z.string(), ts: z.number(), level: z.string(), line: z.string() })),
|
|
57
|
+
}),
|
|
58
|
+
delete: method({
|
|
59
|
+
description: 'Delete the provider placement and Service record.',
|
|
60
|
+
auth: 'authenticated',
|
|
61
|
+
input: z.strictObject({}),
|
|
62
|
+
output: z.strictObject({ ok: z.literal(true) }),
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** A Service is visible only to the Identity that owns its provider effects. */
|
|
2
|
+
export declare const ObserveService: import("@astrale-os/sdk/schema").Policy;
|
|
3
|
+
/** Ownership edges disclose only the subject's own Service relationship. */
|
|
4
|
+
export declare const TraverseOwnedService: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { service_owned_by } from './relationships.js';
|
|
3
|
+
/** A Service is visible only to the Identity that owns its provider effects. */
|
|
4
|
+
export const ObserveService = policy({
|
|
5
|
+
description: 'The subject owns this Service.',
|
|
6
|
+
match: ({ edge, object, subject }) => edge({ source: subject, class: () => service_owned_by, target: object }),
|
|
7
|
+
});
|
|
8
|
+
/** Ownership edges disclose only the subject's own Service relationship. */
|
|
9
|
+
export const TraverseOwnedService = policy({
|
|
10
|
+
description: 'The subject owns the Service at the target of this relationship.',
|
|
11
|
+
match: ({ allOf, edge, source, subject, target }) => allOf(edge({ source: subject, class: () => service_owned_by, target }), edge({ source, class: () => service_owned_by, target })),
|
|
12
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const service_owned_by: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
|
|
2
|
+
readonly depth: 0;
|
|
3
|
+
readonly abstract: false;
|
|
4
|
+
readonly extends: readonly [];
|
|
5
|
+
readonly properties: never;
|
|
6
|
+
readonly source: {
|
|
7
|
+
readonly as: "owner";
|
|
8
|
+
readonly outgoing: "0..*";
|
|
9
|
+
};
|
|
10
|
+
readonly target: {
|
|
11
|
+
readonly as: "service";
|
|
12
|
+
readonly incoming: "1";
|
|
13
|
+
};
|
|
14
|
+
readonly constraints: Record<never, never>;
|
|
15
|
+
readonly effectiveProperties: never;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { CloudflareWorker } from './class.js';
|
|
3
|
+
import { TraverseOwnedService } from './policies.js';
|
|
4
|
+
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: [() => CloudflareWorker], incoming: '1' },
|
|
8
|
+
policies: { traverse: () => TraverseOwnedService },
|
|
9
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@astrale-domains/services",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/astrale-os/domains.git",
|
|
7
|
+
"directory": "services"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/schema/index.js",
|
|
14
|
+
"types": "./dist/schema/index.d.ts",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#schema": "./dist/schema/index.js",
|
|
17
|
+
"#schema/*": "./dist/schema/*/index.js"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/schema/index.d.ts",
|
|
22
|
+
"import": "./dist/schema/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@astrale-os/sdk": "0.5.0-beta.45",
|
|
31
|
+
"zod": "^4.4.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@astrale-os/adapter-astrale": "0.5.0-beta.41",
|
|
35
|
+
"@astrale-os/adapter-cloudflare": "0.5.0-beta.48",
|
|
36
|
+
"@astrale-os/ox": ">=0.1.3 <1.0.0",
|
|
37
|
+
"@astrale-os/shell": "0.4.2-beta.3",
|
|
38
|
+
"@astrale-os/shell-react": "0.3.2-beta.2",
|
|
39
|
+
"@tailwindcss/vite": "^4.0.6",
|
|
40
|
+
"@tanstack/react-router": "1.170.17",
|
|
41
|
+
"@tanstack/router-plugin": "1.168.19",
|
|
42
|
+
"@types/node": "^22.0.0",
|
|
43
|
+
"@types/react": "^19.2.0",
|
|
44
|
+
"@types/react-dom": "^19.2.0",
|
|
45
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
46
|
+
"oxlint": ">=1.78.0 <2.0.0",
|
|
47
|
+
"react": "^19.2.0",
|
|
48
|
+
"react-dom": "^19.2.0",
|
|
49
|
+
"tailwindcss": "^4.0.6",
|
|
50
|
+
"typescript": "7.0.2",
|
|
51
|
+
"vite": "^8.2.1",
|
|
52
|
+
"vitest": "^4.1.10"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=22.13"
|
|
56
|
+
},
|
|
57
|
+
"trustedDependencies": [
|
|
58
|
+
"esbuild",
|
|
59
|
+
"sharp",
|
|
60
|
+
"workerd"
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"dev": "astrale-domain dev",
|
|
64
|
+
"prod": "astrale-domain deploy prod",
|
|
65
|
+
"deploy": "astrale-domain deploy",
|
|
66
|
+
"build": "astrale-domain build",
|
|
67
|
+
"lint": "astrale-domain lint",
|
|
68
|
+
"lint:fix": "astrale-domain lint --fix",
|
|
69
|
+
"package": "astrale-domain package",
|
|
70
|
+
"provider:bootstrap": "bun providers/cloudflare/operator/provision/bootstrap.ts",
|
|
71
|
+
"provider:route-wildcard": "bun providers/cloudflare/operator/routing/wildcard.ts",
|
|
72
|
+
"provider:route-tenant": "bun providers/cloudflare/operator/routing/tenant.ts",
|
|
73
|
+
"qualify:cloudflare": "bun scripts/qualification/cloudflare/run.ts",
|
|
74
|
+
"typecheck": "tsc --noEmit",
|
|
75
|
+
"test": "vitest run --config vitest.config.ts",
|
|
76
|
+
"frontend:dev": "vite",
|
|
77
|
+
"frontend:build": "vite build"
|
|
78
|
+
}
|
|
79
|
+
}
|