@lunora/runtime 1.0.0-alpha.35 → 1.0.0-alpha.36
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/index.d.mts +197 -2
- package/dist/index.d.ts +197 -2
- package/dist/index.mjs +3 -3
- package/dist/packem_shared/{analyticsEngineSink-DgL64WVC.mjs → analyticsEngineSink-yLFNjHDt.mjs} +74 -17
- package/dist/packem_shared/{argsFromQuery-BqPiQTPc.mjs → argsFromQuery-c-U1WRy-.mjs} +9 -2
- package/dist/packem_shared/{composeWorker-UwHY2r8O.mjs → composeWorker-DiWwOXXt.mjs} +205 -37
- package/dist/packem_shared/otlp-resource-Dow6-F_u.mjs +163 -0
- package/package.json +1 -1
- package/dist/packem_shared/otlp-DKZJCkdD.mjs +0 -95
package/dist/index.d.mts
CHANGED
|
@@ -1536,6 +1536,20 @@ type ContextLogLevel = "debug" | "error" | "fatal" | "info" | "log" | "trace" |
|
|
|
1536
1536
|
* `waitUntil` (no request context) means the sink falls back to fire-and-forget.
|
|
1537
1537
|
*/
|
|
1538
1538
|
interface LogSinkContext {
|
|
1539
|
+
/**
|
|
1540
|
+
* Resolves this request's detected OTLP resource attributes (`service.version`,
|
|
1541
|
+
* `cloud.region`, …) on demand, or absent when the host does not detect any.
|
|
1542
|
+
*
|
|
1543
|
+
* Deliberately a resolved, allowlisted bag behind a thunk rather than the raw
|
|
1544
|
+
* `env` and `Request` the host detected them from: this context is fanned out
|
|
1545
|
+
* to **every** registered sink, including user-authored ones, so anything
|
|
1546
|
+
* reachable here should be assumed to end up in someone's debug log — and raw
|
|
1547
|
+
* `env` is every secret binding, while a raw `Request` carries the caller's
|
|
1548
|
+
* `Authorization` and `Cookie`. The thunk keeps detection lazy (a sink that
|
|
1549
|
+
* does not want resource attributes pays nothing) and hosts are expected to
|
|
1550
|
+
* memoize it per request.
|
|
1551
|
+
*/
|
|
1552
|
+
resourceAttributes?: () => Record<string, boolean | number | string>;
|
|
1539
1553
|
/** Keep a background promise alive past the response (the request's `waitUntil`). */
|
|
1540
1554
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1541
1555
|
}
|
|
@@ -1894,8 +1908,24 @@ interface ObservabilityEvent {
|
|
|
1894
1908
|
};
|
|
1895
1909
|
/** Function path being invoked, e.g. `"messages:list"`. */
|
|
1896
1910
|
functionPath: string;
|
|
1911
|
+
/** Host of the inbound request (e.g. `"api.example.com"`). */
|
|
1912
|
+
host?: string;
|
|
1913
|
+
/** HTTP method of the inbound request (e.g. `"POST"`). */
|
|
1914
|
+
method?: string;
|
|
1897
1915
|
/** True when the dispatch completed without throwing. */
|
|
1898
1916
|
ok: boolean;
|
|
1917
|
+
/**
|
|
1918
|
+
* Span id of the upstream caller extracted from the inbound `traceparent`,
|
|
1919
|
+
* when present. This becomes the OTLP `parentSpanId` for the dispatch span so
|
|
1920
|
+
* collector waterfalls show the worker span nested under the upstream caller.
|
|
1921
|
+
*/
|
|
1922
|
+
parentSpanId?: string;
|
|
1923
|
+
/** URL path of the inbound request (e.g. `"/_lunora/rpc"`). */
|
|
1924
|
+
path?: string;
|
|
1925
|
+
/** Port of the inbound request, when available. */
|
|
1926
|
+
port?: number;
|
|
1927
|
+
/** URL scheme of the inbound request (e.g. `"https"`). */
|
|
1928
|
+
scheme?: string;
|
|
1899
1929
|
/** Shard key for single-shard calls; absent for fan-outs. */
|
|
1900
1930
|
shardKey?: string;
|
|
1901
1931
|
/**
|
|
@@ -1907,7 +1937,14 @@ interface ObservabilityEvent {
|
|
|
1907
1937
|
* falls back to random ids).
|
|
1908
1938
|
*/
|
|
1909
1939
|
spanId?: string;
|
|
1940
|
+
/**
|
|
1941
|
+
* W3C trace flags for this dispatch (the sampled flag, bit 0). Carried from
|
|
1942
|
+
* the upstream `traceparent` or set by the runtime's head-sampling decision.
|
|
1943
|
+
*/
|
|
1944
|
+
traceFlags?: number;
|
|
1910
1945
|
traceId?: string;
|
|
1946
|
+
/** Inbound `User-Agent` header, when available. */
|
|
1947
|
+
userAgent?: string;
|
|
1911
1948
|
}
|
|
1912
1949
|
/**
|
|
1913
1950
|
* The `ctx.log` observability contract lives in `shared/` (inlined into each
|
|
@@ -2036,6 +2073,8 @@ type RestInvoke = (parameters: {
|
|
|
2036
2073
|
functionPath: string;
|
|
2037
2074
|
request: Request;
|
|
2038
2075
|
shardKey?: string;
|
|
2076
|
+
/** The request's `waitUntil`, so dispatch telemetry survives isolate teardown. */
|
|
2077
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
2039
2078
|
}) => Promise<Response>;
|
|
2040
2079
|
/**
|
|
2041
2080
|
* Optional per-request rate-limit gate for the public surface. Returns a `429`
|
|
@@ -2044,6 +2083,15 @@ type RestInvoke = (parameters: {
|
|
|
2044
2083
|
* `@lunora/ratelimit`.
|
|
2045
2084
|
*/
|
|
2046
2085
|
type RestRateLimit = (request: Request, functionPath: string) => Promise<Response | undefined> | Response | undefined;
|
|
2086
|
+
/**
|
|
2087
|
+
* A built REST route. Takes the same `(request, env, url, context)` shape as the
|
|
2088
|
+
* runtime's internal route table so it can be spread straight into it; `url` is
|
|
2089
|
+
* unused here (the route re-parses it) and `context` is read only for its
|
|
2090
|
+
* `waitUntil`, which keeps dispatch telemetry alive past the response.
|
|
2091
|
+
*/
|
|
2092
|
+
type RestRoute = (request: Request, env: unknown, url?: URL, context?: {
|
|
2093
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
2094
|
+
}) => Promise<Response>;
|
|
2047
2095
|
interface RestRouteDeps {
|
|
2048
2096
|
/** The generated function registry — the source of which procedures are exposed. */
|
|
2049
2097
|
functions: RestRegistryLike;
|
|
@@ -2075,7 +2123,7 @@ declare const argsFromQuery: (url: URL) => Record<string, unknown>;
|
|
|
2075
2123
|
* construction. A `query` handler accepts `GET` (args from the query string) and
|
|
2076
2124
|
* `POST` (args from a JSON body); a `mutation` / `action` accepts `POST` only.
|
|
2077
2125
|
*/
|
|
2078
|
-
declare const buildRestRoutes: (deps: RestRouteDeps) => Record<string,
|
|
2126
|
+
declare const buildRestRoutes: (deps: RestRouteDeps) => Record<string, RestRoute>;
|
|
2079
2127
|
/** Structural view of a `@lunora/ratelimit` `RateLimiter` — only the `.limit()` call, so the runtime needs no hard dependency. */
|
|
2080
2128
|
interface RateLimiterLike {
|
|
2081
2129
|
limit: (name: string, args?: {
|
|
@@ -2238,6 +2286,68 @@ declare const handleCorsPreflight: (request: Request, resolved: ResolvedSecurity
|
|
|
2238
2286
|
* hibernation handshake.
|
|
2239
2287
|
*/
|
|
2240
2288
|
declare const decorateResponse: (response: Response, request: Request, resolved: ResolvedSecurity) => Response;
|
|
2289
|
+
/**
|
|
2290
|
+
* Who is allowed to hand this worker a trace to join.
|
|
2291
|
+
*
|
|
2292
|
+
* Continuing an inbound W3C `traceparent` is what makes a distributed waterfall
|
|
2293
|
+
* stitch end to end, but the header is caller-supplied: on a public worker,
|
|
2294
|
+
* trusting it lets anyone choose which trace their spans and `ctx.log` lines land
|
|
2295
|
+
* in, and — because `shared/sampling` derives the head verdict from the trace id —
|
|
2296
|
+
* choose their own sampling outcome. Whether that matters is a *deployment*
|
|
2297
|
+
* question ("can an untrusted client reach this worker directly?"), which no
|
|
2298
|
+
* amount of request inspection can answer on its own.
|
|
2299
|
+
*
|
|
2300
|
+
* So rather than ask users to hand-roll a security predicate, this module ships
|
|
2301
|
+
* the answers that are actually sound, named:
|
|
2302
|
+
*
|
|
2303
|
+
* ```ts
|
|
2304
|
+
* createWorker({ trustInboundTraceContext: true }); // nothing untrusted can reach this worker
|
|
2305
|
+
* createWorker({ trustInboundTraceContext: "mtls" }); // only edge-verified client certs
|
|
2306
|
+
* createWorker({ trustInboundTraceContext: (request) => … }); // anything else
|
|
2307
|
+
* ```
|
|
2308
|
+
*
|
|
2309
|
+
* **Behind a gateway, mesh, or Cloudflare Access, `true` is the answer.** If the
|
|
2310
|
+
* worker is genuinely unreachable except through that front door, every caller
|
|
2311
|
+
* has already passed it and there is nothing left to discriminate on. Check that
|
|
2312
|
+
* it really is unreachable — a `*.workers.dev` route left enabled, or a hostname
|
|
2313
|
+
* outside the Access policy, is a second front door with no gate on it.
|
|
2314
|
+
*
|
|
2315
|
+
* There is deliberately no `"cloudflare-access"` signal. Recognising Access by its
|
|
2316
|
+
* `cf-access-jwt-assertion` header only tests that a header is present, which is
|
|
2317
|
+
* redundant when the worker is properly fronted (`true` already covers it) and
|
|
2318
|
+
* forgeable in one `curl` when it is not. Verifying the assertion for real means a
|
|
2319
|
+
* JWKS fetch and an audience check — `@lunora/cloudflare-access` does exactly
|
|
2320
|
+
* that, and it is async, so it belongs in `resolveIdentity` rather than on the
|
|
2321
|
+
* dispatch path. Pass a predicate if you want to wire it in yourself.
|
|
2322
|
+
*
|
|
2323
|
+
* Everything resolves to one predicate at worker construction, so the per-request
|
|
2324
|
+
* cost is a single call.
|
|
2325
|
+
*
|
|
2326
|
+
* The custom form receives only the `Request`, deliberately: handing user code the
|
|
2327
|
+
* Worker `env` would put every secret binding behind a telemetry callback, the
|
|
2328
|
+
* same boundary `LogSinkContext` was just narrowed to avoid. A predicate that
|
|
2329
|
+
* needs to compare against a binding should close over it — build the worker per
|
|
2330
|
+
* request from an options factory, the pattern `createLunoraHandler` already uses.
|
|
2331
|
+
*/
|
|
2332
|
+
/**
|
|
2333
|
+
* A named trust signal — a per-request property that, on its own, establishes the
|
|
2334
|
+
* caller is one whose trace context may be adopted.
|
|
2335
|
+
*
|
|
2336
|
+
* - `"mtls"` — the caller presented a client certificate that **Cloudflare
|
|
2337
|
+
* verified at the edge**. `cf.tlsClientAuth` is platform-injected request
|
|
2338
|
+
* metadata, not a header, so a caller cannot write it: the check carries its own
|
|
2339
|
+
* proof and holds regardless of how the worker is exposed.
|
|
2340
|
+
*
|
|
2341
|
+
* Signals live here only when they meet that bar. A property a client can set for
|
|
2342
|
+
* itself is not a signal; see the module doc on why Cloudflare Access is absent.
|
|
2343
|
+
*/
|
|
2344
|
+
type TraceTrustSignal = "mtls";
|
|
2345
|
+
/**
|
|
2346
|
+
* How much of the inbound trace context to trust. `false` (the default) ignores
|
|
2347
|
+
* it entirely; `true` trusts every caller, which is right when nothing untrusted
|
|
2348
|
+
* can reach the worker.
|
|
2349
|
+
*/
|
|
2350
|
+
type TrustInboundTraceContext = boolean | TraceTrustSignal | ((request: Request) => boolean);
|
|
2241
2351
|
/**
|
|
2242
2352
|
* Wire-format RPC envelope. Posted to `POST /_lunora/rpc`.
|
|
2243
2353
|
*
|
|
@@ -3273,6 +3383,39 @@ interface WorkerOptions {
|
|
|
3273
3383
|
* endpoint. When omitted, the sync feed covers only shard-local tables.
|
|
3274
3384
|
*/
|
|
3275
3385
|
syncGlobals?: GlobalCdcSyncFunction;
|
|
3386
|
+
/**
|
|
3387
|
+
* Who may hand this worker a trace to join. Controls whether an inbound W3C
|
|
3388
|
+
* `traceparent` is continued — adopting its trace id, parenting this
|
|
3389
|
+
* dispatch's span under the upstream span, and carrying its `tracestate` to
|
|
3390
|
+
* the shard. **Default: off.**
|
|
3391
|
+
*
|
|
3392
|
+
* ```ts
|
|
3393
|
+
* trustInboundTraceContext: true // nothing untrusted can reach this worker
|
|
3394
|
+
* trustInboundTraceContext: "mtls" // only edge-verified client certificates
|
|
3395
|
+
* trustInboundTraceContext: (request) => … // anything else
|
|
3396
|
+
* ```
|
|
3397
|
+
*
|
|
3398
|
+
* Off by default because the header is caller-supplied: on a worker an
|
|
3399
|
+
* untrusted client can reach directly, trusting it lets anyone choose which
|
|
3400
|
+
* trace their spans and `ctx.log` lines join — grafting entries into another
|
|
3401
|
+
* tenant's waterfall in a shared collector — and, because the head-sampling
|
|
3402
|
+
* verdict is derived from the trace id, choose their own sampling outcome.
|
|
3403
|
+
* (Error traces are unaffected either way: the tail bias is evaluated from
|
|
3404
|
+
* the worker's own decision, never the caller's.)
|
|
3405
|
+
*
|
|
3406
|
+
* Turn it on when something you control — a gateway, service mesh, or
|
|
3407
|
+
* Cloudflare Access — sets `traceparent` itself; a proxy that only _forwards_
|
|
3408
|
+
* the client's header is not such a thing. Behind a front door like that,
|
|
3409
|
+
* `true` is the answer, because every caller has already passed it. Confirm
|
|
3410
|
+
* the worker really is unreachable otherwise — a `*.workers.dev` route left
|
|
3411
|
+
* enabled is a second front door with no gate on it.
|
|
3412
|
+
*
|
|
3413
|
+
* Leaving this unset logs a one-time hint if an inbound trace is actually
|
|
3414
|
+
* dropped; setting it explicitly to `false` keeps the behaviour and silences
|
|
3415
|
+
* that.
|
|
3416
|
+
* @see {@link TrustInboundTraceContext} for what each signal proves.
|
|
3417
|
+
*/
|
|
3418
|
+
trustInboundTraceContext?: TrustInboundTraceContext;
|
|
3276
3419
|
/**
|
|
3277
3420
|
* Read-only introspector for Vectorize indexes, backing the studio's vector
|
|
3278
3421
|
* browser via `GET /_lunora/admin/vector/indexes` and
|
|
@@ -3357,9 +3500,12 @@ interface LunoraWorker {
|
|
|
3357
3500
|
* @param options Call options mirroring the RPC envelope.
|
|
3358
3501
|
* @param options.shardKey Routes to a specific shard (omitted → the worker's
|
|
3359
3502
|
* `defaultShardKey`).
|
|
3503
|
+
* @param options.waitUntil The host's `waitUntil`, so dispatch telemetry
|
|
3504
|
+
* whose export is deferred (a gzipped OTLP body) survives isolate teardown.
|
|
3360
3505
|
*/
|
|
3361
3506
|
serverQuery: (request: Request, env: unknown, reference: unknown, args?: Record<string, unknown>, options?: {
|
|
3362
3507
|
shardKey?: string;
|
|
3508
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
3363
3509
|
}) => Promise<Response>;
|
|
3364
3510
|
}
|
|
3365
3511
|
/**
|
|
@@ -3608,6 +3754,15 @@ declare class LunoraError extends LunoraError$1 {
|
|
|
3608
3754
|
});
|
|
3609
3755
|
toResponse(): Response;
|
|
3610
3756
|
}
|
|
3757
|
+
/** A JS attribute value the encoder maps onto an OTLP `AnyValue`. */
|
|
3758
|
+
type OtlpAttributeValue = boolean | number | string;
|
|
3759
|
+
/**
|
|
3760
|
+
* A `Resource.attributes` bag — the process-level identity (`service.name`,
|
|
3761
|
+
* `service.version`, `cloud.region`, …) attached to every exported signal.
|
|
3762
|
+
* Lives here rather than in either exporter because both packages build one and
|
|
3763
|
+
* `wrapResource*` consumes it.
|
|
3764
|
+
*/
|
|
3765
|
+
type OtlpResourceAttributes = Record<string, OtlpAttributeValue>;
|
|
3611
3766
|
/** Shared shape for sinks that can be limited to error events only. */
|
|
3612
3767
|
interface OnlyErrorsOption {
|
|
3613
3768
|
/** When true, only events with `ok === false` are forwarded. */
|
|
@@ -3808,6 +3963,28 @@ interface PipelineLogSinkOptions {
|
|
|
3808
3963
|
declare const pipelineLogSink: (options: PipelineLogSinkOptions) => ObservabilitySink;
|
|
3809
3964
|
/** Options for {@link otlpSink}. */
|
|
3810
3965
|
interface OtlpSinkOptions extends OnlyErrorsOption {
|
|
3966
|
+
/**
|
|
3967
|
+
* Value of the `deployment.environment` resource attribute (e.g.
|
|
3968
|
+
* `"production"`, `"staging"`, `"development"`).
|
|
3969
|
+
*/
|
|
3970
|
+
deploymentEnvironment?: string;
|
|
3971
|
+
/**
|
|
3972
|
+
* When `true`, the sink attaches the resource attributes the **host** detected
|
|
3973
|
+
* for the current request, merged *under* any explicit option so those always
|
|
3974
|
+
* win on collision. In a Worker that is `service.version`,
|
|
3975
|
+
* `deployment.environment`, `cloud.provider`, and `cloud.region` (the colo).
|
|
3976
|
+
*
|
|
3977
|
+
* The sink never inspects `env` or the request itself — detection happens once
|
|
3978
|
+
* per request in the runtime and arrives pre-resolved on the sink context (see
|
|
3979
|
+
* `LogSinkContext.resourceAttributes`), so no sink is ever handed raw bindings.
|
|
3980
|
+
*
|
|
3981
|
+
* Events that originate inside a shard (`ctx.log`, `ctx.trace`, `ctx.metrics`)
|
|
3982
|
+
* carry no host-detected attributes today — the shard has no `env` of its own —
|
|
3983
|
+
* so they export with the explicit options only. Set the values you need
|
|
3984
|
+
* explicitly if you require them to match across worker and shard spans of the
|
|
3985
|
+
* same trace.
|
|
3986
|
+
*/
|
|
3987
|
+
detectResources?: boolean;
|
|
3811
3988
|
/**
|
|
3812
3989
|
* The OTLP-over-HTTP collector base endpoint (e.g.
|
|
3813
3990
|
* `https://collector.example.com`). Following the OTel base-endpoint
|
|
@@ -3822,11 +3999,29 @@ interface OtlpSinkOptions extends OnlyErrorsOption {
|
|
|
3822
3999
|
* default and may be overridden here.
|
|
3823
4000
|
*/
|
|
3824
4001
|
headers?: Record<string, string>;
|
|
4002
|
+
/**
|
|
4003
|
+
* Additional resource attributes to attach to every exported signal. These
|
|
4004
|
+
* ride alongside the built-in `service.name` and any convenience fields
|
|
4005
|
+
* (`serviceVersion`, `deploymentEnvironment`, etc.). A key that collides with
|
|
4006
|
+
* a built-in resource attribute wins; use this for custom dimensions like
|
|
4007
|
+
* `deployment.region`, `host.name`, or `service.instance.id`.
|
|
4008
|
+
*/
|
|
4009
|
+
resourceAttributes?: OtlpResourceAttributes;
|
|
3825
4010
|
/**
|
|
3826
4011
|
* Value of the `service.name` resource attribute on every exported span and
|
|
3827
4012
|
* log — the logical service the telemetry belongs to. Defaults to `lunora`.
|
|
3828
4013
|
*/
|
|
3829
4014
|
serviceName?: string;
|
|
4015
|
+
/**
|
|
4016
|
+
* Value of the `service.namespace` resource attribute, useful when multiple
|
|
4017
|
+
* services share the same `service.name` under a tenant or team boundary.
|
|
4018
|
+
*/
|
|
4019
|
+
serviceNamespace?: string;
|
|
4020
|
+
/**
|
|
4021
|
+
* Value of the `service.version` resource attribute (e.g. a git sha or
|
|
4022
|
+
* release tag).
|
|
4023
|
+
*/
|
|
4024
|
+
serviceVersion?: string;
|
|
3830
4025
|
/**
|
|
3831
4026
|
* Convenience bearer token: when set, an `Authorization: Bearer` header
|
|
3832
4027
|
* carrying it is added to every POST (overriding any authorization in
|
|
@@ -3871,4 +4066,4 @@ declare const otlpSink: (options: OtlpSinkOptions) => ObservabilitySink;
|
|
|
3871
4066
|
*/
|
|
3872
4067
|
declare const combineSinks: (...sinks: ObservabilitySink[]) => ObservabilitySink;
|
|
3873
4068
|
declare const VERSION: string;
|
|
3874
|
-
export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthConfigInfo, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type AuthUserFieldSpec, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_LOG_COLUMNS, DEFAULT_LOG_LIMIT, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportBatch, type ExportChange, type ExportCursorStore, type ExportFanOutRequest, type ExportFanOutResult, type ExportSink, type ExportTapFailure, type ExportTapResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, HEALTH_PATH, HEALTH_READY_PATH, type HealthAuthPosture, type HealthBody, type HealthCheckReport, type HealthProbe, type HealthProbeKind, type HealthProbeResult, type HealthRouteDeps, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, LOG_ARCHIVE_NOT_CONFIGURED, LOG_ARCHIVE_PATH, type ListAuthUsersOptions, type LogArchiveConfig, type LogEvent, type LogFields, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MetricEvent, type MetricKind, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type NotifySubscriptionDevice, type NotifySubscriptionStoreLike, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type OtlpSinkOptions, type PipelineLike, type PipelineLogColumnMap, type PipelineLogCursor, type PipelineLogField, type PipelineLogPage, type PipelineLogQuery, type PipelineLogReader, type PipelineLogReaderOptions, type PipelineLogRow, type PipelineLogSinkOptions, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ResolvedSecurity, type ResolvedShard, type RestInvoke, type RestRateLimit, type RestRegistryEntry, type RestRegistryLike, type RestRouteDeps, type Route, type RpcContext, type RpcEnvelope, type RunExportTapOptions, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SpanEvent, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, argsFromQuery, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createStaticShardRegistry, createWorker, d1Probe, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, otlpSink, pipelineLogSink, presenceProbe, r2Sink, readShardKey, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
|
|
4069
|
+
export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthConfigInfo, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type AuthUserFieldSpec, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_LOG_COLUMNS, DEFAULT_LOG_LIMIT, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportBatch, type ExportChange, type ExportCursorStore, type ExportFanOutRequest, type ExportFanOutResult, type ExportSink, type ExportTapFailure, type ExportTapResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, HEALTH_PATH, HEALTH_READY_PATH, type HealthAuthPosture, type HealthBody, type HealthCheckReport, type HealthProbe, type HealthProbeKind, type HealthProbeResult, type HealthRouteDeps, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, LOG_ARCHIVE_NOT_CONFIGURED, LOG_ARCHIVE_PATH, type ListAuthUsersOptions, type LogArchiveConfig, type LogEvent, type LogFields, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MetricEvent, type MetricKind, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type NotifySubscriptionDevice, type NotifySubscriptionStoreLike, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type OtlpResourceAttributes, type OtlpSinkOptions, type PipelineLike, type PipelineLogColumnMap, type PipelineLogCursor, type PipelineLogField, type PipelineLogPage, type PipelineLogQuery, type PipelineLogReader, type PipelineLogReaderOptions, type PipelineLogRow, type PipelineLogSinkOptions, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ResolvedSecurity, type ResolvedShard, type RestInvoke, type RestRateLimit, type RestRegistryEntry, type RestRegistryLike, type RestRoute, type RestRouteDeps, type Route, type RpcContext, type RpcEnvelope, type RunExportTapOptions, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SpanEvent, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, type TraceTrustSignal, type TrustInboundTraceContext, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, argsFromQuery, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createStaticShardRegistry, createWorker, d1Probe, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, otlpSink, pipelineLogSink, presenceProbe, r2Sink, readShardKey, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
|
package/dist/index.d.ts
CHANGED
|
@@ -1536,6 +1536,20 @@ type ContextLogLevel = "debug" | "error" | "fatal" | "info" | "log" | "trace" |
|
|
|
1536
1536
|
* `waitUntil` (no request context) means the sink falls back to fire-and-forget.
|
|
1537
1537
|
*/
|
|
1538
1538
|
interface LogSinkContext {
|
|
1539
|
+
/**
|
|
1540
|
+
* Resolves this request's detected OTLP resource attributes (`service.version`,
|
|
1541
|
+
* `cloud.region`, …) on demand, or absent when the host does not detect any.
|
|
1542
|
+
*
|
|
1543
|
+
* Deliberately a resolved, allowlisted bag behind a thunk rather than the raw
|
|
1544
|
+
* `env` and `Request` the host detected them from: this context is fanned out
|
|
1545
|
+
* to **every** registered sink, including user-authored ones, so anything
|
|
1546
|
+
* reachable here should be assumed to end up in someone's debug log — and raw
|
|
1547
|
+
* `env` is every secret binding, while a raw `Request` carries the caller's
|
|
1548
|
+
* `Authorization` and `Cookie`. The thunk keeps detection lazy (a sink that
|
|
1549
|
+
* does not want resource attributes pays nothing) and hosts are expected to
|
|
1550
|
+
* memoize it per request.
|
|
1551
|
+
*/
|
|
1552
|
+
resourceAttributes?: () => Record<string, boolean | number | string>;
|
|
1539
1553
|
/** Keep a background promise alive past the response (the request's `waitUntil`). */
|
|
1540
1554
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1541
1555
|
}
|
|
@@ -1894,8 +1908,24 @@ interface ObservabilityEvent {
|
|
|
1894
1908
|
};
|
|
1895
1909
|
/** Function path being invoked, e.g. `"messages:list"`. */
|
|
1896
1910
|
functionPath: string;
|
|
1911
|
+
/** Host of the inbound request (e.g. `"api.example.com"`). */
|
|
1912
|
+
host?: string;
|
|
1913
|
+
/** HTTP method of the inbound request (e.g. `"POST"`). */
|
|
1914
|
+
method?: string;
|
|
1897
1915
|
/** True when the dispatch completed without throwing. */
|
|
1898
1916
|
ok: boolean;
|
|
1917
|
+
/**
|
|
1918
|
+
* Span id of the upstream caller extracted from the inbound `traceparent`,
|
|
1919
|
+
* when present. This becomes the OTLP `parentSpanId` for the dispatch span so
|
|
1920
|
+
* collector waterfalls show the worker span nested under the upstream caller.
|
|
1921
|
+
*/
|
|
1922
|
+
parentSpanId?: string;
|
|
1923
|
+
/** URL path of the inbound request (e.g. `"/_lunora/rpc"`). */
|
|
1924
|
+
path?: string;
|
|
1925
|
+
/** Port of the inbound request, when available. */
|
|
1926
|
+
port?: number;
|
|
1927
|
+
/** URL scheme of the inbound request (e.g. `"https"`). */
|
|
1928
|
+
scheme?: string;
|
|
1899
1929
|
/** Shard key for single-shard calls; absent for fan-outs. */
|
|
1900
1930
|
shardKey?: string;
|
|
1901
1931
|
/**
|
|
@@ -1907,7 +1937,14 @@ interface ObservabilityEvent {
|
|
|
1907
1937
|
* falls back to random ids).
|
|
1908
1938
|
*/
|
|
1909
1939
|
spanId?: string;
|
|
1940
|
+
/**
|
|
1941
|
+
* W3C trace flags for this dispatch (the sampled flag, bit 0). Carried from
|
|
1942
|
+
* the upstream `traceparent` or set by the runtime's head-sampling decision.
|
|
1943
|
+
*/
|
|
1944
|
+
traceFlags?: number;
|
|
1910
1945
|
traceId?: string;
|
|
1946
|
+
/** Inbound `User-Agent` header, when available. */
|
|
1947
|
+
userAgent?: string;
|
|
1911
1948
|
}
|
|
1912
1949
|
/**
|
|
1913
1950
|
* The `ctx.log` observability contract lives in `shared/` (inlined into each
|
|
@@ -2036,6 +2073,8 @@ type RestInvoke = (parameters: {
|
|
|
2036
2073
|
functionPath: string;
|
|
2037
2074
|
request: Request;
|
|
2038
2075
|
shardKey?: string;
|
|
2076
|
+
/** The request's `waitUntil`, so dispatch telemetry survives isolate teardown. */
|
|
2077
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
2039
2078
|
}) => Promise<Response>;
|
|
2040
2079
|
/**
|
|
2041
2080
|
* Optional per-request rate-limit gate for the public surface. Returns a `429`
|
|
@@ -2044,6 +2083,15 @@ type RestInvoke = (parameters: {
|
|
|
2044
2083
|
* `@lunora/ratelimit`.
|
|
2045
2084
|
*/
|
|
2046
2085
|
type RestRateLimit = (request: Request, functionPath: string) => Promise<Response | undefined> | Response | undefined;
|
|
2086
|
+
/**
|
|
2087
|
+
* A built REST route. Takes the same `(request, env, url, context)` shape as the
|
|
2088
|
+
* runtime's internal route table so it can be spread straight into it; `url` is
|
|
2089
|
+
* unused here (the route re-parses it) and `context` is read only for its
|
|
2090
|
+
* `waitUntil`, which keeps dispatch telemetry alive past the response.
|
|
2091
|
+
*/
|
|
2092
|
+
type RestRoute = (request: Request, env: unknown, url?: URL, context?: {
|
|
2093
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
2094
|
+
}) => Promise<Response>;
|
|
2047
2095
|
interface RestRouteDeps {
|
|
2048
2096
|
/** The generated function registry — the source of which procedures are exposed. */
|
|
2049
2097
|
functions: RestRegistryLike;
|
|
@@ -2075,7 +2123,7 @@ declare const argsFromQuery: (url: URL) => Record<string, unknown>;
|
|
|
2075
2123
|
* construction. A `query` handler accepts `GET` (args from the query string) and
|
|
2076
2124
|
* `POST` (args from a JSON body); a `mutation` / `action` accepts `POST` only.
|
|
2077
2125
|
*/
|
|
2078
|
-
declare const buildRestRoutes: (deps: RestRouteDeps) => Record<string,
|
|
2126
|
+
declare const buildRestRoutes: (deps: RestRouteDeps) => Record<string, RestRoute>;
|
|
2079
2127
|
/** Structural view of a `@lunora/ratelimit` `RateLimiter` — only the `.limit()` call, so the runtime needs no hard dependency. */
|
|
2080
2128
|
interface RateLimiterLike {
|
|
2081
2129
|
limit: (name: string, args?: {
|
|
@@ -2238,6 +2286,68 @@ declare const handleCorsPreflight: (request: Request, resolved: ResolvedSecurity
|
|
|
2238
2286
|
* hibernation handshake.
|
|
2239
2287
|
*/
|
|
2240
2288
|
declare const decorateResponse: (response: Response, request: Request, resolved: ResolvedSecurity) => Response;
|
|
2289
|
+
/**
|
|
2290
|
+
* Who is allowed to hand this worker a trace to join.
|
|
2291
|
+
*
|
|
2292
|
+
* Continuing an inbound W3C `traceparent` is what makes a distributed waterfall
|
|
2293
|
+
* stitch end to end, but the header is caller-supplied: on a public worker,
|
|
2294
|
+
* trusting it lets anyone choose which trace their spans and `ctx.log` lines land
|
|
2295
|
+
* in, and — because `shared/sampling` derives the head verdict from the trace id —
|
|
2296
|
+
* choose their own sampling outcome. Whether that matters is a *deployment*
|
|
2297
|
+
* question ("can an untrusted client reach this worker directly?"), which no
|
|
2298
|
+
* amount of request inspection can answer on its own.
|
|
2299
|
+
*
|
|
2300
|
+
* So rather than ask users to hand-roll a security predicate, this module ships
|
|
2301
|
+
* the answers that are actually sound, named:
|
|
2302
|
+
*
|
|
2303
|
+
* ```ts
|
|
2304
|
+
* createWorker({ trustInboundTraceContext: true }); // nothing untrusted can reach this worker
|
|
2305
|
+
* createWorker({ trustInboundTraceContext: "mtls" }); // only edge-verified client certs
|
|
2306
|
+
* createWorker({ trustInboundTraceContext: (request) => … }); // anything else
|
|
2307
|
+
* ```
|
|
2308
|
+
*
|
|
2309
|
+
* **Behind a gateway, mesh, or Cloudflare Access, `true` is the answer.** If the
|
|
2310
|
+
* worker is genuinely unreachable except through that front door, every caller
|
|
2311
|
+
* has already passed it and there is nothing left to discriminate on. Check that
|
|
2312
|
+
* it really is unreachable — a `*.workers.dev` route left enabled, or a hostname
|
|
2313
|
+
* outside the Access policy, is a second front door with no gate on it.
|
|
2314
|
+
*
|
|
2315
|
+
* There is deliberately no `"cloudflare-access"` signal. Recognising Access by its
|
|
2316
|
+
* `cf-access-jwt-assertion` header only tests that a header is present, which is
|
|
2317
|
+
* redundant when the worker is properly fronted (`true` already covers it) and
|
|
2318
|
+
* forgeable in one `curl` when it is not. Verifying the assertion for real means a
|
|
2319
|
+
* JWKS fetch and an audience check — `@lunora/cloudflare-access` does exactly
|
|
2320
|
+
* that, and it is async, so it belongs in `resolveIdentity` rather than on the
|
|
2321
|
+
* dispatch path. Pass a predicate if you want to wire it in yourself.
|
|
2322
|
+
*
|
|
2323
|
+
* Everything resolves to one predicate at worker construction, so the per-request
|
|
2324
|
+
* cost is a single call.
|
|
2325
|
+
*
|
|
2326
|
+
* The custom form receives only the `Request`, deliberately: handing user code the
|
|
2327
|
+
* Worker `env` would put every secret binding behind a telemetry callback, the
|
|
2328
|
+
* same boundary `LogSinkContext` was just narrowed to avoid. A predicate that
|
|
2329
|
+
* needs to compare against a binding should close over it — build the worker per
|
|
2330
|
+
* request from an options factory, the pattern `createLunoraHandler` already uses.
|
|
2331
|
+
*/
|
|
2332
|
+
/**
|
|
2333
|
+
* A named trust signal — a per-request property that, on its own, establishes the
|
|
2334
|
+
* caller is one whose trace context may be adopted.
|
|
2335
|
+
*
|
|
2336
|
+
* - `"mtls"` — the caller presented a client certificate that **Cloudflare
|
|
2337
|
+
* verified at the edge**. `cf.tlsClientAuth` is platform-injected request
|
|
2338
|
+
* metadata, not a header, so a caller cannot write it: the check carries its own
|
|
2339
|
+
* proof and holds regardless of how the worker is exposed.
|
|
2340
|
+
*
|
|
2341
|
+
* Signals live here only when they meet that bar. A property a client can set for
|
|
2342
|
+
* itself is not a signal; see the module doc on why Cloudflare Access is absent.
|
|
2343
|
+
*/
|
|
2344
|
+
type TraceTrustSignal = "mtls";
|
|
2345
|
+
/**
|
|
2346
|
+
* How much of the inbound trace context to trust. `false` (the default) ignores
|
|
2347
|
+
* it entirely; `true` trusts every caller, which is right when nothing untrusted
|
|
2348
|
+
* can reach the worker.
|
|
2349
|
+
*/
|
|
2350
|
+
type TrustInboundTraceContext = boolean | TraceTrustSignal | ((request: Request) => boolean);
|
|
2241
2351
|
/**
|
|
2242
2352
|
* Wire-format RPC envelope. Posted to `POST /_lunora/rpc`.
|
|
2243
2353
|
*
|
|
@@ -3273,6 +3383,39 @@ interface WorkerOptions {
|
|
|
3273
3383
|
* endpoint. When omitted, the sync feed covers only shard-local tables.
|
|
3274
3384
|
*/
|
|
3275
3385
|
syncGlobals?: GlobalCdcSyncFunction;
|
|
3386
|
+
/**
|
|
3387
|
+
* Who may hand this worker a trace to join. Controls whether an inbound W3C
|
|
3388
|
+
* `traceparent` is continued — adopting its trace id, parenting this
|
|
3389
|
+
* dispatch's span under the upstream span, and carrying its `tracestate` to
|
|
3390
|
+
* the shard. **Default: off.**
|
|
3391
|
+
*
|
|
3392
|
+
* ```ts
|
|
3393
|
+
* trustInboundTraceContext: true // nothing untrusted can reach this worker
|
|
3394
|
+
* trustInboundTraceContext: "mtls" // only edge-verified client certificates
|
|
3395
|
+
* trustInboundTraceContext: (request) => … // anything else
|
|
3396
|
+
* ```
|
|
3397
|
+
*
|
|
3398
|
+
* Off by default because the header is caller-supplied: on a worker an
|
|
3399
|
+
* untrusted client can reach directly, trusting it lets anyone choose which
|
|
3400
|
+
* trace their spans and `ctx.log` lines join — grafting entries into another
|
|
3401
|
+
* tenant's waterfall in a shared collector — and, because the head-sampling
|
|
3402
|
+
* verdict is derived from the trace id, choose their own sampling outcome.
|
|
3403
|
+
* (Error traces are unaffected either way: the tail bias is evaluated from
|
|
3404
|
+
* the worker's own decision, never the caller's.)
|
|
3405
|
+
*
|
|
3406
|
+
* Turn it on when something you control — a gateway, service mesh, or
|
|
3407
|
+
* Cloudflare Access — sets `traceparent` itself; a proxy that only _forwards_
|
|
3408
|
+
* the client's header is not such a thing. Behind a front door like that,
|
|
3409
|
+
* `true` is the answer, because every caller has already passed it. Confirm
|
|
3410
|
+
* the worker really is unreachable otherwise — a `*.workers.dev` route left
|
|
3411
|
+
* enabled is a second front door with no gate on it.
|
|
3412
|
+
*
|
|
3413
|
+
* Leaving this unset logs a one-time hint if an inbound trace is actually
|
|
3414
|
+
* dropped; setting it explicitly to `false` keeps the behaviour and silences
|
|
3415
|
+
* that.
|
|
3416
|
+
* @see {@link TrustInboundTraceContext} for what each signal proves.
|
|
3417
|
+
*/
|
|
3418
|
+
trustInboundTraceContext?: TrustInboundTraceContext;
|
|
3276
3419
|
/**
|
|
3277
3420
|
* Read-only introspector for Vectorize indexes, backing the studio's vector
|
|
3278
3421
|
* browser via `GET /_lunora/admin/vector/indexes` and
|
|
@@ -3357,9 +3500,12 @@ interface LunoraWorker {
|
|
|
3357
3500
|
* @param options Call options mirroring the RPC envelope.
|
|
3358
3501
|
* @param options.shardKey Routes to a specific shard (omitted → the worker's
|
|
3359
3502
|
* `defaultShardKey`).
|
|
3503
|
+
* @param options.waitUntil The host's `waitUntil`, so dispatch telemetry
|
|
3504
|
+
* whose export is deferred (a gzipped OTLP body) survives isolate teardown.
|
|
3360
3505
|
*/
|
|
3361
3506
|
serverQuery: (request: Request, env: unknown, reference: unknown, args?: Record<string, unknown>, options?: {
|
|
3362
3507
|
shardKey?: string;
|
|
3508
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
3363
3509
|
}) => Promise<Response>;
|
|
3364
3510
|
}
|
|
3365
3511
|
/**
|
|
@@ -3608,6 +3754,15 @@ declare class LunoraError extends LunoraError$1 {
|
|
|
3608
3754
|
});
|
|
3609
3755
|
toResponse(): Response;
|
|
3610
3756
|
}
|
|
3757
|
+
/** A JS attribute value the encoder maps onto an OTLP `AnyValue`. */
|
|
3758
|
+
type OtlpAttributeValue = boolean | number | string;
|
|
3759
|
+
/**
|
|
3760
|
+
* A `Resource.attributes` bag — the process-level identity (`service.name`,
|
|
3761
|
+
* `service.version`, `cloud.region`, …) attached to every exported signal.
|
|
3762
|
+
* Lives here rather than in either exporter because both packages build one and
|
|
3763
|
+
* `wrapResource*` consumes it.
|
|
3764
|
+
*/
|
|
3765
|
+
type OtlpResourceAttributes = Record<string, OtlpAttributeValue>;
|
|
3611
3766
|
/** Shared shape for sinks that can be limited to error events only. */
|
|
3612
3767
|
interface OnlyErrorsOption {
|
|
3613
3768
|
/** When true, only events with `ok === false` are forwarded. */
|
|
@@ -3808,6 +3963,28 @@ interface PipelineLogSinkOptions {
|
|
|
3808
3963
|
declare const pipelineLogSink: (options: PipelineLogSinkOptions) => ObservabilitySink;
|
|
3809
3964
|
/** Options for {@link otlpSink}. */
|
|
3810
3965
|
interface OtlpSinkOptions extends OnlyErrorsOption {
|
|
3966
|
+
/**
|
|
3967
|
+
* Value of the `deployment.environment` resource attribute (e.g.
|
|
3968
|
+
* `"production"`, `"staging"`, `"development"`).
|
|
3969
|
+
*/
|
|
3970
|
+
deploymentEnvironment?: string;
|
|
3971
|
+
/**
|
|
3972
|
+
* When `true`, the sink attaches the resource attributes the **host** detected
|
|
3973
|
+
* for the current request, merged *under* any explicit option so those always
|
|
3974
|
+
* win on collision. In a Worker that is `service.version`,
|
|
3975
|
+
* `deployment.environment`, `cloud.provider`, and `cloud.region` (the colo).
|
|
3976
|
+
*
|
|
3977
|
+
* The sink never inspects `env` or the request itself — detection happens once
|
|
3978
|
+
* per request in the runtime and arrives pre-resolved on the sink context (see
|
|
3979
|
+
* `LogSinkContext.resourceAttributes`), so no sink is ever handed raw bindings.
|
|
3980
|
+
*
|
|
3981
|
+
* Events that originate inside a shard (`ctx.log`, `ctx.trace`, `ctx.metrics`)
|
|
3982
|
+
* carry no host-detected attributes today — the shard has no `env` of its own —
|
|
3983
|
+
* so they export with the explicit options only. Set the values you need
|
|
3984
|
+
* explicitly if you require them to match across worker and shard spans of the
|
|
3985
|
+
* same trace.
|
|
3986
|
+
*/
|
|
3987
|
+
detectResources?: boolean;
|
|
3811
3988
|
/**
|
|
3812
3989
|
* The OTLP-over-HTTP collector base endpoint (e.g.
|
|
3813
3990
|
* `https://collector.example.com`). Following the OTel base-endpoint
|
|
@@ -3822,11 +3999,29 @@ interface OtlpSinkOptions extends OnlyErrorsOption {
|
|
|
3822
3999
|
* default and may be overridden here.
|
|
3823
4000
|
*/
|
|
3824
4001
|
headers?: Record<string, string>;
|
|
4002
|
+
/**
|
|
4003
|
+
* Additional resource attributes to attach to every exported signal. These
|
|
4004
|
+
* ride alongside the built-in `service.name` and any convenience fields
|
|
4005
|
+
* (`serviceVersion`, `deploymentEnvironment`, etc.). A key that collides with
|
|
4006
|
+
* a built-in resource attribute wins; use this for custom dimensions like
|
|
4007
|
+
* `deployment.region`, `host.name`, or `service.instance.id`.
|
|
4008
|
+
*/
|
|
4009
|
+
resourceAttributes?: OtlpResourceAttributes;
|
|
3825
4010
|
/**
|
|
3826
4011
|
* Value of the `service.name` resource attribute on every exported span and
|
|
3827
4012
|
* log — the logical service the telemetry belongs to. Defaults to `lunora`.
|
|
3828
4013
|
*/
|
|
3829
4014
|
serviceName?: string;
|
|
4015
|
+
/**
|
|
4016
|
+
* Value of the `service.namespace` resource attribute, useful when multiple
|
|
4017
|
+
* services share the same `service.name` under a tenant or team boundary.
|
|
4018
|
+
*/
|
|
4019
|
+
serviceNamespace?: string;
|
|
4020
|
+
/**
|
|
4021
|
+
* Value of the `service.version` resource attribute (e.g. a git sha or
|
|
4022
|
+
* release tag).
|
|
4023
|
+
*/
|
|
4024
|
+
serviceVersion?: string;
|
|
3830
4025
|
/**
|
|
3831
4026
|
* Convenience bearer token: when set, an `Authorization: Bearer` header
|
|
3832
4027
|
* carrying it is added to every POST (overriding any authorization in
|
|
@@ -3871,4 +4066,4 @@ declare const otlpSink: (options: OtlpSinkOptions) => ObservabilitySink;
|
|
|
3871
4066
|
*/
|
|
3872
4067
|
declare const combineSinks: (...sinks: ObservabilitySink[]) => ObservabilitySink;
|
|
3873
4068
|
declare const VERSION: string;
|
|
3874
|
-
export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthConfigInfo, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type AuthUserFieldSpec, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_LOG_COLUMNS, DEFAULT_LOG_LIMIT, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportBatch, type ExportChange, type ExportCursorStore, type ExportFanOutRequest, type ExportFanOutResult, type ExportSink, type ExportTapFailure, type ExportTapResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, HEALTH_PATH, HEALTH_READY_PATH, type HealthAuthPosture, type HealthBody, type HealthCheckReport, type HealthProbe, type HealthProbeKind, type HealthProbeResult, type HealthRouteDeps, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, LOG_ARCHIVE_NOT_CONFIGURED, LOG_ARCHIVE_PATH, type ListAuthUsersOptions, type LogArchiveConfig, type LogEvent, type LogFields, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MetricEvent, type MetricKind, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type NotifySubscriptionDevice, type NotifySubscriptionStoreLike, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type OtlpSinkOptions, type PipelineLike, type PipelineLogColumnMap, type PipelineLogCursor, type PipelineLogField, type PipelineLogPage, type PipelineLogQuery, type PipelineLogReader, type PipelineLogReaderOptions, type PipelineLogRow, type PipelineLogSinkOptions, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ResolvedSecurity, type ResolvedShard, type RestInvoke, type RestRateLimit, type RestRegistryEntry, type RestRegistryLike, type RestRouteDeps, type Route, type RpcContext, type RpcEnvelope, type RunExportTapOptions, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SpanEvent, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, argsFromQuery, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createStaticShardRegistry, createWorker, d1Probe, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, otlpSink, pipelineLogSink, presenceProbe, r2Sink, readShardKey, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
|
|
4069
|
+
export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthConfigInfo, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type AuthUserFieldSpec, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_LOG_COLUMNS, DEFAULT_LOG_LIMIT, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportBatch, type ExportChange, type ExportCursorStore, type ExportFanOutRequest, type ExportFanOutResult, type ExportSink, type ExportTapFailure, type ExportTapResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, HEALTH_PATH, HEALTH_READY_PATH, type HealthAuthPosture, type HealthBody, type HealthCheckReport, type HealthProbe, type HealthProbeKind, type HealthProbeResult, type HealthRouteDeps, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, LOG_ARCHIVE_NOT_CONFIGURED, LOG_ARCHIVE_PATH, type ListAuthUsersOptions, type LogArchiveConfig, type LogEvent, type LogFields, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MetricEvent, type MetricKind, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type NotifySubscriptionDevice, type NotifySubscriptionStoreLike, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type OtlpResourceAttributes, type OtlpSinkOptions, type PipelineLike, type PipelineLogColumnMap, type PipelineLogCursor, type PipelineLogField, type PipelineLogPage, type PipelineLogQuery, type PipelineLogReader, type PipelineLogReaderOptions, type PipelineLogRow, type PipelineLogSinkOptions, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type RateLimiterLike, type ResolvedSecurity, type ResolvedShard, type RestInvoke, type RestRateLimit, type RestRegistryEntry, type RestRegistryLike, type RestRoute, type RestRouteDeps, type Route, type RpcContext, type RpcEnvelope, type RunExportTapOptions, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type SpanEvent, type StorageListFunction as StorageListFn, type StorageObject, type TraceSamplingConfig, type TraceTrustSignal, type TrustInboundTraceContext, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, argsFromQuery, buildHealthRoutes, buildRestRoutes, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createKvCursorStore, createLunoraHandler, createMemoryCursorStore, createPipelineLogReader, createQueryCoordinator, createRestRateLimit, createStaticShardRegistry, createWorker, d1Probe, decorateResponse, defineExportSink, defineRpcEnvelope, durableObjectProbe, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, otlpSink, pipelineLogSink, presenceProbe, r2Sink, readShardKey, resolveLogArchiveFromEnv, resolveLunoraOptions, resolveSecurity, resolveShard, restSurfaceFromRegistry, routeIdentityResolvers, runExportTap, sanitizeChange, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookExportSink, webhookSink, withFrameworkWorker };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { toAirbyteMessages, toFivetranResponse } from './packem_shared/toAirbyteMessages-DrHdplb4.mjs';
|
|
2
|
-
export { composeWorker, createLunoraHandler, createWorker, defineRpcEnvelope, resolveLunoraOptions, withFrameworkWorker } from './packem_shared/composeWorker-
|
|
2
|
+
export { composeWorker, createLunoraHandler, createWorker, defineRpcEnvelope, resolveLunoraOptions, withFrameworkWorker } from './packem_shared/composeWorker-DiWwOXXt.mjs';
|
|
3
3
|
export { createCrossShardRelationCapabilities } from './packem_shared/createCrossShardRelationCapabilities-CbcWjkAn.mjs';
|
|
4
4
|
export { DEFAULT_REGISTRY_CACHE_TTL_MS, SHARD_REGISTRY_DO_NAME, createDynamicShardRegistry } from './packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-B3pA7aXp.mjs';
|
|
5
5
|
export { LunoraError, toErrorResponse } from './packem_shared/LunoraError-Bpb9EFJ3.mjs';
|
|
@@ -7,11 +7,11 @@ export { createKvCursorStore, createMemoryCursorStore, defineExportSink, r2Sink,
|
|
|
7
7
|
export { HEALTH_PATH, HEALTH_READY_PATH, buildHealthRoutes, d1Probe, durableObjectProbe, presenceProbe } from './packem_shared/HEALTH_PATH-e5J_NHBx.mjs';
|
|
8
8
|
export { LOG_ARCHIVE_PATH, resolveLogArchiveFromEnv } from './packem_shared/LOG_ARCHIVE_PATH-CNs0bznX.mjs';
|
|
9
9
|
export { e as emitLogEvent, a as emitRpcEvent } from './packem_shared/observability--NOFYBFc.mjs';
|
|
10
|
-
export { analyticsEngineSink, combineSinks, consoleSink, otlpSink, pipelineLogSink, sentrySink, webhookSink } from './packem_shared/analyticsEngineSink-
|
|
10
|
+
export { analyticsEngineSink, combineSinks, consoleSink, otlpSink, pipelineLogSink, sentrySink, webhookSink } from './packem_shared/analyticsEngineSink-yLFNjHDt.mjs';
|
|
11
11
|
export { D as DEFAULT_LOG_COLUMNS, a as DEFAULT_LOG_LIMIT, c as createPipelineLogReader } from './packem_shared/pipeline-log-reader-BXULGNC3.mjs';
|
|
12
12
|
export { createQueryCoordinator, createStaticShardRegistry, mergeStrategyForAggregate } from './packem_shared/createQueryCoordinator-DNCJzOZE.mjs';
|
|
13
13
|
export { applyJurisdiction, resolveShard } from './packem_shared/applyJurisdiction-BkZtTkct.mjs';
|
|
14
|
-
export { argsFromQuery, buildRestRoutes, createRestRateLimit, readShardKey, restSurfaceFromRegistry } from './packem_shared/argsFromQuery-
|
|
14
|
+
export { argsFromQuery, buildRestRoutes, createRestRateLimit, readShardKey, restSurfaceFromRegistry } from './packem_shared/argsFromQuery-c-U1WRy-.mjs';
|
|
15
15
|
export { decorateResponse, enforceOrigin, handleCorsPreflight, resolveSecurity } from './packem_shared/decorateResponse-DRWQFNhF.mjs';
|
|
16
16
|
export { LOG_ARCHIVE_NOT_CONFIGURED } from './packem_shared/LOG_ARCHIVE_NOT_CONFIGURED-acNcguqc.mjs';
|
|
17
17
|
export { NOOP_EXECUTION_CONTEXT } from './packem_shared/NOOP_EXECUTION_CONTEXT-CCTu0Bf1.mjs';
|