@alienplatform/core 1.7.1 → 1.9.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.
Files changed (88) hide show
  1. package/.turbo/turbo-build.log +12 -11
  2. package/dist/index.d.ts +783 -100
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +199 -33
  5. package/dist/index.js.map +1 -1
  6. package/dist/stack.js +579 -44
  7. package/dist/stack.js.map +1 -1
  8. package/dist/tests/index.js +1 -1
  9. package/package.json +1 -1
  10. package/src/__tests__/__snapshots__/stack.test.ts.snap +10 -4
  11. package/src/__tests__/error.test.ts +1 -1
  12. package/src/__tests__/stack.test.ts +184 -2
  13. package/src/compute-cluster.ts +211 -0
  14. package/src/container.ts +38 -26
  15. package/src/daemon.ts +79 -0
  16. package/src/generated/index.ts +42 -2
  17. package/src/generated/schemas/architecture.json +1 -0
  18. package/src/generated/schemas/capacityGroup.json +1 -0
  19. package/src/generated/schemas/capacityGroupScalePolicy.json +1 -0
  20. package/src/generated/schemas/computeChoiceRange.json +1 -0
  21. package/src/generated/schemas/computeCluster.json +1 -0
  22. package/src/generated/schemas/computePoolSelection.json +1 -0
  23. package/src/generated/schemas/computeSettings.json +1 -0
  24. package/src/generated/schemas/container.json +1 -1
  25. package/src/generated/schemas/containerOutputs.json +1 -1
  26. package/src/generated/schemas/containerPort.json +1 -1
  27. package/src/generated/schemas/daemon.json +1 -1
  28. package/src/generated/schemas/daemonOutputs.json +1 -1
  29. package/src/generated/schemas/daemonRuntime.json +1 -0
  30. package/src/generated/schemas/daemonRuntimeMount.json +1 -0
  31. package/src/generated/schemas/exposeProtocol.json +1 -1
  32. package/src/generated/schemas/gpuSpec.json +1 -0
  33. package/src/generated/schemas/machineProfile.json +1 -0
  34. package/src/generated/schemas/publicEndpoint.json +1 -0
  35. package/src/generated/schemas/publicEndpointOutput.json +1 -0
  36. package/src/generated/schemas/stack.json +1 -1
  37. package/src/generated/schemas/stackImportRequest.json +1 -1
  38. package/src/generated/schemas/stackImportResponse.json +1 -1
  39. package/src/generated/schemas/stackInputDefaultValue.json +1 -0
  40. package/src/generated/schemas/stackInputDefinition.json +1 -0
  41. package/src/generated/schemas/stackInputEnvironmentMapping.json +1 -0
  42. package/src/generated/schemas/stackInputEnvironmentVariableType.json +1 -0
  43. package/src/generated/schemas/stackInputKind.json +1 -0
  44. package/src/generated/schemas/stackInputProvider.json +1 -0
  45. package/src/generated/schemas/stackInputValidation.json +1 -0
  46. package/src/generated/schemas/stackSettings.json +1 -1
  47. package/src/generated/schemas/worker.json +1 -1
  48. package/src/generated/schemas/workerOutputs.json +1 -1
  49. package/src/generated/schemas/workerPublicEndpoint.json +1 -0
  50. package/src/generated/zod/architecture-schema.ts +13 -0
  51. package/src/generated/zod/capacity-group-scale-policy-schema.ts +27 -0
  52. package/src/generated/zod/capacity-group-schema.ts +27 -0
  53. package/src/generated/zod/compute-choice-range-schema.ts +17 -0
  54. package/src/generated/zod/compute-cluster-schema.ts +20 -0
  55. package/src/generated/zod/compute-pool-selection-schema.ts +22 -0
  56. package/src/generated/zod/compute-settings-schema.ts +18 -0
  57. package/src/generated/zod/container-outputs-schema.ts +5 -6
  58. package/src/generated/zod/container-port-schema.ts +1 -5
  59. package/src/generated/zod/container-schema.ts +7 -3
  60. package/src/generated/zod/daemon-outputs-schema.ts +4 -0
  61. package/src/generated/zod/daemon-runtime-mount-schema.ts +14 -0
  62. package/src/generated/zod/daemon-runtime-schema.ts +19 -0
  63. package/src/generated/zod/daemon-schema.ts +14 -2
  64. package/src/generated/zod/expose-protocol-schema.ts +2 -2
  65. package/src/generated/zod/gpu-spec-schema.ts +16 -0
  66. package/src/generated/zod/index.ts +42 -2
  67. package/src/generated/zod/machine-profile-schema.ts +25 -0
  68. package/src/generated/zod/public-endpoint-output-schema.ts +21 -0
  69. package/src/generated/zod/public-endpoint-schema.ts +22 -0
  70. package/src/generated/zod/stack-import-request-schema.ts +3 -0
  71. package/src/generated/zod/stack-input-default-value-schema.ts +25 -0
  72. package/src/generated/zod/stack-input-definition-schema.ts +43 -0
  73. package/src/generated/zod/stack-input-environment-mapping-schema.ts +20 -0
  74. package/src/generated/zod/stack-input-environment-variable-type-schema.ts +13 -0
  75. package/src/generated/zod/stack-input-kind-schema.ts +13 -0
  76. package/src/generated/zod/stack-input-provider-schema.ts +13 -0
  77. package/src/generated/zod/stack-input-validation-schema.ts +23 -0
  78. package/src/generated/zod/stack-schema.ts +4 -0
  79. package/src/generated/zod/stack-settings-schema.ts +5 -1
  80. package/src/generated/zod/worker-outputs-schema.ts +4 -5
  81. package/src/generated/zod/worker-public-endpoint-schema.ts +17 -0
  82. package/src/generated/zod/worker-schema.ts +4 -4
  83. package/src/index.ts +9 -0
  84. package/src/input.ts +380 -0
  85. package/src/stack.ts +19 -0
  86. package/src/worker.ts +24 -14
  87. package/src/generated/schemas/ingress.json +0 -1
  88. 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
- * Controls network accessibility of the worker.
104
- * - `public`: Worker accessible from the internet.
105
- * - `private`: Worker accessible only via cloud API calls / triggers.
106
- * - `vpc`: Worker deployed within a VPC with specific network controls.
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 ingress(value: Ingress): this {
112
- this._config.ingress = value
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 have Public ingress.
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
- * .ingress("public")
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>