@alienplatform/core 1.8.0 → 1.10.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/.turbo/turbo-build.log +10 -10
- package/dist/index.d.ts +772 -89
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +199 -33
- package/dist/index.js.map +1 -1
- package/dist/stack.js +579 -44
- package/dist/stack.js.map +1 -1
- package/dist/tests/index.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/stack.test.ts.snap +10 -4
- package/src/__tests__/stack.test.ts +185 -2
- package/src/compute-cluster.ts +213 -0
- package/src/container.ts +38 -26
- package/src/daemon.ts +79 -0
- package/src/generated/index.ts +42 -2
- package/src/generated/schemas/architecture.json +1 -0
- package/src/generated/schemas/capacityGroup.json +1 -0
- package/src/generated/schemas/capacityGroupScalePolicy.json +1 -0
- package/src/generated/schemas/computeChoiceRange.json +1 -0
- package/src/generated/schemas/computeCluster.json +1 -0
- package/src/generated/schemas/computePoolSelection.json +1 -0
- package/src/generated/schemas/computeSettings.json +1 -0
- package/src/generated/schemas/container.json +1 -1
- package/src/generated/schemas/containerOutputs.json +1 -1
- package/src/generated/schemas/containerPort.json +1 -1
- package/src/generated/schemas/daemon.json +1 -1
- package/src/generated/schemas/daemonOutputs.json +1 -1
- package/src/generated/schemas/daemonRuntime.json +1 -0
- package/src/generated/schemas/daemonRuntimeMount.json +1 -0
- package/src/generated/schemas/exposeProtocol.json +1 -1
- package/src/generated/schemas/gpuSpec.json +1 -0
- package/src/generated/schemas/machineProfile.json +1 -0
- package/src/generated/schemas/publicEndpoint.json +1 -0
- package/src/generated/schemas/publicEndpointOutput.json +1 -0
- package/src/generated/schemas/stack.json +1 -1
- package/src/generated/schemas/stackImportRequest.json +1 -1
- package/src/generated/schemas/stackImportResponse.json +1 -1
- package/src/generated/schemas/stackInputDefaultValue.json +1 -0
- package/src/generated/schemas/stackInputDefinition.json +1 -0
- package/src/generated/schemas/stackInputEnvironmentMapping.json +1 -0
- package/src/generated/schemas/stackInputEnvironmentVariableType.json +1 -0
- package/src/generated/schemas/stackInputKind.json +1 -0
- package/src/generated/schemas/stackInputProvider.json +1 -0
- package/src/generated/schemas/stackInputValidation.json +1 -0
- package/src/generated/schemas/stackSettings.json +1 -1
- package/src/generated/schemas/worker.json +1 -1
- package/src/generated/schemas/workerOutputs.json +1 -1
- package/src/generated/schemas/workerPublicEndpoint.json +1 -0
- package/src/generated/zod/architecture-schema.ts +13 -0
- package/src/generated/zod/capacity-group-scale-policy-schema.ts +27 -0
- package/src/generated/zod/capacity-group-schema.ts +27 -0
- package/src/generated/zod/compute-choice-range-schema.ts +17 -0
- package/src/generated/zod/compute-cluster-schema.ts +20 -0
- package/src/generated/zod/compute-pool-selection-schema.ts +22 -0
- package/src/generated/zod/compute-settings-schema.ts +18 -0
- package/src/generated/zod/container-outputs-schema.ts +5 -6
- package/src/generated/zod/container-port-schema.ts +1 -5
- package/src/generated/zod/container-schema.ts +7 -3
- package/src/generated/zod/daemon-outputs-schema.ts +4 -0
- package/src/generated/zod/daemon-runtime-mount-schema.ts +14 -0
- package/src/generated/zod/daemon-runtime-schema.ts +19 -0
- package/src/generated/zod/daemon-schema.ts +14 -2
- package/src/generated/zod/expose-protocol-schema.ts +2 -2
- package/src/generated/zod/gpu-spec-schema.ts +16 -0
- package/src/generated/zod/index.ts +42 -2
- package/src/generated/zod/machine-profile-schema.ts +25 -0
- package/src/generated/zod/public-endpoint-output-schema.ts +21 -0
- package/src/generated/zod/public-endpoint-schema.ts +22 -0
- package/src/generated/zod/stack-import-request-schema.ts +3 -0
- package/src/generated/zod/stack-input-default-value-schema.ts +25 -0
- package/src/generated/zod/stack-input-definition-schema.ts +43 -0
- package/src/generated/zod/stack-input-environment-mapping-schema.ts +20 -0
- package/src/generated/zod/stack-input-environment-variable-type-schema.ts +13 -0
- package/src/generated/zod/stack-input-kind-schema.ts +13 -0
- package/src/generated/zod/stack-input-provider-schema.ts +13 -0
- package/src/generated/zod/stack-input-validation-schema.ts +23 -0
- package/src/generated/zod/stack-schema.ts +4 -0
- package/src/generated/zod/stack-settings-schema.ts +5 -1
- package/src/generated/zod/worker-outputs-schema.ts +4 -5
- package/src/generated/zod/worker-public-endpoint-schema.ts +17 -0
- package/src/generated/zod/worker-schema.ts +4 -4
- package/src/index.ts +9 -0
- package/src/input.ts +380 -0
- package/src/stack.ts +19 -0
- package/src/worker.ts +24 -14
- package/src/generated/schemas/ingress.json +0 -1
- package/src/generated/zod/ingress-schema.ts +0 -13
package/src/stack.ts
CHANGED
|
@@ -4,8 +4,10 @@ import {
|
|
|
4
4
|
type ResourceEntry,
|
|
5
5
|
type ResourceLifecycle,
|
|
6
6
|
type Stack as StackConfig,
|
|
7
|
+
type StackInputDefinition,
|
|
7
8
|
StackSchema,
|
|
8
9
|
} from "./generated/index.js"
|
|
10
|
+
import { type StackInputCollection, getStackInputDefinitions } from "./input.js"
|
|
9
11
|
import type { Resource } from "./resource.js"
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -29,6 +31,13 @@ export type {
|
|
|
29
31
|
PermissionSet,
|
|
30
32
|
ManagementPermissions,
|
|
31
33
|
PermissionsConfig,
|
|
34
|
+
StackInputDefaultValue,
|
|
35
|
+
StackInputDefinition,
|
|
36
|
+
StackInputEnvironmentMapping,
|
|
37
|
+
StackInputEnvironmentVariableType,
|
|
38
|
+
StackInputKind,
|
|
39
|
+
StackInputProvider,
|
|
40
|
+
StackInputValidation,
|
|
32
41
|
} from "./generated/index.js"
|
|
33
42
|
export {
|
|
34
43
|
StackSchema,
|
|
@@ -95,6 +104,16 @@ export class Stack {
|
|
|
95
104
|
return this
|
|
96
105
|
}
|
|
97
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Configure values that must be provided before setup or deployment can proceed.
|
|
109
|
+
* @param inputs Stack input definitions created with alien.inputs({...}).
|
|
110
|
+
* @returns The Stack builder instance.
|
|
111
|
+
*/
|
|
112
|
+
public inputs(inputs: StackInputCollection | readonly StackInputDefinition[]): this {
|
|
113
|
+
this._config.inputs = getStackInputDefinitions(inputs)
|
|
114
|
+
return this
|
|
115
|
+
}
|
|
116
|
+
|
|
98
117
|
/**
|
|
99
118
|
* Gets the stack ID without building/validating the stack.
|
|
100
119
|
* @returns The stack ID.
|
package/src/worker.ts
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type Ingress,
|
|
3
2
|
type ReadinessProbe,
|
|
4
3
|
type ResourceType,
|
|
5
4
|
type WorkerCode,
|
|
6
5
|
type Worker as WorkerConfig,
|
|
6
|
+
type WorkerPublicEndpoint,
|
|
7
7
|
WorkerSchema,
|
|
8
8
|
type WorkerTrigger,
|
|
9
9
|
} from "./generated/index.js"
|
|
10
10
|
import { Resource } from "./resource.js"
|
|
11
11
|
|
|
12
12
|
export type {
|
|
13
|
-
Ingress,
|
|
14
13
|
Worker as WorkerConfig,
|
|
15
14
|
WorkerOutputs,
|
|
15
|
+
WorkerPublicEndpoint,
|
|
16
16
|
WorkerTrigger,
|
|
17
17
|
ReadinessProbe,
|
|
18
18
|
HttpMethod,
|
|
19
19
|
} from "./generated/index.js"
|
|
20
20
|
export {
|
|
21
|
-
IngressSchema,
|
|
22
21
|
WorkerSchema as WorkerConfigSchema,
|
|
23
22
|
WorkerOutputsSchema,
|
|
23
|
+
WorkerPublicEndpointSchema,
|
|
24
24
|
WorkerTriggerSchema,
|
|
25
25
|
ReadinessProbeSchema,
|
|
26
26
|
HttpMethodSchema,
|
|
27
27
|
} from "./generated/index.js"
|
|
28
28
|
|
|
29
|
+
export interface WorkerPublicEndpointOptions {
|
|
30
|
+
hostLabel?: string
|
|
31
|
+
wildcardSubdomains?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
/**
|
|
30
35
|
* Represents a serverless worker that executes code in response to triggers or direct invocations.
|
|
31
36
|
* Workers are the primary compute resource in serverless applications, designed to be stateless and ephemeral.
|
|
@@ -34,6 +39,7 @@ export class Worker {
|
|
|
34
39
|
private _config: Partial<WorkerConfig> = {
|
|
35
40
|
links: [],
|
|
36
41
|
triggers: [],
|
|
42
|
+
publicEndpoints: [],
|
|
37
43
|
environment: {},
|
|
38
44
|
}
|
|
39
45
|
|
|
@@ -100,16 +106,20 @@ export class Worker {
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* Default: `private`.
|
|
108
|
-
* @param value The ingress type.
|
|
109
|
-
* @returns The Worker builder instance.
|
|
109
|
+
* Exposes a named public HTTP endpoint for the worker.
|
|
110
|
+
*
|
|
111
|
+
* If no public endpoint is declared, the worker is private and only reachable
|
|
112
|
+
* through triggers, commands, or provider invocation APIs.
|
|
110
113
|
*/
|
|
111
|
-
public
|
|
112
|
-
this._config.
|
|
114
|
+
public publicEndpoint(name: string, options: WorkerPublicEndpointOptions = {}): this {
|
|
115
|
+
if (!this._config.publicEndpoints) {
|
|
116
|
+
this._config.publicEndpoints = []
|
|
117
|
+
}
|
|
118
|
+
this._config.publicEndpoints.push({
|
|
119
|
+
name,
|
|
120
|
+
hostLabel: options.hostLabel,
|
|
121
|
+
wildcardSubdomains: options.wildcardSubdomains ?? false,
|
|
122
|
+
} satisfies WorkerPublicEndpoint)
|
|
113
123
|
return this
|
|
114
124
|
}
|
|
115
125
|
|
|
@@ -153,7 +163,7 @@ export class Worker {
|
|
|
153
163
|
/**
|
|
154
164
|
* Configures a readiness probe for the worker.
|
|
155
165
|
* The probe will be executed after provisioning/update to verify the worker is ready.
|
|
156
|
-
* Only works with workers that
|
|
166
|
+
* Only works with workers that declare a public endpoint.
|
|
157
167
|
*
|
|
158
168
|
* @example
|
|
159
169
|
* ```typescript
|
|
@@ -164,7 +174,7 @@ export class Worker {
|
|
|
164
174
|
*
|
|
165
175
|
* const func = new Worker("my-api")
|
|
166
176
|
* .code({ type: "image", image: "my-api:latest" })
|
|
167
|
-
* .
|
|
177
|
+
* .publicEndpoint("api")
|
|
168
178
|
* .readinessProbe(probe)
|
|
169
179
|
* .build();
|
|
170
180
|
* ```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"string","description":"Controls network accessibility of the worker.","enum":["public","private"],"x-readme-ref-name":"Ingress"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import * as z from "zod";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @description Controls network accessibility of the worker.
|
|
10
|
-
*/
|
|
11
|
-
export const IngressSchema = z.enum(["public", "private"]).describe("Controls network accessibility of the worker.")
|
|
12
|
-
|
|
13
|
-
export type Ingress = z.infer<typeof IngressSchema>
|