@lunora/container 1.0.0-alpha.11 → 1.0.0-alpha.13
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 +2 -0
- package/dist/bridge.d.mts +49 -33
- package/dist/bridge.d.ts +49 -33
- package/dist/do/index.d.mts +71 -70
- package/dist/do/index.d.ts +71 -70
- package/dist/index.d.mts +188 -147
- package/dist/index.d.ts +188 -147
- package/dist/otel.d.mts +63 -46
- package/dist/otel.d.ts +63 -46
- package/dist/otel.mjs +4 -0
- package/dist/packem_shared/jurisdiction.d-8oUUvrew.d.mts +281 -0
- package/dist/packem_shared/jurisdiction.d-8oUUvrew.d.ts +281 -0
- package/package.json +2 -2
- package/dist/packem_shared/jurisdiction.d-TwTGkgTg.d.mts +0 -266
- package/dist/packem_shared/jurisdiction.d-TwTGkgTg.d.ts +0 -266
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { D as DurableObjectJurisdiction, C as ContainerConfig, a as ContainerDefinition, b as ContainerImageSource, N as NormalizedContainerImage } from "./packem_shared/jurisdiction.d-
|
|
2
|
-
export type { B as BuildImageSource, c as ContainerInstanceType, d as ContainerReadinessCheck, e as ContainerRollout, f as CustomContainerInstanceType, g as NamedContainerInstanceType, R as RegistryImageSource } from "./packem_shared/jurisdiction.d-
|
|
3
|
-
/**
|
|
1
|
+
import { D as DurableObjectJurisdiction, C as ContainerConfig, a as ContainerDefinition, b as ContainerImageSource, N as NormalizedContainerImage } from "./packem_shared/jurisdiction.d-8oUUvrew.mjs";
|
|
2
|
+
export type { B as BuildImageSource, c as ContainerInstanceType, d as ContainerReadinessCheck, e as ContainerRollout, f as CustomContainerInstanceType, g as NamedContainerInstanceType, R as RegistryImageSource } from "./packem_shared/jurisdiction.d-8oUUvrew.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Options for explicitly starting an instance (mirrors `@cloudflare/containers`).
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
4
7
|
interface ContainerStartOptions {
|
|
5
8
|
/** Override outbound internet access for this start. */
|
|
6
9
|
enableInternet?: boolean;
|
|
@@ -11,7 +14,10 @@ interface ContainerStartOptions {
|
|
|
11
14
|
/** Metadata labels attached for metrics/observability. */
|
|
12
15
|
labels?: Record<string, string>;
|
|
13
16
|
}
|
|
14
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* A container instance's runtime state, as returned by `getState()`. Structural — the platform adds fields over time.
|
|
19
|
+
* @experimental
|
|
20
|
+
*/
|
|
15
21
|
interface ContainerInstanceState {
|
|
16
22
|
[key: string]: unknown;
|
|
17
23
|
/** Process exit code, present once the instance has `stopped_with_code`. */
|
|
@@ -36,63 +42,70 @@ interface ContainerStubLike {
|
|
|
36
42
|
start?: (options?: ContainerStartOptions) => Promise<void>;
|
|
37
43
|
stop?: (signal?: number | string) => Promise<void>;
|
|
38
44
|
}
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* What the client needs from a Durable Object namespace binding.
|
|
47
|
+
* @experimental
|
|
48
|
+
*/
|
|
40
49
|
interface ContainerNamespaceLike {
|
|
41
50
|
get: (id: unknown) => ContainerStubLike;
|
|
42
51
|
idFromName: (name: string) => unknown;
|
|
43
52
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
* Derive a jurisdiction-restricted subnamespace. Optional because older
|
|
54
|
+
* workers-types releases (and test doubles) may not expose it.
|
|
55
|
+
*/
|
|
47
56
|
jurisdiction?: (jurisdiction: DurableObjectJurisdiction) => ContainerNamespaceLike;
|
|
48
57
|
}
|
|
49
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* A handle on one container instance (one Durable Object).
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
50
62
|
interface ContainerHandle {
|
|
51
63
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
* Send an HTTP (or WebSocket-upgrade) request to the container. A path
|
|
65
|
+
* string (`"/transcode"`) is resolved against a synthetic origin; a full
|
|
66
|
+
* `Request`/URL passes through unchanged.
|
|
67
|
+
*/
|
|
56
68
|
fetch: (input: Request | string, init?: RequestInit) => Promise<Response>;
|
|
57
69
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
* Return a handle that routes every request to `targetPort` on the
|
|
71
|
+
* container instead of the definition's `defaultPort` — for multi-port
|
|
72
|
+
* containers (declare the ports in `requiredPorts`). Sets the
|
|
73
|
+
* `cf-container-target-port` header the way `@cloudflare/containers`'
|
|
74
|
+
* `switchPort` does, so it composes with `.get()`, `.any()`, and `.pool()`:
|
|
75
|
+
* `ctx.containers.app.get("u1").port(9090).fetch("/admin")`.
|
|
76
|
+
*/
|
|
65
77
|
port: (targetPort: number) => ContainerHandle;
|
|
66
78
|
}
|
|
67
79
|
/**
|
|
68
|
-
* A handle on a *named* instance (from `.get(name)`) — `fetch` plus explicit
|
|
69
|
-
* lifecycle control. The per-entity pattern (a sandbox per user, a room per
|
|
70
|
-
* game, a job runner per id) often needs to tear down or inspect the instance
|
|
71
|
-
* rather than wait for `sleepAfter`, so these wrap the container DO's
|
|
72
|
-
* `start`/`stop`/`destroy`/`getState`.
|
|
73
|
-
|
|
80
|
+
* A handle on a *named* instance (from `.get(name)`) — `fetch` plus explicit
|
|
81
|
+
* lifecycle control. The per-entity pattern (a sandbox per user, a room per
|
|
82
|
+
* game, a job runner per id) often needs to tear down or inspect the instance
|
|
83
|
+
* rather than wait for `sleepAfter`, so these wrap the container DO's
|
|
84
|
+
* `start`/`stop`/`destroy`/`getState`.
|
|
85
|
+
* @experimental
|
|
86
|
+
*/
|
|
74
87
|
interface ContainerInstanceHandle extends ContainerHandle {
|
|
75
88
|
/** Stop and discard the instance (its ephemeral disk is lost). */
|
|
76
89
|
destroy: () => Promise<void>;
|
|
77
90
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
* Adjust this instance's egress allow/deny lists at runtime — the dynamic
|
|
92
|
+
* counterpart to the static `allowedHosts`/`deniedHosts` config. Useful for
|
|
93
|
+
* per-tenant egress policy. Requires the worker to export `ContainerProxy`
|
|
94
|
+
* (codegen re-exports it from the generated container file whenever any
|
|
95
|
+
* container is defined, so the runtime controls always work).
|
|
96
|
+
*/
|
|
84
97
|
egress: ContainerEgressControls;
|
|
85
98
|
/** Read the instance's current runtime state. */
|
|
86
99
|
getState: () => Promise<ContainerInstanceState>;
|
|
87
100
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
* Reset the instance's `sleepAfter` idle timer. The platform renews it on
|
|
102
|
+
* each proxied request, and because `@lunora/container` proxies WebSocket
|
|
103
|
+
* frames through the Durable Object, message traffic on an open socket
|
|
104
|
+
* renews it too (the WebSocket-keepalive gap of cloudflare/containers#147 is
|
|
105
|
+
* closed in the bundled base). This manual control is the escape hatch for
|
|
106
|
+
* keeping a container awake during activity that is neither an HTTP request
|
|
107
|
+
* nor a WS message — e.g. a long out-of-band job running inside it.
|
|
108
|
+
*/
|
|
96
109
|
renewActivityTimeout: () => Promise<void>;
|
|
97
110
|
/** Explicitly start the instance, optionally with per-instance env/entrypoint. */
|
|
98
111
|
start: (options?: ContainerStartOptions) => Promise<void>;
|
|
@@ -100,11 +113,12 @@ interface ContainerInstanceHandle extends ContainerHandle {
|
|
|
100
113
|
stop: (signal?: number | string) => Promise<void>;
|
|
101
114
|
}
|
|
102
115
|
/**
|
|
103
|
-
* Runtime egress-firewall controls for a named instance (`handle.egress.*`).
|
|
104
|
-
* Each maps to the corresponding `@cloudflare/containers` `Container` RPC, so
|
|
105
|
-
* an app can tighten or relax a single instance's allowed/denied hosts after
|
|
106
|
-
* start without redeploying.
|
|
107
|
-
|
|
116
|
+
* Runtime egress-firewall controls for a named instance (`handle.egress.*`).
|
|
117
|
+
* Each maps to the corresponding `@cloudflare/containers` `Container` RPC, so
|
|
118
|
+
* an app can tighten or relax a single instance's allowed/denied hosts after
|
|
119
|
+
* start without redeploying.
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
108
122
|
interface ContainerEgressControls {
|
|
109
123
|
/** Add one hostname (or glob) to the allow-list. */
|
|
110
124
|
allow: (hostname: string) => Promise<void>;
|
|
@@ -119,86 +133,96 @@ interface ContainerEgressControls {
|
|
|
119
133
|
/** Replace the entire deny-list. */
|
|
120
134
|
setDenied: (hosts: ReadonlyArray<string>) => Promise<void>;
|
|
121
135
|
}
|
|
122
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* The per-definition accessor exposed as `ctx.containers.<exportName>`.
|
|
138
|
+
* @experimental
|
|
139
|
+
*/
|
|
123
140
|
interface ContainerAccessor {
|
|
124
141
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
* A random instance from a fixed pool of `count` (defaults to the
|
|
143
|
+
* definition's `maxInstances`, else 3 — mirroring `getRandom` from
|
|
144
|
+
* `@cloudflare/containers`). For stateless, interchangeable workloads.
|
|
145
|
+
*
|
|
146
|
+
* Like `.get()`, a path/URL-string fetch transparently retries the
|
|
147
|
+
* cold-start "instance is provisioning" transients (cloudflare/containers#45,
|
|
148
|
+
* #139); pass {@link InstanceRetryOptions} to tune or disable it.
|
|
149
|
+
*/
|
|
133
150
|
any: (count?: number, options?: InstanceRetryOptions) => ContainerHandle;
|
|
134
151
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
152
|
+
* The instance for `name` — one container per entity (user, room, job…),
|
|
153
|
+
* with lifecycle control.
|
|
154
|
+
*
|
|
155
|
+
* A path/URL-string fetch transparently retries the platform's cold-start
|
|
156
|
+
* transients — "there is no Container instance available" / "container is
|
|
157
|
+
* not listening" while an instance is still provisioning
|
|
158
|
+
* (cloudflare/containers#45, #139) — on the *same* instance with backoff,
|
|
159
|
+
* since the request never reached the app. Pass {@link InstanceRetryOptions}
|
|
160
|
+
* to tune attempts/backoff or disable it (`{ attempts: 1 }`). A pre-built
|
|
161
|
+
* `Request` (possibly a one-shot stream body) is sent once, never retried.
|
|
162
|
+
*/
|
|
146
163
|
get: (name: string, options?: InstanceRetryOptions) => ContainerInstanceHandle;
|
|
147
164
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
* A resilient handle over the pool: each `fetch` picks a random instance and,
|
|
166
|
+
* on a thrown error or a retryable response (5xx by default), retries on a
|
|
167
|
+
* freshly-picked instance with exponential backoff. Until Cloudflare ships
|
|
168
|
+
* native autoscaling + health-aware routing this is the recommended way to
|
|
169
|
+
* call a stateless container pool — it rides over a single cold/unhealthy
|
|
170
|
+
* instance instead of failing the whole request.
|
|
171
|
+
*
|
|
172
|
+
* Because a retry re-issues the request, pass a **replayable** body — a path
|
|
173
|
+
* string plus an `init.body` string/`ArrayBuffer` (re-created each attempt).
|
|
174
|
+
* A pre-built `Request` carrying a stream body can only be sent once, so it
|
|
175
|
+
* is not retry-safe here; use `.get()`/`.any()` for those.
|
|
176
|
+
*/
|
|
160
177
|
pool: (options?: PoolOptions) => ContainerHandle;
|
|
161
178
|
}
|
|
162
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* Tuning for a pooled, retrying container handle. See {@link ContainerAccessor.pool}.
|
|
181
|
+
* @experimental
|
|
182
|
+
*/
|
|
163
183
|
interface PoolOptions {
|
|
164
184
|
/** Total attempts before giving up (each on a freshly-picked instance). Default 3. */
|
|
165
185
|
attempts?: number;
|
|
166
186
|
/** Base backoff in ms between attempts; doubles each retry (0 disables the wait). Default 100. */
|
|
167
187
|
backoffMs?: number;
|
|
168
188
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
189
|
+
* Upper bound on a single backoff sleep, in ms. The doubling delay is clamped
|
|
190
|
+
* to this ceiling so a large `attempts` count can't produce an unboundedly
|
|
191
|
+
* long wait. Default {@link DEFAULT_MAX_BACKOFF_MS} (30s).
|
|
192
|
+
*/
|
|
173
193
|
maxBackoffMs?: number;
|
|
174
194
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
195
|
+
* Whether a *returned* response should be retried on another instance.
|
|
196
|
+
* Defaults to retrying any `5xx`. A thrown error (network/start failure) is
|
|
197
|
+
* always retried regardless of this predicate.
|
|
198
|
+
*/
|
|
179
199
|
retryOn?: (response: Response) => boolean;
|
|
180
200
|
/** Pool size to spread picks across. Defaults to the definition's `maxInstances`, else 3. */
|
|
181
201
|
size?: number;
|
|
182
202
|
}
|
|
183
203
|
/**
|
|
184
|
-
* Tuning for the cold-start retry on a `.get()`/`.any()` handle. The retry fires
|
|
185
|
-
* only on the platform's provisioning transients (no-instance / not-listening /
|
|
186
|
-
* rate-limited — see {@link isColdStartTransient}), which is why it's safe by
|
|
187
|
-
* default: those responses mean the request never reached the container.
|
|
188
|
-
|
|
204
|
+
* Tuning for the cold-start retry on a `.get()`/`.any()` handle. The retry fires
|
|
205
|
+
* only on the platform's provisioning transients (no-instance / not-listening /
|
|
206
|
+
* rate-limited — see {@link isColdStartTransient}), which is why it's safe by
|
|
207
|
+
* default: those responses mean the request never reached the container.
|
|
208
|
+
* @experimental
|
|
209
|
+
*/
|
|
189
210
|
interface InstanceRetryOptions {
|
|
190
211
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
212
|
+
* Total attempts on a cold-start transient before the last outcome is
|
|
213
|
+
* surfaced as-is. `1` disables the retry. Default
|
|
214
|
+
* {@link DEFAULT_COLD_START_ATTEMPTS}.
|
|
215
|
+
*/
|
|
195
216
|
attempts?: number;
|
|
196
217
|
/** Base backoff in ms between attempts; doubles each retry (0 disables the wait). Default {@link DEFAULT_COLD_START_BACKOFF_MS}. */
|
|
197
218
|
backoffMs?: number;
|
|
198
219
|
/** Upper bound on a single backoff sleep, in ms. Default {@link DEFAULT_MAX_BACKOFF_MS} (30s). */
|
|
199
220
|
maxBackoffMs?: number;
|
|
200
221
|
}
|
|
201
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* Wiring info for one definition, emitted by codegen into the generated DO.
|
|
224
|
+
* @experimental
|
|
225
|
+
*/
|
|
202
226
|
interface ContainerBindingSpec {
|
|
203
227
|
/** Durable Object binding name, e.g. `CONTAINER_TRANSCODER`. */
|
|
204
228
|
binding: string;
|
|
@@ -208,73 +232,90 @@ interface ContainerBindingSpec {
|
|
|
208
232
|
maxInstances?: number;
|
|
209
233
|
}
|
|
210
234
|
/**
|
|
211
|
-
* Build the `ctx.containers` record from the Worker `env`. Called by the
|
|
212
|
-
* generated ShardDO with the specs codegen derived from `lunora/containers.ts`.
|
|
213
|
-
* A missing binding doesn't throw here — only when the handle is actually used —
|
|
214
|
-
* so one unprovisioned container never breaks unrelated functions.
|
|
215
|
-
*
|
|
216
|
-
* `traceparent` (the inbound RPC's W3C trace context, forwarded by the runtime
|
|
217
|
-
* and read off the request by the DO) is stamped onto every outbound container
|
|
218
|
-
* `fetch`, so the container's own spans stitch under the Worker's trace.
|
|
219
|
-
|
|
235
|
+
* Build the `ctx.containers` record from the Worker `env`. Called by the
|
|
236
|
+
* generated ShardDO with the specs codegen derived from `lunora/containers.ts`.
|
|
237
|
+
* A missing binding doesn't throw here — only when the handle is actually used —
|
|
238
|
+
* so one unprovisioned container never breaks unrelated functions.
|
|
239
|
+
*
|
|
240
|
+
* `traceparent` (the inbound RPC's W3C trace context, forwarded by the runtime
|
|
241
|
+
* and read off the request by the DO) is stamped onto every outbound container
|
|
242
|
+
* `fetch`, so the container's own spans stitch under the Worker's trace.
|
|
243
|
+
* @experimental
|
|
244
|
+
*/
|
|
220
245
|
declare const createContainerContext: (env: Record<string, unknown>, specs: ReadonlyArray<ContainerBindingSpec>, jurisdiction?: DurableObjectJurisdiction, traceparent?: string) => Record<string, ContainerAccessor>;
|
|
221
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* A test handler: receives the request plus the targeted instance name.
|
|
248
|
+
* @experimental
|
|
249
|
+
*/
|
|
222
250
|
type ContainerTestHandler = (request: Request, instance: {
|
|
223
251
|
name: string;
|
|
224
252
|
}) => Promise<Response> | Response;
|
|
225
253
|
/**
|
|
226
|
-
* Docker-free test double for `ctx.containers`: each export name maps to a
|
|
227
|
-
* fetch handler that plays the container. Mirrors the real shape exactly, so
|
|
228
|
-
* action handlers under test can't tell the difference.
|
|
229
|
-
*
|
|
230
|
-
* ```ts
|
|
231
|
-
* const containers = createContainerTestContext({
|
|
232
|
-
* transcoder: (request) => new Response("ok"),
|
|
233
|
-
* });
|
|
234
|
-
* ```
|
|
235
|
-
|
|
254
|
+
* Docker-free test double for `ctx.containers`: each export name maps to a
|
|
255
|
+
* fetch handler that plays the container. Mirrors the real shape exactly, so
|
|
256
|
+
* action handlers under test can't tell the difference.
|
|
257
|
+
*
|
|
258
|
+
* ```ts
|
|
259
|
+
* const containers = createContainerTestContext({
|
|
260
|
+
* transcoder: (request) => new Response("ok"),
|
|
261
|
+
* });
|
|
262
|
+
* ```
|
|
263
|
+
* @experimental
|
|
264
|
+
*/
|
|
236
265
|
declare const createContainerTestContext: (handlers: Record<string, ContainerTestHandler>) => Record<string, ContainerAccessor>;
|
|
237
266
|
/**
|
|
238
|
-
* Normalize a `ContainerImageSource` into the shape wrangler wants: a
|
|
239
|
-
* Dockerfile path + build context for local builds, or a fully-qualified
|
|
240
|
-
* reference for pre-built images.
|
|
241
|
-
*
|
|
242
|
-
* A local-path string whose basename starts with `Dockerfile` (so
|
|
243
|
-
* `Dockerfile.dev` also counts) is used as-is with its directory as the build
|
|
244
|
-
* context; any other path is treated as the build-context directory and the
|
|
245
|
-
* Dockerfile is expected at `<dir>/Dockerfile`.
|
|
246
|
-
|
|
267
|
+
* Normalize a `ContainerImageSource` into the shape wrangler wants: a
|
|
268
|
+
* Dockerfile path + build context for local builds, or a fully-qualified
|
|
269
|
+
* reference for pre-built images.
|
|
270
|
+
*
|
|
271
|
+
* A local-path string whose basename starts with `Dockerfile` (so
|
|
272
|
+
* `Dockerfile.dev` also counts) is used as-is with its directory as the build
|
|
273
|
+
* context; any other path is treated as the build-context directory and the
|
|
274
|
+
* Dockerfile is expected at `<dir>/Dockerfile`.
|
|
275
|
+
* @experimental
|
|
276
|
+
*/
|
|
247
277
|
declare const normalizeContainerImage: (image: ContainerImageSource) => NormalizedContainerImage;
|
|
248
278
|
/**
|
|
249
|
-
* The generated Container DO class name for a `lunora/containers.ts` export:
|
|
250
|
-
* `transcoder` → `TranscoderContainer`. wrangler's `containers[].class_name`
|
|
251
|
-
* and the Durable Object binding's `class_name` both reference it, so codegen
|
|
252
|
-
* and the config layer MUST derive it identically — always via this helper.
|
|
253
|
-
|
|
279
|
+
* The generated Container DO class name for a `lunora/containers.ts` export:
|
|
280
|
+
* `transcoder` → `TranscoderContainer`. wrangler's `containers[].class_name`
|
|
281
|
+
* and the Durable Object binding's `class_name` both reference it, so codegen
|
|
282
|
+
* and the config layer MUST derive it identically — always via this helper.
|
|
283
|
+
* @experimental
|
|
284
|
+
*/
|
|
254
285
|
declare const containerClassName: (exportName: string) => string;
|
|
255
286
|
/**
|
|
256
|
-
* The Durable Object binding name for a container export: `transcoder` →
|
|
257
|
-
* `CONTAINER_TRANSCODER`, `imageResizer` → `CONTAINER_IMAGE_RESIZER`. The
|
|
258
|
-
* `CONTAINER_` prefix namespaces these away from `SHARD`/`SESSION`/`SCHEDULER`
|
|
259
|
-
* so a container export can never collide with the built-in bindings.
|
|
260
|
-
|
|
287
|
+
* The Durable Object binding name for a container export: `transcoder` →
|
|
288
|
+
* `CONTAINER_TRANSCODER`, `imageResizer` → `CONTAINER_IMAGE_RESIZER`. The
|
|
289
|
+
* `CONTAINER_` prefix namespaces these away from `SHARD`/`SESSION`/`SCHEDULER`
|
|
290
|
+
* so a container export can never collide with the built-in bindings.
|
|
291
|
+
* @experimental
|
|
292
|
+
*/
|
|
261
293
|
declare const containerBindingName: (exportName: string) => string;
|
|
262
294
|
/**
|
|
263
|
-
* The local image tag a Railpack `{ build }` container is built and pushed
|
|
264
|
-
* under: `transcoder` → `lunora-transcoder:build`. The config reconciler writes
|
|
265
|
-
* it as the wrangler `containers[].image`, and `lunora deploy` builds that tag
|
|
266
|
-
* with Railpack and `wrangler containers push`es it before deploying — so all
|
|
267
|
-
* three derive the tag from this one helper and can never disagree.
|
|
268
|
-
|
|
295
|
+
* The local image tag a Railpack `{ build }` container is built and pushed
|
|
296
|
+
* under: `transcoder` → `lunora-transcoder:build`. The config reconciler writes
|
|
297
|
+
* it as the wrangler `containers[].image`, and `lunora deploy` builds that tag
|
|
298
|
+
* with Railpack and `wrangler containers push`es it before deploying — so all
|
|
299
|
+
* three derive the tag from this one helper and can never disagree.
|
|
300
|
+
* @experimental
|
|
301
|
+
*/
|
|
269
302
|
declare const containerBuildTag: (exportName: string) => string;
|
|
303
|
+
/**
|
|
304
|
+
* `defineContainer` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
305
|
+
* @experimental
|
|
306
|
+
*/
|
|
270
307
|
declare const defineContainer: (config: ContainerConfig) => ContainerDefinition;
|
|
271
|
-
/**
|
|
308
|
+
/**
|
|
309
|
+
* True when a value is a `defineContainer` result (the runtime brand check).
|
|
310
|
+
* @experimental
|
|
311
|
+
*/
|
|
272
312
|
declare const isContainerDefinition: (value: unknown) => value is ContainerDefinition;
|
|
273
313
|
/**
|
|
274
|
-
* The container's full environment at instance start: the static `env` block
|
|
275
|
-
* plus every declared secret resolved from the Worker `env`. A declared secret
|
|
276
|
-
* missing from the Worker env fails fast — starting the container without a
|
|
277
|
-
* credential it was promised yields far worse errors downstream.
|
|
278
|
-
|
|
314
|
+
* The container's full environment at instance start: the static `env` block
|
|
315
|
+
* plus every declared secret resolved from the Worker `env`. A declared secret
|
|
316
|
+
* missing from the Worker env fails fast — starting the container without a
|
|
317
|
+
* credential it was promised yields far worse errors downstream.
|
|
318
|
+
* @experimental
|
|
319
|
+
*/
|
|
279
320
|
declare const resolveContainerEnvVariables: (definition: ContainerDefinition, workerEnv: Record<string, unknown>, exportName?: string) => Record<string, string>;
|
|
280
321
|
export { type ContainerAccessor, type ContainerBindingSpec, type ContainerConfig, type ContainerDefinition, type ContainerEgressControls, type ContainerHandle, type ContainerImageSource, type ContainerInstanceHandle, type ContainerInstanceState, type ContainerNamespaceLike, type ContainerStartOptions, type ContainerTestHandler, type DurableObjectJurisdiction, type InstanceRetryOptions, type NormalizedContainerImage, type PoolOptions, containerBindingName, containerBuildTag, containerClassName, createContainerContext, createContainerTestContext, defineContainer, isContainerDefinition, normalizeContainerImage, resolveContainerEnvVariables as resolveContainerEnvVars };
|