@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/do/index.d.ts
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.js";
|
|
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 };
|