@astrale-domains/services 0.5.1 → 0.7.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 +115 -51
- package/dist/scaffold/create-service.mjs +94 -0
- package/dist/scaffold/template/.env.example +4 -0
- package/dist/scaffold/template/README.md +75 -0
- package/dist/scaffold/template/gitignore +6 -0
- package/dist/scaffold/template/scripts/build.mjs +20 -0
- package/dist/scaffold/template/scripts/deploy.mjs +65 -0
- package/dist/scaffold/template/scripts/service.mjs +69 -0
- package/dist/scaffold/template/src/account.js +31 -0
- package/dist/scaffold/template/src/index.js +50 -0
- package/dist/scaffold/template/src/job.js +22 -0
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/modules/deployment/classes/cloudflare-deployment.d.ts +15 -56
- package/dist/schema/modules/deployment/classes/deployment.d.ts +24 -61
- package/dist/schema/modules/deployment/classes/deployment.js +16 -9
- package/dist/schema/modules/deployment/index.d.ts +2 -2
- package/dist/schema/modules/deployment/index.js +1 -1
- package/dist/schema/modules/deployment/types/deployment-hosting.d.ts +19 -49
- package/dist/schema/modules/deployment/types/deployment-hosting.js +10 -10
- package/dist/schema/modules/deployment/types/deployment-request.d.ts +45 -93
- package/dist/schema/modules/deployment/types/deployment-request.js +60 -30
- package/dist/schema/modules/deployment/types/deployment-response.d.ts +14 -22
- package/dist/schema/modules/deployment/types/deployment-response.js +5 -2
- package/dist/schema/modules/deployment/types/deployment-secret.d.ts +2 -2
- package/dist/schema/modules/deployment/types/deployment-secret.js +2 -2
- package/dist/schema/modules/deployment/types/deployment-summary.d.ts +13 -112
- package/dist/schema/modules/deployment/types/deployment-summary.js +16 -18
- package/dist/schema/modules/deployment/types/index.d.ts +6 -12
- package/dist/schema/modules/deployment/types/index.js +3 -6
- package/dist/schema/modules/deployment/types/worker-configuration.d.ts +21 -0
- package/dist/schema/modules/deployment/types/worker-configuration.js +21 -0
- package/dist/schema/modules/deployment/types/worker-record.d.ts +12 -0
- package/dist/schema/modules/deployment/types/worker-record.js +15 -0
- package/dist/schema/modules/service/classes/cloudflare-service.d.ts +56 -135
- package/dist/schema/modules/service/classes/cloudflare-service.js +4 -1
- package/dist/schema/modules/service/classes/service.d.ts +8 -7
- package/dist/schema/modules/service/classes/service.js +8 -7
- package/dist/schema/modules/service/functions/deploy-service.d.ts +44 -100
- package/dist/schema/modules/service/functions/deploy-service.js +6 -5
- package/dist/schema/modules/service/functions/describe-hosting.d.ts +0 -1
- package/dist/schema/modules/service/functions/list-service-deployments.d.ts +12 -36
- package/dist/schema/schema.d.ts +83 -247
- package/package.json +11 -7
- package/dist/schema/modules/deployment/types/content/index.d.ts +0 -1
- package/dist/schema/modules/deployment/types/content/index.js +0 -1
- package/dist/schema/modules/deployment/types/content/limits.d.ts +0 -7
- package/dist/schema/modules/deployment/types/content/limits.js +0 -7
- package/dist/schema/modules/deployment/types/deployment-record.d.ts +0 -35
- package/dist/schema/modules/deployment/types/deployment-record.js +0 -31
- package/dist/schema/modules/deployment/types/frozen-configuration.d.ts +0 -52
- package/dist/schema/modules/deployment/types/frozen-configuration.js +0 -55
- package/dist/schema/modules/deployment/types/service-deployment-artifact-module.d.ts +0 -26
- package/dist/schema/modules/deployment/types/service-deployment-artifact-module.js +0 -10
- package/dist/schema/modules/deployment/types/service-deployment-assets.d.ts +0 -49
- package/dist/schema/modules/deployment/types/service-deployment-assets.js +0 -16
- package/dist/schema/modules/deployment/types/service-deployment-content.d.ts +0 -19
- package/dist/schema/modules/deployment/types/service-deployment-content.js +0 -24
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* The `FrozenConfigurationV1` (`@astrale-os/sdk/deployment/address`) one deployment freezes beside
|
|
4
|
-
* its build: the author's plain variables, the execution settings and the durable Workflow options
|
|
5
|
-
* it declares, the runtime, the services and dispatch namespaces it binds and the names of the
|
|
6
|
-
* secrets it binds, never their values. Its digest and the build digest make the deployment's
|
|
7
|
-
* address. This shape only bounds what a request and the graph carry; the SDK's
|
|
8
|
-
* `configurationDigest` admits its canonical form, and a hosted deployment's admission decides
|
|
9
|
-
* which bindings Services hosts (`acceptDeploymentRequest`).
|
|
10
|
-
*/
|
|
11
|
-
export declare const frozenConfiguration: z.ZodObject<{
|
|
12
|
-
format: z.ZodLiteral<"astrale.deployment.configuration">;
|
|
13
|
-
version: z.ZodLiteral<1>;
|
|
14
|
-
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
15
|
-
settings: z.ZodObject<{
|
|
16
|
-
maximumRequestBytes: z.ZodNumber;
|
|
17
|
-
invocationTimeoutMs: z.ZodNumber;
|
|
18
|
-
tokenExchange: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
19
|
-
maximumLifetimeSeconds: z.ZodNumber;
|
|
20
|
-
}, z.core.$strict>]>;
|
|
21
|
-
durableOptions: z.ZodOptional<z.ZodObject<{
|
|
22
|
-
retentionMs: z.ZodOptional<z.ZodNumber>;
|
|
23
|
-
retry: z.ZodOptional<z.ZodObject<{
|
|
24
|
-
initialIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
26
|
-
maxIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
}, z.core.$strict>>;
|
|
28
|
-
stepTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
29
|
-
}, z.core.$strict>>;
|
|
30
|
-
}, z.core.$strict>;
|
|
31
|
-
runtime: z.ZodObject<{
|
|
32
|
-
compatibilityDate: z.ZodString;
|
|
33
|
-
compatibilityFlags: z.ZodArray<z.ZodString>;
|
|
34
|
-
}, z.core.$strict>;
|
|
35
|
-
bindings: z.ZodObject<{
|
|
36
|
-
services: z.ZodArray<z.ZodObject<{
|
|
37
|
-
name: z.ZodString;
|
|
38
|
-
service: z.ZodString;
|
|
39
|
-
}, z.core.$strict>>;
|
|
40
|
-
dispatchNamespaces: z.ZodArray<z.ZodObject<{
|
|
41
|
-
name: z.ZodString;
|
|
42
|
-
namespace: z.ZodString;
|
|
43
|
-
}, z.core.$strict>>;
|
|
44
|
-
secrets: z.ZodArray<z.ZodString>;
|
|
45
|
-
}, z.core.$strict>;
|
|
46
|
-
router: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
47
|
-
service: z.ZodString;
|
|
48
|
-
hostSuffix: z.ZodString;
|
|
49
|
-
minLabels: z.ZodNumber;
|
|
50
|
-
}, z.core.$strict>]>;
|
|
51
|
-
}, z.core.$strict>;
|
|
52
|
-
export type FrozenConfiguration = z.output<typeof frozenConfiguration>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
const name = z.string().min(1).max(128);
|
|
3
|
-
const positive = z.number().int().min(1);
|
|
4
|
-
/**
|
|
5
|
-
* The `FrozenConfigurationV1` (`@astrale-os/sdk/deployment/address`) one deployment freezes beside
|
|
6
|
-
* its build: the author's plain variables, the execution settings and the durable Workflow options
|
|
7
|
-
* it declares, the runtime, the services and dispatch namespaces it binds and the names of the
|
|
8
|
-
* secrets it binds, never their values. Its digest and the build digest make the deployment's
|
|
9
|
-
* address. This shape only bounds what a request and the graph carry; the SDK's
|
|
10
|
-
* `configurationDigest` admits its canonical form, and a hosted deployment's admission decides
|
|
11
|
-
* which bindings Services hosts (`acceptDeploymentRequest`).
|
|
12
|
-
*/
|
|
13
|
-
export const frozenConfiguration = z.strictObject({
|
|
14
|
-
format: z.literal('astrale.deployment.configuration'),
|
|
15
|
-
version: z.literal(1),
|
|
16
|
-
vars: z.record(name, z.string().max(64 * 1024)),
|
|
17
|
-
settings: z.strictObject({
|
|
18
|
-
maximumRequestBytes: z.number().int().min(1),
|
|
19
|
-
invocationTimeoutMs: z.number().int().min(1),
|
|
20
|
-
tokenExchange: z.union([
|
|
21
|
-
z.literal(false),
|
|
22
|
-
z.strictObject({ maximumLifetimeSeconds: z.number().int().min(1) }),
|
|
23
|
-
]),
|
|
24
|
-
durableOptions: z
|
|
25
|
-
.strictObject({
|
|
26
|
-
retentionMs: positive.optional(),
|
|
27
|
-
retry: z
|
|
28
|
-
.strictObject({
|
|
29
|
-
initialIntervalMs: positive.optional(),
|
|
30
|
-
maxAttempts: positive.optional(),
|
|
31
|
-
maxIntervalMs: positive.optional(),
|
|
32
|
-
})
|
|
33
|
-
.optional(),
|
|
34
|
-
stepTimeoutMs: positive.optional(),
|
|
35
|
-
})
|
|
36
|
-
.optional(),
|
|
37
|
-
}),
|
|
38
|
-
runtime: z.strictObject({
|
|
39
|
-
compatibilityDate: z.string().min(1).max(32),
|
|
40
|
-
compatibilityFlags: z.array(name).max(64),
|
|
41
|
-
}),
|
|
42
|
-
bindings: z.strictObject({
|
|
43
|
-
services: z.array(z.strictObject({ name, service: name })).max(32),
|
|
44
|
-
dispatchNamespaces: z.array(z.strictObject({ name, namespace: name })).max(32),
|
|
45
|
-
secrets: z.array(name).max(64),
|
|
46
|
-
}),
|
|
47
|
-
router: z.union([
|
|
48
|
-
z.literal(false),
|
|
49
|
-
z.strictObject({
|
|
50
|
-
service: name,
|
|
51
|
-
hostSuffix: z.string().max(253),
|
|
52
|
-
minLabels: z.number().int().min(0).max(127),
|
|
53
|
-
}),
|
|
54
|
-
]),
|
|
55
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const artifactModule: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
kind: z.ZodOptional<z.ZodEnum<{
|
|
5
|
-
data: "data";
|
|
6
|
-
esm: "esm";
|
|
7
|
-
text: "text";
|
|
8
|
-
wasm: "wasm";
|
|
9
|
-
}>>;
|
|
10
|
-
content: z.ZodUnion<readonly [z.ZodObject<{
|
|
11
|
-
encoding: z.ZodEnum<{
|
|
12
|
-
gzip: "gzip";
|
|
13
|
-
identity: "identity";
|
|
14
|
-
}>;
|
|
15
|
-
decodedSize: z.ZodNumber;
|
|
16
|
-
contentBase64: z.ZodString;
|
|
17
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
18
|
-
encoding: z.ZodEnum<{
|
|
19
|
-
gzip: "gzip";
|
|
20
|
-
identity: "identity";
|
|
21
|
-
}>;
|
|
22
|
-
decodedSize: z.ZodNumber;
|
|
23
|
-
contentBase64Chunks: z.ZodArray<z.ZodString>;
|
|
24
|
-
}, z.core.$strict>]>;
|
|
25
|
-
}, z.core.$strict>;
|
|
26
|
-
export type ArtifactModule = z.infer<typeof artifactModule>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { encodedContent, MAX_MODULE_BASE64_SIZE } from './service-deployment-content.js';
|
|
3
|
-
const fields = {
|
|
4
|
-
name: z.string().min(1).max(256),
|
|
5
|
-
kind: z.enum(['esm', 'wasm', 'text', 'data']).optional(),
|
|
6
|
-
};
|
|
7
|
-
export const artifactModule = z.strictObject({
|
|
8
|
-
...fields,
|
|
9
|
-
content: encodedContent(MAX_MODULE_BASE64_SIZE),
|
|
10
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const assetFile: z.ZodObject<{
|
|
3
|
-
path: z.ZodString;
|
|
4
|
-
contentType: z.ZodOptional<z.ZodString>;
|
|
5
|
-
content: z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
-
encoding: z.ZodEnum<{
|
|
7
|
-
gzip: "gzip";
|
|
8
|
-
identity: "identity";
|
|
9
|
-
}>;
|
|
10
|
-
decodedSize: z.ZodNumber;
|
|
11
|
-
contentBase64: z.ZodString;
|
|
12
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
-
encoding: z.ZodEnum<{
|
|
14
|
-
gzip: "gzip";
|
|
15
|
-
identity: "identity";
|
|
16
|
-
}>;
|
|
17
|
-
decodedSize: z.ZodNumber;
|
|
18
|
-
contentBase64Chunks: z.ZodArray<z.ZodString>;
|
|
19
|
-
}, z.core.$strict>]>;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
|
-
export declare const assetBundle: z.ZodObject<{
|
|
22
|
-
files: z.ZodArray<z.ZodObject<{
|
|
23
|
-
path: z.ZodString;
|
|
24
|
-
contentType: z.ZodOptional<z.ZodString>;
|
|
25
|
-
content: z.ZodUnion<readonly [z.ZodObject<{
|
|
26
|
-
encoding: z.ZodEnum<{
|
|
27
|
-
gzip: "gzip";
|
|
28
|
-
identity: "identity";
|
|
29
|
-
}>;
|
|
30
|
-
decodedSize: z.ZodNumber;
|
|
31
|
-
contentBase64: z.ZodString;
|
|
32
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
-
encoding: z.ZodEnum<{
|
|
34
|
-
gzip: "gzip";
|
|
35
|
-
identity: "identity";
|
|
36
|
-
}>;
|
|
37
|
-
decodedSize: z.ZodNumber;
|
|
38
|
-
contentBase64Chunks: z.ZodArray<z.ZodString>;
|
|
39
|
-
}, z.core.$strict>]>;
|
|
40
|
-
}, z.core.$strict>>;
|
|
41
|
-
notFound: z.ZodOptional<z.ZodEnum<{
|
|
42
|
-
"404-page": "404-page";
|
|
43
|
-
none: "none";
|
|
44
|
-
"single-page-application": "single-page-application";
|
|
45
|
-
}>>;
|
|
46
|
-
runWorkerFirst: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
-
htmlHandling: z.ZodOptional<z.ZodLiteral<"none">>;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
export type AssetBundle = z.infer<typeof assetBundle>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { encodedContent, MAX_ASSET_BASE64_SIZE } from './service-deployment-content.js';
|
|
3
|
-
const fields = {
|
|
4
|
-
path: z.string().min(1).max(2_048),
|
|
5
|
-
contentType: z.string().min(1).max(256).optional(),
|
|
6
|
-
};
|
|
7
|
-
export const assetFile = z.strictObject({
|
|
8
|
-
...fields,
|
|
9
|
-
content: encodedContent(MAX_ASSET_BASE64_SIZE),
|
|
10
|
-
});
|
|
11
|
-
export const assetBundle = z.strictObject({
|
|
12
|
-
files: z.array(assetFile).min(1).max(2_000),
|
|
13
|
-
notFound: z.enum(['none', '404-page', 'single-page-application']).optional(),
|
|
14
|
-
runWorkerFirst: z.boolean().optional(),
|
|
15
|
-
htmlHandling: z.literal('none').optional(),
|
|
16
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export { PORTABLE_BASE64_CHUNK_SIZE, MAX_MODULE_BASE64_SIZE, MAX_ASSET_BASE64_SIZE, MAX_MODULE_DECODED_SIZE, MAX_ASSET_DECODED_SIZE, MAX_DEPLOYMENT_DECODED_SIZE, } from './content/index.js';
|
|
3
|
-
/** Encoding is transport evidence; release identity always describes decoded bytes. */
|
|
4
|
-
export declare function encodedContent(maximumSize: number): z.ZodUnion<readonly [z.ZodObject<{
|
|
5
|
-
encoding: z.ZodEnum<{
|
|
6
|
-
gzip: "gzip";
|
|
7
|
-
identity: "identity";
|
|
8
|
-
}>;
|
|
9
|
-
decodedSize: z.ZodNumber;
|
|
10
|
-
contentBase64: z.ZodString;
|
|
11
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
12
|
-
encoding: z.ZodEnum<{
|
|
13
|
-
gzip: "gzip";
|
|
14
|
-
identity: "identity";
|
|
15
|
-
}>;
|
|
16
|
-
decodedSize: z.ZodNumber;
|
|
17
|
-
contentBase64Chunks: z.ZodArray<z.ZodString>;
|
|
18
|
-
}, z.core.$strict>]>;
|
|
19
|
-
export type ServiceDeploymentContent = z.infer<ReturnType<typeof encodedContent>>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PORTABLE_BASE64_CHUNK_SIZE } from './content/index.js';
|
|
3
|
-
export { PORTABLE_BASE64_CHUNK_SIZE, MAX_MODULE_BASE64_SIZE, MAX_ASSET_BASE64_SIZE, MAX_MODULE_DECODED_SIZE, MAX_ASSET_DECODED_SIZE, MAX_DEPLOYMENT_DECODED_SIZE, } from './content/index.js';
|
|
4
|
-
/** Encoding is transport evidence; release identity always describes decoded bytes. */
|
|
5
|
-
export function encodedContent(maximumSize) {
|
|
6
|
-
const fields = {
|
|
7
|
-
encoding: z.enum(['identity', 'gzip']),
|
|
8
|
-
decodedSize: z
|
|
9
|
-
.number()
|
|
10
|
-
.int()
|
|
11
|
-
.min(0)
|
|
12
|
-
.max((maximumSize / 4) * 3),
|
|
13
|
-
};
|
|
14
|
-
return z.union([
|
|
15
|
-
z.strictObject({ ...fields, contentBase64: z.string().max(maximumSize) }),
|
|
16
|
-
z.strictObject({
|
|
17
|
-
...fields,
|
|
18
|
-
contentBase64Chunks: z
|
|
19
|
-
.array(z.string().min(1).max(PORTABLE_BASE64_CHUNK_SIZE))
|
|
20
|
-
.min(1)
|
|
21
|
-
.max(Math.ceil(maximumSize / PORTABLE_BASE64_CHUNK_SIZE)),
|
|
22
|
-
}),
|
|
23
|
-
]);
|
|
24
|
-
}
|