@lunora/container 1.0.0-alpha.12 → 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/dist/bridge.d.mts +45 -45
- package/dist/bridge.d.ts +45 -45
- package/dist/do/index.d.mts +71 -71
- package/dist/do/index.d.ts +71 -71
- package/dist/index.d.mts +178 -178
- package/dist/index.d.ts +178 -178
- package/dist/otel.d.mts +58 -58
- package/dist/otel.d.ts +58 -58
- 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-CdUpqfc-.d.mts +0 -290
- package/dist/packem_shared/jurisdiction.d-CdUpqfc-.d.ts +0 -290
package/dist/bridge.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
2
|
/**
|
|
3
|
-
* A `fetch` implementation — defaults to the runtime global.
|
|
4
|
-
* @experimental
|
|
5
|
-
*/
|
|
3
|
+
* A `fetch` implementation — defaults to the runtime global.
|
|
4
|
+
* @experimental
|
|
5
|
+
*/
|
|
6
6
|
type FetchLike = (input: string, init: {
|
|
7
7
|
body: string;
|
|
8
8
|
headers: Record<string, string>;
|
|
@@ -14,40 +14,40 @@ type FetchLike = (input: string, init: {
|
|
|
14
14
|
statusText?: string;
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
|
-
* `ContainerBridgeOptions` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
18
|
-
* @experimental
|
|
19
|
-
*/
|
|
17
|
+
* `ContainerBridgeOptions` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
20
|
interface ContainerBridgeOptions {
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
* Base URL of the deployed Lunora Worker (no trailing `/_lunora/rpc`), e.g.
|
|
23
|
+
* `https://my-app.workers.dev`. In a Lunora container, surface it as an
|
|
24
|
+
* `env` value on the definition.
|
|
25
|
+
*/
|
|
26
26
|
baseUrl: string;
|
|
27
27
|
/** Injectable `fetch` (tests / non-global runtimes). Defaults to `globalThis.fetch`. */
|
|
28
28
|
fetch?: FetchLike;
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
* Bearer token sent as `Authorization: Bearer <token>`. Your Worker's
|
|
31
|
+
* `resolveIdentity` maps it to the identity the called functions run as.
|
|
32
|
+
* Pass it to the container as a `secret`, never bake it into the image.
|
|
33
|
+
*/
|
|
34
34
|
token?: string;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Thrown when a Lunora function returns an error envelope. A `LunoraError` subclass carrying the wire `code`.
|
|
38
|
-
* @experimental
|
|
39
|
-
*/
|
|
37
|
+
* Thrown when a Lunora function returns an error envelope. A `LunoraError` subclass carrying the wire `code`.
|
|
38
|
+
* @experimental
|
|
39
|
+
*/
|
|
40
40
|
declare class ContainerBridgeError extends LunoraError {
|
|
41
41
|
constructor(code: string, message: string);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Structural mirror of `@lunora/client`'s `FunctionReference` — the typed
|
|
45
|
-
* handle the generated `_generated/api` object carries. Declared locally (not
|
|
46
|
-
* imported) so the bridge stays dependency-free and its `.d.ts` is
|
|
47
|
-
* self-contained; the `__lunoraPhantom` shape matches, so a real `api.x.y`
|
|
48
|
-
* reference is assignable and its arg/return types are inferable.
|
|
49
|
-
* @experimental
|
|
50
|
-
*/
|
|
44
|
+
* Structural mirror of `@lunora/client`'s `FunctionReference` — the typed
|
|
45
|
+
* handle the generated `_generated/api` object carries. Declared locally (not
|
|
46
|
+
* imported) so the bridge stays dependency-free and its `.d.ts` is
|
|
47
|
+
* self-contained; the `__lunoraPhantom` shape matches, so a real `api.x.y`
|
|
48
|
+
* reference is assignable and its arg/return types are inferable.
|
|
49
|
+
* @experimental
|
|
50
|
+
*/
|
|
51
51
|
interface BridgeFunctionReference<Args = unknown, Result = unknown> {
|
|
52
52
|
readonly __lunoraPhantom?: {
|
|
53
53
|
args: Args;
|
|
@@ -68,9 +68,9 @@ type ResultOfReference<Reference> = Reference extends {
|
|
|
68
68
|
};
|
|
69
69
|
} ? Result : never;
|
|
70
70
|
/**
|
|
71
|
-
* `ContainerBridge` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
72
|
-
* @experimental
|
|
73
|
-
*/
|
|
71
|
+
* `ContainerBridge` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
72
|
+
* @experimental
|
|
73
|
+
*/
|
|
74
74
|
interface ContainerBridge {
|
|
75
75
|
/** Call an `action` by `namespace:fn` path. Alias of {@link ContainerBridge.call} for intent. */
|
|
76
76
|
action: <Result = unknown>(functionPath: string, args?: Record<string, unknown>, shardKey?: string) => Promise<Result>;
|
|
@@ -81,26 +81,26 @@ interface ContainerBridge {
|
|
|
81
81
|
/** Call a `query` by `namespace:fn` path. Alias of {@link ContainerBridge.call} for intent. */
|
|
82
82
|
query: <Result = unknown>(functionPath: string, args?: Record<string, unknown>, shardKey?: string) => Promise<Result>;
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
* Fully-typed call via a generated function reference. Pass a reference from
|
|
85
|
+
* the project's `_generated/api` (e.g. `api.messages.list`) and the args +
|
|
86
|
+
* result are inferred from it — the typed counterpart to {@link ContainerBridge.call}
|
|
87
|
+
* for JS/TS containers that can import the generated `api`.
|
|
88
|
+
*/
|
|
89
89
|
run: <Reference extends BridgeFunctionReference>(reference: Reference, args: ArgsOfReference<Reference>, shardKey?: string) => Promise<ResultOfReference<Reference>>;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Build a container→Lunora bridge bound to a Worker URL + token.
|
|
93
|
-
*
|
|
94
|
-
* ```ts
|
|
95
|
-
* const lunora = createContainerBridge({ baseUrl: process.env.LUNORA_URL!, token: process.env.LUNORA_TOKEN });
|
|
96
|
-
* const messages = await lunora.query("messages:list", { limit: 20 });
|
|
97
|
-
* await lunora.mutation("messages:markProcessed", { id });
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* `query`/`mutation`/`action` are intent-revealing aliases of one `call` — the
|
|
101
|
-
* wire is identical and the server dispatches by the function's registered
|
|
102
|
-
* kind, so a query path called via `.mutation(...)` still runs as a query.
|
|
103
|
-
* @experimental
|
|
104
|
-
*/
|
|
92
|
+
* Build a container→Lunora bridge bound to a Worker URL + token.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* const lunora = createContainerBridge({ baseUrl: process.env.LUNORA_URL!, token: process.env.LUNORA_TOKEN });
|
|
96
|
+
* const messages = await lunora.query("messages:list", { limit: 20 });
|
|
97
|
+
* await lunora.mutation("messages:markProcessed", { id });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* `query`/`mutation`/`action` are intent-revealing aliases of one `call` — the
|
|
101
|
+
* wire is identical and the server dispatches by the function's registered
|
|
102
|
+
* kind, so a query path called via `.mutation(...)` still runs as a query.
|
|
103
|
+
* @experimental
|
|
104
|
+
*/
|
|
105
105
|
declare const createContainerBridge: (options: ContainerBridgeOptions) => ContainerBridge;
|
|
106
106
|
export { type BridgeFunctionReference, type ContainerBridge, ContainerBridgeError, type ContainerBridgeOptions, type FetchLike, createContainerBridge };
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
2
|
/**
|
|
3
|
-
* A `fetch` implementation — defaults to the runtime global.
|
|
4
|
-
* @experimental
|
|
5
|
-
*/
|
|
3
|
+
* A `fetch` implementation — defaults to the runtime global.
|
|
4
|
+
* @experimental
|
|
5
|
+
*/
|
|
6
6
|
type FetchLike = (input: string, init: {
|
|
7
7
|
body: string;
|
|
8
8
|
headers: Record<string, string>;
|
|
@@ -14,40 +14,40 @@ type FetchLike = (input: string, init: {
|
|
|
14
14
|
statusText?: string;
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
|
-
* `ContainerBridgeOptions` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
18
|
-
* @experimental
|
|
19
|
-
*/
|
|
17
|
+
* `ContainerBridgeOptions` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
20
|
interface ContainerBridgeOptions {
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
* Base URL of the deployed Lunora Worker (no trailing `/_lunora/rpc`), e.g.
|
|
23
|
+
* `https://my-app.workers.dev`. In a Lunora container, surface it as an
|
|
24
|
+
* `env` value on the definition.
|
|
25
|
+
*/
|
|
26
26
|
baseUrl: string;
|
|
27
27
|
/** Injectable `fetch` (tests / non-global runtimes). Defaults to `globalThis.fetch`. */
|
|
28
28
|
fetch?: FetchLike;
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
* Bearer token sent as `Authorization: Bearer <token>`. Your Worker's
|
|
31
|
+
* `resolveIdentity` maps it to the identity the called functions run as.
|
|
32
|
+
* Pass it to the container as a `secret`, never bake it into the image.
|
|
33
|
+
*/
|
|
34
34
|
token?: string;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Thrown when a Lunora function returns an error envelope. A `LunoraError` subclass carrying the wire `code`.
|
|
38
|
-
* @experimental
|
|
39
|
-
*/
|
|
37
|
+
* Thrown when a Lunora function returns an error envelope. A `LunoraError` subclass carrying the wire `code`.
|
|
38
|
+
* @experimental
|
|
39
|
+
*/
|
|
40
40
|
declare class ContainerBridgeError extends LunoraError {
|
|
41
41
|
constructor(code: string, message: string);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Structural mirror of `@lunora/client`'s `FunctionReference` — the typed
|
|
45
|
-
* handle the generated `_generated/api` object carries. Declared locally (not
|
|
46
|
-
* imported) so the bridge stays dependency-free and its `.d.ts` is
|
|
47
|
-
* self-contained; the `__lunoraPhantom` shape matches, so a real `api.x.y`
|
|
48
|
-
* reference is assignable and its arg/return types are inferable.
|
|
49
|
-
* @experimental
|
|
50
|
-
*/
|
|
44
|
+
* Structural mirror of `@lunora/client`'s `FunctionReference` — the typed
|
|
45
|
+
* handle the generated `_generated/api` object carries. Declared locally (not
|
|
46
|
+
* imported) so the bridge stays dependency-free and its `.d.ts` is
|
|
47
|
+
* self-contained; the `__lunoraPhantom` shape matches, so a real `api.x.y`
|
|
48
|
+
* reference is assignable and its arg/return types are inferable.
|
|
49
|
+
* @experimental
|
|
50
|
+
*/
|
|
51
51
|
interface BridgeFunctionReference<Args = unknown, Result = unknown> {
|
|
52
52
|
readonly __lunoraPhantom?: {
|
|
53
53
|
args: Args;
|
|
@@ -68,9 +68,9 @@ type ResultOfReference<Reference> = Reference extends {
|
|
|
68
68
|
};
|
|
69
69
|
} ? Result : never;
|
|
70
70
|
/**
|
|
71
|
-
* `ContainerBridge` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
72
|
-
* @experimental
|
|
73
|
-
*/
|
|
71
|
+
* `ContainerBridge` is part of the experimental `@lunora/container` API and may change without a major version bump.
|
|
72
|
+
* @experimental
|
|
73
|
+
*/
|
|
74
74
|
interface ContainerBridge {
|
|
75
75
|
/** Call an `action` by `namespace:fn` path. Alias of {@link ContainerBridge.call} for intent. */
|
|
76
76
|
action: <Result = unknown>(functionPath: string, args?: Record<string, unknown>, shardKey?: string) => Promise<Result>;
|
|
@@ -81,26 +81,26 @@ interface ContainerBridge {
|
|
|
81
81
|
/** Call a `query` by `namespace:fn` path. Alias of {@link ContainerBridge.call} for intent. */
|
|
82
82
|
query: <Result = unknown>(functionPath: string, args?: Record<string, unknown>, shardKey?: string) => Promise<Result>;
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
* Fully-typed call via a generated function reference. Pass a reference from
|
|
85
|
+
* the project's `_generated/api` (e.g. `api.messages.list`) and the args +
|
|
86
|
+
* result are inferred from it — the typed counterpart to {@link ContainerBridge.call}
|
|
87
|
+
* for JS/TS containers that can import the generated `api`.
|
|
88
|
+
*/
|
|
89
89
|
run: <Reference extends BridgeFunctionReference>(reference: Reference, args: ArgsOfReference<Reference>, shardKey?: string) => Promise<ResultOfReference<Reference>>;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Build a container→Lunora bridge bound to a Worker URL + token.
|
|
93
|
-
*
|
|
94
|
-
* ```ts
|
|
95
|
-
* const lunora = createContainerBridge({ baseUrl: process.env.LUNORA_URL!, token: process.env.LUNORA_TOKEN });
|
|
96
|
-
* const messages = await lunora.query("messages:list", { limit: 20 });
|
|
97
|
-
* await lunora.mutation("messages:markProcessed", { id });
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* `query`/`mutation`/`action` are intent-revealing aliases of one `call` — the
|
|
101
|
-
* wire is identical and the server dispatches by the function's registered
|
|
102
|
-
* kind, so a query path called via `.mutation(...)` still runs as a query.
|
|
103
|
-
* @experimental
|
|
104
|
-
*/
|
|
92
|
+
* Build a container→Lunora bridge bound to a Worker URL + token.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* const lunora = createContainerBridge({ baseUrl: process.env.LUNORA_URL!, token: process.env.LUNORA_TOKEN });
|
|
96
|
+
* const messages = await lunora.query("messages:list", { limit: 20 });
|
|
97
|
+
* await lunora.mutation("messages:markProcessed", { id });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* `query`/`mutation`/`action` are intent-revealing aliases of one `call` — the
|
|
101
|
+
* wire is identical and the server dispatches by the function's registered
|
|
102
|
+
* kind, so a query path called via `.mutation(...)` still runs as a query.
|
|
103
|
+
* @experimental
|
|
104
|
+
*/
|
|
105
105
|
declare const createContainerBridge: (options: ContainerBridgeOptions) => ContainerBridge;
|
|
106
106
|
export { type BridgeFunctionReference, type ContainerBridge, ContainerBridgeError, type ContainerBridgeOptions, type FetchLike, createContainerBridge };
|
package/dist/do/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
|
|
2
|
-
import { a as ContainerDefinition, D as DurableObjectJurisdiction } from "../packem_shared/jurisdiction.d-
|
|
2
|
+
import { a as ContainerDefinition, D as DurableObjectJurisdiction } from "../packem_shared/jurisdiction.d-8oUUvrew.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* ContainerStartOptions as they come from worker types
|
|
5
5
|
*/
|
|
@@ -119,7 +119,7 @@ type OutboundHandler<E = Cloudflare.Env, P = unknown> = {
|
|
|
119
119
|
type OutboundHandlerParams = Record<string, unknown>;
|
|
120
120
|
type OutboundHandlerParamsOf<THandler> = THandler extends ((req: Request, env: unknown, ctx: OutboundHandlerContext<infer Params>) => Promise<Response> | Response) ? Params : never;
|
|
121
121
|
declare function outboundParams<THandler extends OutboundHandler<unknown, unknown>>(_handler: THandler, params: OutboundHandlerParamsOf<THandler>): OutboundHandlerParamsOf<THandler>;
|
|
122
|
-
type OutboundHandlers<ParamsByMethod extends OutboundHandlerParams, E = Cloudflare.Env> = { [Method in keyof ParamsByMethod]?: OutboundHandler<E, ParamsByMethod[Method]
|
|
122
|
+
type OutboundHandlers<ParamsByMethod extends OutboundHandlerParams, E = Cloudflare.Env> = { [Method in keyof ParamsByMethod]?: OutboundHandler<E, ParamsByMethod[Method]>; };
|
|
123
123
|
type OutboundHandlerOverride<Params = unknown> = {
|
|
124
124
|
method: string;
|
|
125
125
|
} & ([Params] extends [undefined] ? {
|
|
@@ -485,29 +485,29 @@ declare class Container<Env = Cloudflare.Env> extends DurableObject<Env> {
|
|
|
485
485
|
}
|
|
486
486
|
type DurableObjectContext = ConstructorParameters<typeof Container>[0];
|
|
487
487
|
/**
|
|
488
|
-
* Base class for the generated Container DO classes. Applies a
|
|
489
|
-
* `defineContainer` definition onto `@cloudflare/containers`' `Container`:
|
|
490
|
-
* port, sleep timeout, internet access, and the container environment (static
|
|
491
|
-
* `env` merged with the declared Worker secrets — a declared-but-unset secret
|
|
492
|
-
* fails fast here rather than starting a container without its credential).
|
|
493
|
-
*
|
|
494
|
-
* Generated subclasses stay one line of behavior:
|
|
495
|
-
*
|
|
496
|
-
* ```ts
|
|
497
|
-
* export class TranscoderContainer extends LunoraContainer {
|
|
498
|
-
* constructor(ctx: DurableObjectState, env: Env) {
|
|
499
|
-
* super(ctx, env, transcoder, "transcoder");
|
|
500
|
-
* }
|
|
501
|
-
* }
|
|
502
|
-
* ```
|
|
503
|
-
* @experimental
|
|
504
|
-
*/
|
|
488
|
+
* Base class for the generated Container DO classes. Applies a
|
|
489
|
+
* `defineContainer` definition onto `@cloudflare/containers`' `Container`:
|
|
490
|
+
* port, sleep timeout, internet access, and the container environment (static
|
|
491
|
+
* `env` merged with the declared Worker secrets — a declared-but-unset secret
|
|
492
|
+
* fails fast here rather than starting a container without its credential).
|
|
493
|
+
*
|
|
494
|
+
* Generated subclasses stay one line of behavior:
|
|
495
|
+
*
|
|
496
|
+
* ```ts
|
|
497
|
+
* export class TranscoderContainer extends LunoraContainer {
|
|
498
|
+
* constructor(ctx: DurableObjectState, env: Env) {
|
|
499
|
+
* super(ctx, env, transcoder, "transcoder");
|
|
500
|
+
* }
|
|
501
|
+
* }
|
|
502
|
+
* ```
|
|
503
|
+
* @experimental
|
|
504
|
+
*/
|
|
505
505
|
declare class LunoraContainer<Env = unknown> extends Container<Env> {
|
|
506
506
|
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
* Data-residency jurisdiction the app's DOs are pinned to (codegen passes the
|
|
508
|
+
* schema's `.jurisdiction("…")`). Used to pin the best-effort lifecycle report
|
|
509
|
+
* to the same region as the root shard. `undefined` ⇒ un-pinned.
|
|
510
|
+
*/
|
|
511
511
|
private readonly lunoraJurisdiction?;
|
|
512
512
|
/** The `lunora/containers.ts` export name, for lifecycle log correlation. */
|
|
513
513
|
private readonly lunoraName;
|
|
@@ -523,76 +523,76 @@ declare class LunoraContainer<Env = unknown> extends Container<Env> {
|
|
|
523
523
|
private lunoraSecretsStoreResolved?;
|
|
524
524
|
constructor(context: DurableObjectContext, env: Env, definition: ContainerDefinition, exportName?: string, jurisdiction?: DurableObjectJurisdiction);
|
|
525
525
|
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
526
|
+
* Proxy entry for every `ctx.containers.<name>` fetch. Resolves the
|
|
527
|
+
* `secretsStore` bindings into `envVars` before delegating, so the values
|
|
528
|
+
* are present when the base implicitly starts the container for this
|
|
529
|
+
* request — a no-op when `secretsStore` is unset.
|
|
530
|
+
*/
|
|
531
531
|
override containerFetch(...args: Parameters<Container<Env>["containerFetch"]>): Promise<Response>;
|
|
532
532
|
/**
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
533
|
+
* Explicit start (`ctx.containers.<name>.get(id).start()`). Resolves the
|
|
534
|
+
* `secretsStore` bindings into `envVars` first, mirroring
|
|
535
|
+
* {@link containerFetch}. A per-instance `start({ envVars })` replaces the
|
|
536
|
+
* env set wholesale (base behavior), so the injected values only apply to a
|
|
537
|
+
* bare `start()` — same as the static `env`/`secrets`. When the caller
|
|
538
|
+
* supplies its own `envVars` we skip resolution entirely: those values would
|
|
539
|
+
* be discarded anyway, so a missing/unreadable binding shouldn't fail a start
|
|
540
|
+
* that never uses them.
|
|
541
|
+
*/
|
|
542
542
|
override start(...args: Parameters<Container<Env>["start"]>): Promise<void>;
|
|
543
543
|
override onActivityExpired(): Promise<void>;
|
|
544
544
|
override onError(error: unknown): unknown;
|
|
545
545
|
override onStart(): Promise<void>;
|
|
546
546
|
/**
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
547
|
+
* Hook run when the container's `hardTimeout` elapses (dispatched by the base
|
|
548
|
+
* scheduler via the run-generation-stamped schedule armed in
|
|
549
|
+
* {@link onStart}). Default: stop the instance. Override to drain/checkpoint
|
|
550
|
+
* first. A stale schedule from a previous run, or an already-stopped
|
|
551
|
+
* instance, is ignored (upstream cloudflare/containers#85).
|
|
552
|
+
*/
|
|
553
553
|
onHardTimeoutExpired(payload?: {
|
|
554
554
|
generation?: number;
|
|
555
555
|
}): Promise<void>;
|
|
556
556
|
override onStop(parameters: StopParams): Promise<void>;
|
|
557
557
|
/**
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
558
|
+
* Arm the hard-timeout kill via the base scheduler (so it integrates with
|
|
559
|
+
* the container's own alarm machinery instead of fighting it). Bumps the run
|
|
560
|
+
* generation and stamps the schedule with it, so {@link onHardTimeoutExpired}
|
|
561
|
+
* can tell a fresh schedule from a stale one. No-op without a `hardTimeout`.
|
|
562
|
+
*/
|
|
563
563
|
private armHardTimeout;
|
|
564
564
|
/**
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
565
|
+
* Resolve the `secretsStore` bindings (async `.get()`) once and merge the
|
|
566
|
+
* values into `envVars`, so they're present when the base starts the
|
|
567
|
+
* container. Memoised on the first call — every later start reuses the
|
|
568
|
+
* resolved promise. A missing binding or a non-string value fails fast (the
|
|
569
|
+
* start surfaces the error), the same fail-closed stance the static
|
|
570
|
+
* `secrets` resolution takes for a missing Worker secret. No-op without
|
|
571
|
+
* `secretsStore`.
|
|
572
|
+
*/
|
|
573
573
|
private resolveSecretsStoreEnv;
|
|
574
574
|
/**
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
575
|
+
* Block until every `readyOn` probe responds with its expected status, or
|
|
576
|
+
* throw once the readiness budget is spent. Probes run in parallel and hit
|
|
577
|
+
* the container's TCP port directly (NOT `containerFetch`, which would
|
|
578
|
+
* recurse back into the start path). No-op without `readyOn`.
|
|
579
|
+
*/
|
|
580
580
|
private awaitContainerReadiness;
|
|
581
581
|
/** Poll one readiness probe until it returns its expected status or the shared deadline passes. */
|
|
582
582
|
private awaitReadinessCheck;
|
|
583
583
|
/**
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
584
|
+
* Best-effort push of `envelope` into the root ShardDO's log buffer so it
|
|
585
|
+
* also appears in the Studio Logs panel (the terminal already has it via
|
|
586
|
+
* `emitContainerLifecycle`). Fire-and-forget and fully swallowed: a missing
|
|
587
|
+
* `SHARD` binding, a missing admin token, or a fetch failure NEVER throws
|
|
588
|
+
* out of a lifecycle hook — the `console` path stays the source of truth.
|
|
589
|
+
*/
|
|
590
590
|
private surfaceInStudioLogs;
|
|
591
591
|
/**
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
592
|
+
* Per-instance correlation id: the Durable Object id, which Cloudflare also
|
|
593
|
+
* injects into the container as `CLOUDFLARE_DURABLE_OBJECT_ID`. Read
|
|
594
|
+
* defensively — the id shape varies and isn't worth crashing a hook over.
|
|
595
|
+
*/
|
|
596
596
|
private instanceId;
|
|
597
597
|
}
|
|
598
598
|
export { ContainerProxy, LunoraContainer, type OutboundHandler, type OutboundHandlerContext, type OutboundHandlerParams, type OutboundHandlerParamsOf, type OutboundHandlers, outboundParams };
|